MariuszS Posted September 22, 2023 Share Posted September 22, 2023 (edited) Few years ago @David Eschmeyer and @studioneko write a code to change product add date. But unfortunately its for prestashop 1.6 but i have 1.7.8 Is it possible to use it in Prestashop 1.7.8? Quote works in 1.6.1.x Add it to line 132 (1.6.1.3) (after hard return) of: admin folder\themes\default\template\controllers\products\informations.tlp {if $product->date_add} <div class="form-group"> <label class="control-label col-lg-3"></td> <span class="label-tooltip" data-toggle="tooltip" title="{l s='Change date for "product new from".'}"> {$bullet_common_field} {l s='New from'} </span> </label> <div class="col-lg-3"> <input type="text" id="date_add" class="datepicker" name="date_add" value="{$product->date_add|escape:html:'UTF-8'}" /> </div> </div> {/if} Edited September 22, 2023 by MariuszS (see edit history) Link to comment Share on other sites More sharing options...
Nickz Posted September 22, 2023 Share Posted September 22, 2023 can't you change those dates over the database? Have back ups before any touches on database and shop. Link to comment Share on other sites More sharing options...
MariuszS Posted September 22, 2023 Author Share Posted September 22, 2023 Every time I add a product that was imported a long time ago? I could, but it's not very comfortable. Link to comment Share on other sites More sharing options...
ComGrafPL Posted September 22, 2023 Share Posted September 22, 2023 If you don't want to deal with db way. You can try, i.e https://mypresta.eu/modules/administration-tools/product-date-change.html Link to comment Share on other sites More sharing options...
Nickz Posted September 22, 2023 Share Posted September 22, 2023 (edited) 10 hours ago, MariuszS said: Every time I add a product that was imported a long time ago? I could, but it's not very comfortable. I still have to grasp the why. No Offense, actually for many of the customization wishes of people running shops. Edited September 22, 2023 by Nickz (see edit history) 1 Link to comment Share on other sites More sharing options...
Yelish Posted September 25, 2023 Share Posted September 25, 2023 Hello, how are you? I don't understand, you don't want to change the product add date, you want it to be displayed differently in the template as if it were the current date? Is this correct? Link to comment Share on other sites More sharing options...
MariuszS Posted September 25, 2023 Author Share Posted September 25, 2023 I want the product for which I have changed the description, name, etc. to be displayed as "new product". However, I don't want to do it manually every time in the database via PhpMyAdmin etc. I would like to be able to do this through the store's administration panel. Preferably when editing a product. I thought that the code I mentioned at the beginning could be easily adapted to Prestashop 1.7 Link to comment Share on other sites More sharing options...
Yelish Posted September 25, 2023 Share Posted September 25, 2023 Implement it in your store's template, add conditions in the template to check if the product is new, instead of relying on date_add, base it on date_upd. Link to comment Share on other sites More sharing options...
ps8modules Posted September 27, 2023 Share Posted September 27, 2023 (edited) Hi override Product.php function update(). /* added */ $this->date_add = date('Y-m-d H:i:s'); Or in your module add hook: public function hookActionObjectProductUpdateAfter($params) { $db = Db::getInstance(); $db->execute("UPDATE "._DB_PREFIX_."product SET date_add = '".date('Y-m-d H:i:s')."' WHERE id_product = ".$params['object']->id); $db->execute("UPDATE "._DB_PREFIX_."product_shop SET date_add = '".date('Y-m-d H:i:s')."' WHERE id_product = ".$params['object']->id); } Edited September 27, 2023 by ps8moduly.cz (see edit history) 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