Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Allow Just One Payment Method for an Item


Mort-lemur

Recommended Posts

Hi,

 

Store = 2.2 Rc2a

 

I offer several payment methods - Paypal, EPDQ, Cash on collection, Phone with Card Payment and Bank Transfer.

 

A couple of my products are high priced items and the market is very competitive, so on these items I would just like to allow the Bank Transfer payment option - That way I can avoid the CC or paypal fees and sell at a lower price.

 

Is there a way for these items that I can just offer one payment method at checkout ??

 

Many Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

maybe you can change selection method in each class (Paypal, EPDQ, Cash on collection, Phone with Card Payment):

function selection() {
  global $cart;
  if($cart->in_cart('X') || $cart->in_cart('Y')) {
	$this->enabled = false;
  }else{
.../... the code of class
	}
}

 

X & Y are the products_id for the couple of your products.

Link to comment
Share on other sites

another way to do it :

 

in catalog/checkout_payment.php :

 

change this line :

 

 $selection = $payment_modules->selection();

 

with :

 

 $restriction = false;
 foreach(explode(',' , $cart->get_product_id_list()) as $product_id){
  if(tep_get_prid($product_id) == 'X') $restriction = true;
 }
 $selection = $payment_modules->selection($restriction);

 

(X is your product id)

 

and in catalog/includes/classes/payment.php, change this code :

 

function selection() {
  $selection_array = array();

  if (is_array($this->modules)) {
	reset($this->modules);
	while (list(, $value) = each($this->modules)) {
	  $class = substr($value, 0, strrpos($value, '.'));
	  if ($GLOBALS[$class]->enabled) {
		$selection = $GLOBALS[$class]->selection();
		if (is_array($selection)) $selection_array[] = $selection;
	  }
	}
  }
  return $selection_array;
}

 

with :

 

function selection() {
  $selection_array = array();

  $check = func_get_args();
  if($check[0] == true) {
  $selection_array[] = $GLOBALS['banktransfer']->selection();
  }else{

  if (is_array($this->modules)) {
	reset($this->modules);
	while (list(, $value) = each($this->modules)) {
	  $class = substr($value, 0, strrpos($value, '.'));
	  if ($GLOBALS[$class]->enabled) {
		$selection = $GLOBALS[$class]->selection();
		if (is_array($selection)) $selection_array[] = $selection;
	  }
	}
   }
  }
  return $selection_array;
}

 

with this solution, no need to change each class of payment.

Link to comment
Share on other sites

  • 2 months later...

Sorry been off this subject for a while....

 

Been thinking though, as my products I need to restrict is getting bigger, That maybe I need to add a new field to the product table that can be filled in when in the admin product page that does the following:

 

If Field is Null (default) allow all payment methods

If field is not null then only allow one payment method - in my case bank transfer.A

 

any ideas welcome...

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

@@burt

 

Hi Gary, nice to see you again!

 

Ill look up the hazmat contribution and see if I can alter it - oh dear, here we go again..........

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...