Search code examples
prestashopsmarty

Prestashop 1.7.8 Specific Price - Smarty - retrieve day


As they still haven't decided to put the time to work in the date-picker of discounts.

Wouldn't it be possible to take 1 day off the code that shows the end date of the promotion?

This code displays the end date of the promotion, but due to the time issue the promotion ends before the end of the day, so we have to add a day on the backoffice side. And the idea in this code was to remove the extra day to hit the date right, you know?

{l s='End promo: '}{$product->specificPrice.to|date_format:'%d-%m-%Y' . "-1 days"}

but not working... i have tried a lot of combinations and nothing.

I await your comments.

Thanks!


Solution

  • Here is the solution:

    {if $product.has_discount}{dateFormat date=$product.specific_prices.from} to {dateFormat date=$product.specific_prices.to|cat:' -1 day'|date_format:'%Y-%m-%d'}{/if}
    

    Hope this works for you guys to!