|
Hi Emily,
I’m implementing something similar (thanks for the code @danieln).
I have products that can only be shipping locally so I created a “LocalOnly” yes/no product attribute. If the cart contains any item for which the flag is set to yes, I want to only show the local courrier delivery method.
To achieve that, I added the following code to all shipping php files except for the local courrier one.
$products = new Mage_Checkout_Model_Cart();
$productIds = $products->getProductIds(); foreach ($productIds as $productId) { $product = Mage::getModel('catalog/product')->load($productId); }
$islocalonly = $product->getData('localonly'); if ($islocalonly == '1') { return false; }
But here’s a caveat and a request! I’m not a coder so there may be a better way (or even a flaw). Also, if the product is local only, instead of simply having “return false;” I would like to show the method along with a message that says something like: “This method is disabled since your cart contains items that can only be shipped locally.” Something similar to the specifiermsg.
Can anyone help with the implementation of this message?
Thanks!
Martin
|