2

It started out as users not being able to check out - when they added items to their cart through the one page checkout they would get to the shipping methods then get kicked back to the cart page. I have now since disabled USPS and everything works with UPS except, in system configuration I get a blank page when I try to change settings in the ship method settings.

I have getting the following errors:

PHP Fatal error: Class Mage_Usa_Model_Shipping_Carrier_Usps contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Mage_Usa_Model_Shipping_Carrier_Abstract::_doShipmentRequest) in /public_html/app/code/local/Mage/Usa/Model/Shipping/Carrier/Usps.php on line 913, referer: http://domain.com/index.php/admin/system_config/edit/section/shipping/key/9c01422374d1f5cdc61d4f9ac85c6a00/

Running magento 1.7.0.2

Really need some help - I have tried applying the patch from the magento website to fix the issue but no luck.

1

The version on this file that is in the official release of Magento 1.7 there is a function _doShipmentRequest. I assume your file is broken in some way. I would suggest that you need to re download the file so that you have all the functions you need but here is the single function if you need.

/**
 * Do shipment request to carrier web service, obtain Print Shipping Labels and process errors in response
 *
 * @param Varien_Object $request
 * @return Varien_Object
 */
protected function _doShipmentRequest(Varien_Object $request)
{
    $this->_prepareShipmentRequest($request);
    $result = new Varien_Object();
    $service = $this->getCode('service_to_code', $request->getShippingMethod());
    $recipientUSCountry = $this->_isUSCountry($request->getRecipientAddressCountryCode());

    if ($recipientUSCountry && $service == 'EXPRESS') {
        $requestXml = $this->_formUsExpressShipmentRequest($request);
        $api = 'ExpressMailLabel';
    } else if ($recipientUSCountry) {
        $requestXml = $this->_formUsSignatureConfirmationShipmentRequest($request, $service);
        if ($this->getConfigData('mode')) {
            $api = 'SignatureConfirmationV3';
        } else {
            $api = 'SignatureConfirmationCertifyV3';
        }
    } else if ($service == 'FIRST CLASS') {
        $requestXml = $this->_formIntlShipmentRequest($request);
        $api = 'FirstClassMailIntl';
    } else if ($service == 'PRIORITY') {
        $requestXml = $this->_formIntlShipmentRequest($request);
        $api = 'PriorityMailIntl';
    } else {
        $requestXml = $this->_formIntlShipmentRequest($request);
        $api = 'ExpressMailIntl';
    }

    $debugData = array('request' => $requestXml);
    $url = $this->getConfigData('gateway_secure_url');
    if (!$url) {
        $url = $this->_defaultGatewayUrl;
    }
    $client = new Zend_Http_Client();
    $client->setUri($url);
    $client->setConfig(array('maxredirects'=>0, 'timeout'=>30));
    $client->setParameterGet('API', $api);
    $client->setParameterGet('XML', $requestXml);
    $response = $client->request()->getBody();

    $response = simplexml_load_string($response);
    if ($response === false || $response->getName() == 'Error') {
        $debugData['result'] = array(
            'error' => $response->Description,
            'code' => $response->Number,
            'xml' => $response->asXML()
        );
        $this->_debug($debugData);
        $result->setErrors($debugData['result']['error']);
    } else {
        if ($recipientUSCountry && $service == 'EXPRESS') {
            $labelContent = base64_decode((string) $response->EMLabel);
            $trackingNumber = (string) $response->EMConfirmationNumber;
        } else if ($recipientUSCountry) {
            $labelContent = base64_decode((string) $response->SignatureConfirmationLabel);
            $trackingNumber = (string) $response->SignatureConfirmationNumber;
        } else  {
            $labelContent = base64_decode((string) $response->LabelImage);
            $trackingNumber = (string) $response->BarcodeNumber;
        }
        $result->setShippingLabelContent($labelContent);
        $result->setTrackingNumber($trackingNumber);
    }

    $result->setGatewayResponse($response);
    $debugData['result'] = $response;
    $this->_debug($debugData);
    return $result;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.