The Official Website of AgoraCart and Agora.cgi
AgoraCart.com Demos Download AgoraCart User Manuals & Wiki Gold Members Forum Go Gold Now! Gold Version Memberships

AgoraCart.com

About
Features
Download
Payment Gateways
Send a Donation
Founders Club
BLOG: News & Updates

Showcases & Demos

AgoraCart Demos
Shop Live Stores

Downloads & Add-ons

Gold Version Downloads
DBwizz Database Mgr.
AgoraCart.com Store

Help & Support

User Manuals
Gold Version Users Forum
Gold Version Chat
Tech Support
Certified Agora Pros
Certified Designers
Hire a Freelancer

Gold Version Members

Member Benefits
Join Today!
Gold Members Home
Gold Version Users Forum
Gold Version Chat Rooms
Gold Version Downloads

For Store Owners

Merchant Accounts
Cool Resources
Advertise Here
"Powered by" Logos
Web Hosting Search

Misc.

Contact Us
MEET's Talking Guide
The Ancient Greek Agora






AgoraCart Free User Forums

This is the official FAQ and Cool Tips guide For the AgoraCart shopping Cart software


Official Sponsors of the AgoraCart Project:

       


RegisterSearchFAQLog in
Reply to topic Page 1 of 1
Shipping info shown wrong in cart pre-purchase.
Author Message
Reply with quote
Post Shipping info shown wrong in cart pre-purchase. 
Hiya, I hope you can help me here. I've gone through this forum to get the code I have done so far but can't seem to resolve this problem. I have set up my shipping to charge 0 postage to buyers from the UK but a postage charge to international customers. I've used the following shipping logic:

Code:
$ship_country = $form_data{Ecom_ShipTo_Postal_CountryCode};

if ($ship_country eq "United Kingdom")
{ @sc_shipping_logic = (
"|1-|||0.00");                 
} else {
@sc_shipping_logic = ( "|1-29.99|||1.99",
                       "|30-|||0.00");
}
#
$shipping_price = &calculate_shipping($temp_total,
                  $total_quantity, $total_measured_quantity);


The actual maths works out fine and the right amount is charged by the confirmation page. The problem is that in the cart, in the steps before that, the international shipping price is shown. So I was hoping you could help me stop it doing that.

My site is at www.descensionrecords.com/index.php

View user's profile Send private message
Reply with quote
Post  
Well, I managed to sort it by what is probably the long winded messy way.

I have the following shipping logic.

Code:
@sc_shipping_logic = (
"United Kingdom|||||0",
"United States|1-29.99|||1.99",
"Australia|1-29.99|||1.99",
"Canada|1-29.99|||1.99",
"Ireland|1-29.99|||1.99",
"Puerto Rico|1-29.99|||1.99",
"American Samoa|1-29.99|||1.99",
"Argentina|1-29.99|||1.99",
"Austria|1-29.99|||1.99",
"Belgium|1-29.99|||1.99",
"Belize|1-29.99|||1.99",
"Brazil|1-29.99|||1.99",
"Chile|1-29.99|||1.99",
"Costa Rica|1-29.99|||1.99",
"Denmark|1-29.99|||1.99",
"Dominican Republic|1-29.99|||1.99",
"Finland|1-29.99|||1.99",
"France|1-29.99|||1.99",
"Germany|1-29.99|||1.99",
"Greece|1-29.99|||1.99",
"Guatemala|1-29.99|||1.99",
"Hong Kong|1-29.99|||1.99",
"Israel|1-29.99|||1.99",
"Italy|1-29.99|||1.99",
"Jamaica|1-29.99|||1.99",
"Mexico|1-29.99|||1.99",
"Netherlands|1-29.99|||1.99",
"New Zealand|1-29.99|||1.99",
"Norway|1-29.99|||1.99",
"Panama|1-29.99|||1.99",
"Portugal|1-29.99|||1.99",
"Spain|1-29.99|||1.99",
"Sweden|1-29.99|||1.99",
"Switzerland|1-29.99|||1.99",
"Taiwan|1-29.99|||1.99",
"Tonga|1-29.99|||1.99",
"Virgin Islands|1-29.99|||1.99",
"|30-|||0.00");

#
$shipping_price = &calculate_shipping($temp_total,
                  $total_quantity, $total_measured_quantity);


In my order form, I put this

Code:
  <SELECT NAME="Ecom_ShipTo_Method">
<OPTION VALUE="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
 if ("$vform_Ecom_ShipTo_Method" eq "") {
   return "United Kingdom";
  } else {
   return "$vform_Ecom_ShipTo_Method";
  }
