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 Everyone
I am trying to create our own custom shipping without success, and no I am not a guru a total self taught amateur. So I have looked at the templates and have tried to adapt existing templates. We are looking to set up prices for a group of products in that if we have one despatched it is £20 and if it is 4 items despatched it is £25.00 etc.... Please see what i have done below. One other thought can you create more than one customised custom option. Thank you in advance. Regards Jane
<?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.
// | rescom => Ship to residential/commercial status.
// | shipstateprov => Ship origin state/province.
// | shipcountry => Ship origin country.
// | shipzip => Ship origin postal code.
// | packages => An array containing all packages with
// | each package defined in it's own array
// | with keys: length, width, height, weight.
// | delinfo => Delivery information array.
// | delitems => An array containing all items with
// | each item id as a key and the item quantity
// | as a value.
// |
// | 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');
$method = 'Standard Carrier';
if ($info['quantity'] >= ‘0.99’&& $info[‘quantity’] <= ‘1.00’) {
$custom = array($method => ’20.00’);
} elseif ($info[‘quantity’] > ‘1.00’ && $info[‘quantity’] <= ‘4.00’) {
$custom = array($method => ’24.00’);
} elseif ($info[‘quantity’] > ‘4.01’ && $info[‘quantity’] <= ‘6.00’) {
$custom = array($method => ’35.00');
} // End of if statement.
$this->globals('ecom.customship_response',$custom);
?>
Offline
You're almost there. You're having issues because you're doing text comparisons on the quantity. Also, those curly quotes are not your friend. Try this:
<?php $info = $this->globals('ecom.customship'); if ($info['quantity'] <= 1) {$custom = array('Standard Carrier' => 20);} elseif ($info['quantity'] <= 4) {$custom = array('Standard Carrier' => 24);} else {$custom = array('Standard Carrier' => 35);} $this->globals('ecom.customship_response',$custom); ?>
Offline
Hi Nick
Thank you. I will give it a try. It looks totally different! Not sure what you mean by curly quotes though.
Is there any way I can find about some of this php stuff to help me out?
Thanks again regards Jane.
Offline
Hi Nick
I have been playing around with the custom shipping and have found that a value based shipping may be better (see below). But either way, is there a way, when reaching an order quantity/value that the shipping costs are referred back to seller e.g. a statement such as 'Price on Application for orders over a certain value/quantity' and the ability of the system not allowing the order to process and for the system to send an email?
Thanks Jane
Offline
oops forgot the below bit!
<?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.
// | rescom => Ship to residential/commercial status.
// | shipstateprov => Ship origin state/province.
// | shipcountry => Ship origin country.
// | shipzip => Ship origin postal code.
// | packages => An array containing all packages with
// | each package defined in it's own array
// | with keys: length, width, height, weight.
// | delinfo => Delivery information array.
// | delitems => An array containing all items with
// | each item id as a key and the item quantity
// | as a value.
// |
// | 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 Calculation On Total Item Cost script that
// | returns a prices based on total item cost.
// +--
$info = $this->globals('ecom.customship');
$method = 'Standard Carrier';
if ($info['total'] >= '0' && $info['total'] <= '25.00') {
$custom = array($method => '16.00');
if ($info['total'] >= '0' && $info['total'] <= '54.00') {
$custom = array($method => '20.00');
} elseif ($info['total'] > '54.00' && $info['total'] <= '216.00') {
$custom = array($method => '25.00');
} elseif ($info['total'] > '216.00' && $info['total'] <= '324.00') {
$custom = array($method => '35.00');
} elseif ($info['total'] > '324.00' && $info['total'] <= '432.00') {
$custom = array($method => '45.00');
} elseif ($info['total'] > '432.00' && $info['total'] <= '540.00') {
$custom = array($method => '55.00');
} // End of if statement.
$this->globals('ecom.customship_response',$custom);
?>
Offline
Still thinking of limiting shipment of an order if doesn't meet certain criteria. If I was to set the maximum weight - found under store>component>settings>shipping setting>Maximum Combined Package Weight. would this work, I have tried it but it doesn't appear to work! is this because I am using a custom shipping method?
Thanks and regards
jane
Offline
Hi Nick
Thank you, once again, I have tried this and it works. The only thing it reads 'Price on Application for orders over 11 items. - FREE' the thing is it won't be free, I don't want it to ship at all without a price been given for the carriage. Also I put in a weight under the set maximum weight - found under store>component>settings>shipping setting>Maximum Combined Package Weight, I have tried it but it doesn't appear to work! is this because I am using a custom shipping method? And finally can I put another variable in for example I have one product of this group of products which is cheaper than the rest and I would like it to be that is one of this are order it would be despatched for £16 so I was thinking about putting a price variable such as example below which I know doesn't work. If put one cheap item & one std item it jumps to £24 carriage which means it is ignoring the instruction for the Carriage charge of £20?
<?php
$info = $this->globals('ecom.customship');
if ($info['total'] >= '0' && $info['total'] <= '25.00') {$custom = array('Standard Carrier' => 16);}
elseif ($info['quantity'] <=1) {$custom = array('Standard Carrier' => 20);}
elseif ($info['quantity'] <= 4) {$custom = array('Standard Carrier' => 24);}
elseif ($info['quantity'] <= 6) {$custom = array('Standard Carrier' => 35);}
elseif ($info['quantity'] <= 8) {$custom = array('Standard Carrier' => 45);}
elseif ($info['quantity'] <= 10) {$custom = array('Standard Carrier' => 55);}
else {$custom = array('Price on Application for orders over 11 items.'=> 0);}
$this->globals('ecom.customship_response',$custom);
?>
thanks and regards
Jane
Offline
There are no controls in V8 to stop an order with a shipping error. This was added as a stock feature in K9. V8 could be modified to do this through our custom shop, but it's a mod, not a feature for V8. Other options would be to make the price very high and prompt a call.
Offline
OK Nick
Thank you, the final question is can it not display the word Free? just the phrase 'Price on Application'
else {$custom = array('Price on Application for orders over 11 items.'=> 0);} displays as 'Price on Application for orders over 11 items. - FREE'
I assume the word 'Free' displays due to '=>0' sign?
Thanks and regards Jane
Offline