Emieliooo Posted July 12, 2010 Share Posted July 12, 2010 Hi Folks, I couldn't find what I was looking for so I started a new Topic.I'm looking for a module or setting to automatically activate a product at 00:00:00u AM and close the product the same day at 23:59:59u (11:59:59pm).I only see "activate" yes/no Is there anything available? I want to use this for products that are only available for just 1 day...a little bit like the "ibood.com" method Link to comment Share on other sites More sharing options...
rocky Posted July 13, 2010 Share Posted July 13, 2010 It is not possible with PrestaShop and I'm not aware of any modules to do this. It may be possible to do this by putting all your 1-day products in a separate category, then put the dates it is available in the "reduction from" and "reduction to" fields, then use code like the following in product-list.tpl in your theme's directory after the {foreach} to hide the product if the current time isn't between the reduction times: {if $product.id_category_default == 2 && $product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product.reduction_from} then before the {/foreach}: {/if} Change 2 to the ID of the category that contains the 1-day products. You'll need to set the default category of these products to the 1-day product category for it to work though. I'm not sure whether that will be problematic for you. Link to comment Share on other sites More sharing options...
Emieliooo Posted July 13, 2010 Author Share Posted July 13, 2010 Hi Rocky, Thanks for your reply.I tried to edit the .tpl file but nothing happens. Can you please check the edit is done correctly?Thanks! > {if isset($products)} <!-- Products list --> </pre> <ul> {foreach from=$products item=product name=products}{if $product.id_category_default == 2 && $product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product.reduction_from} getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" /> {if $product.new == 1}{l s='new'}{/if}{$product.name|escape:'htmlall':'UTF-8'|truncate:35:'...'} {$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'} {if $product.on_sale} {l s='On sale!'} {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product.reduction_from))} {l s='Price lowered!'} {/if} {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} {if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if} {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Add to cart'} {else} {l s='Add to cart'} {/if} {l s='View'} {/if}{/foreach} </ul> <br> <!-- /Products list --><br>{/if Link to comment Share on other sites More sharing options...
rocky Posted July 14, 2010 Share Posted July 14, 2010 It looks fine. Did you create a product with a default category of 2 and give it a reduction from and reduction to date to specify when it should be visible? Link to comment Share on other sites More sharing options...
Emieliooo Posted July 14, 2010 Author Share Posted July 14, 2010 I did all the things you suggested. The product gives a discount on the moments I put the date in. But it not disappears when I want that.For instance; I give a discount from 2010-07-14 10:17:00 / till 2010-07-14 10:20:00 it actually only gives a discount but I want to show the product only temporarily and after the "discount" hide it automatically. I can't see it does the trick with this code. Maybe i'm doing something wrong, I don't know. Link to comment Share on other sites More sharing options...
outlet.ee Posted August 20, 2010 Share Posted August 20, 2010 I would like to do something similar:new products just added to have a discount for the first 10 days only, and text displayed at the product page saying something like 'buy now as the discount lasts only to {reduction_to}'.The discounts and dates will be added manually so the question is only how to display it correctly. I am not able to write the correct code myself, it would be something like this: {if ($product->reduction_to - $product->reduction_from) = 10 days}{l s='The offer will last until'}{$product->reduction_to}{/if} Would somebody like to care to help on this? Any help is greatly appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now