Is it possible to activate the waiting list for product options

  • Posts: 3
  • Thank you received: 0
2 years 8 months ago #334815

-- url of the page with the problem -- : tennislife.sheenltsc.co.uk/index.php/sho...d-ball-week-9-13-aug
-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.9.28
-- PHP version -- : 7.4.21
-- Browser(s) name and version -- : Firefox

Hello,
I have set up a product with product options. Each product option has a stock of 12. When the stock is down to 0 the product option disappears from the list.
- Is it possibe to show the waiting list option when the product option is 0?
- is it possible to show the stock amount for product options?

Many thanks

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
2 years 8 months ago #334821

Hi,

Displaying the stock for each option is possible with a small customization.
You'll have to edit the file product / option.php via the menu Display>Views.
There, the "yes" choice is displayed with the code:

$option_values[] = JHTML::_('select.option', $optionElement->product_id, $text);
so to add the stock to it, you would have to change it to:
$option_values[] = JHTML::_('select.option', $optionElement->product_id, $text. ' '.$optionElement->product_quantity);

To add a waitlist link, you would have to add the code:
	<a class="hikabtn" rel="nofollow" href="<?php echo hikashop_completeLink('product&task=waitlist&cid='.$optionElement->product_id); ?>"><span><?php echo JText::_('ADD_ME_WAITLIST'); ?></span></a>
However, it's a bit more tricky as you need to still display the name of the option, and display that waitlist button only when the option doesn't have stock. So it needs rearranging the code of the view. It requires a developer to work a bit on it to rearrange the code.

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

  • Posts: 3
  • Thank you received: 0
2 years 8 months ago #334836

That's great thanks, I can now see the stock amount.
It it possible to show a product option even if it is out of stock?

On this page I wanted the option Red Ball 09/08/2021 to appear in the options list.

tennislife.sheenltsc.co.uk/index.php/sho...d-ball-week-9-13-aug

Thanks

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
2 years 8 months ago #334838

Hi,

While showing the option even if it is out of stock is quite easy (you can just change the code

if(!$optionElement->product_published || empty($optionElement->product_quantity))
to
if(!$optionElement->product_published)
in the same view file), the add to cart will be refused if the option is selected since it doesn't have stock anymore.

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

  • Posts: 3
  • Thank you received: 0
2 years 8 months ago #334871

Perfect. Thanks.

Would it be possible to add static text next to the stock amount in the dropdown?

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
2 years 8 months ago #334873

Hello,

To do it, you'll probably just have to edit the line you previously changed :

$option_values[] = JHTML::_('select.option', $optionElement->product_id, $text. ' '.$optionElement->product_quantity);

And replace it by :
$option_values[] = JHTML::_('select.option', $optionElement->product_id, $text. ' Your_Static_Text'.$optionElement->product_quantity);

Kind regards,
Mohamed.

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

Time to create page: 0.079 seconds
Powered by Kunena Forum