Skip to main content

Hide Parameter if Product sale date in future

More
7 years 8 months ago - 7 years 8 months ago #302854 by mojooutdoors-holden
-- HikaShop version -- : 3.5.1

I'm trying to conditionally hide a container if the product_sale_start > current date. I should also note, I'm trying to use this on the product/show_default view file.

I tried to mimic what was on the product/quantity view
Code:
<?php $now = time(); $start_date = (@$this->row->product_sale_start || empty($this->element->main)) ? @$this->row->product_sale_start : $this->element->main->product_sale_start; $end_date = (@$this->row->product_sale_end || empty($this->element->main)) ? @$this->row->product_sale_end : $this->element->main->product_sale_end;?> <div style ="<?php if($start_date > 0 && $start_date > $now) echo "display:none";?>"> </div> <?php ?>

However, it seems like it's not pulling the product_sale_start data at all? Any thoughts?
Last edit: 7 years 8 months ago by mojooutdoors-holden.

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

More
7 years 8 months ago #302865 by nicolas
Hi,

Such code should be enough:
Code:
<div style ="<?php if($this->element->product_sale_start > time()) echo "display:none";?>"> </div>

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

More
7 years 8 months ago #302909 by mojooutdoors-holden
Ah, I was complicating matters. Thanks for the fix!

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

Time to create page: 0.163 seconds
Powered by Kunena Forum