I have enabled table rate shipping methods in magento. This is my checkout page
This is the action of update total button
action="http://{{site-url}}/checkout/cart/estimateUpdatePost/"
Now when I go to estimateUpdatePost action in cartcontroller.php file there is a line
if (!empty($code)) {
$this->_getQuote()->getShippingAddress()->setShippingMethod($code)/*->collectTotals()*/->save();
}
I am lookin for setShippingMethod($code) function. I had look through the files in magento and found this function in these two files
\app\code\core\Mage\Adminhtml\Model\Sales\Order\Create.php \app\code\core\Mage\Checkout\Model\Cart\Shipping\Api.php
But when I put die on setShippingMethod function and try to echo something then it is not shown and the page loads. It means these two setShippingMethod function is not hit and there is a function setShippingMethod somewhere else that is hit, due to which code runs. I want to locate it or if setShippingMethod function is not hit then anyone could tell me how update total button action is working.
I have made some changes to my code. First made changes to estimateUpdatePost action
public function estimateUpdatePostAction()
{
$code = (string) $this->getRequest()->getParam('estimate_method');
if (!empty($code)) {
$this->_getQuote()->getShippingAddress()->setShippingMethod($code)/*->collectTotals()*/->save();
die('ssssss');
}
$this->_goBack();
}
and then looked for setData function in magento. Found this function in following files \app\code\core\Mage\Catalog\Model\Abstract.php \app\code\core\Mage\Centinel\Model\StateAbstract.php \app\code\core\Mage\Core\Model\Log\Adapter.php \app\code\core\Mage\Core\Model\Session\Abstract\Zend.php \app\code\core\Mage\Dataflow\Model\Convert\Container\Abstract.php \app\code\core\Mage\Widget\Block\Interface.php
I had put a die with a message in all these functions, and when I clicked on update total button, 'ssssss' this message is shown on browser, means no setData function is running. I am really stuck in this. Please help me in getting part of code that runs setShippingMethod($code) in estimateUpdatePostAction.