Next Webinar: Maximizing Magento - Get the Most out of Promotions. Register Today!

Magento

Open Source eCommerce Evolved

Magento Forum

   
Restrict shipping country for particular products
 
Emily
Jr. Member
 
Total Posts:  16
Joined:  2008-03-31
 

I have Magento 1.0 installed and running.  We offer certain products that can be shipped anywhere in the world, and certain products that can only be shipped to the U.S.  Is there a way to restrict shipping based on particular products (or categories or types of product)?  If a customer has any ‘restricted’ item in their cart, I would like the shipping options to only have the US for country.

Thanks in advance!

Emily

 Signature 

[url=http://www.NeboWeb.com]http://www.NeboWeb.com[/url]

 
Magento Community Magento Community
Magento Community
Magento Community
 
oliverscarlett
Jr. Member
 
Total Posts:  15
Joined:  2008-04-10
 

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

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
41084 users|833 users currently online|87747 forum posts