Magento Forum

   
Passing form value through from CartController to Mage_Shipping_Model_Rate_Request
 
mikewhitby
Member
 
Total Posts:  38
Joined:  2008-09-08
 

Hi - I’ve made a shipping module which takes numbers of days in the future into acount when generating a price, however I’m having problems passing a value through to it from the CartController, here is what I’ve done so far (I’m concentrating on the shipping estimate right now, later on I’ll do real shipping):

Mage_Checkout_CartController:

public function estimatePostAction()
    
{
        $country    
= (string) $this->getRequest()->getParam('country_id');
        
$postcode   = (string) $this->getRequest()->getParam('estimate_postcode');
        
$city       = (string) $this->getRequest()->getParam('estimate_city');
        
$regionId   = (string) $this->getRequest()->getParam('region_id');
        
$region     = (string) $this->getRequest()->getParam('region');
        
/* MWADD */ $daysDue     4;
        
        
/* MWADD Mage_Sales_Model_Quote_Address */
        
$this->_getQuote()->getShippingAddress()
            ->
setCountryId($country)
            ->
setCity($city)
            ->
setPostcode($postcode)
            ->
setRegionId($regionId)
            ->
setRegion($region)
            
/* MWADD */->setDeliveryDaysDue($daysDue)
            ->
setCollectShippingRates(true);
        
$this->_getQuote()->save();
        
$this->_goBack();
    
}

The properties seem to get set on the Mage_Sales_Model_Quote_Address class, but I can’t see where to go from there. The only function call I can see that is called after setting the properties is save() in Mage_Sales_Model_Quote, but this doesn’t seem to trigger the collecting of shipping quotes, so can anyone give me any help? smile

I’m not too fussed in the manner its done, I’m jsut confused as to how all the properties that get set in the code above actually end up being sent to the shipping modules for estimates.....

I’d love to know how everything peices together but I’ve spent almost a day looking now and can;t fathom it, so if someone could give me a rundown of how the properties traverse the objects I’d be in their debt smile

Thanks very much!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top