Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Free Shipping Mod

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 05-14-2009, 10:31 AM
 
mikeslye mikeslye is offline
 

Member
  
Join Date: Feb 2009
Posts: 18
 

Default Free Shipping Mod

This mod allows selecting one or more shipping methods as to be free, while the rest of the shipping methods are calculated as normal...

located in /includes/func.cart.php

Replace:

PHP Code:
# Calculate total_cost and total_+weight for selection condition
            
if ($product["free_shipping"] != "Y" || $config['Shipping']['free_shipping_weight_select'] == 'Y') {
                
$total_shipping_valid += $product["subtotal"];
                
$total_weight_shipping_valid += $product["weight"] * $product["amount"];
            }

            
# Calculate total_cost and total_+weight for shipping calculation
            
if ($product["free_shipping"] == "Y")
                continue; 

With:

PHP Code:
# Calculate total_cost and total_+weight for selection condition
            # Dirks Free Shipping Mod Part 1
            
if ($config['Shipping']['free_shipping_weight_select'] == 'Y') {
            
# End Mod Part 1
                
$total_shipping_valid += $product["subtotal"];
                
$total_weight_shipping_valid += $product["weight"] * $product["amount"];
            }
            
            
# Calculate total_cost and total_+weight for shipping calculation
            #Dirks Free Shipping Mod Part2 -- updated 5-18-09
            #shipping_id 52 is USPS Priority, replace with selected free shipping medthod
                        
if ($product["free_shipping"] == "Y" && $shipping_id == 52)
            continue;
            
# End Mod Part 2 

After trying other mods and searching for hours and hours, and tracing through code... yuck (im not a programmer, LOL) This code works for me, hope it works for you...

--Dirk (Main Tech Guy for http://www.theharddriveexperts.com)
__________________
-------------------------------
http://www.theharddriveexperts.com
New, Refurbished, Re-manufactured, Re-Certified Hard Drives -- ATA, SATA, SCSI, SAS, etc...

x-Cart Version 4.1.11
Reply With Quote
  #2  
Old 05-18-2009, 07:40 AM
 
mikeslye mikeslye is offline
 

Member
  
Join Date: Feb 2009
Posts: 18
 

Default Re: Free Shipping Mod

There was a logic error in this code.. it would make shipping id 52 always free....
PHP Code:
if ($shipping_id == 52)
continue; 

To make shipping id 52 only free when free shipping is selected...

PHP Code:
if ($product["free_shipping"] == "Y" && $shipping_id == 52)
            continue; 
__________________
-------------------------------
http://www.theharddriveexperts.com
New, Refurbished, Re-manufactured, Re-Certified Hard Drives -- ATA, SATA, SCSI, SAS, etc...

x-Cart Version 4.1.11
Reply With Quote
  #3  
Old 07-10-2009, 09:17 PM
 
steewu steewu is offline
 

Member
  
Join Date: Sep 2007
Posts: 26
 

Default Re: Free Shipping Mod

Me too... It took me a long time finding.... Works for version 4.2.2
__________________
Version Xcart5 5.2.XX
Reply With Quote
  #4  
Old 07-14-2009, 11:19 AM
 
tamalita tamalita is offline
 

Advanced Member
  
Join Date: Mar 2005
Location: Idaho
Posts: 64
 

Default Re: Free Shipping Mod

I have a client who wants one of his admin store managers to have free shipping always; would this be the best option to set that up? Or should I use membership profiles?
__________________
X-Cart Gold v4.5.5
X-Special Offers
Linux/PHP 5.3.13/MySQL 5.1.66
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:14 PM.

   

 
X-Cart forums © 2001-2020