Jump to content

listing number of products in shop


tucstore
 Share

Recommended Posts

  • 9 months later...

Hi Tucstore,

Seems there is no module. I suppose you could write a line of code with a  global stock number

Is there a module or code that can display the number of items of each product available for sale? Please see the picture below.

regards

Duncan

 

image.png.38b781869e0bb6c897b3874c79d0cb33.png

Link to comment
Share on other sites

Hi DB,

Instead of a total number of items, I am after the number of items available for sale of each item. 

Instead of it being a global specification, could it be item specific?

Whether it be tickets to a concert or bottles of wine on a  specific page.

This info can be found in the Specifications tab of an item on stock foundation skin.

Here is an example of the amount of stock available,  used on Ebay.

image.png.68d8f92488aafe871fb8eb71c27777c3.png

 

Link to comment
Share on other sites

We know that CubeCart makes this data available on the View Product page.

You also want this data available to be shown on the HomePage "Latest Products".

(Unless I am looking at code from one of my many mods) This data is already made available - we just need to code the template statement to show it. In the template file content.homepage.php:

Find some code that looks like:

<h3><a href="{$product.url}" title="{$product.name}">{$product.name|truncate:38:"&hellip;"}</a></h3>

After that, add:

<h4>{$product.stock_level} available</h4>

This shows the main stock level. Products that have distinct stock levels assigned to specific option combinations, where the main stock level is set to zero, will show zero.

Edited by bsmither
Link to comment
Share on other sites

Thanks Brian,,

Many thanks for your reply.

Latest products is a good answer with little coding.  See https://www.harrisorganicwine.com.au/shop/

Although this info can be found in the Specifications tab of an item on a stock foundation skin and used in latest products as below

image.png.e397a856c3c9639ba7a84eb55ce150e2.png

Is it possible to have the latest products  with " <h5>{$product.stock_level} available</h5> " inserted in the item as shown above, on a page like:

https://www.harrisorganicwine.com.au/shop/events.html

Link to comment
Share on other sites

That would be the content.category.php template. This template has two views: a "list" mode and a "grid" mode (like Latest Products).

The solution for the grid-mode should be the same for Latest Products.

For the list-mode:

Near line 122, find:

                  {elseif !$CATALOGUE_MODE}
                  <div class="row collapse">
                     <div class="small-12 columns">
                        <input type="submit" value="{$LANG.catalogue.out_of_stock_short}" disabled class="button disabled expand small">
                     </div>
                  </div>
                  {/if}

Add after:

<div class="row collapse"><div class="small-12 columns text-center">{$product.stock_level} available</div></div>

The code for grid-mode starts a few lines later.

Link to comment
Share on other sites

  • 2 weeks later...

Good morning,

After clearing the system cache I found this intriguing example. A customer also reported seeing the same thing. ie 2 available and SOLD OUT. This item is a digital product as purchasers download a pdf file for more information.

 

Has anyone seen this ?

 

image.png.eaff9b7c7317efabaaeca34b6ce9e303.png

Link to comment
Share on other sites

A digital product? Well, if I recall your situation, even this digital product has been configured to limit the sales of "tickets to this limited-seating event".

Earlier, there was this disclaimer:

"This shows the main stock level. Products that have distinct stock levels assigned to specific option combinations, where the main stock level is set to zero, will show zero."

This implies that if all the product's options are zero, CubeCart considers the product sold out, regardless what the main stock level is at.

For this product, are there any options? I see no reason for there to be any options, and the February 19 product is sold out (doesn't show options, if any).

In admin, Store Settings, Stock tab, what is the setting for "Main stock level as matrix stock level summary".

Edited by bsmither
Link to comment
Share on other sites

Here's an idea: instead of adding the new line of code after the existing code listed, add the new line before the existing code.

This puts the new line of code within an if-block that only appears if the product is able to be sold. (It's redundant to say "Out of Stock" and "0 available" together.)

 

Link to comment
Share on other sites

Thanks Brian,

Main stock level as matrix stock level summary is ticked.

I have no idea what what "Main stock level as matrix stock level summary" means. Its always been like this.

I could not find anything in the help section.

For further events, maybe I would be better off to have a non - digital product to maintain stock levels of tickets. Then, any pdf or message can be emailed individually to the participants.?

 

image.png.2721f125e0e40a504793a1fdfb2e6ea1.png

regards

Duncan

Link to comment
Share on other sites

The first product is digital and the second product is non digital. The digital product shows an infinite amount on the summary page. However the product page does show the number of items and does show an out of stock indication when there are none available.

image.png.acd05dbae9a1faf7173d6871ae763ffd.png

I need to be more explicit and ask how to change the infinite sign on the product inventory page to a number.

Link to comment
Share on other sites

In the admin source file products.index.inc.php, about 50 lines up from the bottom of the file:

Find:

        $catalogue = Catalogue::getInstance();
        $seo  = SEO::getInstance();
        foreach ($results as $result) {
            if ($result['use_stock_level'] == 0 || $result['digital'] > 0 || !empty($result['digital_path'])) {
                $result['stock_level'] = "&infin;";
            }

Change to:

        $catalogue = Catalogue::getInstance();
        $seo  = SEO::getInstance();
        foreach ($results as $result) {
//            if ($result['use_stock_level'] == 0 || $result['digital'] > 0 || !empty($result['digital_path'])) {
//                $result['stock_level'] = "&infin;";
//            }

This bypasses the test that if the product is ignoring stock levels, or is a digital product, then show an infinite amount available.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...