Skip to main content

add product delivery time

More
10 years 9 months ago - 10 years 9 months ago #224648 by kyratn
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:
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: 10 years 9 months ago by kyratn.

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

More
10 years 9 months ago #224673 by nicolas
Replied by nicolas on topic add product delivery time
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.

More
10 years 9 months ago #224697 by kyratn
Replied by kyratn on topic add product delivery time
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.185 seconds
Powered by Kunena Forum