Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 04-19-2017 12:14:14

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Custom Shipping Methods

We have a coupe of product that are restricted to ground transportation by carriers battery size regulations.

It would be good to create a custom shipping method that allowed shipping to all domestic destinations but effectively makes the product unavailable if an International location is input.

The custom shipping method is designed to return a name and a price only - so out of the box it does not appear to be able to restrict shipping.

We could return a very high price if the destination is international, which is a bit customer unfriendly, unless there is a way to catch this later and effectively make the product unavailable for international shipping.

Any ideas on how we could achieve a restricted shipping zone?

Thanks

Offline

 

#2 04-19-2017 15:51:34

jj1987
Member
From: Orlando, FL
Registered: 07-14-2008
Posts: 502
Website

Re: Custom Shipping Methods

robprotronica wrote:

We have a coupe of product that are restricted to ground transportation by carriers battery size regulations.

It would be good to create a custom shipping method that allowed shipping to all domestic destinations but effectively makes the product unavailable if an International location is input.

The custom shipping method is designed to return a name and a price only - so out of the box it does not appear to be able to restrict shipping.

We could return a very high price if the destination is international, which is a bit customer unfriendly, unless there is a way to catch this later and effectively make the product unavailable for international shipping.

Any ideas on how we could achieve a restricted shipping zone?

Thanks

I don't think what you've outlined is going to work, and keep the site customer friendly.  Here's what I would suggest.

1) Add a column to ecom_prod which would be a true/false value for "Allow International Shipping"
2) Update the product detail display to show a warning if the product is not available for international shipping based on this boolean.
3) When the user checks out, add jQuery which listens for the country dropdown, and when any country other than US is selected, displays a message stating the cart contains items which cannot be shipped internationally, then disables the complete order button.

Hope that helps!



-James Garrett

Offline

 

#3 04-20-2017 04:52:33

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Custom Shipping Methods

Thanks James - I like the idea of including an extra column for "Allow International Shipping".

Less sure about how the javascript is going to work in the checkout process. The first page of the process has the billing address entered - which can be anywhere, second page gives option to specify different delivery address - which could be domestic.

Probably OK to have the "Continue" button disabled at any point the delivery address is showing anything international - the main problem is how to let the client side javascript know that one of the products in the cart is not allowed to ship internationally.

Probably also need to modify whatever puts together the "Order Totals" with a check on each product and then print something on the page about the basket containing products that cannot be shipped internationally.

With a modified "Order Totals" everything should be available server side to check the delivery is OK or not and swap the "Continue" button for a "Back to Cart" button if not. Could be done on page in javascript or on the server - need to look at which is easier to implement.

Now just have to find where all this gets done and how easy it is to modify!

Offline

 

#4 04-20-2017 07:32:56

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Custom Shipping Methods

It's easier than that.  Here's a K9 easter egg you've just uncovered:

Create a custom shipping method.  Tied all relevant inventory items to it.  In the custom shipping method, if the location is not one that can be shipped to, return a shipping method name containing 'Error' and a zero price.  This will deactivate checkout with a shipping error and not allow processing to continue until a valid ship to location is selected, or the item is removed from the cart.


Nick Hendler

Offline

 

#5 04-20-2017 07:53:50

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Custom Shipping Methods

Thanks Nick - Brilliant Easter egg!

I guess I can make the "Error" message a bit more descriptive e.g.

"Error - Cart contains items restricted to UK delivery only"

That's 58 characters - Any limits, technical or otherwise that I should be aware of?

Offline

 

#6 04-20-2017 08:51:06

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Custom Shipping Methods

Just got it all working with the following code:-

Code:

$info = $this->globals('ecom.customship');

if (($info['country'] == 'United Kingdom')){
// UK shipping

$method  = 'Courier - Next Business Day';

$price_per_item = '4.00';

$total = $price_per_item * $info['quantity'];

$custom = array($method => $total);

} else {

$method  = 'Error - Cart contains items restricted to UK delivery only';

$total ='0';

$custom = array($method => $total);

}

$this->globals('ecom.customship_response',$custom);

There is no point putting the explanation of the "Error" in the method name as it does not get displayed - a big red message pops up saying there is a error with the delivery address - so I will modify that to include the possibility that an item may have a shipping destination limitation.

System: Raw Database Admin > core_messages > ecom.coshiperr

All much simpler than it looked yesterday!

Last edited by robprotronica (04-20-2017 09:16:03)

Offline

 

#7 04-21-2017 07:01:03

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Custom Shipping Methods

No limits, just needs 'Error' in it.


Nick Hendler

Offline

 

Board footer