Jump to content

Change date for products in BO (date_add)


marjanbajc

Recommended Posts

  • 6 months later...

Add the following lines to AdminProducts.php in the place you desire. For example I added it to line 1560, bellow the "Weight:" parameter.

 

<tr>
  <td class="col-left">'.$this->l('date added:').'</td>
  <td style="padding-bottom:5px;">
   <input onchange="updateCurrentText();" type="text" id="date_add" name="date_add" value="'.($this->getFieldValue($obj, 'date_add') ? htmlentities($this->getFieldValue($obj, 'date_add'), ENT_COMPAT, 'UTF-8') : date('Y-m-d H:i:s')).'" />
  </td>

 

I'm not a coder, I just copied this from somewhere else and modified it. It works fine for me.

Link to comment
Share on other sites

  • 4 weeks later...

Hi, I am searching for the same option. You are talking about changing the file: .../admin_presta/tabs/AdminProducts.php

right?

Because when I try to edit that file in line 1560 I can't see any weight parameter being defined.

I am working with PrestaShop™ 1.4.6.2.

Could you please paste some of the code you have before that line, just to make sure I am pasting in the right place.

 

This is my code:

 

line

1559 $(document).ready(function(){

1560 $(\'#id_mvt_reason\').change(function(){

1561 updateMvtStatus($(this).val());

 

Thanks in advance!

Link to comment
Share on other sites

I'm using version 1.3.2, that's why.

 

You can put that code anywhere it suits better to you. I have it bellow:

 

<tr>
  <td class="col-left">'.$this->l('Weight:').'</td>
  <td style="padding-bottom:5px;">
   <input size="6" maxlength="6" name="weight" type="text" value="'.htmlentities($this->getFieldValue($obj, 'weight'), ENT_COMPAT, 'UTF-8').'" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" /> '.Configuration::get('PS_WEIGHT_UNIT').'
  </td>
 </tr>

 

De nada ;)

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

I know it is not nice to "resurrect" ancient topics :)

 

However I cannot find /admin_presta/tabs/AdminProducts.php as i am using presta 1.5.6.2

 

Is there any way to add the discussed above function in my version?

Link to comment
Share on other sites

I know it is not nice to "resurrect" ancient topics :)

 

However I cannot find /admin_presta/tabs/AdminProducts.php as i am using presta 1.5.6.2

 

Is there any way to add the discussed above function in my version?

 

 

What a coincidence, I just added this functionality to my new shop (also 1.5.6.2)! The following code worked for me:

<tr>
<td class="col-left"><label>{$bullet_common_field} {l s='New from'}</label></td>
<td style="padding-bottom:5px;">
<input type="text" id="date_add" name="date_add" value="{$product->date_add|escape:html:'UTF-8'}" />
</td>
</tr>

Add it to line 146 of {admin folder}\themes\default\template\controllers\products\informations.tlp

  • Like 1
Link to comment
Share on other sites

What a coincidence, I just added this functionality to my new shop (also 1.5.6.2)! The following code worked for me:

<tr>
<td class="col-left"><label>{$bullet_common_field} {l s='New from'}</label></td>
<td style="padding-bottom:5px;">
<input type="text" id="date_add" name="date_add" value="{$product->date_add|escape:html:'UTF-8'}" />
</td>
</tr>

Add it to line 146 of {admin folder}\themes\default\template\controllers\products\informations.tlp

 

it's enough to create only this field? no core changes?

Link to comment
Share on other sites

it's enough to create only this field? no core changes?

 

For me it's working. I've tested it only a couple of times, though.

 

Add the code and upload file (ftp), go to a product page in backoffice, change the date and save changes. An "old" product can be set as new that easily. ;)

Link to comment
Share on other sites

  • 8 months later...

Adapted this functionality to ps 1.6.0.11.

Add it to line 134 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>

Thank.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

you can wrap that code with if to hide it when a product is actually being added new

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