Change Product Add Date to affect New



  • from ps-forum - with date-picker

    admin folder\themes\default\template\controllers\products\informations.tlp

    find the code

    <div id="product-pack-container" {if $product_type != Product::PTYPE_PACK}style="display:none"{/if}></div>
    
    <hr />
    

    add this after

    {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}


  • Does it give you an option to set old products as new? Please show live example for non programmers :)



  • @MockoB

    BO - product edit

    0_1501438584393_FireShot Screen Capture #217 - 'Artikel } Bearbeiten_ New Angle Li'l Nippers - Chockablock • Heimtierbedarf Service' - heimtierbedarf-service_de_admin.png



  • @MockoB

    For us this is very helpful. If we get lists of new items from our wholesalers (dropshipping), then we can upload them by CSV. Very often, we only have to edit and activate the new articles several days later. So we can activate the article with the current date.



  • Perfect! I wonder why it is not native feature. I sell products which are unique and I was deleting it after every sale. Recently I decided to change just the picture to avoid loosing ranking but it is hard for customers to find them because they have to list all the product pages …
    Are you sure it will not cause any troubles with database or other related features? And is it possible to add for the non native TB theme?



  • @MockoB
    I use the code for over a year with PS. There I had so far no problems. Since I have already switched some of my shops to TB, I could not find any problems so far. The code affects only the template in the BO under Edit Product, where the date of the article can be changed. In the FO, the article appears accordingly under NEW, if the date was set to the current.



  • I can confirm that this works like a charm because we used this already with PS 1.5. But sometimes we needed to deal with just the opposite, because we didn’t want every new entry to show up in frontend. So we backdated the products via date_add and for the remaining new products “abused” the database field upc.
    Every entry > 0 serves as condition in blocknewproducts to display a product (or not). This is helpful, if you have many new products, but don’t want them all in your shop’s frontend and want only a choice of them displayed.



  • @Occam
    Yes. In the case of products which are used, for example, as an emergency aid for various things or are not to appear as new, we use an older date in the date field.



  • Great, I will implement it in my next shop! One more question, what if I update the store? Do I have to update the code also in the file and if that’s the case is there way to avoid changes to be overwritten?


  • administrators

    Would it bother you all if I wrote a dev blog post about this?



  • Not at all, feel free to do so.
    But in this case you should mention that the update safe way to implement such changes is always an override of the standard behavior and not a direct core change. The modified informations.tpl should be created as

    /override/controllers/admin/templates/products/informations.tpl
    

Log in to reply
 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.