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 07-12-2007 00:30:35

fazman
Member
From: Aus
Registered: 03-19-2006
Posts: 196
Website

Add multiple Shipping choices at checkout

Hi I was wondering if there is a way to give the customer a choice of which shipping they want to use.

What I want to offer them is

Express Post

Aus Air Express

Shipping to NZ

and then have the customer choose which one they want to use.

How would I go about this?

Thanx

Faz


has arrived. Flight your way to heavenly pleasures.

Offline

 

#2 07-12-2007 06:41:28

fazman
Member
From: Aus
Registered: 03-19-2006
Posts: 196
Website

Re: Add multiple Shipping choices at checkout

Ok I figured this one out for myself after some working wink. Here is how I did it under user defined calculation.

<?php

// +--
// | All custom shipping scripts work in the same way.  A global
// | variable named 'ecom.customship' contains the following PHP
// | array.  Array keys with value info:
// |
// | weight     => Total weight of items being shipped.
// | total      => Subtotal of items being shipped.
// | quantity   => Quantity of items being shipped.
// | stateprov  => Ship to state/province.
// | country    => Ship to country.
// | postalcode => Ship to postal code.
// |
// | This script must set a global variable named
// | 'ecom.customship_response' which is an array in the
// | following format:
// |
// | method name => amount
// |
// | NOTE: Do not print anything within custom shipping
// | scripts.  They are designed only to return names and
// | prices for custom shipping methods.
// |
// | This script is a User Defined Calculation script that
// | returns a static method and amount.
// +--

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

$custom = array('Express Post' => '14.00','Australian Air Express' => '18.00');

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

?>


has arrived. Flight your way to heavenly pleasures.

Offline

 

#3 07-12-2007 15:37:43

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

Re: Add multiple Shipping choices at checkout

Correct.  Good job.


Nick Hendler

Offline

 

#4 07-12-2007 23:29:02

Litemaster
Member
From: Plymouth, Devon, UK
Registered: 12-03-2005
Posts: 147
Website

Re: Add multiple Shipping choices at checkout

Hi Faz,

Thank you for your post, we have now added a similar user defined calculation to offer standard flat rate shipping or free for collections from our shop.

It's solved a problem where people want to order on line and collect the items from our shop. Until now the cart has been applying carriage regardless of the delivery method.

Mike Simpson
wwwdjshopper.net

Offline

 

#5 07-14-2007 06:04:04

fazman
Member
From: Aus
Registered: 03-19-2006
Posts: 196
Website

Re: Add multiple Shipping choices at checkout

ive been playing with this shipping options for the last 2 days on both version 5 and 6, since im still running 5 till we finalise some tweaks on 6.

Man the things you learn to do when you really sit down and focus on it. I now have it so that people can select their own shipping methods and it will calculate shipping for each of those methods based on weight, for regular express mail, trackable receipt delivery and international delivery.

Its been mind blowing. I'll post the code for version 6 soon as Ive got it functioning fully on 5. Hope it will help some others out with their shipping problems.


has arrived. Flight your way to heavenly pleasures.

Offline

 

#6 07-14-2007 15:59:25

picstart
Member
From: United Kingdom
Registered: 07-11-2006
Posts: 428

Re: Add multiple Shipping choices at checkout

Hi Litemaster,

how did you do the collect from store option etc,

i tried a version of adding collect from store but because it was classed as zero charge for shipping it was the default value and i could see people trying to get away with free shipping so i abandoned it.

Did you also limit it by using a range of postcodes?

regards Mark


"It may be my worst nightmare at present..... but soon it will be my dream"

Offline

 

#7 07-14-2007 19:10:26

fazman
Member
From: Aus
Registered: 03-19-2006
Posts: 196
Website

Re: Add multiple Shipping choices at checkout

Ok Ive been trying to nut it out again based on differant delivery methods and also based on weight for pricing. But what Ive come up with doesnt seem to change when total weight changes.

Could someone please point out what Im doing wrong?

Here is the code Im working with.

<?php

