0

I need to find the code where the variable(s) of shipping origin location are declared and that calculates shipping rates so that I can create a module and manipulate the origin shipping address. Does anyone know where I can find this?

1 Answer 1

3

The shipping origin are managed form the System->Configuration->Shipping Settings->Origin.
These values are used in Mage_Tax_Model_Calculation::getRateOriginRequest()

public function getRateOriginRequest($store = null)
{
    $request = new Varien_Object();
    $request->setCountryId(Mage::getStoreConfig(Mage_Shipping_Model_Config::XML_PATH_ORIGIN_COUNTRY_ID, $store))
        ->setRegionId(Mage::getStoreConfig(Mage_Shipping_Model_Config::XML_PATH_ORIGIN_REGION_ID, $store))
        ->setPostcode(Mage::getStoreConfig(Mage_Shipping_Model_Config::XML_PATH_ORIGIN_POSTCODE, $store))
        ->setCustomerClassId($this->getDefaultCustomerTaxClass($store))
        ->setStore($store);
    return $request;
} 

and in Mage_Shipping_Model_Shipping::collectRates()

public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
    $storeId = $request->getStoreId();
    if (!$request->getOrig()) {
        $request
            ->setCountryId(Mage::getStoreConfig(self::XML_PATH_STORE_COUNTRY_ID, $request->getStore()))
            ->setRegionId(Mage::getStoreConfig(self::XML_PATH_STORE_REGION_ID, $request->getStore()))
            ->setCity(Mage::getStoreConfig(self::XML_PATH_STORE_CITY, $request->getStore()))
            ->setPostcode(Mage::getStoreConfig(self::XML_PATH_STORE_ZIP, $request->getStore()));
    } 
    ....
}

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.