1

I am tasked with the needing to be able to add a declared value for certain products on my magento store for UPS shipping. Doing some research, it doesn't appear they have it set up for the grab that magento executes to get their shipping estimates from UPS.com because I just can't find where the linking could be. Looking into FedEx's files, they DO have a process that gets ran;

$declaredValue = $xml->addChild('DeclaredValue');
$declaredValue->addChild('Value', $r->getValue());
$declaredValue->addChild('CurrencyCode', $this->getCurrencyCode());

I absolutely don't think just plug and play would work here, whereas UPS may not even recognize that search for the declared value. So I suppose my question would be, has anyone ever dealt with this kind of issue, and if it is possible to add such a grab to the UPS search, what would the created attribute on the product inside magento be found at? Simply 'DeclaredValue'?

3 Answers 3

1

We have implemented this in our Dimensional Shipping extension. What you have to bear in mind with declared value is that its the value of the goods at cost, not the value of the purchase price. If you use the purchase price (as magento does) then you could get quoted extra high rates.

The UPS Developer toolkit is needed to understand how the API works on this:

https://www.ups.com/upsdeveloperkit

0

check code in class Mage_Usa_Model_Shipping_Carrier_Ups at

app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php

in function

_formShipmentRequest()

if ($request->getPackagingType() != $this->getCode('container', 'ULE')
        && $request->getShipperAddressCountryCode() == Mage_Usa_Model_Shipping_Carrier_Abstract::USA_COUNTRY_ID
        && ($request->getRecipientAddressCountryCode() == 'CA' //Canada
            || $request->getRecipientAddressCountryCode() == 'PR' //Puerto Rico
    )) {
        $invoiceLineTotalPart = $shipmentPart->addChild('InvoiceLineTotal');
        $invoiceLineTotalPart->addChild('CurrencyCode', $request->getBaseCurrencyCode());
        $invoiceLineTotalPart->addChild('MonetaryValue', ceil($packageParams->getCustomsValue()));
    }
0

You need to adjust the _getXMLQuotes function

        protected function _getXmlQuotes()
                {
                    $url = $this->getConfigData('gateway_xml_url');
                    if (!$url) {
                        $url = $this->_defaultUrls['Rate'];
                    }

                    $this->setXMLAccessRequest();
                    $xmlRequest=$this->_xmlAccessRequest;
        //around line 835ish               
                    //added the currency code to the $r rawrequest object.
                    $r = $this->_rawRequest;
                    $r->setData('CurrencyCode', Mage::app()->getStore()->getCurrentCurrencyCode());



    //around line 950ish - add the PackageServiceOptions Type and it's required parameters InsuredValue, CurrencyCode and MonetaryValue


$xmlRequest .= <<< XMLRequest
      </Address>
    </ShipTo>


    <ShipFrom>
      <Address>
          <PostalCode>{$params['15_origPostal']}</PostalCode>
          <CountryCode>{$params['14_origCountry']}</CountryCode>
          <StateProvinceCode>{$params['origRegionCode']}</StateProvinceCode>
      </Address>
    </ShipFrom>

    <Package>
      <PackagingType><Code>{$params['48_container']}</Code></PackagingType>
      <PackageWeight>
         <UnitOfMeasurement><Code>{$r->getUnitMeasure()}</Code></UnitOfMeasurement>
        <Weight>{$params['23_weight']}</Weight>
      </PackageWeight>
      <PackageServiceOptions>       
        <InsuredValue>
            <CurrencyCode>{$r->getData('CurrencyCode')}</CurrencyCode>
            <MonetaryValue>{$r->getValue()}</MonetaryValue>
        </InsuredValue>                                         
      </PackageServiceOptions>
    </Package>
XMLRequest;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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