Как пропустить информацию о доставке OnePage?
-
16-10-2019 - |
Вопрос
Я создал новый вариант как pickup @ office
в разделе выставления счетов OnePage вместо двух других вариантов Ship to this address
Ship to different address
. Анкет Если клиент выбирает это pickup @ office
Вариант он может использовать любой адрес для платежного адреса. Но адрес доставки будет установлен прогаметически. Я сделал до этого шага. То, что я хочу сделать дальше, - это напрямую перейти к shipping methods
Раздел путем прохождения shipping address
. Анкет Для этого есть лучший способ, кроме переоценки OnePageController.php.
Любые предложения будут оценены. Заранее спасибо.
Решение
Наконец, это было единственное решение, которое я смог найти. Нужно переопределить контроллер Mage_Checkout_OnepageController
config.xml
<config>
. . . . . .
<global>
<rewrite>
<test_cart> <!--This can be any unique id -->
<from><![CDATA[#^/checkout/onepage/#]]></from> <!-- the URL which u want to override-->
<to>/mymodule/onepage/</to> <!-- destination url -->
</test_cart>
</rewrite>
. . . . .
</global>
. . . . . .
</config>
app code local mynamespace mymodule controllers onepagecontroller.php
<?php
require_once 'Mage/Checkout/controllers/OnepageController.php';
class Mynamespace_Mymodule_OnepageController extends Mage_Checkout_OnepageController
{
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
// $postData = $this->getRequest()->getPost('billing', array());
// $data = $this->_filterPostData($postData);
$data = $this->getRequest()->getPost('billing', array());
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
if (isset($data['email'])) {
$data['email'] = trim($data['email']);
}
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
if (!isset($result['error'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$result['goto_section'] = 'shipping_method';
$result['update_section'] = array(
'name' => 'shipping-method',
'html' => $this->_getShippingMethodsHtml()
);
$result['allow_sections'] = array('shipping');
$result['duplicateBillingInfo'] = 'true';
} else {
$result['goto_section'] = 'shipping_method'; // set the checkout step which you want to move
}
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
}