利用可能なレートがない場合は、「引用符取得」を返します。
-
12-12-2019 - |
質問
ユーザーに結果(負または正)を表示するのは常に良い方法です。
私の場合は、マイカートの「引用符の入手」ボタンをクリックすると、ページと料金が利用可能です - 大丈夫です。
しかし、そのアドレスに利用可能なレートがない場合、私は「ねえ、レートの悪い」のような何かのような何かを見せる必要があります。
私が理解している限り、estimatePostAction
メソッドを掘り下げて手動でレートを確認し、フラッシュメッセージを設定します。
しかし、私はこのアプローチを持っている別のMagento-Wayについて疑問に思うだけですか?
提案やビジョンをありがとうございました。
解決
well、ついに私はこの問題を解決しました。
しかし、私は
他のヒント
私はただのようなものを使う:
<?php $_shippingRateGroups = $this->getShippingRates(); ?>
<?php if (!$_shippingRateGroups): ?>
<p><?php echo $this->__('Sorry, no shipping quotes are available to this address. Please contact us at ' . Mage::getStoreConfig('general/store_information/phone') . ' for a shipping quote') ?></p>
<?php else: ?>
...success message...
.
と私たちのgetShippingrates関数は次のようになります:
public function getShippingRates()
{
if (empty($this->_rates)) {
$this->getAddress()->collectShippingRates()->save();
$groups = $this->getAddress()->getGroupedAllShippingRates();
/**
* If no shipping rate is found an error report will be logged containing product and customer information.
*/
if (empty($groups)) {
$this->noShipRateError();
}
return $this->_rates = $groups;
}
return $this->_rates;
}
. 所属していません magento.stackexchange