Advertisement:

Author Topic: How to change the expiration date if ad is updated  (Read 1800 times)

AdsGig

  • Jr. Member
  • **
  • Posts: 72
How to change the expiration date if ad is updated
« on: July 02, 2014, 04:33:01 am »
Hi,  If the user updated his ad the expiration date is still the same date at the time of publishing.

How can we change the expiration date to lets say additional 30 days from current date?

AdsGig

  • Jr. Member
  • **
  • Posts: 72
Re: How to change the expiration date if ad is updated
« Reply #1 on: July 02, 2014, 03:46:23 pm »
found a quick and dirty solution.

in itemactions.php look for 'function edit'

   after this line  $aItem['address']  = osc_sanitize_name( strip_tags( trim( $aItem['address'] ) ) );
   put this code   $aItem['dt_expiration'] =  date("Y-m-d", strtotime("+45 days"));

it's basically hard coded 45 days. 

if you have any other solutions tell me :)
   

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: How to change the expiration date if ad is updated
« Reply #2 on: July 02, 2014, 06:25:00 pm »
yes, in admin, categories default dates per category, and can be defaulted in sub/sub category also.

also in admin, if you want to adjust a particular item -- edit item and in the bottom right corner you can change dates

AdsGig

  • Jr. Member
  • **
  • Posts: 72
Re: How to change the expiration date if ad is updated
« Reply #3 on: July 03, 2014, 02:14:20 pm »
yes, in admin, categories default dates per category, and can be defaulted in sub/sub category also.

also in admin, if you want to adjust a particular item -- edit item and in the bottom right corner you can change dates

Hi design, basically what i want to achieve is if the user tried to update his own ad. I want to add current date + 45 days. Admin dont need to update the expiration date.

onaldo

  • Jr. Member
  • **
  • Posts: 75
Re: How to change the expiration date if ad is updated
« Reply #4 on: March 15, 2016, 10:13:48 am »
Thanks for this. I've been looking for this solution. I instead used the following modified code:

Code: [Select]
$_category = Category::newInstance()->findByPrimaryKey($aItem['catId']);
$i = $_category['i_expiration_days'];
$aItem['dt_expiration'] =  date("Y-m-d", strtotime("+".$i." days"));

found a quick and dirty solution.

in itemactions.php look for 'function edit'

   after this line  $aItem['address']  = osc_sanitize_name( strip_tags( trim( $aItem['address'] ) ) );
   put this code   $aItem['dt_expiration'] =  date("Y-m-d", strtotime("+45 days"));

it's basically hard coded 45 days. 

if you have any other solutions tell me :)