Jump to content
russnyc_2

Extend end date for discount coupon codes

Recommended Posts

Hi,

Does anyone know how to extend the End Date listed when creating coupon codes. Right now I'm only able to go out until 12/31/2018 when creating new discount coupon codes. I'm using 2.2-MS2

 

Thanks

Share this post


Link to post
Share on other sites

You don't say what addon you are using but I'm guessing it is Gift Vouchers. The following will change the date though your code may vary a little since there are many versions of that addon. In admin/coupon_admin.php, find

      $coupon_startdate = split("[-]", date('Y-m-d'));

And change it to

      $coupon_startdate = explode("-", date('Y-m-d', strtotime('+5 years')));

You'll need to do the same for the $coupon_finishdate line.

Share this post


Link to post
Share on other sites

Here are the codes involved with the date of Gift Vouchers:

      <tr>
<?php
// molafish: fixed reset to default of dates when editing an existing coupon or showing an error message
    if ($HTTP_GET_VARS['action'] == 'new' && !$HTTP_POST_VARS['coupon_startdate'] && !$HTTP_GET_VARS['oldaction'] == 'new') {
      $coupon_startdate = preg_split("/[-]/", date('Y-m-d'));
    } elseif (tep_not_null($HTTP_POST_VARS['coupon_startdate'])) {
      $coupon_startdate = preg_split("/[-]/", $HTTP_POST_VARS['coupon_startdate']);
    } elseif (!$HTTP_GET_VARS['oldaction'] == 'new') {   // for action=voucheredit
      $coupon_startdate = preg_split("/[-]/", date('Y-m-d', strtotime($coupon['coupon_start_date'])));
    } else {   // error is being displayed
      $coupon_startdate = preg_split("/[-]/", date('Y-m-d', mktime(0, 0, 0, $HTTP_POST_VARS['coupon_startdate_month'],$HTTP_POST_VARS['coupon_startdate_day'] ,$HTTP_POST_VARS['coupon_startdate_year'] )));
    }
    if ($HTTP_GET_VARS['action'] == 'new' && !$HTTP_POST_VARS['coupon_finishdate'] && !$HTTP_GET_VARS['oldaction'] == 'new') {
      $coupon_finishdate = preg_split("/[-]/", date('Y-m-d'));
      $coupon_finishdate[0] = $coupon_finishdate[0] + 1;
    } elseif (tep_not_null($HTTP_POST_VARS['coupon_finishdate'])) {
      $coupon_finishdate = preg_split("/[-]/", $HTTP_POST_VARS['coupon_finishdate']);
    } elseif (!$HTTP_GET_VARS['oldaction'] == 'new') {   // for action=voucheredit
      $coupon_finishdate = preg_split("/[-]/", date('Y-m-d', strtotime($coupon['coupon_expire_date'])));
    } else {   // error is being displayed
      $coupon_finishdate = preg_split("/[-]/", date('Y-m-d', mktime(0, 0, 0, $HTTP_POST_VARS['coupon_finishdate_month'],$HTTP_POST_VARS['coupon_finishdate_day'] ,$HTTP_POST_VARS['coupon_finishdate_year'] )));
    }
?>
        <td align="left" class="main"><?php echo COUPON_STARTDATE; ?></td>
        <td align="left"><?php echo tep_draw_date_selector('coupon_startdate', mktime(0,0,0, $coupon_startdate[1], $coupon_startdate[2], $coupon_startdate[0])); ?></td>
        <td align="left" class="main"><?php echo COUPON_STARTDATE_HELP; ?></td>
      </tr>
      <tr>
        <td align="left" class="main"><?php echo COUPON_FINISHDATE; ?></td>
        <td align="left"><?php echo tep_draw_date_selector('coupon_finishdate', mktime(0,0,0, $coupon_finishdate[1], $coupon_finishdate[2], $coupon_finishdate[0])); ?></td>
        <td align="left" class="main"><?php echo COUPON_FINISHDATE_HELP; ?></td>

I's really appreciate id someone can help me extend the date. 

 

Untitled-2.jpg

Share this post


Link to post
Share on other sites

I will try to get my edited version uploaded before the end of the year. I'll post here when I do.

Share this post


Link to post
Share on other sites

@henryxli@sucoboyI started to change the date code has mentioned but found so many problems with the code that I decided to write a new version. It requires more to switch to it but the result will be worth it since the new version has many, many security fixes as well as new options. If you, anyone, has questions about the new version, please post those in its support thread.

Share this post


Link to post
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

×