Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Linking Payment and Shipping


SirArthur

Recommended Posts

Posted

I really missed someway to easy link Shipping and Payment method.

This is the real problem:

 

Here, at Portugal, I can send packages by post office on several ways, but in some cases I can send it on "pay-on-delivery" mode and on other cases the costummer can't pay to post office, so it has to be a money transfer.

The problem was that, after Shipping selection all Payment methods will be listed, so costummers can select invalid pairs like "Green or Blue Mail (faster)" with "Pay on delivery (only avaiable for Normal Mail)".

 

So far I managed it on the "hard way", coding the payment modules to get unlisted depending on Shipping selection:

 

 
    //$this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);
	 if(!stristr($order->info['shipping_method'], "Normal")){
	 $this->enabled = false;
	 } else {
	 $this->enabled = true;
	 }    

*where "Normal" is a unic substring that is in the Shipping module name that allow costummers to enable this payment module.

 

This, however, gave me problems, because there was only one payment method shown but there was an array of modules, with the form_check on Checkout_payment.php, so I'd to comment the line that loads the java script:

 

<?php //echo $payment_modules->javascript_validation(); ?>

 

but... the same problem remains, this time due to checkout_confirmation.php, so I've to comment out this:

 

//  if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
//    tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
//  }

 //if (is_array($payment_modules->modules)) {
   //$payment_modules->pre_confirmation_check();
 //}

 

This was too much work for a simple thing. Can't you put on the next version one simply way to link modules through database?

 

To the users: Please note: if you've the same problem and want to try "my solution", please note that after doing this you can ONLY have one payment method for each shipping method.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...