Soon, we’ll be announcing a fresh new marketplace for TastyIgniter developers.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

(Modification For Coupons) Require Users To Register To Use Coupons (TI V2.0)

#1 Tanbir Offline Junior Member
Currently, if you have the 'customer redemption' set to a number other than 0 (unlimited) it will not consider guest orders in the count meaning a customer using guest order can use the coupon more than the customer redemption set amount. Coupon redemption will work as intended if the customer is logged in (is set to 1 the customer can use it once and will not work a second time). This edit ill require the customer to login before using any coupon.


Add anywhere (suggest last line)

$lang['coupon_register']                    = '<p class="alert-danger">You must be registered to use this coupon.</p>';


Remove Lines 185 to 211

Add following to line 185 (to 216)

    public function coupon() {                                                                    // _updateModule() method to update cart
       $json = array();

       if (!$json AND $this->cart->contents() AND is_string($this->input->post('code')))
           switch ($this->input->post('action'))
               case 'remove':
                   $json['success'] = $this->lang->line('alert_coupon_removed');                        // display success message

               case 'add':
               if ($this->customer->isLogged()) {                                                        // if user is logged in accept coupon
                   if (($response = $this->cart_module_lib->validateCoupon($this->input->post('code'))) === TRUE) {
                       $json['success'] = $this->lang->line('alert_coupon_applied');
                                             // display success message
                   } else {
                       $json['error'] = $response;
               } else {
                       $json['success'] = $this->lang->line('coupon_register');                        // if user is not logged in send message
                   $json['redirect'] = referrer_url();

       $this->output->set_output(json_encode($json));                                            // encode the json array and set final out to be sent to jQuery AJAX

Possibly Related Threads...

Thread / Author
Email Templates
Last Post anth made 16 Feb, 07:23 PM
Forum Jump:

Users browsing this thread: 1 Guest(s)