--></option>
<OPTION VALUE="United Kingdom">United Kingdom</OPTION>
<OPTION VALUE="United States">United States</OPTION>
<OPTION VALUE="Australia">Australia</OPTION>
<OPTION VALUE="Canada">Canada</OPTION>
<OPTION VALUE="Ireland">Ireland</OPTION>
<OPTION VALUE="Puerto Rico">Puerto Rico</OPTION>
<OPTION VALUE="American Samoa">American Samoa</OPTION>
<OPTION VALUE="Argentina">Argentina</OPTION>
<OPTION VALUE="Austria">Austria</OPTION>
<OPTION VALUE="Belgium">Belgium</OPTION>
<OPTION VALUE="Belize">Belize</OPTION>
<OPTION VALUE="Brazil">Brazil</OPTION>
<OPTION VALUE="Chile">Chile</OPTION>
<OPTION VALUE="Costa Rica">Costa Rica</OPTION>
<OPTION VALUE="Denmark">Denmark</OPTION>
<OPTION VALUE="Dominican Republic">Dominican Republic</OPTION>
<OPTION VALUE="Finland">Finland</OPTION>
<OPTION VALUE="France">France</OPTION>
<OPTION VALUE="Germany">Germany</OPTION>
<OPTION VALUE="Greece">Greece</OPTION>
<OPTION VALUE="Guatemala">Guatemala</OPTION>
<OPTION VALUE="Hong Kong">Hong Kong</OPTION>
<OPTION VALUE="Israel">Israel</OPTION>
<OPTION VALUE="Italy">Italy</OPTION>
<OPTION VALUE="Jamaica">Jamaica</OPTION>
<OPTION VALUE="Mexico">Mexico</OPTION>
<OPTION VALUE="Netherlands">Netherlands</OPTION>
<OPTION VALUE="New Zealand">New Zealand</OPTION>
<OPTION VALUE="Norway">>Norway</OPTION>
<OPTION VALUE="Panama">Panama</OPTION>
<OPTION VALUE="Portugal">Portugal</OPTION>
<OPTION VALUE="Spain">Spain</OPTION>
<OPTION VALUE="Sweden">Sweden</OPTION>
<OPTION VALUE="Switzerland">Switzerland</OPTION>
<OPTION VALUE="Taiwan">Taiwan</OPTION>
<OPTION VALUE="Tonga">Tonga</OPTION>
<OPTION VALUE="Virgin Islands">Virgin Islands (US)</OPTION>
</SELECT>


and i changed the following values in the order lib file:

Code:
@sc_order_form_required_fields = (
  "Ecom_BillTo_Online_Email",
  "Ecom_ShipTo_Postal_Name_First",
  "Ecom_ShipTo_Postal_Name_Last",
  "Ecom_ShipTo_Postal_Street_Line1",
  "Ecom_ShipTo_Postal_City",
   "Ecom_ShipTo_Postal_PostalCode",
  "Ecom_ShipTo_Method");


Code:
<td class="ac_checkout_review_col1">Country</td>
<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}&nbsp;</td>


There's likely a shorter way of doing it but that's done the trick.

View user's profile Send private message
Reply with quote
Post  
I thought I had posted on this thread... I wonder where it went..
Anyway, you could have just done:
Code:
$ship_country = $form_data{Ecom_ShipTo_Postal_CountryCode};

if ($ship_country ne "United Kingdom") {
@sc_shipping_logic = ( "|-29.99|||1.99",
                       "|30.00-|||0.00");
} else {
@sc_shipping_logic = ( "||||0.00");
}
#
$shipping_price = &calculate_shipping($temp_total,
                  $total_quantity, $total_measured_quantity);


HTH!


_________________
God Bless!
Bonnie - AgoraCart Moderator

Get a Gold Membership
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger ICQ Number
Reply with quote
Post  
Cheers! I reverted back and tried your code but still came up with the same problem. It was still working out the postage before the country had been selected (at the view cart stage). Then I had a brainwave and realised the reason it was showing international postage before the address form was filled in is that no input at all falls into the "else" category. So I changed the shipping logic to..

Code:
$ship_country = $form_data{Ecom_ShipTo_Postal_CountryCode};

if ($ship_country eq "")
{ @sc_shipping_logic = (
"||||0.00");                 
} else {
@sc_shipping_logic = ( "|1-29.99|||1.99",
                       "|30-|||0.00");
}
#
$shipping_price = &calculate_shipping($temp_total,
                  $total_quantity, $total_measured_quantity);


and that stops it from working out postage before the form is filled in. I'm not sure how to put the United Kingdom value back in though? I've tried putting another if field in but it doesn't like it.

View user's profile Send private message
Reply with quote
Post  
Try this one:
Code:
$ship_country = $form_data{Ecom_ShipTo_Postal_CountryCode};

if ($ship_country eq "") {
@sc_shipping_logic = ("||||0.00");                 
} elsif {
($ship_country eq "United Kingdom") {
@sc_shipping_logic = ("|1-|||0.00");                 
} else {
@sc_shipping_logic = ( "|1-29.99|||1.99",
                       "|30-|||0.00");
}
#
$shipping_price = &calculate_shipping($temp_total,
                  $total_quantity, $total_measured_quantity);


HTH!


_________________
God Bless!
Bonnie - AgoraCart Moderator

Get a Gold Membership
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger ICQ Number
Reply with quote
Post  
Thank you, that's sorted it Very Happy

I had to remove a { though, so for reference, the final code looks like:

Code:
$ship_country = $form_data{Ecom_ShipTo_Postal_CountryCode};

if ($ship_country eq "") {
@sc_shipping_logic = ("||||0.00");                 
} elsif
($ship_country eq "United Kingdom") {
@sc_shipping_logic = ("|1-|||0.00");                 
} else {
@sc_shipping_logic = ( "|1-29.99|||1.99",
                       "|30-|||0.00");
}
#
$shipping_price = &calculate_shipping($temp_total,
                  $total_quantity, $total_measured_quantity);


View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum