sjd256 Posted November 23, 2003 Share Posted November 23, 2003 Hi, I am currently using the UK Recorded delivery shipping contribution as well other delivery options. Basically I want to know if this would be hard to write and implement: I want to be able to put a maximum weight limit for each shipping option so if the weight of the order was above that limit instead of showing the top price it would just display "Service not available at this weight" The problem I have is that UK Recorded Delivery is only viable below a certain weight - above that it becomes too expensive for the cutomer. So rather than putting a high price in I would rather it just display a message. Now I know how to write this in Perl but PHP is another thing altogether and am very new to this :o Any help or suggestions would be greatly appreciated! Thanks in advance. Cheers Steve Link to comment Share on other sites More sharing options...
kagg Posted November 24, 2003 Share Posted November 24, 2003 However I have never used UK Recorded delivery shipping, but i believe it can be controlled for weight. You may modify the file based on table shipping file for weight. Link to comment Share on other sites More sharing options...
sjd256 Posted November 26, 2003 Author Share Posted November 26, 2003 Kagg, I am not sure you can limit the maximum shipping weight for each different shipping option. I know you can set a maximum limit overall in the admin section but I want to be able to set them differently. How do most people configure shipping? As an example say I have 3 x Shipping options 1 = Royal Mail (Cheapest option for deliveries weighing upto 2kg) 2 = Acme Couriers (Cheapest option for deliveries weighing 2Kg-70kg) 3 = Pallet Delivery (Cheapest Option for deliveries weighing 70 kg+ ) Say the customers order weighs 50KG the Royal Mail Option will show a really high price for delivery - but obviously the cheapest option will be selected. What I want it to do is for weights over 2kg the Royal Mail Option shows a message "To heavy for this service" Is this possible? Would it be hard to modify one of the shipping options to do this?? Could you have it not to display the most expensive?? Does anyone understand my incoherent ramblings? I am not sure if I have explained it well enough :blink: Any help greatly appreciated though - please :huh: Cheers Steve Link to comment Share on other sites More sharing options...
sjd256 Posted November 26, 2003 Author Share Posted November 26, 2003 Anyone Please ?? Link to comment Share on other sites More sharing options...
kagg Posted November 26, 2003 Share Posted November 26, 2003 You may try modifying any of your shipping file in /catalog/includes/modules/shipping/....php . Add the following lines in function quote(): $order_total = $shipping_weight;if ($order_total >= 2) { $this->quotes = array('module' => $this->title, 'error' => 'To heavy for this service'); } else { $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_TEXT_WAY, 'cost'=>MODULE_SHIPPING_HANDLING))); } you need to configure the above code as per your shipping module values. Hope this helps! Link to comment Share on other sites More sharing options...
sjd256 Posted November 26, 2003 Author Share Posted November 26, 2003 Kagg, Wow, Many thanks for that much appreciated - I will give that a try tonight and let you know!! Thanks again Cheers Steve Link to comment Share on other sites More sharing options...
sjd256 Posted November 26, 2003 Author Share Posted November 26, 2003 Kagg, I tried your code but unfortunately couldn't get it to work. I changes the variables to match my settings but it didn't seem to have any effect. I installed and re-installed just in case that was the problem but all to no avail. In the end using a some of your code and some gleaned from another shipping option I put together a fix that *seems* to do the job that I wanted. The question is - as I don't know much about PHP or OC will it cause any problems?? I have detailed the code below and would appreciate it if you could take a look at it for me: //Modification for maximum weight $order_total = $shipping_weight; if ($order_total >= 2) { $error = over; } else { $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_UKRD_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost'=> $shipping_cost))); } //end of maximum weight Then at the end of the function quote I have added the following line just before the return $this->quotes;: if ($error == over) $this->quotes['error'] = 'To heavy for this service'; It all works as it should but is the coding OK?? Many thanks in advance - much appreciated! Cheers Steve Link to comment Share on other sites More sharing options...
kagg Posted November 27, 2003 Share Posted November 27, 2003 Following code is working fine: function quote($method = '') { global $order, $shipping_weight; $order_total = $shipping_weight; if ($order_total >= 2) { $this->quotes = array('module' => $this->title, 'error' => 'To heavy for this service'); } else { $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_TEXT_WAY, 'cost'=>MODULE_SHIPPING_HANDLING))); } return $this->quotes; } Link to comment Share on other sites More sharing options...
sjd256 Posted November 27, 2003 Author Share Posted November 27, 2003 Kagg, Many thanks again for that!! Unfortunately it still doesn't seem to do it. I have added it and tried it, then changed to reflect my variables and tried it but it just doesn't seem to do anything - sorry. I don't mean to be a pain - honest :rolleyes: Was the snippet I put together no good then?? Seemed to do the job but I was worried that it may cause problems later on?? not sure really? Thanks again Steve Link to comment Share on other sites More sharing options...
sjd256 Posted November 28, 2003 Author Share Posted November 28, 2003 bump Link to comment Share on other sites More sharing options...
kagg Posted November 28, 2003 Share Posted November 28, 2003 Your code is fine. But I will put the word over in quotes in both the lines like : $error = 'over'; if ($error == 'over') $this->quotes['error'] = 'To heavy for this service'; Link to comment Share on other sites More sharing options...
sjd256 Posted November 28, 2003 Author Share Posted November 28, 2003 Kagg, Many thanks for that - I will make the changes as you suggest. Sorry to have been a pain :rolleyes: Cheers Steve Link to comment Share on other sites More sharing options...
Davee Posted November 28, 2003 Share Posted November 28, 2003 Hi Steve Approx which line does the code start in the UKRD Mod? Thanks in advance Dave Link to comment Share on other sites More sharing options...
sjd256 Posted November 28, 2003 Author Share Posted November 28, 2003 Dave, Sorry I am unsure what you mean. I have added some code to the UKRD module which seems to be ok and is working well now. I am unsure which code you mean. Please let me know Cheers Steve Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.