したがって、これはこれのフォローアップ質問です。
オブザーバーによる発送方法の前にステップを追加しています。ステップのタブコンテンツを更新するためにHTMLを使用するのに問題があります。私の最善の努力にもかかわらず、それは私が望むhtmlの代わりにshipping-methodステップのhtmlをロードします。
これはオブザーバーのコードです:
public function gotoViesStep($observer)
{
$response = $observer->getEvent()->getControllerAction()->getResponse();
$body = $response->getBody();
$result = Mage::helper('core')->jsonDecode($body);
if (in_array('error', $result)) {
return;
}
//if conditions are met, go to vies check
if ($result['goto_section'] == 'shipping_method') {
$quote = Mage::getSingleton('checkout/session')->getQuote();
$shippingAddress = $quote->getShippingAddress();
$countryId = $shippingAddress->getCountryId();
if (($countryId != 'BE') && ($this->_countryInEU($countryId))) {
$result['goto_section'] = 'vies';
$result['allow_sections'][] = 'vies';
$result['country_id'] = $countryId;
$result['update_section'] = array(
'name' => 'vies',
'html' => $this->_getViesHtml()
);
$response->setBody(Mage::helper('core')->jsonEncode($result));
}
}
}
protected function _getViesHtml()
{
$layout = Mage::getSingleton('core/layout');
$update = $layout->getUpdate();
$update->load('checkout_onepage_vies');
$layout->generateXml();
$layout->generateBlocks();
$output = $layout->getOutput();
return $output;
}
そしてそのハンドルのlayout.xml checkout_onepage_vies
:
<checkout_onepage_vies>
<remove name="right"/>
<remove name="left"/>
<block type="correctionvat/onepage_vies" name="root" output="toHtml" template="correctionvat/onepage/vies.phtml"/>
</checkout_onepage_vies>
ブロックをロードしようとする代わりに何かを直接置くと、それは機能します。IEの場合、'html' => $this->_getViesHtml()
私が行う代わりに'html' => 'foobar'
、ステップの内容がfoobar
。
つまり、出力/レイアウト/ブロックはすでにOnepageControllerによって課金されているので、再度充電しようとしても失敗します。
何か考えはありますか?