// +--
// | All custom shipping scripts work in the same way.  A global
// | variable named 'ecom.customship' contains the following PHP
// | array.  Array keys with value info:
// |
// | weight     => Total weight of items being shipped.
// | total      => Subtotal of items being shipped.
// | quantity   => Quantity of items being shipped.
// | stateprov  => Ship to state/province.
// | country    => Ship to country.
// | postalcode => Ship to postal code.
// |
// | This script must set a global variable named
// | 'ecom.customship_response' which is an array in the
// | following format:
// |
// | method name => amount
// |
// | NOTE: Do not print anything within custom shipping
// | scripts.  They are designed only to return names and
// | prices for custom shipping methods.
// |
// | This script is a User Defined Calculation script that
// | returns a static method and amount.
// +--

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

if ($weight < "0.5") {

$custom = array('Express Post' => '9.10','Australian Air Express' => '12.00','New Zealand Air Mail' => '14.00');

} elseif ($weight < "1") {

$custom = array('Express Post' => '9.10','Australian Air Express' => '12.00','New Zealand Air Mail' => '21.00');

} elseif ($weight < "1.5") {

$custom = array('Express Post' => '9.10','Australian Air Express' => '12.00','New Zealand Air Mail' => '28.00');

} elseif ($weight < "2") {

$custom = array('Express Post' => '11.50','Australian Air Express' => '12.00','New Zealand Air Mail' => '36.00');

} elseif ($weight < "2.5") {

$custom = array('Express Post' => '11.50','Australian Air Express' => '12.00','New Zealand Air Mail' => '39.00');

} elseif ($weight < "3") {

$custom = array('Express Post' => '11.50','Australian Air Express' => '12.00','New Zealand Air Mail' => '43.00');

} elseif ($weight < "3.5") {

$custom = array('Express Post' => '16.00','Australian Air Express' => '14.50','New Zealand Air Mail' => '47.00');

} elseif ($weight < "4") {

$custom = array('Express Post' => '16.00','Australian Air Express' => '14.50','New Zealand Air Mail' => '51.00');

} elseif ($weight < "4.5") {

$custom = array('Express Post' => '16.00','Australian Air Express' => '14.50','New Zealand Air Mail' => '54.00');

} elseif ($weight < "5") {

$custom = array('Express Post' => '16.00','Australian Air Express' => '14.50','New Zealand Air Mail' => '58.00');

}


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

?>

Thanx

Faz


has arrived. Flight your way to heavenly pleasures.

Offline

 

#8 07-14-2007 21:26:45

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Add multiple Shipping choices at checkout

It might be a good idea to make your if statement start out like

Code:

