wisekurt Posted May 26, 2014 Share Posted May 26, 2014 This is the official support thread for Restrict Shipping Method for 2.3. This addon allows you to restrict shipping types/methods for certain products, or alternatively exclude certain shipping types for products. It is very effective if for example you have an item for sale in your shop that can ONLY be sent via courier but not post. So "courier" can be set as the restricted type of shipping method and enabled in (by selecting "1") that product. This addon is a modification of the "Restrict Delivery" addon for 2.2 by idolcemia, including modifications suggested by ReDYeViL. I have added instructions to allow you to modify which products are the restricted class in the admin backend (categories.php), where previously you had to modify it directly through the SQL database which can be extremely tedious. I changed the name of the addon to help with search results (personally it took me ages stumbling to find the original). See the addon here: http://addons.oscommerce.com/info/9071 Full credit to the original author idolcemia for the original code and addon. oscMarket 1 Quote Link to comment Share on other sites More sharing options...
MrPhil Posted May 27, 2014 Share Posted May 27, 2014 Besides restricting shipping choices for various products, would this be a good base for other restrictions on a product? For example, some cities or states may not allow certain "weapons" (e.g., knives or swords) to be shipped to addresses within them, or require an affidavit that the purchaser is of a certain age. Some products might be subject to national export (or import) controls, and thus can't be shipped to certain countries. Some products may be considered hazardous, and refused by certain shippers, but this is probably already handled. So, given a shipping address (and/or age), some products might have no shipping method at all, and would have to be deleted from the order, while others would have a restricted choice of shippers (you might choose to bundle the entire order together, even at a less attractive rate, rather than ship part by one shipper and part by another. Finally, it would be good to have icons indicating shipping restrictions, to appear on a product listing page (wherever a customer could add it to the cart). For example, if FedEx won't handle it, you could have red-circle-slash "FedEx", or if you must be 21 to purchase, red-circle-slash "under 21" (or green-circle "over 21"). That sort of thing. They could trigger the "signing" of an affidavit that the purchaser is over some minimum age, although I don't know how much legal protection that would give you (it might be worthwhile to consult a lawyer, if you're selling such things). It's worth considering, rather than having all sorts of different ways to restrict shipping for various reasons. wisekurt 1 Quote Link to comment Share on other sites More sharing options...
wisekurt Posted May 27, 2014 Author Share Posted May 27, 2014 (edited) Besides restricting shipping choices for various products, would this be a good base for other restrictions on a product? For example, some cities or states may not allow certain "weapons" (e.g., knives or swords) to be shipped to addresses within them, or require an affidavit that the purchaser is of a certain age. Some products might be subject to national export (or import) controls, and thus can't be shipped to certain countries. Some products may be considered hazardous, and refused by certain shippers, but this is probably already handled. So, given a shipping address (and/or age), some products might have no shipping method at all, and would have to be deleted from the order, while others would have a restricted choice of shippers (you might choose to bundle the entire order together, even at a less attractive rate, rather than ship part by one shipper and part by another. Finally, it would be good to have icons indicating shipping restrictions, to appear on a product listing page (wherever a customer could add it to the cart). For example, if FedEx won't handle it, you could have red-circle-slash "FedEx", or if you must be 21 to purchase, red-circle-slash "under 21" (or green-circle "over 21"). That sort of thing. They could trigger the "signing" of an affidavit that the purchaser is over some minimum age, although I don't know how much legal protection that would give you (it might be worthwhile to consult a lawyer, if you're selling such things). It's worth considering, rather than having all sorts of different ways to restrict shipping for various reasons. Sure all of this would be relative easy to do. The code to integrate some type of "icon" or notification that an order is unavailable is a good idea. I quickly knocked up this code taking advantage of the other loop on the page to achieve exactly this: checkout_shipping.php Find (approximately line 295): <tr> <td colspan="3"><strong><?php echo $quotes[$i]['module']; ?></strong> <?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></td> </tr> Replace with: <?php if ($order->restrict_delivery == false || in_array($quotes[$i]['module'], $restrict_delivery_allowed) ) { echo '<tr><td colspan="3"><strong>' . $quotes[$i]['module'] . '</strong> '; if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon'] . '</td></tr>'; } } else { echo '<tr><td colspan="3"><strong>' . $quotes[$i]['module'] . '</strong> '; if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } echo '(Unavailable on this order)</td></tr>'; } ?> You only need to change the text "(Unavailable on this order)" to what ever you want. This could be a static image e.g. <img src="" alt=""/> I will implement this code into the next version if there is enough interest. To use this code to pick up on DOB or the accounts state you would only really need to change what restrict_delivery actually refers to (which is currently a shipping type). But yes it can be done. Edited May 27, 2014 by wisekurt Quote Link to comment Share on other sites More sharing options...
opus_uno2001 Posted December 1, 2014 Share Posted December 1, 2014 (edited) Does this Mod work? I put in both "ground" and "Ground" for UPS, then added 1 in the product field I want restricted, but USPS is showing its options as well.. Edited December 1, 2014 by opus_uno2001 Quote Link to comment Share on other sites More sharing options...
Supertex Posted December 8, 2014 Share Posted December 8, 2014 (edited) I was unable to limit to specific options within a shipping method (like "Ground"). However, when I put "United Parcel Service" in, only UPS options showed. Edit: Also, this mod is very specific. If you add a method, be sure you separate it with ONLY a semicolon - no spaces. Edited December 8, 2014 by Supertex Quote osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
wisekurt Posted July 23, 2015 Author Share Posted July 23, 2015 Does this Mod work? I put in both "ground" and "Ground" for UPS, then added 1 in the product field I want restricted, but USPS is showing its options as well.. Yes it works. Most likely what is happening here is the name of the shipping has a variable in it e.g. it gives the shipping time dynamically in the name. The mod looks for the name as its identifier, this is why I suggest flat rate as the best method. Otherwise you will need to modify the code for your shipping module so it doesn't implement time/weight quotes within the actual name itself. I was unable to limit to specific options within a shipping method (like "Ground"). However, when I put "United Parcel Service" in, only UPS options showed. Edit: Also, this mod is very specific. If you add a method, be sure you separate it with ONLY a semicolon - no spaces. The only reason "Ground" wouldn't work is the above explanation, but it is good to know you got UPS to work. And yes the items must be separated by semi colon only. I didn't take much notice of this while writing up the guide. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.