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
Flat rate per product per shipping method
Author Message
Reply with quote
Post Flat rate per product per shipping method 
As the title suggests, we are attempting to calculate shipping as a flat rate per product per shipping method (USPS regular parcel and priority). After reviewing some of the posts here, we have put together some shipping logic that seems like it still needs some work. We have been trying to isolate the product ID in a similar array as: http://www.agoraguide.com/faq/viewtopic.php?t=2254

Can anyone offer any suggestions?


Code:
open (CART, "$sc_cart_path") ;
 while (<CART>)
  {
   chop;   
   @my_cart_fields = split (/\|/, $_);
   $my_cart_row_number = pop(@my_cart_fields);
   push (@my_cart_fields, $my_cart_row_number);
   $quantity = $my_cart_fields[0];
   $product_id = $my_cart_fields[1];

if ($product_id eq "00021") {
    @sc_shipping_logic =
   ("Parcel|1-||0|3.50",
   "Priority|1-||0|6.00");
}
if ($product_id eq "00022") {
    @sc_shipping_logic =
   ("Parcel|1-||0|4.5",
   "Priority|1-||0|6.00");
}
if ($product_id eq "00023") {
    @sc_shipping_logic =
   ("Parcel|1-||0|5.00",
   "Priority|1-||0|6.00");
}
if ($product_id eq "00024") {
    @sc_shipping_logic =
   ("Parcel|1-||0|5.10",
   "Priority|1-||0|6.00");
}
if ($product_id eq "00025") {
    @sc_shipping_logic =
   ("Parcel|1-||0|5.20",
   "Priority|1-||0|8.00");
}
if ($product_id eq "00026") {
    @sc_shipping_logic =
   ("Parcel|1-||0|6.00",
   "Priority|1-||0|10.00");
}

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



Thanks Smile



Last edited by AeroWeb on Thu Dec 07, 06 7:44 pm; edited 2 times in total

_________________
AeroWeb|Boston Webdesign Web Hosting
View user's profile Send private message
Reply with quote
Post  
Oops! Surprised Just fixed our own problem. We had the shipping weight set to 0. Removing it altogether got it working. For anyone that needs a similar solution, here is the code:

Code:
open (CART, "$sc_cart_path") ;
 while (<CART>)
  {
   $quantity=0;
   chop;   
   @my_cart_fields = split (/\|/, $_);
   $my_cart_row_number = pop(@my_cart_fields);
   push (@my_cart_fields, $my_cart_row_number);
   $quantity = $my_cart_fields[0];
   $product_id = $my_cart_fields[1];

if ($product_id eq "00021") {
    @sc_shipping_logic =
   ("Parcel|1-|||3.50",
   "Priority|1-|||6.00");
}
if ($product_id eq "00022") {
    @sc_shipping_logic =
   ("Parcel|1-|||4.5",
   "Priority|1-|||6.00");
}
if ($product_id eq "00023") {
    @sc_shipping_logic =
   ("Parcel|1-|||5.00",
   "Priority|1-|||6.00");
}
if ($product_id eq "00024") {
    @sc_shipping_logic =
   ("Parcel|1-|||5.10",
   "Priority|1-|||6.00");
}
if ($product_id eq "00025") {
    @sc_shipping_logic =
   ("Parcel|1-|||5.20",
   "Priority|1-|||8.00");
}
if ($product_id eq "00026") {
    @sc_shipping_logic =
   ("Parcel|1-|||6.00",
   "Priority|1-|||10.00");
}

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




Last edited by AeroWeb on Thu Dec 07, 06 7:44 pm; edited 1 time in total

_________________
AeroWeb|Boston Webdesign Web Hosting
View user's profile Send private message
Reply with quote
Post  
Very nice!
Thanks for posting it!!


_________________
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  
scottcrew wrote:
Very nice!
Thanks for posting it!!


No Problem, glad I could contribute!

I do have another question open to all who can offer any suggestions. Say for example one of the items in the cart is very heavy and we do not want to give the user a secondary shipping option (in this case "Priority"). In other words, we want to remove it from the shipping method drop down field but only if that particular item is in the shopping cart.

We modified the order page for the specific shipping method as follows:

Code:
<!--agorascript-pre
if (("$sc_auth_uspsprioritymail" =~ /yes/i) && ("$product_id" != "00026")) { return
q~<OPTION VALUE="USPS Priority Mail (Priority)">
USPS Priority Mail</OPTION>~;
} else {return '';}
-->


The change we made was the addition of: && ("$product_id" != "00026")
In theory, if the specific $product_id is in the cart, the shipping option in the drop down will not display.

Unfortunately the above does not work. We appear to have the correct logic, but maybe our syntax or product id variable is incorrect? Anyone know how we can isolate the $product_id in the cart for the example above?

Thanks in advance Smile


_________________
AeroWeb|Boston Webdesign Web Hosting
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