display product stock count in category listing as custom filed

  • Posts: 43
  • Thank you received: 3
3 months 3 weeks ago #362433

-- HikaShop version -- : 5.0.2
-- Joomla version -- : 5.1.2
-- PHP version -- : 8.1.13
-- Browser(s) name and version -- : firefox

Hi,
How can display the "Quantity" of a product as a custom field in categories listing each product in a specific category?
I use product stock count phrases from the mentioned code.

<!-- STOCK MESSAGE -->
<?php
$stock_class = ($stock != 0) ? "" : " hikashop_product_no_stock";
?>
<span class="hikashop_product_stock_count<?php echo $stock_class; ?>">
<?php
	if(!empty($this->row->product_stock_message))
		echo JText::sprintf($this->row->product_stock_message, $stock);
	elseif($stock > 0)
		echo (($stock == 1 && JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK') ? JText::sprintf('X_ITEM_IN_STOCK', $stock) : JText::sprintf('X_ITEMS_IN_STOCK', $stock));
	elseif(!$in_stock)
		echo JText::_('NO_STOCK');
?>
</span>
<!-- EO STOCK MESSAGE -->

Thanks in advance

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

  • Posts: 4738
  • Thank you received: 644
  • MODERATOR
3 months 3 weeks ago #362437

Hello,

We are very sorry for this answer but we aren't sure to understand your needs, and what you want to achieved really sorry for this!
Can you elaborate more through concrete case, annotated screenshot or any elements that can help us to better understand your needs and precisely the context.

Regards

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

  • Posts: 43
  • Thank you received: 3
3 months 3 weeks ago #362450

Hi,
I apologize if I can't tell you what I need, sorry for that.


I need to display the "Quantity" amount in the product on the category product listing page. when you enter a number in the Quantity field it displays on the product page on the cart box,

I need to display it on the product category page too.
The thing that I ask is, Is it possible to load the quantity amount from Hikashop "Custom filed" items? cause if it could be loaded from a custom field we have the access to display it in any product or category that we need.

Best regards

Attachments:

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

  • Posts: 4738
  • Thank you received: 644
  • MODERATOR
3 months 3 weeks ago #362451

Hello,

Can you add an Url link in order to see the context?
Note : You can use, if required our Contact us form, just don't forget to add an Url link to this topic in your message.
Regards

Last edit: 3 months 3 weeks ago by Philip.

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

  • Posts: 43
  • Thank you received: 3
3 months 3 weeks ago #362462

Hi,
Links have been sent by Contact Us form.
Thanks in advance
Regards

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

  • Posts: 4738
  • Thank you received: 644
  • MODERATOR
3 months 2 weeks ago #362464

Hello,

Have you tried the quantity field option directly in your Item Menu options?
more precisely in Menus => Menu principal, then click on the relative Item Menu (your product listing)
And in Products options tab



Regards

Last edit: 3 months 3 weeks ago by Philip.

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

  • Posts: 43
  • Thank you received: 3
3 months 2 weeks ago #362470

Hi,
Nothing is displayed on the product category listing page.
Regards

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
3 months 2 weeks ago #362471

Hi,

So, if I understand correctly, what you want is to display the stock of the product on the products listing pages.

Based on how you configured HikaShop, and what I can see on your URLs, I think the best is to copy/paste the code from your first message here, to the product / listing_img_title view file, which you can edit via the menu Display>Views of HikaShop.

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

Time to create page: 0.078 seconds
Powered by Kunena Forum