| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Free Shipping if over $X, not with a coupon | ||||
|
|
Thread Tools | Search this Thread |
#11
|
|||||||
|
|||||||
Quote:
http://forum.x-cart.com/viewtopic.php?p=27185#27185 |
|||||||
#12
|
|||||||
|
|||||||
TINY mod to do Free Shipping for orders over $X w/real time
I also needed to do a "Free Shipping for orders over $X" while keeping the other real-time methods working, and without using flat rates. I've come up with a method that only requires adding ONE line to X_cart's php files. If anyone's seen any of my other posts, I really hate hacking at the x_cart code due to upgrade issues, so I made this as painless as possible.
The method is to add our own real-time shipping method. First, let's add our new shipping method into the database table xcart_shipping. I call it "Free Shipping - Orders Over $200". The code I use is "FREEOVERX", subcode "201" - an arbitrary number I pick that is far enough away from the predefined X_Cart shipping methods. I don't set a weight limit, but you might want to do that just in case: Code:
Now, here is the only hack needed -- in shipping/myshipper.php: Code:
"mod_CUSTOM.php" is where I put my custom shipping methods. Right now, I only have one, the "Free Shipping Over $X". Here's the code for mod_CUSTOM.php: Code:
As you can see, you can pretty much do anything you want in this code to calculate shipping rates. Let me know if you have trouble getting it to work. Have fun! Oh, I forgot to mention, I am using version 3.5.2. |
|||||||
#13
|
|||||||||
|
|||||||||
Very Nice for the Custom Mods section.
__________________
It doesn\'t matter what is done... it is how it is done. ============================= XCart Version: 3.5.3 -> Dmcigars.com XCart Version: 4.1.3.... |
|||||||||
#14
|
|||||||
|
|||||||
thanks
SpinGary,
Your solution to the free shipping problem seems to be exactly what I have been looking for, but I am having trouble getting it to work. I made the modification to myshipper.php, added the row to the xcart_shipping table, and created mod_CUSTOM.php but "Free Shipping Б─⌠ Orders over $99" does not appear as a choice during checkout. I made sure that the "Free Shipping..." method is activated in the "Shipping Methods" Admin area, and still no luck. Is something different because I use 3.4.8? Thanks for your help, Jordan |
|||||||
#15
|
|||||||
|
|||||||
Jordan,
I haven't tried the code with 3.4.x yet. I took a quick look, and you can try this as a debugging step. Backup up your mod_CUSTOM.php file, and replace it with just this one line: Code:
Replace "201" with whatever subcode you used. This should give you a shipping option while in your cart for the shipping method you added at $10. Let me know what happens. Some other quick notes: Make sure that your insert SQL statement went into the table correctly. Make sure your products have weights (just in case). Make sure you are shipping domestically, since the SQL set the method for national only - if not, change it. Gary |
|||||||
#16
|
|||||||
|
|||||||
Having trouble. Can someone help me??
I am trying to use this mod, but I am having trouble with the mysql table part. I am not sure exactly what needs to go into the following:
1. "Field" 2. "Type" 3. "Length/Values*" 4. "Attributes" 5. "Null" 6. "Default**" 7. "Extra" If anyone could let me know, thanks... Also, there was something about.... "The method is to add our own real-time shipping method".... - If I am using UPS real time calculation, will this work or not. please excuse my ignorance... Thanks |
|||||||
#17
|
|||||||
|
|||||||
Joelrhome,
No no-- the MySQL part is not to add a field to the xcart_shipping table. All we are doing is adding a row to that table. You can go to the "Patch/Upgrade" area, under the Apply SQL Patch, type in this in the query(ies) box: Code:
As for your question regarding real-time shipping, yes the other real-time shipping methods will continue to work fine. This method is to add another real-time shipping method to be available to your customers in their cart if their order amount is over $X. Hope this helps, Gary |
|||||||
#18
|
|||||||
|
|||||||
still learning the x cart
Thanks, That did it.
|
|||||||
#19
|
|||||||
|
|||||||
well, maybe not
Ok. I have tried the mod. I guess I must be misunderstanding how this is supposed to work. I have set my own shipping methods based on weight ( like the way UPS does it - in fact, I am using the info from their website to decide how much to charge ). The desired result that I am looking for, is that when The customer checks out and the order is under $300, I dont want them to see anything but the "paid methods that i have defined... When their order total is $300 or over, The "free shipping" method either appears as a choice, (either in place of ground or in addition to) or no shipping methods at all... and the shipping is $0.00 . I hope this isnt confusing to anyone who wishes to read this. I am a newbie... I have been working on this for the past 4 hours. i have tried every variable that i know. I have followed every step mentioned and each time
if the order is under $300, the "free" method is visible. this isnt good. what have done wrong. please help... thanks. |
|||||||
#20
|
|||||||
|
|||||||
Update! Turns out that the global product var that I used to get the cart subtotal is not calculated first if the user updates the quantity. This script is not accurate if the user changes quantity and hits "update". The user will have to refresh the cart one more time to get it to work properly.
So, I adjusted the code to recalculate on its own. Here's the new code: Code:
Have fun! |
|||||||
|
|||
X-Cart forums © 2001-2020
|