Skip to main content

Show stock if there are 10 products or less in stock

8 years 9 months ago #286415 by vaughan
-- url of the page with the problem -- : wpb.es/calendario/listado-de-rodadas/pro...cos-navarra-8-3-2018
-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.8.3
-- PHP version -- : 7.0

Hi

How can I hide stock count, and only show if there are 10 products or less in stock

I'm trying with this code in Views/product/quantity but don't change anything
Code:
<span class="hikashop_product_stock_count"> <?php if($this->row->product_quantity <= 10) echo (($this->row->product_quantity <= 10 && JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK') ? JText::sprintf('X_ITEM_IN_STOCK', $this->row->product_quantity) : JText::sprintf('X_ITEMS_IN_STOCK', $this->row->product_quantity)); elseif(!$in_stock) echo JText::_('NO_STOCK'); ?> </span>

Original code:
Code:
<span class="hikashop_product_stock_count"> <?php if($this->row->product_quantity == 1) echo (($this->row->product_quantity == 1 && JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK') ? JText::sprintf('X_ITEM_IN_STOCK', $this->row->product_quantity) : JText::sprintf('X_ITEMS_IN_STOCK', $this->row->product_quantity)); elseif(!$in_stock) echo JText::_('NO_STOCK'); ?> </span>
Could you help me?

Please Log in or Create an account to join the conversation.

8 years 9 months ago - 8 years 9 months ago #286450 by Philip
Hello,

This forum aim is to help and guide in your custom you, and so I can only advice you to analyze data available on this HikaShop View.
Maybe by using a
Code:
var_dump($this);

That will allow you to see that you don't check the good value, because "
Code:
product_quantity
" isn't the quantity but a boolean about the option to display quantity or not (0).

Hope you will achieved what you plan.
Regards
Last edit: 8 years 9 months ago by Philip.

Please Log in or Create an account to join the conversation.

Time to create page: 0.099 seconds
Powered by Kunena Forum