add product delivery time

  • Posts: 1119
  • Thank you received: 114
8 years 11 months ago #224648

Hi,

Again I need little help with php.
I want to display delivery time on product page and hide it if product sold out with custom message.

After reading some topics I have added this code:

<div class="hikashop__custom_delivery">
<?php
    if($this->row->product_quantity > 0)
    echo ' <span class="hikashop_product_deliver_time pull-right">'.JText::_('CUSTOM_DELIVERY_TIME').'</span><span class="hikashop_product_deliver pull-right">'.JText::_('CUSTOM_DELIVERY').'</span>';	
else
    echo ' <span class="hikashop_product_soldout_message">'.JText::_('CUSTOM_SOLDOUT').'</span>';
?>
</div>
So if item stock is 1 it will display message ( 'CUSTOM_DELIVERY_TIME, CUSTOM_DELIVERY ) if its sold out it will display other message ( CUSTOM_SOLDOUT ). That's OK.
However if item stock is more then 1 it will not display what I need. How can I have to display message ( 'CUSTOM_DELIVERY_TIME, CUSTOM_DELIVERY ) if stock is 1 or more and display ( CUSTOM_SOLDOUT ) if product is sold out?
Could anyone help me to fix it?



Kind Regards

Last edit: 8 years 11 months ago by kyratn.

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

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
8 years 11 months ago #224673

Hi,

That code is correct for what you want, which means that the problem comes from where you added that code. You must have added it inside a block of code which only display in some cases.

Also, note that if you have some products with unlimited quantity, it's better to use != instead of > in your condition since unlimited is -1

The following user(s) said Thank You: kyratn

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

  • Posts: 1119
  • Thank you received: 114
8 years 11 months ago #224697

Hi,

I see what was the problem. I have added that code to show_default in quantity line after I moved it to product/ quantity it started to work.

Thanks again Nicolas!

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

Time to create page: 0.056 seconds
Powered by Kunena Forum