Can you shed some light which files need to edit and how. I edit this module file with if clause order total but it did not work.
Can you shed some light which files need to edit and how. I edit this module file with if clause order total but it did not work.
You'll need to find a way, whether a separate field in the database or a simple PHP look-up table, to associate the minimum-order amount for free shipping on a product-by-product basis.
The logic for granting free shipping on products marked "always free shipping" happens in a couple places. Which one takes effect depends on which shipping module/s you have enabled in your store.
Sometimes the shipping module itself does all the calculations on its own.
Often it simply relies on the "weight of the entire order", which the shopping_cart class provides after first setting the weight for "always free shipping" products to 0. This effectively makes them "free shipping" because shipping is mostly determined by the weight of the shipment.
So, you'll need to find all the code that checks for the 'product_is_always_free_shipping' flag on each of the products in your cart and converts the weight to 0, and update the code to also check for whether the overall cart total is above the threshold you say you want to impose.
Inside the shopping_cart class that total is represented in $this->total. Outside the class it's in $_SESSION['cart']->total instead.
As a sanity check later in your code you can check these values to see if your code adjustments make sense:
$_SESSION['cart']->free_shipping_weight (weight of all items granted free shipping)
$_SESSION['cart']->free_shipping_item (number of items granted free shipping)
$_SESSION['cart']->weight (weight of non-free-shipping items)
Remember, the shopping_cart class treats the following as free-shipping (by setting the weight for these items to 0):
- product has 'product_is_always_free_shipping' set to 1
- downloads
- purchase of gift certificates
- weight is 0 (either directly, or via attribute rules selected for that product)
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Bookmarks