Jump to content

specific payment method on selected products


Recommended Posts

is it possible in prestashop 1.6 we can add specific payment method on selected product 

 

Example: 

Product A:  buyer can order Product A by choosing any payment method like cash on delivery or advance payment.  ( while ordering customer can see all payment method we offers )

 

Product B: buy can order only if he agree to pay in advance via bank account. ( customer can see this item required only advance payment ) 

 

we have some items which we wants customer pay in advance then we will dispatch these products to customer 

 

can anybody give me the solution?

 

Thanks in Advance

 

 

Link to comment
Share on other sites

the module above limits payments based on order amount, I don't see it restricting based on products.

 

the easiest way is to edit the payment modules hookpayment function, and add your logic directly to it.  some pseudo logic

 

1) define an array of product ids that are allowed

$allowed_products=array(1,5,10,12);

2) in hookpayment, get a list of products in the cart

$products = $cart->getProducts();

3) loop through the products and determine if the module should be displayed

$allowed=false;
foreach ($products as $product)
{
    if (in_array($product['id_product'], $allowed_products))
        $allowed=true;
}
if (!$allowed)
    return;
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

×
×
  • Create New...