Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Posts
    186
    Plugin Contributions
    0

    Default Cannot use string offset as an array - error in UPSXML module

    [FONT=verdana, courier new,courier,tahoma,sans-serif]I have a customer that is getting this error. I am getting other orders from other customers. I have had the customer clear all his private data and he is still getting the error.

    Fatal error: Cannot use string offset as an array in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 262

    Any help will be greatly appreciated.

    Thanks,
    Marc
    [/FONT]

  2. #2
    Join Date
    Jan 2005
    Posts
    186
    Plugin Contributions
    0

    Default Problems with UPSXML mod

    I am getting this error:
    Fatal error: Cannot use string offset as an array in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 262

    when I try to use the checkout for an order to South Africa. I am getting other order without problem but for some reason this one will not go through.

    I think that this is the line in question:
    Code:
                for ($i=0; $i < sizeof($upsQuote); $i++) {
                    list($type, $cost) = each($upsQuote[$i]);
                    if (!exclude_choices($type)) continue;
                    if ( $method == '' || $method == $type ) {
                      $_type = $type;
                    if (isset($this->servicesTimeintransit[$type])) {
                        $eta_array = explode("-", $this->servicesTimeintransit[$type]["date"]);
    Can anyone see a problem in this line that would cause this?

    Please help, thanks,
    Marc

  3. #3
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Problems with UPSXML mod

    I suggest you follow the instructions on line 91-92 of that file to enable debug logging:
    Code:
            // to enable logging, create an empty "upsxml.log" file at the location you set below, give it write permissions (777) and uncomment the next line
            // $this->logfile = '/tmp/upsxml.log';
    ... and find out whether the error is being caused by an empty set of results coming from UPS.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Jan 2005
    Posts
    186
    Plugin Contributions
    0

    Default Re: Cannot use string offset as an array - error in UPSXML module

    I really appreciate the quick response but I think that I need a little more detailed explanation as to what to do.

    I created a blank file that I titled upsxml.log in notepad. I am not sure where I should place that file.

    I think that I should be placing it in /includes/modules/shipping/upsxml.log and changing the line below the instruction to reflect that location.

    In order to uncomment the line do I just have to remove the // marks?

    Those are the steps that I have taken and now I am receiving this when I try and use the "go to checkout" button.

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 622

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 623

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 624

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 664

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 672

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 234

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 235

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 622

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 623

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 624

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 664

    Warning: error_log(/includes/modules/shipping/upsxml.log) [function.error-log]: failed to open stream: No such file or directory in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 672

    Fatal error: Cannot use string offset as an array in /home2/needgcom/public_html/includes/modules/shipping/upsxml.php on line 262

    Is this the information that we are looking for or did I mess something else up now?

    Thanks,
    Marc

  5. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Problems with UPSXML mod

    You need to give it a complete path to wherever you want the log file to exist.

    So, changing this:
    Code:
         // $this->logfile = '/tmp/upsxml.log';
    to something like this:
    Code:
         $this->logfile = '/home2/needgcom/public_html/includes/modules/shipping/upsxml.log';
    should work ... or even this, which puts it in your /cache folder which should already be writable:
    Code:
         $this->logfile = DIR_FS_SQL_CACHE . '/upsxml.log';
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Jan 2005
    Posts
    186
    Plugin Contributions
    0

    Default Re: Cannot use string offset as an array - error in UPSXML module

    Ok, I got that changed and here is what is in the log after I recreate the error. I edited out my account number, username and password.


    ------------------------------------------
    DATE AND TIME: 2008-08-14 15:08:56
    UPS URL: https://wwwcie.ups.com:443/ups.app/xml/TimeInTransit
    UPS REQUEST: <?xml version="1.0"?>
    <AccessRequest xml:lang="en-US">
    <AccessLicenseNumber>XXXXXXXXXXXX</AccessLicenseNumber>
    <UserId>XXXXXXX</UserId>
    <Password>XXXXXXX</Password>
    </AccessRequest>
    <?xml version="1.0"?>
    <TimeInTransitRequest xml:lang="en-US">
    <Request>
    <TransactionReference>
    <CustomerContext>Time in Transit</CustomerContext>
    <XpciVersion>1.0001</XpciVersion>
    </TransactionReference>
    <RequestAction>TimeInTransit</RequestAction>
    </Request>
    <TransitFrom>
    <AddressArtifactFormat>
    <PoliticalDivision2>Adams</PoliticalDivision2>
    <PoliticalDivision1>MA</PoliticalDivision1>
    <CountryCode>US</CountryCode>
    <PostcodePrimaryLow>01220</PostcodePrimaryLow>
    </AddressArtifactFormat>
    </TransitFrom>
    <TransitTo>
    <AddressArtifactFormat>
    <PoliticalDivision2>Benoni north</PoliticalDivision2>
    <PoliticalDivision1></PoliticalDivision1>
    <CountryCode>ZA</CountryCode>
    <PostcodePrimaryLow>1527</PostcodePrimaryLow>
    <PostcodePrimaryHigh>1527</PostcodePrimaryHigh>
    </AddressArtifactFormat>
    </TransitTo>
    <PickupDate>20080815</PickupDate>
    <ShipmentWeight>
    <UnitOfMeasurement>
    <Code>LBS</Code>
    </UnitOfMeasurement>
    <Weight>10</Weight>
    </ShipmentWeight>
    <InvoiceLineTotal>
    <CurrencyCode>USD</CurrencyCode>
    <MonetaryValue>100</MonetaryValue>
    </InvoiceLineTotal>
    </TimeInTransitRequest>

    UPS RESPONSE: <?xml version="1.0"?><TimeInTransitResponse><Response><TransactionReference>
    <CustomerContext>Time in Transit</CustomerContext><XpciVersion>1.0001</XpciVersion></TransactionReference>
    <ResponseStatusCode>0</ResponseStatusCode><ResponseStatusDescription>Failure</ResponseStatusDescription>
    <Error><ErrorSeverity>Hard</ErrorSeverity><ErrorCode>270032</ErrorCode><ErrorDescription>Invalid Destination Postal Code and City</ErrorDescription></Error></Response></TimeInTransitResponse>
    ------------------------------------------
    Time in Transit: 0
    ------------------------------------------
    DATE AND TIME: 2008-08-14 15:08:58
    UPS URL: https://wwwcie.ups.com:443/ups.app/xml/Rate
    UPS REQUEST: <?xml version="1.0"?>
    <AccessRequest xml:lang="en-US">
    <AccessLicenseNumber>xxxxxx</AccessLicenseNumber>
    <UserId>xxxxxx</UserId>
    <Password>xxxxxxxx</Password>
    </AccessRequest>
    <?xml version="1.0"?>
    <RatingServiceSelectionRequest xml:lang="en-US">
    <Request>
    <TransactionReference>
    <CustomerContext>Rating and Service</CustomerContext>
    <XpciVersion>1.0001</XpciVersion>
    </TransactionReference>
    <RequestAction>Rate</RequestAction>
    <RequestOption>shop</RequestOption>
    </Request>
    <PickupType>
    <Code>01</Code>
    </PickupType>
    <Shipment>
    <Shipper>
    <Address>
    <City>Adams</City>
    <StateProvinceCode>MA</StateProvinceCode>
    <CountryCode>US</CountryCode>
    <PostalCode>01220</PostalCode>
    </Address>
    </Shipper>
    <ShipTo>
    <Address>
    <City>Benoni north</City>
    <StateProvinceCode></StateProvinceCode>
    <CountryCode>ZA</CountryCode>
    <PostalCode>1527</PostalCode>
    <ResidentialAddressIndicator/>
    </Address>
    </ShipTo>
    <Package>
    <PackagingType>
    <Code>02</Code>
    </PackagingType>
    <PackageWeight>
    <UnitOfMeasurement>
    <Code>LBS</Code>
    </UnitOfMeasurement>
    <Weight>10.5</Weight>
    </PackageWeight>
    <PackageServiceOptions>
    <InsuredValue>
    <CurrencyCode>USD</CurrencyCode>
    <MonetaryValue>100</MonetaryValue>
    </InsuredValue>
    </PackageServiceOptions>
    </Package>
    </Shipment>
    <CustomerClassification>
    <Code>01</Code>
    </CustomerClassification>
    </RatingServiceSelectionRequest>

    UPS RESPONSE:
    Code:
    <?xml version="1.0"?><RatingServiceSelectionResponse><Response><TransactionReference><CustomerContext>Rating and Service</CustomerContext><XpciVersion>1.0001</XpciVersion></TransactionReference><ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription></Response><RatedShipment><Service><Code>65</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>11.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>379.96</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>379.96</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime>11:30 P.M.</ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></TotalCharges><Weight>10.5</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>0.0</Weight></BillingWeight></RatedPackage></RatedShipment></RatingServiceSelectionResponse>
    It looks like it could be an invalid postal code but I am not sure.

    Ok, I did a search and it looks like I did not have a zone set up for the Gauteng province in South Africa so that information was ot being collected in the customers account and being sent to UPS in the right field. I added that zone to the ZA(South Africa) location and it looks like everything is fine now because we are getting shipping quotes to that area now.

    I guess it wasn't a software issue. I know that you guys have an awful lot of zones built in to ZenCart but I guess that I need to be aware that a zone that I need or a customer lives in may not be in the core files. Overall a good learning experience and I hope that I do not have to do it again real soon.

    Will there be more zones added to the core files as time goes on? Could someone find a way to include all or almost all zones in the core files?

    Thanks,
    Marc

 

 

Similar Threads

  1. Error in referrals.php - Cannot use object of type queryFactoryResult as array
    By Agouti in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 3 Jan 2009, 08:25 PM
  2. UPSXML error: Cannot use string offset as an array
    By callingrohit in forum Addon Shipping Modules
    Replies: 9
    Last Post: 16 Sep 2008, 06:23 PM
  3. Replies: 4
    Last Post: 21 Mar 2008, 06:41 PM
  4. Fatal error: Cannot use string offset as an array in upsxml.php
    By yaby in forum Addon Shipping Modules
    Replies: 4
    Last Post: 19 Oct 2007, 06:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg