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.
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
Offline
Ok I figured this one out for myself after some working
. 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);
?>
Offline
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
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.
Offline
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
Offline
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
Offline
It might be a good idea to make your if statement start out like
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
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
Offline
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