Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SELECTIVE PAYMENT OPTION


collotcorp

Recommended Posts

I wish to know if anybody knows of a method or contribution so that I can assign different payment options to different products...that is, product A can only be paid with PayPal, product B can be paid with both PayPal and 2CO, etc.

 

Suggestions are appreciated.

Link to comment
Share on other sites

  • 2 weeks later...

What I found out so far:

 

I can disable the payment option "invoice" by adding

$cart; and if($cart->total <200) $this->enabled = false; in includes/modules/payment/invoice.php:

 

  class invoice {
var $code, $title, $description, $enabled;

// class constructor
function invoice() {
  global $order, $bt_array; [b]$cart;[/b]

  $this->code = 'invoice';
  $this->title = MODULE_PAYMENT_INVOICE_TEXT_TITLE;
  $this->description = MODULE_PAYMENT_INVOICE_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_PAYMENT_INVOICE_SORT_ORDER;
  $this->enabled = ((MODULE_PAYMENT_INVOICE_STATUS == 'True') ? true : false);	  
  // invoice is only available if total in shoppping cart < 200
 [b] if ($cart->total <200) $this->enabled = false;[/b]
  if ((int)MODULE_PAYMENT_INVOICE_ORDER_STATUS_ID > 0) {
	$this->order_status = MODULE_PAYMENT_INVOICE_ORDER_STATUS_ID;
  }

  if (is_object($order)) $this->update_status();
}

 

 

Now I would like to disable the payment option "invoice" if product id "119" is in shopping cart.

I tried:

if (($cart->in_cart(119)) $this->enabled = false;

 

Unfortunately, this leads to the following error:

PHP Fatal error: Call to a member function in_cart() on a non-object in /www/htdocs/eshop/includes/mne 28, referer: http://mydomain/eshop/checkout_shipping.ph...ahccuif6ovlqmo1

 

 

Any idea what I did wrong?

Edited by zopeuser
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...