Show stock if there are 10 products or less in stock

  • Posts: 71
  • Thank you received: 0
7 years 3 months ago #286415

-- 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

<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:
<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.

  • Posts: 4820
  • Thank you received: 654
  • MODERATOR
7 years 3 months ago #286450

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

var_dump($this);
[/b]
That will allow you to see that you don't check the good value, because "
product_quantity
[/b]" 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: 7 years 3 months ago by Philip.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum