문제

I have 4 shipping methods.

The old customer gets only 2 methods. I've created the same customer with another email. It gets all 4 shipping methods.

I dived into code and DB table sales_flat_quote_shipping_rate.

Sorting by address_id we have: for old customer: 2 rate records; for the same new customer: 4 rate records.

Why does it happens? and where is rate record created?

UPDATE 1:

I doesn't depends on address. It depends on product. If product has filled weight then customer cannot see some shipping methods. Now the question is why?)

도움이 되었습니까?

해결책

The reason was in proccessAdditionalValidation function in Mage_Shipping_Model_Carrier_Abstract class:

    /**
         * Processing additional validation to check is carrier applicable.
         *
         * @param Mage_Shipping_Model_Rate_Request $request
         * @return Mage_Shipping_Model_Carrier_Abstract|Mage_Shipping_Model_Rate_Result_Error|boolean
         */
        public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request)
        {
            $maxAllowedWeight = (float) $this->getConfigData('max_package_weight');
            $error = null;
            $showMethod = $this->getConfigData('showmethod');
            foreach ($request->getAllItems() as $item) {
                if ($item->getProduct() && $item->getProduct()->getId()) {

// here I got true

                    if ($item->getProduct()->getWeight() > $maxAllowedWeight) {                         $error = Mage::getModel('shipping/rate_result_error');
                        $error->setCarrier($this->_code)
                            ->setCarrierTitle($this->getConfigData('title'));
                        $errorMsg = $this->getConfigData('specificerrmsg');
                        $error->setErrorMessage($errorMsg?$errorMsg:Mage::helper('shipping')->__('The shipping module is not available.'));
                        break;
                    }
                }
            }
            if (null !== $error && $showMethod) {
                return $error;
            } elseif (null !== $error) {
                return false;
            }
            return $this;
        }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top