Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Restrict USPS shipping options by product dimensions

    I suspect there is no simple way to do this at present, but I need to allow only certain shipping options to be displayed for orders, depending on the dimensions of the total order. For example, someone just requested that their 8"x8"x8" selection be shipped in a USPS flat rate envelope. I'm adding shipping notes to each product now to indicate the minimum size container that it can be shipped in, but that has never been enough to stop people from choosing an inappropriate shipping method. Even worse, since we capture payment at the time of ordering rather than when shipped, we have to manually enter the extra cost after getting permission from the customer.

    Our previous shopping cart software did not include the ability to choose any of the USPS flat rate boxes, so we're already in a better position with ZenCart. I suspect we lost a lot of orders when people looked at the cost of Priority shipping and decided not to order at all, when we could have shipped in a flat rate box for a lot less. But we obviously still have the problem of people choosing too small a container just because it costs less.

    What I envisage is a combined "minimum container size" per product, plus the ability to specify the required space by product dimension. This would add at least four fields to the product data (one for a minimum size container code and three for the volume dimensions). Hopefully those would cover most of the product combinations that get shipped. For example, if someone chose a product that required at least a 6x6x6 cube, the minimum shipping options they would see for USPS shipping would be Priority Mail and the Regional Rate A box, plus the other larger and more expensive options. A multiple item order would default to the sum of the space required.

    I do know how complex this would be. It would require an additional table to specify minimum box volumes for all the commonly used boxes in a given company (we already have six, plus the USPS flat and regional rate boxes). And it would require additional calculations for the shopping cart, including checking item dimensions against box dimensions so it wouldn't be possible to choose--for example--the small flat rate box just because its internal volume was adequate, without making sure none of the product dimensions exceeded its dimensions. But if it could be implemented, it would restrict the customer's ability to choose an inappropriate shipping method (thus cutting down on the number of emails that have to go back and forth and the additional charges that have to be entered manually for shipping). It might also make the container-packing process itself faster, by stipulating to employees what choices of container were permitted for this order. Our volume is not yet so large that this is a major problem, but I would certainly like to see that day arrive.

    I've looked through the shipping add-ons and don't see anything resembling this function.

  2. #2
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: Restrict shipping options by product dimensions

    We use weight to take care of similar situations because the least expensive will always be chosen regardless of any notes to customers which indicate otherwise.

    99% of our products will fit within a Size 0 padded envelope or a small flatrate box. We use a tare weight of 0.1 pound to account for the padded envelope. Those products have actual weights assigned.
    For those products which do not fit, we assign a weight which is used to filter the USPS options since weight is not a factor when using the USPS FR boxes.
    For those products which do not fit within any USPS flatrate boxes, the weight causes all USPS options to be removed and only display Fedex options.

    1st class package: 0-0.999 pounds
    Small FR box: 0-1.5 pounds
    Regional A: 1.51-3 pounds
    Med FR box: 3.01-7 pounds
    Priority: 7.01-70 pounds
    Priority Express FR envelope: 0-2 pounds

    The lesser shipping options are removed from display when the max weight of that particular option is exceeded.

    Since pricing for Priority FR envelope and Small FR box is so close, we do not offer that choice.
    It took a bit of weight tweaking for product combinations but it has worked for us. That also minimizes issues caused by custom code or plugin compatibility that can occur with zencart upgrades.

    Can something like this be a possibility for your purposes?
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  3. #3
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: Restrict shipping options by product dimensions

    Thanks, something to think about. I took care of one of the problems by simply removing the flat rate envelope from the list. But the USPS padded envelope needs to stay, as we do ship some things in those, and I know people are going to start using that now that I eliminated the other one.

    Most of my products cost more to ship in a flat rate box than by regular Priority mail, unless the customer lives on the opposite coast from me. And only a couple of things will fit in a small flat rate box. But that and the padded envelope are now the two cheapest options, so I know people are going to pick those. If I could even have a field in each product record, to say 'this product can only be shipped in this box,' that would help. It would shift the situation so that it was a problem with orders containing multiple items, but those are few and far between for me, so the quantity of problems would be fewer. I may do that and upload it as a shipping addon, when I have time. For any business like mine, where people tend to order just one of the products at a time, it would help.

  4. #4
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Need help with shipping

    I love everything about Zencart EXCEPT the inability to restrict shipping options by product. My customers are driving me insane by choosing shipping options that I can't use. I removed the Priority Mail flat envelope choice (everyone wanted to use that for a package with a minimum 8x6x6 inch size requirement). So they all started choosing a padded envelope. I removed that choice, even though we can, and would prefer to, ship some things in a padded envelope. Then they started choosing a small flat rate box. I have now removed that.

    But I have multiple products that can be shipped in a padded envelope or a small flat rate box. Forcing people to pick the more expensive Priority Package rate means some of them are going to go elsewhere. My sales picked way up when I changed to ZenCart because people who were buying those small items were able to take advantage of the lower shipping, and I really hate to lose those sales in the future. I have "IMPORTANT SHIPPING INFORMATION!" all over the website and on each individual product explaining which shipping methods can be used for that product, and people still pick the cheapest thing they see. I've been told multiple times that the shopping cart shouldn't display shipping methods that aren't appropriate for the product, and I agree with that.

    I would be happy right now if I could just hard-code something in the USPS shipping module to force it not to display the padded envelope or small flat-rate box for certain product numbers. Only about six products are involved, and people normally order those by themselves, not in combination with other items. So it wouldn't be a huge programming job. Can anyone just get me started on this?

    On top of everything else, it means we can't interface with stamps.com (which is the reason I switched to ZenCart to begin with) because the shipping method in the original order is almost never what we end up using.

    Thanks much.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Need help with shipping

    There are "hooks" in USPS (observers) that can be used for just such a case or set of cases.

    If I may, ZC has the full ability to do such a thing, it's that generally speaking the complexity of the situation increases for each individual's desired use. So much so that there has been commercial product developed to do such a thing and more.

    It's been a minute since I've looked at the details of where and what notifiers are applied, but anywhere you see ->notify(' that is a point at which an observer can use data available or made available at that point in the program. Further, Ajeh did a bang up job of placing code comments in areas where modifications could/should be made to support desired modifications.

    I haven't seen her around much in a bit, but she typically (is left to) answer such shipping questions(, unfortunately).
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Need help with shipping

    Quote Originally Posted by HeleneWallis View Post
    I would be happy right now if I could just hard-code something in the USPS shipping module to force it not to display the padded envelope or small flat-rate box for certain product numbers. Only about six products are involved, and people normally order those by themselves, not in combination with other items. So it wouldn't be a huge programming job. Can anyone just get me started on this?
    This looks to be a good starting point. The example is based on category, but to do it by product ID is simpler because you don't have to do any category lookups for each product: https://www.zen-cart.com/showthread....ogrammatically
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: Need help with shipping

    Thanks both of you. Categories would actually work just as well for me, in fact. It would mean fewer if-then statements, because all the items in any given category would meet the same shipping requirements.

    I want to do a full-blown version of this eventually, with additional fields in the product file for dimensions, and all the bells and whistles. Right now, I just want to not have to call every customer and explain why I can't put a 16-ounce container of oil in an envelope, sigh.

  8. #8
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: Need help with shipping

    Okay, I have some PHP questions. I've looked over Ajeh's recommendation in the thread in DrByte's reply. Seems fairly obvious, except that it isn't doing anything. It doesn't appear to me that item.php even gets executed until you hit the Checkout button (I deliberately introduce a syntax error to check that out). So I'm not sure where 'hello world' is supposed to be seen.

    I added a global $cart in the function quote routine, as directed, but the variable 'cart' was already in use in that routine without being defined there. So I assume it was defined somewhere higher up? So does it need to be defined there again? Doesn't seem to make any difference whether I define it there again or not.

    I picked through the logic of the snippet below, and it seems pretty obvious. For this example, if an item in the cart has the master_categories_id of '6' then $yes is assigned the value 'hello world.' Then the 'title' variable in the 'methods' array gets $yes tacked on to the end. The only problem is that for the product I'm testing this with, the master_categories_id IS 6, and 'hello world' doesn't seem to showing up anywhere.

    I'm sure the problem is with my fumbling attempts to figure out PHP, but any help would be welcome. My changes in red.


    Name:  yes.jpg
Views: 423
Size:  61.4 KB

  9. #9
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: Need help with shipping

    Well I'll be darned. Look what I found in usps.php

    // bof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart
    // change false to true to use WAS FALSE
    if (true) {
    $chk_cart = 0;
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','1');
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','15');
    }
    // see below use of $chk_cart
    // eof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart
    This is exactly what I needed right now, and I can modify it to suit the other classes that I need to block for specific categories. So a big thank you to whoever put that in there (and thanks to the Developers Tools that enabled me to find it).

    I already tested it on the category that's causing me the most problems, and it's working exactly as it should.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Need help with shipping

    Quote Originally Posted by HeleneWallis View Post
    Well I'll be darned. Look what I found in usps.php

    // bof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart
    // change false to true to use WAS FALSE
    if (true) {
    $chk_cart = 0;
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','1');
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','15');
    }
    // see below use of $chk_cart
    // eof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart
    This is exactly what I needed right now, and I can modify it to suit the other classes that I need to block for specific categories. So a big thank you to whoever put that in there (and thanks to the Developers Tools that enabled me to find it).

    I already tested it on the category that's causing me the most problems, and it's working exactly as it should.
    Yay!
    It's almost certainly Ajeh's doing.
    Glad it's providing a workable solution to the problem.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Shipping - restrict carriers/options per Catagory
    By liderbug in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 22 Jan 2015, 08:03 PM
  2. Replies: 3
    Last Post: 11 Nov 2013, 11:59 PM
  3. Replies: 5
    Last Post: 8 Sep 2013, 12:13 AM
  4. v150 USPS shipping module...trying to restrict shipping options programmatically
    By ecclescake in forum Addon Shipping Modules
    Replies: 3
    Last Post: 3 May 2013, 10:02 PM
  5. Restrict Shipping Methods Options?
    By JinkyO in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 21 Jan 2009, 01:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR