質問

マゼントを学んで、カートの小計が100ドル未満の場合にのみ出荷方法を作成しようとしています。

関数getSubTotal()collectRates()を試みた後、戻り値が100より小さい場合は常にreturn falseを返します。私はそれがそのステップで計算されていなかったと思います、その真の?

そして私が欲しいものをすることができる他に何もありますか?

助けてください...ありがとうございました!

役に立ちましたか?

解決

あなたのcollectRatesメソッドはこの

のように見えるはずです
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
    //if method is disabled
    if (!$this->getConfigFlag('active')) {
        return false;
    }

    if ($request->getPackageValue() < 100) {
        return false;
    }
    /** @var Mage_Shipping_Model_Rate_Result $result */
    $result = Mage::getModel('shipping/rate_result');
    $method = Mage::getModel('shipping/rate_result_method');
    $method->setCarrier($this->_code); //add here the payment method code
    $method->setCarrierTitle($this->getConfigData('title')); //or you can add any title if it's not configurable
    $method->setPrice(your shiping cost here);
    $result->append($method);
    return $result;
}
.

ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top