Jump to content

Display category discount date


Misa Amane

Recommended Posts

Hello all,

 

I set a specific price for a category of product.

How can i display this date in the categories pages ( in file product-list.tpl) ? I tried to get the date from 1 product with {$product->specificPrice['to']} but it didn't work.

Link to comment
Share on other sites

In that case, I would rather compute the number of days left within the CategoryController.

E.g. from line 240 in PS 1.6.1.5:

        // ADD THIS...
        $now = time();
        
        foreach ($this->cat_products as &$product) {
            if (isset($product['id_product_attribute']) && $product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity'])) {
                $product['minimal_quantity'] = $product['product_attribute_minimal_quantity'];
            }
            // ... AND THAT
            if (isset($product['specific_prices'])) {
                $product['specific_prices']['days_left'] = ceil((strtotime($product['specific_prices']['to']) - $now)/86400);
            }
        }

Then use {$product.specific_prices.days_left} in product-list.tpl

 

[EDIT] Oops, sorry again, I didn't see your edit...

Edited by erouvier29 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...