JuanIgnacio Posted June 20, 2008 Share Posted June 20, 2008 I'm doing some changes to a payment module running in the latest 2 RC version. What I need to do (and couldn't find it in the forums) is to make this payment module to be selectable (or even enabled/disabled) ONLY if a specific shipping method was selected in the previous step. I'm not asking somebody to code everything for me, I'm and intermediate PHP programmer, all I need is to know how to detect which shipping method was selected and how to "turn the payment option off" Is there a way to do this? If this was answered before and I missed it, please point me into the right direction Thanks a lot! Quote Link to comment Share on other sites More sharing options...
web-project Posted June 20, 2008 Share Posted June 20, 2008 possible to do, simply modify the checkout pages code & check the session variables. Quote Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here! 8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself. Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues. Any issues with oscommerce, I am here to help you. Link to comment Share on other sites More sharing options...
JuanIgnacio Posted June 20, 2008 Author Share Posted June 20, 2008 (edited) That's what I'm doing, modifying the pages code, but what I need to do is to find which variables to check: $_SESSION['WHAT?'] ? $order->what['what'] ? do I have to initialize something? I think $order->info['shipping_method'] should contain that, but what does that variable contain?... shipping_module_file.php: function shipping() { $this->code = ['this variable???']; Thanks Edited June 20, 2008 by JuanIgnacio Quote Link to comment Share on other sites More sharing options...
Guest Posted June 23, 2008 Share Posted June 23, 2008 Can anyone help me with a similar code segment to display a payment method based on the shipping method selected in the previous step? What I want to do is offer distinct payment on delivery modules for the 'Correos Paquete Azul' post office parcel service and Courier 'Tourline Express' delivery methods. The post office charges a fixed fee of 1.40€ to collect a cash payment on delivery while Tourline take a 5% commission with a 3.40€ minimum. So my code needs to do something like this: // In psuedo code If $shipping_method = 'tablerate' Then showCod2 = true; Else If $sipping_method = 'courier' Then showCod1 = true; Juan, did you get anywhere with that? That's what I'm doing, modifying the pages code, but what I need to do is to find which variables to check:$_SESSION['WHAT?'] ? $order->what['what'] ? do I have to initialize something? I think $order->info['shipping_method'] should contain that, but what does that variable contain?... shipping_module_file.php: function shipping() { $this->code = ['this variable???']; Thanks Many thanks :) Quote Link to comment Share on other sites More sharing options...
Guest Posted June 23, 2008 Share Posted June 23, 2008 Can anyone help me with a similar code segment to display a payment method based on the shipping method selected in the previous step? What I want to do is offer distinct payment on delivery modules for the 'Correos Paquete Azul' post office parcel service and Courier 'Tourline Express' delivery methods. The post office charges a fixed fee of 1.40€ to collect a cash payment on delivery while Tourline take a 5% commission with a 3.40€ minimum. So my code needs to do something like this: // In psuedo code If $shipping_method = 'tablerate' Then showCod2 = true; Else If $sipping_method = 'courier' Then showCod1 = true; Juan, did you get anywhere with that? Many thanks :) I'm thinking I should insert my code into calalog/includes/classes/payment.php. I'll allow all enabled payment modules to be loaded into the array normally (including both cash-on-delivery methods) then test and remove the module/s that are not relevant to the shipping method before the test for "only one payment module" is performed: // if there is only one payment method, select it as default because in // checkout_confirmation.php the $payment variable is being assigned the // $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible) if ( (tep_count_payment_modules() == 1) && (!isset($GLOBALS[$payment]) || (isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) ) { $payment = $include_modules[0]['class']; } if ( (tep_not_null($module)) && (in_array($module, $this->modules)) && (isset($GLOBALS[$module]->form_action_url)) ) { $this->form_action_url = $GLOBALS[$module]->form_action_url; } Quote Link to comment Share on other sites More sharing options...
♥toyicebear Posted June 23, 2008 Share Posted June 23, 2008 Click me.... Quote Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce - Commercial Support Inquiries - OSC 2.3+ How To To see what more i can do for you check out my profile [click here] Link to comment Share on other sites More sharing options...
JuanIgnacio Posted June 24, 2008 Author Share Posted June 24, 2008 Pete: Most shipping and payment methods have a way to add a fee just for using them. You don't have to detect the method used, just make the method to add this fee and it will only be added if the method is selected. Look into some module that has this fee and look for the code on how to add it to the total. Quote Link to comment Share on other sites More sharing options...
JuanIgnacio Posted June 24, 2008 Author Share Posted June 24, 2008 I'm detecting the shipping method this way: if (substr_count($order->info['shipping_method'], '>>Shipping Name<<') > 0) { .... } I'm done with that. The thing is I CAN'T TURN THE PAYMENT METHOD OFF. I placed "$this->enabled == false; " and "$check_flag = false;" inside the if, outside the if, in the before_process() function.... and the payment method it's still there for the user to select. How in the world do I disable the payment method after detecting the shipping method selected?? Quote Link to comment Share on other sites More sharing options...
Guest Posted June 25, 2008 Share Posted June 25, 2008 Pete: Most shipping and payment methods have a way to add a fee just for using them. You don't have to detect the method used, just make the method to add this fee and it will only be added if the method is selected. Look into some module that has this fee and look for the code on how to add it to the total. That's great, but I want my customers to still have the choice of using another payment method after selecting their preferred shipping method. And I don't want to charge everyone a handling fee to cover payment on delivery even if they are paying by PayPal. That would be unfair and artificially inflate the cost of shipping, which is already quite high and causing some customers to abandon the checkout process at the shipping page. Have you tried removing the payment method completely from the array $payment ? Quote Link to comment Share on other sites More sharing options...
JuanIgnacio Posted June 25, 2008 Author Share Posted June 25, 2008 Pete If I understand, what your trying to do is to charge for the Contrareembolso service if that's how they pay for. The best way to do this, I think, is to create a OrderTotal (totalización) module. Do a simple check to detect which payment method was selected and make the OrderTotal module to create a CARGO POR CONTRAREEMBOLSO fee. I think that should be fine and pretty easy. Have you tried removing the payment method completely from the array $payment ? Mmmm... no, how can I do that? Quote Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2008 Share Posted June 27, 2008 Click me.... That looks like a nice contrib if it does what it says. Unfortunately the download links seem to be broken, I'll try again later. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2008 Share Posted July 18, 2008 That looks like a nice contrib if it does what it says. Unfortunately the download links seem to be broken, I'll try again later. I installed the Cash on Delivery Fee contrib and its working great for my table rate shipping module, but I have a courier module that's not in the list. Is codfee supported on the forum? How do you add a shipping method to codfee? 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.