Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extend end date for discount coupon codes


russnyc_2

Recommended Posts

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.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 5 months later...

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

Link to comment
Share on other sites

  • 5 months later...
  • 3 weeks later...

@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.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...