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)
-   -   UPS - Setting Maximum Weight per box (https://forum.x-cart.com/showthread.php?t=11659)

jmell 01-23-2005 02:54 AM

UPS - Setting Maximum Weight per box
 
I have a few items that ship in one box at 47Lbs. When you order 4 of them UPS will not rate it because it comes back over weight. How do I tell UPS to Rate it as 4 Boxes?

sheylak 02-24-2005 07:04 AM

ups
 
yup same question :) how? <3

shan 02-24-2005 07:31 AM

i think this got looked at in later versions.

check the changelog for more info

nick1628 03-01-2005 01:20 PM

i just upgraded to the latest stable of xcart 4.0.12 and no this hasn't been fixed ever...this is actually extremely easy to fix (although it took me a long time to track down)....i've heard of people paying huge chunks of cash for this simple fix....this works in every version of 4.x that i've tried

as it is...i have it rating them as all seperate boxes but if someone wants i could update the code to put as many items into a box as possible.....

so..here's the code

Before: (file /shipping/mod_UPS.php)
Code:

        $query=<<<EOT
<?xml version='1.0'?>
<AccessRequest xml:lang='en-US'>
        <AccessLicenseNumber>$UPS_accesskey</AccessLicenseNumber>
        <UserId>$UPS_username</UserId>
        <Password>$UPS_password</Password>
</AccessRequest>
<?xml version='1.0'?>
<RatingServiceSelectionRequest xml:lang='en-US'>
        <FreightCharges>
                <CurrencyCode>USD</CurrencyCode>
        </FreightCharges>
        <Request>
                <TransactionReference>
                        <CustomerContext>Rating and Service</CustomerContext>
                        <XpciVersion>1.0001</XpciVersion>
                </TransactionReference>
                <RequestAction>Rate</RequestAction>
                <RequestOption>shop</RequestOption>
        </Request>
        <PickupType>
                <Code>$pickup_type</Code>
        </PickupType>
$customer_classification_query
        <Shipment>
                <Shipper>
                        <Address>
                                <City>$src_city</City>
                                <PostalCode>$src_zipcode</PostalCode>
                                <CountryCode>$src_country_code</CountryCode>
                        </Address>
                </Shipper>
                <ShipFrom>
                        <Address>
                                <City>$src_city</City>
                                <PostalCode>$src_zipcode</PostalCode>
                                <CountryCode>$src_country_code</CountryCode>
                        </Address>
                </ShipFrom>
                <ShipTo>
                        <Address>
                                <City>$dst_city</City>
                                <PostalCode>$dst_zipcode</PostalCode>
                                <CountryCode>$dst_country_code</CountryCode>
$residental_flag
                        </Address>
                </ShipTo>
                <Package>
                        <PackagingType>
                                <Code>$packaging_type</Code>
                        </PackagingType>
                        <PackageWeight>
                                <UnitOfMeasurement>
                                        <Code>$UPS_wunit</Code>
                                </UnitOfMeasurement>
                                <Weight>$UPS_weight</Weight>
                        </PackageWeight>
$dimensions_query
$pkgparams
                </Package>
        </Shipment>
</RatingServiceSelectionRequest>
EOT;


After:
Code:

        $query=<<<EOT
<?xml version='1.0'?>
<AccessRequest xml:lang='en-US'>
        <AccessLicenseNumber>$UPS_accesskey</AccessLicenseNumber>
        <UserId>$UPS_username</UserId>
        <Password>$UPS_password</Password>
</AccessRequest>
<?xml version='1.0'?>
<RatingServiceSelectionRequest xml:lang='en-US'>
        <FreightCharges>
                <CurrencyCode>USD</CurrencyCode>
        </FreightCharges>
        <Request>
                <TransactionReference>
                        <CustomerContext>Rating and Service</CustomerContext>
                        <XpciVersion>1.0001</XpciVersion>
                </TransactionReference>
                <RequestAction>Rate</RequestAction>
                <RequestOption>shop</RequestOption>
        </Request>
        <PickupType>
                <Code>$pickup_type</Code>
        </PickupType>