if (($weight > '0') && ($weight <= '0.5')) {

the greater than statement is to not let a zero or negative number triger something you don't want. Putting in the equal signs (also in the elseif statements) would generate the shipping amount for 0.5 (in this case) as what you have 0.5 would be shifted up into the less than 1 amounts. The double quotes are ok but in php they let the statement match anthing they sround and single quotes state that it has to match exact.

John

Last edited by dh783 (07-14-2007 21:31:24)

Offline

 

#9 07-15-2007 01:51:36

fazman
Member
From: Aus
Registered: 03-19-2006
Posts: 196
Website

Re: Add multiple Shipping choices at checkout

Ah I finally got it. What you suggested helped, thanx John.

I worked out what the error was ontop of what u suggested. I needed to actually created the variable $weight, and to do this I used $weight = $info['weight'] since that weight was just a single piece of it all, but at that stage not a variable that could be called upon for my methods.

So here is the revised working code

<?php

// +--
// | All custom shipping scripts work in the same way.  A global
// | variable named 'ecom.customship' contains the following PHP
// | array.  Array keys with value info:
// |
// | weight     => Total weight of items being shipped.
// | total      => Subtotal of items being shipped.
// | quantity   => Quantity of items being shipped.
// | stateprov  => Ship to state/province.
// | country    => Ship to country.
// | postalcode => Ship to postal code.
// |
// | This script must set a global variable named
// | 'ecom.customship_response' which is an array in the
// | following format:
// |
// | method name => amount
// |
// | NOTE: Do not print anything within custom shipping
// | scripts.  They are designed only to return names and
// | prices for custom shipping methods.
// |
// | This script is a User Defined Calculation script that
// | returns a static method and amount.
// +--

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

$weight = $info['weight'];

if (($weight > '0') && ($weight <= '0.5')) {

$custom = array('Express Post' => '9.10','Australian Air Express' => '12.00','New Zealand Air Mail' => '14.00');

} elseif (($weight > '0.5') && ($weight <= '1')) {

$custom = array('Express Post' => '9.10','Australian Air Express' => '12.00','New Zealand Air Mail' => '21.00');

} elseif (($weight > '1') && ($weight <= '1.5')) {

$custom = array('Express Post' => '9.10','Australian Air Express' => '12.00','New Zealand Air Mail' => '28.00');

} elseif (($weight > '1.5') && ($weight <= '2')) {

$custom = array('Express Post' => '11.50','Australian Air Express' => '12.00','New Zealand Air Mail' => '36.00');

} elseif (($weight > '2') && ($weight <= '2.5')) {

$custom = array('Express Post' => '11.50','Australian Air Express' => '12.00','New Zealand Air Mail' => '39.00');

} elseif (($weight > '2.5') && ($weight <= '3')) {

$custom = array('Express Post' => '11.50','Australian Air Express' => '12.00','New Zealand Air Mail' => '43.00');

} elseif (($weight > '3') && ($weight <= '3.5')) {

$custom = array('Express Post' => '16.00','Australian Air Express' => '14.50','New Zealand Air Mail' => '47.00');

} elseif (($weight > '3.5') && ($weight <= '4')) {

$custom = array('Express Post' => '16.00','Australian Air Express' => '14.50','New Zealand Air Mail' => '51.00');

} elseif (($weight > '4') && ($weight <= '4.5')) {

$custom = array('Express Post' => '16.00','Australian Air Express' => '14.50','New Zealand Air Mail' => '54.00');

} elseif (($weight > '4.5') && ($weight <= '5')) {

$custom = array('Express Post' => '16.00','Australian Air Express' => '14.50','New Zealand Air Mail' => '58.00');

}


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

?>

hope this will help others out that  have similar problems

Faz


has arrived. Flight your way to heavenly pleasures.

Offline

 

#10 07-15-2007 06:35:38

Litemaster
Member
From: Plymouth, Devon, UK
Registered: 12-03-2005
Posts: 147
Website

Re: Add multiple Shipping choices at checkout

picstart wrote:

Hi Litemaster,

how did you do the collect from store option etc,

Did you also limit it by using a range of postcodes?

regards Mark

Hi Mark,

I used the code example kindly posted by Fazman and just modified it for our site.

Basically I set up a new custom shipping method and named it Flat_rate at present it has three entries one Free for collection from our shop, one standard delivery and one express delivery rate for each order.

At present I am not using any if statements so it is one rate for all UK Mainland post codes, I may add additional coding to allow for UK offshore delivery postcodes at the appropriate rates.

This is set up in ClickCartPro > Shipping: Realtime Shippers and Custom Shipping Methods > Manage Custom Shipping Methods.

The code I used is:

<?php

// +--
// | All custom shipping scripts work in the same way.  A global
// | variable named 'ecom.customship' contains the following PHP
// | array.  Array keys with value info:
// |
// | weight     => Total weight of items being shipped.
// | total      => Subtotal of items being shipped.
// | quantity   => Quantity of items being shipped.
// | stateprov  => Ship to state/province.
// | country    => Ship to country.
// | postalcode => Ship to postal code.
// |
// | This script must set a global variable named
// | 'ecom.customship_response' which is an array in the
// | following format:
// |
// | method name => amount
// |
// | NOTE: Do not print anything within custom shipping
// | scripts.  They are designed only to return names and
// | prices for custom shipping methods.
// |
// | This script is a User Defined Calculation script that
// | returns a static method and amount.
// +--

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

$custom = array('Collect from shop' => '0.00','Standard Carrier' => '14.99','Express Carrier' => '19.99');

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

?>

You can see the results on our web site, it works like a charm.

Kind Regards

Mike Simpson
wwwdjshopper.net

Offline

 

Board footer