Magento Free Shipping for Match Items Only - Using Table Rates Based on Order Total -


can achieve following magento:

i'm using table rate system of price vs destination. , i've got shopping cart price rule of free shipping products attribute free_shipping -> set yes.

this works fine if have normal products in basket or free shipping products in basket. if have both normal product , free shipping product in basket. calculates shipping based on order total including product free shipping.

how can correct this, shipping applied order total of products not including free shipping, when both type of products exist in basket?

is there magento plugin this? in advance.

i had same problem , implemented small code change make work.

basically forget promotion rule. disable it. doesn't seem work shipping rates table when applying free shipping individual items. shipping rules seem take precedence , calculate based on cart total.

the trick subtract free shipping items cart total @ point shipping rates module making calculation.

in case inside particular category (id:15) free shippping. can amend logic suit needs.

you need amend following file (or copy local codebase things properly).

app\code\core\mage\shipping\model\carrier\tablerate.php

change this:

public function collectrates(mage_shipping_model_rate_request $request)     {         if (!$this->getconfigflag('active')) {             return false;         }          // exclude virtual products price package value if pre-configured         if (!$this->getconfigflag('include_virtual_price') && $request->getallitems()) {             foreach ($request->getallitems() $item) {                 if ($item->getparentitem()) {                     continue;                 }                 if ($item->gethaschildren() && $item->isshipseparately()) {                     foreach ($item->getchildren() $child) {                         if ($child->getproduct()->isvirtual()) {                             $request->setpackagevalue($request->getpackagevalue() - $child->getbaserowtotal());                         }                     }                 } elseif ($item->getproduct()->isvirtual()) {                     $request->setpackagevalue($request->getpackagevalue() - $item->getbaserowtotal());                 }             }         } 

to this:

public function collectrates(mage_shipping_model_rate_request $request) {     if (!$this->getconfigflag('active')) {         return false;     }      // exclude virtual products price package value if pre-configured     //and exclude items should have free shipping     if (!$this->getconfigflag('include_virtual_price') && $request->getallitems()) {         $freeshipping_category_id = 15;          foreach ($request->getallitems() $item) {             if ($item->getparentitem()) {                 continue;             }             if ($item->gethaschildren() && $item->isshipseparately()) {                 foreach ($item->getchildren() $child) {                     if ($child->getproduct()->isvirtual()) {                         $request->setpackagevalue($request->getpackagevalue() - $child->getbaserowtotal());                     }                         //if it's in free shipping, remove it's value basket                         $arr_category_ids = $child->getproduct()->getcategoryids();                         if ( in_array($freeshipping_category_id, $arr_category_ids) ) {                             $request->setpackagevalue($request->getpackagevalue() - $child->getbaserowtotal());                         }                 }             } elseif ($item->getproduct()->isvirtual()) {                 $request->setpackagevalue($request->getpackagevalue() - $item->getbaserowtotal());             }                 //if it's in free shipping category, remove it's value basket                 $arr_category_ids = $item->getproduct()->getcategoryids();                 if ( in_array($freeshipping_category_id, $arr_category_ids) ) {                     $request->setpackagevalue($request->getpackagevalue() - $item->getbaserowtotal());                 }         }     } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -