Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

URGENT Help Needed Please


Mort-lemur

Recommended Posts

Posted

Hi,

 

I have discovered a problem with my site set-up as follows:

 

I have Kgt Discount coupons installed - works fine

 

I have Exclude items from free shipping installed - works fine

 

However, when A customer buys items which are excluded from free shipping using a discount code - then shipping is set to Free.

 

I think it is a conflict of the code in includes/classes/order.php and I think the conflict is occuring in the code below:

 

        //kgt - discount coupons
       if( is_object( $this->coupon ) ) {
         $applied_discount = 0;
         $discount = $this->coupon->calculate_discount( $this->products[$index], $valid_products_count );
         if( $discount['applied_discount'] > 0 ) $valid_products_count++;
         $shown_price = $this->coupon->calculate_shown_price( $discount, $this->products[$index] );
         $this->info['subtotal'] += $shown_price['shown_price'];
         $shown_price = $shown_price['actual_shown_price'];
       } else {
         $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
       $this->info['subtotal'] += $shown_price;
   ///////// BOF exclude products from free shipping total V 1.0 /////////
       $excluded_products_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where exclude_free_shipping = 1 ");
        while ($excluded_products = tep_db_fetch_array($excluded_products_query)) {
           $string_id = $products[$i]['id'] ; //something ugly like 71{1}14, we need 71
          $string_idArray = split('{',$string_id);

          //the first in our array will be the products_id even if it has attributes

          if($string_idArray[0] == $excluded_products['products_id']) {
          $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
       $this->info['subtotal_excluded'] += $shown_price;
      } }
       ///////// EOF exclude products from free shipping total V 1.0 /////////		
       }

 

Can anyone see an obvious conflict that would override the exclude free shipping code?

 

This is costing me as customers are in effect getting double discount

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Posted

OK Sorted it.

 

I had the Exclude free shipping code in slightly the wrong place, new code reads :

 

         //kgt - discount coupons
       if( is_object( $this->coupon ) ) {
         $applied_discount = 0;
         $discount = $this->coupon->calculate_discount( $this->products[$index], $valid_products_count );
         if( $discount['applied_discount'] > 0 ) $valid_products_count++;
         $shown_price = $this->coupon->calculate_shown_price( $discount, $this->products[$index] );
         $this->info['subtotal'] += $shown_price['shown_price'];
         $shown_price = $shown_price['actual_shown_price'];
       } else {
         $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
       $this->info['subtotal'] += $shown_price;

       }
       /**************
       $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
       $this->info['subtotal'] += $shown_price;
       **************/
       //end kgt - discount coupons
   ///////// BOF exclude products from free shipping total V 1.0 /////////
       $excluded_products_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where exclude_free_shipping = 1 ");
        while ($excluded_products = tep_db_fetch_array($excluded_products_query)) {
           $string_id = $products[$i]['id'] ; //something ugly like 71{1}14, we need 71
          $string_idArray = split('{',$string_id);

          //the first in our array will be the products_id even if it has attributes

          if($string_idArray[0] == $excluded_products['products_id']) {
          $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
       $this->info['subtotal_excluded'] += $shown_price;
      } }
       ///////// EOF exclude products from free shipping total V 1.0 /////////		

 

Fingers crossed all seems to be working now....

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Archived

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

×
×
  • Create New...