3

I'm on Magento 1.9.2 and use Magestore's gift-card plugin.

When someone buys something with a gift card and the remain order price is zero I wanted all other payment methods gone.

I found the following thread, zero subtotal cart - can I automatically select 'no payment information required'?, and one of the answers from user ReinhardL, worked really well, here is his code;

Set the sort order for Zero Subtotal Checkout as low as possible (All other active payment methods should have higher values)

Now edit (copy to local) Mage_Checkout_Block_Onepage_Payment_Methods and change the _canUseMethod($method) function like this:

protected function _canUseMethod($method)
{
    if (!$method || !$method->canUseCheckout()) {
        return false;
    }

    if ($method->getCode() == 'free' && parent::_canUseMethod($method)) {
        Mage::register('payment_free_active', true);
    }
    else if (Mage::registry('payment_free_active')) {
        return false;
    }

    return parent::_canUseMethod($method);
}

This should work quite well, as long as you don't forget to sort your payment methods, otherwise the registry value won't be set early enough, and all payment methods with a lower sort order value will still be shown.

Now my problem is that it works however when some selects the gift card payment method and then clicks continue it redirects back to the cart.

Can anyone help as to why this would happen?

4

Magestore's Gift Card extension is a mess. It looks great and it will work for everyone who's on a plain Magento install and doesn't do any other fancy stuff with his shop or the code.

However underneath the surface the code is horrible. The problem you are describing occurred to me too with Magestore's Promotional Gift module (is this the same one?). After a lot of debugging I found a check inside a PHTML template that would redirect to the shopping cart if something was not as it should be. Yes, you are reading this right, a redirect (+ exit();) within a Magento PHTML template.

I would advise you to abandon this extension when you're still having issues, or other issues occur. Or you could try to find the source of the problem and try to fix it with local rewrites.

I don't want you to discourage contacting Magestore support, which you should probably do, but I did not find this very helpfull:

could you please provide me with the FTP account and admin backend access information of your website?

Euhm... no. We don't use FTP and you're not getting my admin account.

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.