X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Free Shipping Mod (https://forum.x-cart.com/showthread.php?t=47554)

mikeslye 05-14-2009 10:31 AM

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)

mikeslye 05-18-2009 07:40 AM

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; 


steewu 07-10-2009 09:17 PM

Re: Free Shipping Mod
 
Me too... It took me a long time finding.... Works for version 4.2.2

tamalita 07-14-2009 11:19 AM

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?


All times are GMT -8. The time now is 05:44 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.