Show Quantity For Particular Products Or Categories Only

Hi,

I know it's possible to show product quantity for all items across the whole site, but I am hoping there is a way to show the product quantity for products in stock for certain categories (it may be possible through category templates). Or even having an option in the product to show the quantity when in stock (and still show "out of stock" when out of stock, and override the system's default.

I know it's possible to show product quantity for all items across the whole site, but I am hoping there is a way to show the product quantity for products in stock for certain categories (it may be possible through category templates). Or even having an option in the product to show the quantity when in stock (and still show "out of stock" when out of stock, and override the system's default.

Yes, you can do by creating new templates only. You can clone available templates in the following directory

design/themes/THEME/templates/blocks/product_list_templates

As a result they will be automatically available to choose on the Settings -> Appearance and category details page

Thanks for your quick reply,

Is it possible to show the quantity on the product page itself?

Is it possible to show the quantity on the product page itself?


Settings:Appearance:Show number of available products:

Settings:Appearance:Show number of available products:

Hi,

Thanks for you reply, however I meant show quantities on the product page for certain categories.

Hi,

Thanks for you reply, however I meant show quantities on the product page for certain categories.

It also can be done with custom category templates. It is controlled by the $show_product_amount parameter when the product_data.tpl is called

Hi,

I am a beginner to this, please could you explain thoroughly the steps I need to take?

Hi,

I am a beginner to this, please could you explain thoroughly the steps I need to take?

Hello!

Try to use the {hook name="products:product_amount"} hook that is defined in the product_data.tpl file.

I am a beginner to this, please could you explain thoroughly the steps I need to take?

For example, if you clone the grid list template

design/themes/THEME/templates/blocks/product_list_templates/products_multicolumns.tpl

you will see several parameters in the this file like show_name, show_old_price, etc

You can add the show_product_amount one and check the result

Hi,

I have seen in the CS-Cart admin there is Products > Categories > (select a category) > Views > Products Details View.

I have tried duplicating design/themes/THEME/templates/blocks/product_template

and selecting the new template for the category i want. But when I update the template, it doesn't take effect in the product view for the product in that category.

Hi,

I have seen in the CS-Cart admin there is Products > Categories > (select a category) > Views > Products Details View.

I have tried duplicating design/themes/THEME/templates/blocks/product_template

and selecting the new template for the category i want. But when I update the template, it doesn't take effect in the product view for the product in that category.

May be cache issue?

Hi,

I've tried that.

Could there be any other product template which is used instead?

Hi,

I've tried that.

Could there be any other product template which is used instead?

3rd party addons can also use hooks in these templates

Hi,

Thanks for your help with this.

When I go to Products > Categories > (select a category) > Views > Product details view:

the new product template which I created, appears.

So I select that product template and click Save.

I've made a small change to the product template file, but this is now showing on the frontend. So it's like the new template save hasn't worked. I'm assuming this is a caching issue? Could it be anything else?

Hi,

Thanks for your help with this.

When I go to Products > Categories > (select a category) > Views > Product details view:

the new product template which I created, appears.

So I select that product template and click Save.

I've made a small change to the product template file, but this is now showing on the frontend. So it's like the new template save hasn't worked. I'm assuming this is a caching issue? Could it be anything else?

Try to delete var/cache directory and check

That's great thanks!

Ok, so this hook is not displaying anything:

{hook name="products:product_amount"}

In the overall settings for the site, the product quantity is off, so I just need to override that for products in a certain category.

Its the 'in stock' number which I want to show

That's great thanks!

Ok, so this hook is not displaying anything:

{hook name="products:product_amount"}

In the overall settings for the site, the product quantity is off, so I just need to override that for products in a certain category.

Sorry, your message is not quite clear. Please clarify

Hi,

In the configuration for the whole site, displaying the product quantity is turned off. What I want to do is display the product quantity on the product page for products in a certain category.

I have a new product template which is working for the products in a certain category, but I cannot seem to get the product quantity to display on the frontend, whilst having the rest of the site not showing product quantity for products.

Before calling product_data.tpl with the $show_product_amount set to true, try to add the following line of code

{$settings.Appearance.in_stock_field = 'Y'}