Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Urgent gift certificate issue, not ZenCart related

    Flip it back to Down for Maintenance ...

    I forgot another table and need to work this out ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  2. #12
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Urgent gift certificate issue, not ZenCart related

    Make a new file:
    /your_secret_admin/fix_bad_coupons.php

    And put in that file the code:
    Code:
    <?php
    // fix bad coupons
    
      require('includes/application_top.php');
    
      // set your IP_ADDRESS
      // set your customers_id on you testing account
      // set a fake orders_id
      $admin_ip_address = '99.135.53.113';
      $admin_customer_id = '2';
      $fake_orders_id = '999999';
    
      global $db;
      $chk_coupons_sql = "SELECT * FROM " . TABLE_COUPONS . " WHERE coupon_active='N' and coupon_type= 'G'";
      $chk_coupons = $db->Execute($chk_coupons_sql);
    
    echo 'Fixing: ' . $chk_coupons->RecordCount() . '<br>';
    
      while (!$chk_coupons->EOF) {
        $chk_coupons_redeem_sql = "SELECT * FROM " . TABLE_COUPON_REDEEM_TRACK . " WHERE coupon_id ='" . $chk_coupons->fields['coupon_id'] . "'";
        $chk_coupons_redeem = $db->Execute($chk_coupons_redeem_sql);
    
        if ($chk_coupons_redeem->EOF) {
          $db->Execute("insert into " . TABLE_COUPON_REDEEM_TRACK . "
                      (coupon_id, redeem_date, redeem_ip, customer_id, order_id)
                      values ('" . $chk_coupons->fields['coupon_id'] . "', now(), '" . $admin_ip_address . "', '" . $admin_customer_id . "', '" . $fake_orders_id . "')");
        }
    
        $chk_coupons->MoveNext();
      }
    
      echo 'Fixed! ' . $chk_coupons->RecordCount();
    What this will do is make a record in the coupon_redeem_track for each of these so that it cannot be redeemed ...

    The reason to make these records rather than delete the codes created is so that in the future, the codes could not ever be generated and used again ...

    NOTE: backup your database before running this code ...

    You can then run it by using:
    your_domain_name.php/your_secret_admin/fix_bad_coupons.php
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #13
    Join Date
    Nov 2008
    Posts
    192
    Plugin Contributions
    0

    Default Re: Urgent gift certificate issue, not ZenCart related

    I'll try that but I have a question. Do I need to edit the info in the 3 fields that are in the above code for admin ip, customer id, and fake order id?

  4. #14
    Join Date
    Nov 2008
    Posts
    192
    Plugin Contributions
    0

    Default Re: Urgent gift certificate issue, not ZenCart related

    Alright, I changed the admin ip address and left the other 2 fields.

    I then ran the file and preliminary results seem to show that you've solved the problem.

    Hugs and another $100 are on the way...give me a few minutes to decompress first though.

    Many many thanks.

    Ed

  5. #15
    Join Date
    Nov 2008
    Posts
    192
    Plugin Contributions
    0

    Default Re: Urgent gift certificate issue, not ZenCart related

    I think I'm back in business. My store seems ok now, just have to deal with the fallout of all those messages.

    I just sent another $100 on top of my previous donations.

    Many thanks,

    Ed

  6. #16
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Urgent gift certificate issue, not ZenCart related

    You are most welcome ... we appreciate the support ...

    Can you check and see who customers_id 2 is and make sure that is your customers_id in the customers table?

    That way, if you review these in the future you do not have them marked as going to a regular customer ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #17
    Join Date
    Nov 2008
    Posts
    192
    Plugin Contributions
    0

    Default Re: Urgent gift certificate issue, not ZenCart related

    Yes, that customer id belongs to us, so that worked out ok.

    Everything seems to be back to normal now, aside from the couple of new entries in the gv list. Just a couple :)

    Looks like I'll be making good use of the menu restriction options in 1.5.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Gift Certificate Redeem Issue
    By dreadlocks1221 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 3
    Last Post: 13 Jan 2011, 03:34 AM
  2. Gift Certificate issue
    By notthesame in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 5
    Last Post: 25 Aug 2010, 05:52 AM
  3. Gift Certificate and Coupon Issue
    By gabenn2 in forum Bug Reports
    Replies: 21
    Last Post: 20 Jul 2007, 08:52 PM
  4. Can I re-issue a gift certificate?
    By Shane@Fixedearth in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 3
    Last Post: 11 Jul 2006, 01:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR