3

We basically want to add an additional step before checkout where the customer will choose if he/she is a private or business customer. Then we want to initiate the checkout process, but the available payment methods should depend upon the choice the customer made in the pre-checkout step.

We don't want to use different web sites for private and business customers, and the customer should not be required to register an account.

Is there any way to achieve this without building a new checkout module?

  • 1
    this question about magento2 or magento 1.X version? – Amit Bera Feb 16 '16 at 12:52
  • You have no choice without do customization at checkout pages. First need add new tab at checkout as @Hardik Shah mention. – Amit Bera Feb 16 '16 at 12:52
0

For Adding new step you can refer below blog: Excellance magento blog

for adding the filter for payment method based on selection you can do following thing:

/app/code/core/Mage/Payment/Block/Form/container.php

There is function called getMethods() you must rewrite the file in your module:

/**
 * Retrieve availale payment methods
 *
 * @return array
 */
public function getMethods()
{
    $methods = $this->getData('methods');
    if (is_null($methods)) {
        $quote = $this->getQuote();
        $store = $quote ? $quote->getStoreId() : null;
        $methods = $this->helper('payment')->getStoreMethods($store, $quote);
        $total = $quote->getGrandTotal();
        foreach ($methods as $key => $method) {
            if ($this->_canUseMethod($method)
                && ($total != 0
                    || $method->getCode() == 'free'
                    || ($quote->hasRecurringItems() && $method->canManageRecurringProfiles()))) {
                $this->_assignMethod($method);
            } else {
                unset($methods[$key]);
            }
        }
        $this->setData('methods', $methods);
    }
    return $methods;
}

In above function you can get your selection from object and based on condition you can make payment method available.

I hope it will help you.

  • 2
    Per the tags, this question is asking about Magento 2. Pretty sure a blog post from 2011 won't help here. – Ryan Hoerr Feb 16 '16 at 13:35

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.