1

Our store has a fixed handling rate of 5ZAR for any product. Obviously, this is not needed for downloadable products. Where can I disable the flat rate, as set up under System->Configuration->Sales->Shipping Modules, for downloadable products?

I have now searched EVERYWHERE and can not find an answer.

5
  • can you please tell your curretn cart have a simple and a dowload product then what will the happen
    – Amit Bera
    Apr 20, 2015 at 11:33
  • The fixed handling rate remains at 5ZAR.
    – Bird87 ZA
    Apr 20, 2015 at 11:34
  • that means when cart only have download product that time 5ZAR will be remove?
    – Amit Bera
    Apr 20, 2015 at 11:37
  • Yes, when the cart only has a downloadable product, 5ZAR should not be applied.
    – Bird87 ZA
    Apr 20, 2015 at 11:43
  • can please show the model class code of shipping module
    – Amit Bera
    Apr 20, 2015 at 11:53

1 Answer 1

1

As per as magento system collectRates() function of a shipping module model class has been responsible for shipping activation and deactivation at checkout.

I guss that You shipping class is YourCompany_NewModule_Model_Carrier_ShippingMethod of your module then

On collectRates(),you can check current quote/cart have only downloable product then basic of logic inactive the method

  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
    {
        .........


        $hasOnlyDownloadproduct = 0;
        $noofdonloadPro=0;
        $toltalItem=0;
        if ($request->getAllItems()) {
            foreach ($request->getAllItems() as $item) {
                $toltalItem++;
                if($item->getProductTypeId()=='downloadable'):
                $noofdonloadPro++;
                $hasOnlyDownloadproduct=1;
                else:
                $hasOnlyDownloadproduct=0;
                endif;
            }
        }
        // reomve the Shippin method
        if($toltalItem>0 && $noofdonloadPro>0):
            // If totaly item at cart and  no of download has same then disable the shipping methoo;
            if($toltalItem==$noofdonloadPro):
                 return false;
            endif;
        endif;
    .....

       return $result;
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.