1

Need to show one checkbox in product details page and if customer choose these checkbox then need to show only one payment method option in checkout page. Condition is: if grand total amount greater than 3000 and customer choose checkbox.Is it possible in magento?

0
1

Create a module with an observer on "payment_method_is_active" event.

You should then check if this is the payment method you want

$MethodInstance    = $observer->getEvent()->getMethodInstance();
$paymentMethodCode = $MethodInstance->getCode();

if ($paymentMethodCode == 'cashondelivery') {
    ...
}

Get the total from the quote,

$quote = $observer->getEvent()->getQuote();

Set the isAvailable flag on the payment method you with to limit.

$result = $observer->getEvent()->getResult();

if ($result->isAvailable) {
    $result->isAvailable = $this->isTotalOverThreshold();
}

Here's a similar module I wrote for filtering payment methods by shipping country.

https://github.com/peacockcarter/magento-filter-payment-methods-on-shipping-address

This is actually a very good idea for a module. Might write it later in the week.

2
  • Thanks.I already implement.My logic is: 1)First i create custom option checkbox(name is "Avail EMI Offer") from manage product->my product->custom option. 2) Then copy this custom attribute for all products which products price greater or equal 3000. 3) If customer check this checkbox when he/she add to cart. 4) In checkout page, I receive this custom option in a variable and implement logic if variable=='1' then only show EMI payment method else show cash on delivery payment method. – chayan roy Aug 9 '16 at 11:47
  • But i need to implement custom option pragmatically. Is it possible ? I am Beginner – chayan roy Aug 9 '16 at 11:52
0

My suggestion is , for your condition better set the checkbox in checkout page instead of product detail page. Just check for the Grand total from the quote on the checkout page , if Grand total > 3000 makes the check box to be visible else let the checkbox be hidden

1
  • Thanks.I already implement this logic.But i need to add checkbox in product details page pragmatically. – chayan roy Aug 9 '16 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.