View Single Post
  #2  
Old 08-25-2004, 04:30 PM
  minorgod's Avatar 
minorgod minorgod is offline
 

X-Adept
  
Join Date: Sep 2002
Location: Arivaca, AZ
Posts: 402
 

Default An even better version

Okay, if you want this free shipping to work only with the shipping method you specify, here's what to do. Follow the previous post instructions for editing your database. Then add another new field to the database the same way, but this time call it "free_shipping_allowed_method" and enter in the same values, but give it an appropriate description. Then use the following code in your func_caluculate_single() function instead of adding the code snippet in my last post:
Code:
//added by brett to offer free shipping if the free shipping threshold has been met if ($config["Shipping"]["free_shipping_threshold"] > 0 && $subtotal >= $config["Shipping"]["free_shipping_threshold"] && $config['Shipping']['free_shipping_allowed_method'] == $shipping_id){ //$coupon_discount += $shipping_cost; $shipping_cost = 0; }
This will work just like my previous post, except now you can specify the shippingid of whichever shipping method you want this to work with. You can only specify a single shipping method if you choose to do it this way, but I figure most people will only want to offer UPS Ground for free anyway. If you wanted to have it apply to multiple shipping methods, it would be trivial to modify the code so that you could apply free shipping to a comma separated list of shipping ids instead of just a single shipping id. To find the shippingid of a specific shipping method, just look in your xcart_shipping table of your xcart database. Find the shipping ID of your preferred free shipping method and enter it in the "general options--->shipping options" admin page along with your free shipping threshold.

UPDATE: I have modified the code above by commenting out the $coupon_discount lines because it interfered with the normal coupon discount display in order receipts. Otherwise, the code is fine.
__________________
www.brettbrewer.com
Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more.
Reply With Quote