Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Mar 2011
    Posts
    14
    Plugin Contributions
    0

    Default Need Coupon Zone Restriction by Shipping Address

    Hi Newbie Zen Cart user, here. I'm running v1.3.9h and I've run across something I can't untangle.

    I've created a coupon that I want only deployed military customers (using APO/FPO addresses) to use. I have restrictions on the categories, and I set up a "military" zone that includes all the "states" (AE, AP, etc.).

    It appears to work fine except for the problem that breaks it - that being, of course, that zone restrictions apply to the billing address, which is not the APO address. (In other words, when I use the APO address as the billing, it's applied as expected.)

    I know what I'm wanting to do was actually a bug in previous versions. I've looked at some older versions of ot_coupon.php, but the code has changed enough that with my limited php knowledge I can't untangle it. Even if I could, I have no idea if other code needs modification as well.

    I don't have any problem changing core code because (at this time), no other coupons would have a need for zone restrictions.

    Any code snippets or advice would be most appreciated. I promised soldiers a coupon, but I don't want to post it until I can control who uses it.

    Thanks!

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

    Default Re: Need Coupon Zone Restriction by Shipping Address

    You would need to customize the Order Total module for Discount Coupons ot_coupons and have it use the Delivery Address on your coupons rather than the Billing Address ...

    Currently, the restrictions only use the Delivery Address on Free Shipping for the restrictions ...

    If you look in the code around line 267 you will see the start of the code for which address is used on the restrictions ...
    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. #3
    Join Date
    Mar 2011
    Posts
    14
    Plugin Contributions
    0

    Default Re: Need Coupon Zone Restriction by Shipping Address

    Fantastic! What a quick response! That's close to where I was at - I was looking around line 309 at the code commented with "...always validate coupon for payment address changes."

    Do you know which line is calling for the address? I've got a ways to go before I can read php with any confidence.

    Thanks for your help!

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

    Default Re: Need Coupon Zone Restriction by Shipping Address

    There are two case statements ... one for the country and one for the zone id ...

    You need to adjust them for whether they pull Delivery or Billing ...
    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!

  5. #5
    Join Date
    Mar 2011
    Posts
    14
    Plugin Contributions
    0

    Default Re: Need Coupon Zone Restriction by Shipping Address

    Odd - I searched TABLE_ZONES_TO_GEO_ZONES in Zen cart admin tools, and, as you stated, it's around line 286, but in opening the php file, it's line 573. I'll have to unravel that one later...

    So the following commented out:

    // $sql = "select zone_id, zone_country_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . $coupon_result->fields['coupon_zone_restriction'] . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id";

    And is followed by:

    $sql = "select zone_id, zone_country_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . $coupon_result->fields['coupon_zone_restriction'] . "' and zone_country_id = '" . $check_zone_country_id . "' order by zone_id";

    $check = $db->Execute($sql);


    I'm assuming what I want is:

    '" . $check_zone_country_id . "'

    Am I in the right direction still?

  6. #6
    Join Date
    Mar 2011
    Posts
    14
    Plugin Contributions
    0

    Default Re: Need Coupon Zone Restriction by Shipping Address

    Sorry - didn't see your last post until after I posted again. OK, thanks, I'll keep at it!

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

    Default Re: Need Coupon Zone Restriction by Shipping Address

    If you are using the restrictions ... have you look at the two sections labeled:
    Code:
              // base restrictions zone restrictions for Delivery or Billing address
    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!

  8. #8
    Join Date
    Mar 2011
    Posts
    14
    Plugin Contributions
    0

    Default Re: Need Coupon Zone Restriction by Shipping Address

    Got it! I'm brain-fried, I kept looking for $order->shipping in spite of "delivery" being right there in front of me

    Thanks for your help!

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

    Default Re: Need Coupon Zone Restriction by Shipping Address

    You are most welcome ... thanks for the update that you were able to alter this to your needs ...
    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!

  10. #10
    Join Date
    Mar 2011
    Posts
    14
    Plugin Contributions
    0

    Default Re: Need Coupon Zone Restriction by Shipping Address

    Not a prob! I'm just glad you were there before I gave myself a head wound *lol*

    If zen cart has (and I'm sure it does) a bug/request tracker, maybe this would work as an admin option? Even handier might be the option to set individual coupons. (But more likely, I'm one in a million who would set it this way).

    Thanks again!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Coupon Zone Restriction - Not working
    By imfsub12 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 6
    Last Post: 2 Feb 2011, 10:30 PM
  2. Restriction shipping zone before check out page
    By arul_css in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 26 Mar 2010, 02:32 AM
  3. Free Shipping Options Zone Restriction: Where is it defined?
    By mauiexcellent in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 23 Oct 2008, 06:18 AM
  4. Coupon Restriction by Zone not working when I require Terms and Conditions checkbox
    By karma-lab in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 3
    Last Post: 8 Aug 2008, 05:27 PM

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