$customer_classification_query
        <Shipment>
                <Shipper>
                        <Address>
                                <City>$src_city</City>
                                <PostalCode>$src_zipcode</PostalCode>
                                <CountryCode>$src_country_code</CountryCode>
                        </Address>
                </Shipper>
                <ShipFrom>
                        <Address>
                                <City>$src_city</City>
                                <PostalCode>$src_zipcode</PostalCode>
                                <CountryCode>$src_country_code</CountryCode>
                        </Address>
                </ShipFrom>
                <ShipTo>
                        <Address>
                                <City>$dst_city</City>
                                <PostalCode>$dst_zipcode</PostalCode>
                                <CountryCode>$dst_country_code</CountryCode>
$residental_flag
                        </Address>
                </ShipTo>

EOT;
//<? //only in here to make code look nicer in php editor..doesn't affect anything
global $cart;

foreach($cart['products'] as $prodKey => $prodArray)
{
        for( $quantity=0; $quantity<$prodArray['amount'];$quantity++)
        {
                $prodWeight = $prodArray['weight'];
                $query .=<<<EOT
                        <Package>
                                <PackagingType>
                                        <Code>$packaging_type</Code>
                                </PackagingType>
                                <PackageWeight>
                                        <UnitOfMeasurement>
                                                <Code>$UPS_wunit</Code>
                                        </UnitOfMeasurement>
                                        <Weight>$prodWeight</Weight>
                                </PackageWeight>
$dimensions_query
$pkgparams
                        </Package>
EOT;
        }
}
$query .=<<<EOT
        </Shipment>
</RatingServiceSelectionRequest>
EOT;



and the other file

Before: (file cart.php around line 285)
Code:

$cart["products"][]=array("cartid"=>$cartid, "productid"=>$productid,"amount"=>$amount, "options"=>$product_options, "free_price"=>@price_format(@$free_price),"distribution"=>$product_distribution);


After:
Code:

$cart["products"][]=array("cartid"=>$cartid, "productid"=>$productid,"amount"=>$amount, "options"=>$product_options, "weight"=>$added_product["weight"], "free_price"=>@price_format(@$free_price),"distribution"=>$product_distribution);

Hope this helps, if you have any problems just drop me a message.

- Nick

leonp 03-21-2005 05:39 AM

Nick,

Thanks for the code but I must have done something wrong when trying to install it.

I basically cut and pasted the code you supplied in both programs but now I come up with the following error message:

Parse error: parse error, unexpected T_SL in /home/dropship/public_html/store/shipping/mod_UPS.php on line 218

Just in case I messed up, I cut and pasted a second time with the same results.

Any help would be greatly appreciated because this is the last problem that I have to solve before going live with my store.

I am running Version 4.0.12

Thanks,
Leon P.
http://www.DropShipSupplier.com

nick1628 03-21-2005 09:46 AM

Hi,

I replied to your PM to me with my thoughts. I'm assuming this should fix it, so for anyone else, make sure that there are no spaces after the $query=<<<EOT on line 218 and also that the EOT; on line 266 is all the way against the left side with no spaces after. I'll update this later if that doesn't help leon.

- nick

nfc5382 03-21-2005 11:06 AM

This has been discussed in the following thread:

http://forum.x-cart.com/viewtopic.php?t=2094

sabrina 03-21-2005 02:35 PM

UPS
 
Same problem

leonp 03-22-2005 05:45 AM

To anyone having this problem,

I have installed the mods that nick1628 posted on Tue Mar 01, 2005 5:20 pm and that has taken care of the problem.

I can now ship via UPS, mutiple items in one order even if the total weight is greater than 150 lbs..

Thanks Nick for the code and the quick response when I had a problem installing it (really my lack of knowledge that caused the problem).

X-Cart wanted to charge me to fix their module. Is that how they normally treat customers that find problems in their programs?

Leon P.

sabrina 03-22-2005 01:15 PM

Can you post here for others?


All times are GMT -8. The time now is 11:14 AM.

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