Guest Posted January 28, 2015 Share Posted January 28, 2015 Hi. rebuilding a store with 2.3.4 i need something that can disable shipping if customers order for less than say 100DKK, but store pickup should still be an option, but all other shipping options should be disabled.. maybe with a note why there is only store pickup is there something like this allready there? Quote Link to comment Share on other sites More sharing options...
Bob Terveuren Posted January 28, 2015 Share Posted January 28, 2015 Hi there Just managed to lose a load of typing here so excuse me for being brief. I do not know of anything that does this 'out there'- here's a back of the envelope thing to try... Pop two config entries into the database: INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES(NULL, 'Store pickup only amount', 'SPU_SHIPPING_ONLY', '0', 'Disable shipping for orders total below this amount ', 7, 6, now(), '0000-00-00 00:00:00', NULL, NULL),(NULL, 'Store pickup filename', 'SPU_FILENAME', 'flat.php', 'The full filename of the module you want to enforce', 7, 7, now(), '0000-00-00 00:00:00', NULL, NULL); Leave the first one at zero to make no changes or set to the value below which you want to force SPU or whatever. The second one you need to enter the full filename of the module you want to enforce. (I'm using flat.php to test). then you need to edit includes/classes/shipping.php - you could pop something similar into checkout_shipping.php instead - in the class file make $order a global then add in the extra code - this will look to see if (1) your module filename entered is in the list of modules (2) the order amount is not zero (3)the order amount is below your setting - if so then it will leave the proposed module in the list by itself. It'll also add a message using the line $_GET['info_message']='Sorry you have to come and collect it'; but that is a total hack as (1) it'll overwrite any $_GET['info_message'] that may have been out there and (2) it needs to have a proper language definition built in (even better something like 'To qualify for home delivery you need to spend over DK 99999') - or something like that. Finally - experiment offline someplace ;-) class shipping { var $modules; // class constructor function shipping($module = '') { global $language, $PHP_SELF, $order;//<----- add $order here ########### if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) { $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); ##################################### new code ################################### //we have an array of the shipping files so if(defined('SPU_SHIPPING_ONLY') && defined('SPU_FILENAME') && SPU_SHIPPING_ONLY >0 && in_array(trim(SPU_FILENAME),$this->modules) && $order->info['total']<SPU_SHIPPING_ONLY){ //we have a match, kill all others //setup a single value array $module_to_keep=array(trim(SPU_FILENAME)); //intersect// $this->modules=array_intersect($module_to_keep,$this->modules); //hack the $_GET $_GET['info_message']='Sorry you have to come and collect it';//<-- be better to have a proper language file definition here } #################################### end new code ################################## Quote Link to comment Share on other sites More sharing options...
Guest Posted January 29, 2015 Share Posted January 29, 2015 hehe... i have created a sub domain for the real shop so i can test it with a live server and yet keep the live shop isolated it might not be the best way to do it, but for me its not a problem since in only run danish as language... (dont think pizza does very well over long distance :-) ) so i will give this a go, the idea is sane so why should it not work? but not sure if it will be today but weekend at latest Quote Link to comment Share on other sites More sharing options...
Guest Posted January 30, 2015 Share Posted January 30, 2015 after end code i should still have this line right: $include_modules = array(); ? so the new code section is inserted between line: $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); and $include_modules = array(); will test this in a an hour or less maybe Quote Link to comment Share on other sites More sharing options...
Guest Posted January 30, 2015 Share Posted January 30, 2015 works fine.... the green bar are a few pixels wider than the rest of the things... but absolute useable Quote Link to comment Share on other sites More sharing options...
Guest Posted February 18, 2015 Share Posted February 18, 2015 besides testing this it has now been put in to production... still works 100% as intended... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.