Originally Posted by
Ajeh
Not without sitting down and writting all of the code ...
.
Oh please, they just asked where to start.
How about this:
edit includes/functions/functions_general.php and modify:
PHP Code:
zen_get_shipping_enabled($shipping_module)
Something like this is probably overkill, but for me it gives the user all of the available shipping options.
PHP Code:
////
// enable shipping
function zen_get_shipping_enabled($shipping_module) {
global $PHP_SELF, $cart, $order;
// for admin always true if installed
if (strstr($PHP_SELF, FILENAME_MODULES)) {
return true;
}
$check_cart_free = $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1');
$check_cart_cnt = $_SESSION['cart']->count_contents();
$check_cart_weight = $_SESSION['cart']->show_weight();
switch(true) {
// for admin always true if installed
case (strstr($PHP_SELF, FILENAME_MODULES)):
return true;
break;
// Free Shipping when 0 weight - enable freeshipper - ORDER_WEIGHT_ZERO_STATUS must be on
case (ORDER_WEIGHT_ZERO_STATUS == '1' and ($check_cart_weight == 0 and $shipping_module == 'freeshipper')):
return true;
break;
// Free Shipping when 0 weight - disable everyone - ORDER_WEIGHT_ZERO_STATUS must be on
case (ORDER_WEIGHT_ZERO_STATUS == '1' and ($check_cart_weight == 0 and $shipping_module != 'freeshipper')):
//return false; - No, we want to offer other modules
return true;
break;
case (($_SESSION['cart']->free_shipping_items() == $check_cart_cnt) and $shipping_module == 'freeshipper'):
return true;
break;
case (($_SESSION['cart']->free_shipping_items() == $check_cart_cnt) and $shipping_module != 'freeshipper'):
//return false; - No, we want to offer other modules
return true;
break;
// Always free shipping only true - enable freeshipper
case (($check_cart_free == $check_cart_cnt) and $shipping_module == 'freeshipper'):
return true;
break;
// Always free shipping only true - disable everyone
case (($check_cart_free == $check_cart_cnt) and $shipping_module != 'freeshipper'):
//return false; - No, we want to offer other modules
return true;
break;
// Always free shipping only is false - disable freeshipper
case (($check_cart_free != $check_cart_cnt) and $shipping_module == 'freeshipper'):
return false;
break;
default:
return true;
break;
}
}
This will enable other shipping options with Free Shipping. There is still a problem however because Zen Cart sets the weight of the product to 0 if it's set to "Yes, always free shipping". So we need to stop that from happening.
edit the calculate method in includes/classes/shopping_cart.php
wherever you see the code
PHP Code:
if ($product->fields['product_is_always_free_shipping'] != 1 and ...
and it's part of the $products_weight calculation, comment it out.
In some cases the if statement is looking for product_is_always_free_shipping to be a 1 to add to the free_shipping_weight. Comment out those too.
You may have to tweak it a bit for attributes etc, but since you asked to be pointed to the files needed to be customized, there you go!
Bookmarks