display quantity statut

  • Posts: 46
  • Thank you received: 2
10 years 5 months ago #196295

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6

Hello,


I dont manage to display the quantity statut ( out of stock or available) in the product page.

Its displayed in the wishlist but i just whant to show the same message on the product page.

Thanks

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

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #196299

Hi,

Do you set a quantity for your products ? If it is, so you should already have a message displayed.
If you have unlimited quantities and want to display a message so you can add that kind of code:

$text = JText::_('UNLIMITED_ITEMS_IN_STOCK');
echo '<span class="hikashop_product_stock_count">'.$text.'<br/></span>';
Right after:
	if($this->row->product_quantity == -1) {
?>
In the view "product / quantity".
www.hikashop.com/support/support/documen...ize-the-display.html

And then add a translation override on the key "UNLIMITED_ITEMS_IN_STOCK".
www.hikashop.com/support/faq.html#tran

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

  • Posts: 46
  • Thank you received: 2
10 years 5 months ago #196885

I donc have any message concerning the stock in the product page. I just discovered that stock isnt displayed when i'm on catalog mode.

Then, is it simply possible to display the stock even when i dont use the add to cart functionalities ?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #196905

Hi,

Yes it is possible, you can edit the view "product / show_default" and add the following code where you want:

		if($this->row->product_quantity == 1 && JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK')
			$text = JText::sprintf('X_ITEM_IN_STOCK', $this->row->product_quantity);
		else
			$text = JText::sprintf('X_ITEMS_IN_STOCK', $this->row->product_quantity);

		echo '<span class="hikashop_product_stock_count">'.$text.'<br/></span>';
That code must be placed between php tags.

The following user(s) said Thank You: saturnales

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

  • Posts: 46
  • Thank you received: 2
10 years 5 months ago #196954

Thanks
I didnt know that I had an access to the product quantity from that view

I dont understand why you did the condition
JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK'

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

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #196955

Hi,

This condition allow to check if the string "X_ITEM_IN_STOCK" is translated or not, if not so we display the translation for "X_ITEMS_IN_STOCK" which is present in HikaShop since the beginning contrary to the other one which has been added in a more recent version. ;)

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

  • Posts: 46
  • Thank you received: 2
10 years 5 months ago #197073

ok ;)

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

Time to create page: 0.057 seconds
Powered by Kunena Forum