Zen Cart Logo
Forums / General Questions / 1st order help :(

1st order help :(

Views: 994

Results 1 to 7 of 7
12 Oct 2011, 8:26 PM
#1
wartht avatar

wartht

New Zenner

Join Date:
Sep 2011
Posts:
31
Plugin Contributions:
0

1st order help :(

I've been looking all over the place for an answer and cant find one so i figured id ask.

I've been in business for a while, and just came up with a first order discount coupon. but unfortunately all I've tried has given the discount to all customers not just ones that haven't made an order yet.

anyone got a solution? I've got plenty of costumers now but i'm trying to get more and i want to advertise the code not just have it in an email. if i just give it out to all then that puts me out quite a lot more then just to the ones who haven't ordered yet.

so i appeal to you guys for help. if anyone can help me its you guys :)

12 Oct 2011, 11:41 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 1st order help :(

This is not built into Zen Cart ...

You could customize the Discount Coupon order totals file by adding the code in RED:

          // remove if fails address validation
          if (!$foundvalid) {
            $messageStack->add_session('checkout_payment', TEXT_REMOVE_REDEEM_COUPON_ZONE, 'caution');
            $this->clear_posts();
            if (!$foundvalid) zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL',true, false));
          }

          // bof: remove if discount and has an order
          if ($foundvalid && $coupon_result->fields['coupon_id'] == NEW_SIGNUP_DISCOUNT_COUPON) {
            $chk_first_order = $db->Execute("select orders_id from " . TABLE_ORDERS . " where customers_id = " . $_SESSION['customer_id']);
            if (!$chk_first_order->EOF) {
              $foundvalid = false;
              $messageStack->add_session('checkout_payment', 'Only allowed on first order', 'caution');
              $this->clear_posts();
              if (!$foundvalid) zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL',true, false));
            }
          }
          // eof: remove if discount and has an order

to the file:
/includes/modules/order_total/ot_coupon.php

This will then use the setting in the Configuration ... GV Coupons ... for the:

New Signup Discount Coupon ID#

and check the customer for Orders and stop it from being used ...

13 Oct 2011, 1:02 AM
#3
wartht avatar

wartht

New Zenner

Join Date:
Sep 2011
Posts:
31
Plugin Contributions:
0

Re: 1st order help :(

ty ill try it and hope it works :) crosses fingers

13 Oct 2011, 2:13 AM
#4
wartht avatar

wartht

New Zenner

Join Date:
Sep 2011
Posts:
31
Plugin Contributions:
0

Re: 1st order help :(

yay it works!!! tyvm ive been working on this problem for so long :)

13 Oct 2011, 2:16 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 1st order help :(

Excellent ... thanks for the update that this fixed your issues!! :cool:

15 Dec 2013, 9:02 PM
#6
alhakeem2001 avatar

alhakeem2001

Zen Follower

Join Date:
Nov 2007
Posts:
434
Plugin Contributions:
1

Re: 1st order help :(

Hi Ajeh, I have the same problem but I'm using the last version of zc, v.1.5.1 , Do I still need to do the modification on the script ? in other words, Can that be done from the admin panel without tweaking the script ?

15 Dec 2013, 11:16 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 1st order help :(

If you want to customize it so that a Discount Coupon only works on the first order, you would need to do a similar customization, as this is not built in to the core code ...