close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Different shipping rates dependent on Post (Zip) Code

Thread began 5/08/2012 11:53 am by martin400112 | Last modified 5/09/2012 10:41 am by Jason Byrnes | 667 views | 3 replies |

martin400112

Different shipping rates dependent on Post (Zip) Code

Hi everyone,

I have a client who wishes to be able to have a different shipping rate to certain post codes in the UK where the code begins with (for example) IM, or GU or something like that.

Is there a way that this can be done in eCart? I can make it so the shipping rate changes if the post code equals a given variable (I think), but how about beginning with two letters as described above...?

Many thanks,

Martin

Sign in to reply to this post

Jason ByrnesWebAssist

on the confirm page, there will be the following code to set a session containing the shipping post code that was entered:

php:
<?php


if (!session_id()) session_start();
if(
$_SERVER["REQUEST_METHOD"] == "POST")     {
  
$_SESSION["eCartCheckoutForm_shipping_postcode"] = "".((isset($_POST["shipping_postcode"]))?$_POST["shipping_postcode"]:"")  ."";
}
?>



add the following code after it to set a session variable named "postCodeBegins" with the first 2 characters of the entered post code

php:
<?php

if(isset($_SESSION["eCartCheckoutForm_shipping_postcode"]) && $_SESSION["eCartCheckoutForm_shipping_postcode"] != "") {
    
$_SESSION['postCodeBegins'] = substr($_SESSION["eCartCheckoutForm_shipping_postcode"],0,2);
}
?>




then you can use the trigger:
Based on session variable value:
if the session variable "postCodeBegins" is "=" a value of "IM"

for your shipping rule

Sign in to reply to this post

martin400112

Hi Jason,

That's great. Thank you.

Have added the code as instructed and it works just fine **but** in order for the new shipping rate to be calculated correctly on confirm.php, I have to refresh the page before the additional amount is added.

1 - View Cart
2 - Checkout and add address details with an 'IM' post code.
3 - confirm.php shows standard shipping rate
4 - Refresh the confirm.php page
5 - confirm.php now shows the correct shipping rate.

Any ideas how I can make the page show the correct rate on it's first load?

Thanks again,

Martin

Sign in to reply to this post

Jason ByrnesWebAssist

near the top of the confirm page, there will be a line that looks like this:

php:
<?php

$cartName
->GetContent();
?>



where cartName is the name of your eCart object.

copy that code block and paste it again just before the doctype tag.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...