VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Shipping VM 1.1 => UPS VM 1 => Topic started by: OrangeLoon on February 06, 2011, 22:51:25 PM

Title: UPS: “Undefined variable: shipment"
Post by: OrangeLoon on February 06, 2011, 22:51:25 PM
All,  This is my first implementation of VirtualMart and I am having an error with the UPS module:
"Undefined variable: shipment in administrator\components\com_virtuemart\classes\shipping\ups.php on line 308".

Line 308 is (out of the box):
if (!$shipment ) {
   //$vmLogger->err( "Error processing the Request to UPS.com" );
   /*$vmLogger->err( "We could not find a UPS shipping rate.
   Please make sure you have entered a valid shipping address.
   Or choose a rate below." );
   // Switch to StandardShipping on Error !!!
   require_once( CLASSPATH . 'shipping/standard_shipping.php' );
          $shipping = new standard_shipping();
          $shipping->list_rates( $d );*/
          return;
          }

I realize that the error is being displayed because of my error setting; however, the UPS module is not displaying the shipping cost.

I viewed the <AccessRequest> and <RatingServiceSelectionResponse> XML via debug and can see that the <RatingServiceSelectionResponse> returns the shipping cost, but it never gets displayed on the page.

After search the forum and web I have covered the following:
*I have received and inputted the UPS Access Key for the production server from UPS.
*I have configured the UPS shipping module to allow for:
UPS Next Day Air, UPS Ground, UPS Standard, and UPS 3 Day Select.
*I have tried both clearing the "Ship From Zip Code" and populated it with the shipping originators zipcode.

I am, at this point, formally stuck.

Any help would be appreciated.

Using:
VirtualMart:1.1.6 stable
PHP Built on: Windows NT 6.1 build 7600
Database Version: 5.5.8-log
Database Collation: utf8_general_ci
PHP Version: 5.2.11
Web Server: Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8k PHP/5.2.11 (WAMP)
Web Server to PHP interface: apache2handler
Joomla! Version: Joomla! 1.5.10 Production/Stable [ Wohmamni ] 27-March-2009 23:00 GMT
User Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13

Thanks
Title: Re: UPS: “Undefined variable: shipment"
Post by: lowmips on February 07, 2011, 02:07:27 AM
Try selecting all services in the module config. If you see rates after doing that, then you should expand your service selections.
Title: Re: UPS: “Undefined variable: shipment"
Post by: OrangeLoon on February 07, 2011, 03:48:46 AM
Great suggestion - no go.
Title: Re: UPS: “Undefined variable: shipment"
Post by: lowmips on February 07, 2011, 04:50:07 AM
Post the XML request/reply here (be sure to REMOVE YOUR CREDENTIALS from the request).
Title: Re: UPS: “Undefined variable: shipment"
Post by: OrangeLoon on February 07, 2011, 07:33:53 AM
Thanks for the help - maybe I am overlooked something.
==============================================
<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>xxxxxxxxxx</AccessLicenseNumber>
<UserId>xxxxxxx</UserId>
<Password>xxxxxxxxx</Password>
</AccessRequest><?xml version="1.0"?>

<RatingServiceSelectionRequest xml:lang="en-US">

   <Request> 
      <TransactionReference>
         <CustomerContext>Shipping Estimate</CustomerContext>
         <XpciVersion>1.0001</XpciVersion>
      </TransactionReference> 
      <RequestAction>rate</RequestAction> 
      <RequestOption>shop</RequestOption>
   </Request>
   
   <PickupType> 
      <Code>01</Code>
   </PickupType>

   <Shipment> 
      <Shipper>   
         <Address>   
         <PostalCode>75093-7469</PostalCode>   
         <CountryCode>US</CountryCode>   
         </Address> 
      </Shipper> 
      <ShipTo>   
         <Address>   
            <PostalCode>78665</PostalCode>   
            <CountryCode>US</CountryCode>   
            <ResidentialAddressIndicator/>   
         </Address> 
      </ShipTo> 
      <ShipFrom>   
         <Address>   
            <PostalCode>75093-7469</PostalCode>   
            <CountryCode>US</CountryCode>   
         </Address> 
      </ShipFrom> 
      <Package>   
            <PackagingType>   
               <Code>02</Code>   
            </PackagingType>   
         <PackageWeight>   
            <UnitOfMeasurement>     
               <Code>LBS</Code>   
            </UnitOfMeasurement>   
            <Weight>1</Weight>   
         </PackageWeight> 
      </Package>
   </Shipment>
</RatingServiceSelectionRequest>

==========================================

HTTP/1.1 200 OK
Date: Sun, 06 Feb 2011 15:09:50 GMT
Server: Apache
Pragma: no-cache
Content-Length: 7318
X-Powered-By: Servlet/2.5 JSP/2.1
Vary: User-Agent
Connection: close
Content-Type: application/xml


<?xml version="1.0"?>
<RatingServiceSelectionResponse>
<Response>
<TransactionReference>
<CustomerContext>Shipping Estimate</CustomerContext>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<ResponseStatusCode>1</ResponseStatusCode>
<ResponseStatusDescription>Success</ResponseStatusDescription>
</Response>
<RatedShipment>
<Service>
<Code>03</Code>
</Service>
<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>8.28</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>8.28</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery/>
<ScheduledDeliveryTime/>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>8.28</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>8.28</MonetaryValue>
</TotalCharges>
<Weight>1.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>12</Code>
</Service>
<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>11.17</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>11.17</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>3</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime/>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>11.17</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>11.17</MonetaryValue>
</TotalCharges>
<Weight>1.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>02</Code>
</Service>
<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>15.04</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>15.04</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>2</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime/>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>15.04</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>15.04</MonetaryValue>
</TotalCharges>
<Weight>1.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>13</Code>
</Service>
<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>28.23</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>28.23</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime/>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>28.23</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>28.23</MonetaryValue>
</TotalCharges>
<Weight>1.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>14</Code>
</Service>
<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>66.11</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>66.11</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime>8:00 A.M.</ScheduledDeliveryTime>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>66.11</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>66.11</MonetaryValue>
</TotalCharges>
<Weight>1.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>01</Code>
</Service>
<RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>32.32</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>32.32</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime>10:30 A.M.</ScheduledDeliveryTime>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>32.32</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>32.32</MonetaryValue>
</TotalCharges>
<Weight>1.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
</RatingServiceSelectionResponse>
Title: Re: UPS: “Undefined variable: shipment"
Post by: lowmips on February 07, 2011, 14:50:15 PM
You're getting http headers in the reply, which breaks the parser code.  You can try this fix:
http://forum.virtuemart.net/index.php?topic=80529.0

Or use my UPSv2 module:
http://forum.virtuemart.net/index.php?topic=47142.0

Title: Re: UPS: “Undefined variable: shipment"
Post by: OrangeLoon on February 12, 2011, 15:35:39 PM
Problem Solved - thanks!