SFHATDEV Posted July 2, 2014 Share Posted July 2, 2014 I'm trying to set the add date for a product so that the "new" label doesn't show up in its display. However, I don't see a place in PrestaShop Admin to change the date for when a product was added. I found mySQL code in classes/Product.php (see below), which helped me determine which database table is being used to store the date. I found the table in question, and it's `p`.`product_shop`. The column in question is `date_add`. By updating my product through phpMyAdmin to a date that is further back than the current date minus the {number-of-days-for-new-product // paraphrased} setting, IT WORKS! I'm wondering if there is an interface through PrestaShop Admin to do this. public function isNew() { $result = Db::getInstance()->executeS(' SELECT p.id_product FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p').' WHERE p.id_product = '.(int)$this->id.' AND DATEDIFF( product_shop.`date_add`, DATE_SUB( NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY ) ) > 0 '); return count($result) > 0; } Link to comment Share on other sites More sharing options...
dioniz Posted July 3, 2014 Share Posted July 3, 2014 I don't think there is any other way for changing date of individual product. If you want to turn off new label for all products set Number of days for which the product is considered 'new' in New products module to 0 Link to comment Share on other sites More sharing options...
David Eschmeyer Posted June 10, 2016 Share Posted June 10, 2016 i have seen a module that does it. It lets you mark the product as new from the product list i believe. If you search you may find it. Link to comment Share on other sites More sharing options...
David Eschmeyer Posted June 10, 2016 Share Posted June 10, 2016 in bo - prod information tab (not the product list though, in product as specified) 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 <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" name="date_add" value="{$product->date_add|escape:html:'UTF-8'}" /></div></div> added the smarty if statement to hide the field if new product is really being added 1 Link to comment Share on other sites More sharing options...
David Eschmeyer Posted October 19, 2016 Share Posted October 19, 2016 oops forgot the if statements: 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" name="date_add" value="{$product->date_add|escape:html:'UTF-8'}" /> </div> </div> {/if} 1 Link to comment Share on other sites More sharing options...
studioneko Posted November 26, 2016 Share Posted November 26, 2016 oops forgot the if statements: 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" name="date_add" value="{$product->date_add|escape:html:'UTF-8'}" /> </div> </div> {/if} Hey David, thanks for your code Works like a charm on presta 1.6.x Just a small addition: we added a class="datepicker" to the input to force the date picker to show. When you select only a date, without specifying a time, the database saves it with a 00:00:00 value {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} 2 Link to comment Share on other sites More sharing options...
Recommended Posts