Question

I'm trying to understand why the free shipping cartrule I just created doesn't work on all the available shipping methods. I have one shipping method that becomes free, and the other (socolissimoflexibilite) doesn't change.

Could someone give me a hint, explanation, or some config/data/code to check on socolissimoflexibilite shipping method ? My first investigations lead me to the sales/quote_address_rate collection : one rate is well changed to 0.00€, but not the other.

I also checked the quote shipping address : its free_shipping field is set to 1.

Help ?

Was it helpful?

Solution

Ok I found the answer : We had a module (socolissimoflexibilite) extending the module socolissimosimplicite. socolissimoflexibilite rewrites the collectRates() function, and freeShipping isn't supported anymore. I had to rewrite this part by myself. For people getting the same issues with this module, here is the trick :

In Addonline_SoColissimoFlexibilite_Model_Carrier_ShippingMethod class, the collectRates() function must be replaced with this code :

public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
    $rates = parent::collectRates($request);
    $shippingAddress = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();

    if ($shippingAddress && $shippingAddress->getData('soco_product_code') == 'RDV') {
        foreach ($rates->getAllRates() as $rate) {
            if ($rate->getCarrier()===$this->_code) {
                $rate->setPrice($rate->getPrice()+(int)Mage::getStoreConfig('carriers/socolissimoflexibilite/rdv_fees'));
            }
        }
    }
    if($shippingAddress->getFreeShipping()) {
        foreach ($rates->getAllRates() as $rate) {
            if($rate->getCarrier() === $this->_code) {
                $rate->setPrice(0) ;
                $rate->setCost(0) ;
            }
        }
    }
    return $rates;
}

And now, freeShipping rules will be supported by socolissimoflexibilite !

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top