Aarto Posted August 25, 2010 Posted August 25, 2010 Hi all! I have a shipping module which is only applicable for amounts over a certain limit, I would like to alter the code a bit to hide the shipping option from the user if the cart amount is less than 500 DKK I tried putting in code in the nidule function itself (function zipship()) and this works fine on the front-end but i get an error in the admin section every time i view shipping modules section The code i tested (to disable module if cart anount < 500 ) class zipship { var $code, $title, $description, $enabled, $num_zones; // class constructor function zipship() { global $order, $cart, $cart_total; $this->code = 'zipship'; $this->title = MODULE_SHIPPING_ZIPSHIP_TEXT_TITLE; $this->description = MODULE_SHIPPING_ZIPSHIP_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ZIPSHIP_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ZIPSHIP_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_ZIPSHIP_STATUS == 'True') ? true : false); $this->num_zones = 3; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ZIPSHIP_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_ZIPSHIP_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } $cart_total = $cart->show_total(); if ($cart_total < 500) { $this->enabled = false; } (i added these last 4 lines) I get this error message in admin "Fatal error: Call to a member function show_total() on a non-object in /var/www/web52/web/shop/includes/modules/shipping/zipship.php on line 154" I have (as you probably realixed by now) very limited .php knowledge but it should not be very difficult to hide a shipping method based on the order amount? I would be grateful for any tips/pointers With kind regards /Aarto gaveartikler
Recommended Posts
Archived
This topic is now archived and is closed to further replies.