Topic RSS
There have been a few requests forthe ability to offer different flat rate shipping options, based on order amount.
Let's say that you wanted to offer 2 flat rate shipping charges based on the order total.
For example:
Order total $0.00 to $100.00 = $6.50 shipping
Order total $100.01 to and up = $9.50 shipping
This functionality can be added to the Market Theme system without a whole lot of trouble.
Here's how…
Open up your "cart.php" file for editing. (This file is located in the "ajCart/" folder of the Market Theme files area.)
On or around line #100, you will find this line of code:
Disable the line by changing it to this:
Next, on or around line #104 you will find this line of code:
For this support post example, we will use the shipping rates as outlined above. So, immediately AFTER this line, enter the following lines:
if ($GrandTotal > 100.00) { $ShippingTotal = 9.50; }
$checkout .='<input type="hidden" name="shipping_1" value="'.$ShippingTotal.'" />';
Save the file, and that's it.
To take this a step further.. Let's say you actually wanted 4 shipping ranges like this instead of 2:
Order total $0.00 to $100.00 = $6.50 shipping
Order total $100.01 to $200.00 = $9.50 shipping
Order total $200.01 to $300.00 = $12.50 shipping
Order total $300.01 and up = $15.50 shipping
For a scenario like this, you would simply add two more lines of code in similar fashion as you just did, only changing the range of the Grand Total.
So, for this new example you would instead enter these lines:
if ($GrandTotal > 100.00) { $ShippingTotal = 9.50; }
if ($GrandTotal > 200.00) { $ShippingTotal = 12.50; }
if ($GrandTotal > 300.00) { $ShippingTotal = 15.50; }
$checkout .='<input type="hidden" name="shipping_1" value="'.$ShippingTotal.'" />';
Save the file, and that would do it.
6:26 pm
October 27, 2010
OfflineThanks for this. I did insert the required code but when I put an item into my shopping cart I'm getting an error message that says, "syntax error, unexpected '{' in [location of cart.php] on line 104.
Clearly I must have done something wrong, but I can't for the life of me see my error.
I'm new to this, so please let me know if there's more info I need to send in order to allow someone to provide me w/ some guidance.
Thanks!
For those wanting to do pricing based on the number of items, instead of adding the code:
if ($GrandTotal > 0) { $ShippingTotal = 6.50; }
if ($GrandTotal > 100.00) { $ShippingTotal = 9.50; }
if ($GrandTotal > 200.00) { $ShippingTotal = 12.50; }
if ($GrandTotal > 300.00) { $ShippingTotal = 15.50; }
$checkout .='<input type="hidden" name="shipping_1" value="'.$ShippingTotal.'" />';
you could do something like this, based on the quantity of items.
For example:
For 1-6 items = $6.50
For 7-30= $9.50
For 31 – 72= $12.50
For 73 and above = $15.50
// Set shipping rate based on total order quantity
$totalquan=$totalquan+$crtQuantity[$item];
if ($totalquan > 0) { $ShippingTotal = 6.50; }
if ($totalquan > 6) { $ShippingTotal = 9.50; }
if ($totalquan > 30) { $ShippingTotal = 12.50; }
if ($totalquan > 72) { $ShippingTotal = 15.50; }
$checkout .='<input type="hidden" name="shipping_1" value="'.$ShippingTotal.'" />';I set my code as follows:
if ($i > 0) { $ShippingTotal = 6.50; }
if ($i > 4) { $ShippingTotal = 9.50; }
if ($i > 10) { $ShippingTotal = 12.50; }
if ($i > 20) { $ShippingTotal = 16.50; }
$checkout .='<input type="hidden" name="shipping_1" value="'.$ShippingTotal.'" />';
When I increase the quanties in the shopping cart above 4, the shipping price does not increase to $9.50.
what else do I need to do to make this work?
There was no mention in this tutorial about what to do with the normal fields on the individul product post page.
Any ideas of what I need to do? thanks...
By your code listed, it appears correct that if a user has a quantity of 5 (ie. greater than 4), then the shipping total should be $9.50.
However, I did notice something else on your site. Your images and shopping cart aren't showing up correctly.
Go into your Market Theme settings area and change your image path settings from "absolute" to "relative" and save.
Make sure that your images are now showing up. Also check your shopping cart contents page, to make sure it shows correctly.
If it doesn't, then would I be correct in guessing that your hosting account is through Hostgator?
If so, let me know and I can direct you to a help page for that.
After that's working, then let's proceed on this shipping total question.
I think these instructions are obsolete for the current version, or at least the one I am using currently. 4.2
$checkout .='<input type="hidden" name="shipping_'.$i.'" value="'.$Shipping.'" />'; does not exist in current code.
I don't know which code to comment out.
I see:
$checkout = '';
$prods = '';
$i = 1;
$ShippingTotal = 0;
$GrandTotal = 0;
and
$checkout .='<input type="hidden" name="handling_'.$i.'" value="'.$Handling.'"
and
$checkout .='<input type="hidden" name="item_name_'.$i.'" value="'.$crtName[$item].'" />
and
$checkout .='<input type="hidden" name="item_description_'.$i.'" value="'.$crtOptions[$item].'" />
Ok…
So here are the code changes for the current version of 4.23:
1. Open up your "cart.php" file for editing. It's located within the "ajCart/" folder, however you can also edit it through the Appearance Theme editor tool.
2. Locate the line around #189 that says:
// Create value for inventory control
3. Immediately BEFORE this line, enter this extra code:
if ($GrandTotal > 0) { $ShippingTotal = 1.00; }
if ($GrandTotal > 100.00) { $ShippingTotal = 2.00; }
if ($GrandTotal > 200.00) { $ShippingTotal = 3.00; }
if ($GrandTotal > 300.00) { $ShippingTotal = 4.00; }
if ($i<count($crtAmount)){
$item_shipping_pk = 0;
} else {
$item_shipping_pk = $ShippingTotal;
}
4. Save the file.
Keep in mind, you'll want to alter this code in three ways.
1. The code above is for 4 price brackets. You can have more or less. To add more, you'll add an extra line like this:
if ($GrandTotal > 400.00) { $ShippingTotal = 5.00; }-or- to have one or two price brackets less, you'll remove a line or two --
if ($GrandTotal > 200.00) { $ShippingTotal = 3.00; } if ($GrandTotal > 300.00) { $ShippingTotal = 4.00; }if ($GrandTotal > 0) { $ShippingTotal = 4.95; } if ($GrandTotal > 49.99) { $ShippingTotal = 6.95; } if ($GrandTotal > 99.99) { $ShippingTotal = 0.00; } if ($i<count($crtAmount)){ $item_shipping_pk = 0; } else { $item_shipping_pk = $ShippingTotal; }
I need help. Was trying to follow the above directions to get shipping calculated by items quantity but just made a mess out of my coding. I too use hostgator and have the latest version of market theme. My checkout bot is now showing error on box#199. But I think it's all wrong. In the end of the code I changed $item for#item.
And have both portions of code on: the one after GrandTotal and the one before create value as above.
How do I clean up this mess?
You also may need to make sure the "register_globals" variable is turned "off" in your "php.ini" hosting configuration file.
Here are more details on that process.
http://www.markettheme.com/for…..pty/page-4
(post #67)
Most Users Ever Online: 40
Currently Online:
24 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Member Stats:
Guest Posters: 428
Members: 2252
Moderators: 1
Admins: 1
Forum Stats:
Groups: 1
Forums: 4
Topics: 2983
Posts: 16042
Newest Members: Allsed, deleteduser, shanm, slidesketch, jimharrison, vmi
Moderators: Market Admin (5051)
Administrators: Market Admin (5051)

Log In
Register
Home



