@ স্বর্গ 7 আমি এই বিটগুলি অনেপেজকন্ট্রোলআরপিএপগুলিতে পরিবর্তন করেছি সামগ্রিকভাবে আমি এটির কারচুপি করার চেয়ে বেশি করেছি তবে আমি আমার কোডটি তালিকাভুক্ত করব যাতে আপনি দেখতে পাবেন যে আমি ঠিক কী পরিবর্তন করেছি। মূল ফোল্ডারে নয়, কেবল একটি স্থানীয় কপিতে এটি করতে মনে রাখবেন।
`protected $_sectionUpdateFunctions = array(
/* 'payment-method' => '_getPaymentMethodsHtml',
'shipping-method' => '_getShippingMethodsHtml',*/
'review' => '_getReviewHtml',
); public function saveBillingAction()
{
if ($this->_expireAjax()){
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('billing', array());
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
// if (!isset($result['error'])) {
// if ($this->getOnepage()->getQuote()->isVirtual()) {
$this->loadLayout('checkout_onepage_review');
$result['goto_section'] = 'review';
$result['update_section'] = array(
'name' => 'review',
'html' => $this->_getReviewHtml()
);
}
/*elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$this->saveShippingMethodAction();
$this->loadLayout('checkout_onepage_review');
$result['goto_section'] = 'review';
$result['update_section'] = array(
'name' => 'review',
'html' => $this->_getReviewHtml()
);
$result['allow_sections'] = array('shipping','review');
$result['duplicateBillingInfo'] = 'true';
}*/
/* else {
//$result['goto_section'] = 'shipping';
//TODO There is an error with loading the layout of the Review tab.
$result['goto_section'] = 'review';
}*/
// }
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
public function saveShippingAction()
{
if($this->_expireAjax()){
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('shipping', array());
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
if (!isset($result['error'])) {
$this->saveShippingMethodAction();
$this->loadLayout('checkout_onepage_review');
$result['goto_section'] = 'review';
$result['update_section'] = array(
'name' => 'review',
'html' => $this->_getReviewHtml()
);
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
public function saveShippingMethodAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('shipping_method', '');
$result = $this->getOnepage()->saveShippingMethod($data);
/*
$result will have erro data if shipping method is empty
*/
if(!$result) {
Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
array('request'=>$this->getRequest(),
'quote'=>$this->getOnepage()->getQuote()));
$this->getOnepage()->getQuote()->collectTotals();
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
$result['goto_section'] = 'review';
$result['update_section'] = array(
'name' => 'review',
'html' => $this->_getReviewHtml()
);
}
$this->getOnepage()->getQuote()->collectTotals()->save();
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}