close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart Shipping Upgrade Options

Thread began 4/05/2012 5:23 pm by toni272059 | Last modified 4/09/2012 1:20 pm by toni272059 | 2465 views | 8 replies |

toni272059

eCart Shipping Upgrade Options

I have setup shipping options based on Quantity of product in shopping cart for standard shipping based on Country in Checkout.

USA First Class $5.00 for first item then $1 for each additional item
International $7.00 for first item then $1 for each additional item

I would like to add option on shopping cart page to upgrade USA to Priority (+$2.00) or Overnight (+$7.50)

I followed the instructions on an earlier post (12-07-2009, 01:23 AM david331670) and created form fields on the cart page with check boxes to add an upgrade for either priority or overnight shipping, added hidden fields on the confirm page and added shipping options in the eCart.

No price increase is added if upgrade selected on cart page.

Attached are the cart, confirm pages and eCart1_PHP.php
Work in progress website : www.johnpripheritagecollection.com/
It is not currently attached to its PayPal account as don't want to risk the wrong shipping being calculated. Sales tax to RI customers only.

What am I missing?

thanks

Attached Files
Archive.zip
Sign in to reply to this post

Jason ByrnesWebAssist

you added the checkboxes to the cart display page, this page posts to itself, then redirects to the checkout page.

instead of adding the behaviors to set the session variables for priority and overnight on the confirm page, you need to add them to the cart display page.

Sign in to reply to this post

toni272059

Thank you!

Sign in to reply to this post

toni272059

I spoke too soon!

Question -- currently with checkboxes there is the chance someone can select both and get charged for both priority and overnight shipping upgrades

I tried changing to radio buttons but to be a group they need to have the same name. When I changed name for both to upgrade the upgrade fee stopped being added

<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["upgrade"] = "".((isset($_POST["priority"]))?$_POST["priority"]:"") ."";
}
?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["upgrade"] = "".((isset($_POST["overnight"]))?$_POST["overnight"]:"") ."";
}
?>

<input name="upgrade" type="radio" value="1" id="priority" />
USPS Priority : +$2.00<br />
<input name="upgrade" type="radio" value="1" id="overnight" />
USPS Overnight : +$7.50

Sign in to reply to this post

Jason ByrnesWebAssist

radio button is really the only way to go, but with the radio button, you willl need to set the value to to either priority or overnight:

<input name="upgrade" type="radio" value="priority" id="priority" />
USPS Priority : +$2.00<br />
<input name="upgrade" type="radio" value="overnight" id="overnight" />
USPS Overnight : +$7.50


you will only need one set session behavior to set the upgrade session variable:
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["upgrade"] = "".((isset($_POST["upgrade"]))?$_POST["upgrade"]:"") ."";
}
?>


the in the shipping rule for the priority, set the trigger to:

Session Variable 'upgrade' exists

AND
Based on session variable value:
if the session variable 'upgrade' has a value of 'priority'

flat rate of '2.00'



and in the shipping rule for overnight:
Session Variable 'upgrade' exists

AND
Based on session variable value:
if the session variable 'upgrade' has a value of 'overnight'

flat rate of '7.50'

Sign in to reply to this post

toni272059

OK, everything is working correctly.

Next step:
I have added dynamic text before the word 'Shipping' on the Confirm page so whatever shipping option selected on the shopping cart page will be repeated. <td class="eC_SummaryLabel"><?php echo $_SESSION['upgrade']; ?> Shipping</td>
Result -- First Class Shipping, Priority Shipping, or Overnight Shipping

All works great for USA shipping

However, if someone selects an upgrade and the shipping address is outside the US, while the additional shipping fee will not be added (I created shipping rules) the name still appears before Shipping.

Is there a way I can create a function that if shipping address is not US only show First Class (regardless of which radio button selected on shopping cart page)?

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

this should do it for you:

php:
<td class="eC_SummaryLabel"><?php echo((isset($_SESSION['eCartCheckoutForm_shipping_country']) && $_SESSION['eCartCheckoutForm_shipping_country'] == "US")?$_SESSION['upgrade']:"First Class"); ?> Shipping</td>
Sign in to reply to this post

toms016390756

The things you learn in these forums is priceless. Thanks!




Sign in to reply to this post

toni272059

Perfect, thanks again!

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...