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 there,
I am setting up an eshop which is intended to ship only in Cyprus.
The shipping tools in EuropaCart 8 are very helpful but in my case are not.
Which option should be selected if my customer prefers to use a local courier service?
Can I add cities/towns under Cyprus? If yes, how could I assign the cost for each destination?
Regards
Praxandros
Offline
I would think you'd add areas to the states/provinces and assign them to Cyprus, and additionally edit all countries so that all but Cyprus are suppressed in both billing and shipping displays. Then you can use a custom shipping script that uses state/province conditions (many can be found on the forum).
Offline
Hi Nick,
I have done what you suggested.
After that I have chosen a custom script and tried to alter it as follows but did not worked. It continue to take instructions from Strore-> Settings-> Shipping Settings
Could you please have a look and tell me what's wrong.
Regards
<?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');
if ($info['stateprov'] == 'Nicosia'){
$method = 'Flat Rate';
$methodfree = 'FREE Shipping';
if ($info['total'] < 100) {
$custom = array($method => 5);
}else{
$custom = array($methodfree => 0);
}
} elseif ($info['stateprov'] == 'Limassol' || $info['stateprov'] == 'Larnaca'){
$method = 'Flat Rate';
$methodfree = 'FREE Shipping';
if ($info['total'] < 100) {
$custom = array($method => 10);
}else{
$custom = array($methodfree => 0);
}
} elseif ($info['stateprov'] == 'Paphos' || $info['stateprov'] == 'Famagusta'){
$method = 'Flat Rate';
$methodfree = 'FREE Shipping';
if ($info['total'] < 100) {
$custom = array($method => 15);
}else{
$custom = array($methodfree => 0);
}
Last edited by Praxandros (08-10-2015 21:48:47)
Offline
Hi Nick.
Thanks for your reply.
I have done the addition.
The software continues to act refusing the script.
Do I have to clear any cache?
Thanks
Offline
I cleaned it up:
<?php $info = $this->globals('ecom.customship'); $custom = array(); if ($info['stateprov'] == 'Nicosia') { if ($info['total'] < 100) {$custom = array('Flat Rate' => 5);} else {$custom = array('FREE Shipping' => 0);} } elseif ($info['stateprov'] == 'Limassol' || $info['stateprov'] == 'Larnaca') { if ($info['total'] < 100) {$custom = array('Flat Rate' => 10);} else {$custom = array('FREE Shipping' => 0);} } elseif ($info['stateprov'] == 'Paphos' || $info['stateprov'] == 'Famagusta') { if ($info['total'] < 100) {$custom = array('Flat Rate' => 15);} else {$custom = array('FREE Shipping' => 0);} } else { $custom = array('Shipping ERROR Please Call' => 999); } // End of if statement. $this->globals('ecom.customship_response',$custom); ?>
It was syntactically correct, however I missed that it was missing the all-important globalization of the custom array at the end:
$this->globals('ecom.customship_response',$custom);
Offline
Be aware you really should have an else condition at the end that catches everything else (I added it above), otherwise an error will trigger if anything is being shipped anywhere other than the stateprovs you have conditions for. By doing an else, you control the error text and amount from within the script.
Offline
Hi Nick,
Thank you very much.
Now it is working .
Regards Praxandros
Offline