1

I am building a marketplace in Magento using a third party extension. We have our own products in addition to third party sellers products. Te sellers products are shipping based on a table rate. Our products will ship free. I want to set up a rule that will display the option for free shipping if all of the items in the cart are ours (ie: seller id = null) but if there is a product in the cart that has a seller id associated with it display that sellers table option. Right now, both free shipping and the table rate are showing in one page checkout in the shipping methods panel. What file is the best location to begin setting this up?

Edited to add: Technically this could be as simple as just not showing the "Free Shipping" Option if there are items in the cart where seller id > 0. I'm just not sure where to accomplish that.

2
  • I found a way to expose a product attribute in the Shipping Cart Price Rules section so we can make on-the-fly decisions about Free Shipping there. magentocommerce.com/wiki/3_-_store_setup_and_management/…
    – KRay
    Sep 15, 2014 at 16:55
  • However, is there a way to state that ALL items in the shopping cart need to have a specific attribute on them to bring up the free shipping rule?
    – KRay
    Sep 15, 2014 at 16:56

1 Answer 1

1

Each shipping method carrier model supports a method called proccessAdditionalValidation. If this method returns false then the shipping method will not be used.
So you need to rewrite the models for free shipping Mage_Shipping_Model_Carrier_Freeshipping and the model for table rate Mage_Shipping_Model_Carrier_Tablerate and implement this method.
Something like this

public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request)
{
    //common part for both classes
    //get all items in the cart
    $items = $request->getAllItems();
    foreach ($items as $item) {
        $product = $item->getProduct();
       //in the free shipping model - check if there is a product in the cart with a not null reseller id
       if ($product->getResellerId()) {
            //if there is one then return false;
            return false;
       }
       //in the table rate model check if there is a product with a not null reseller id
       if ($product->getResellerId()) {
            //if there is one then return $this so the method will be used
            return $this;
       }
    }
    //on the free ehipping model
    return $this;
    //on the table rate model
    return false;
}

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.