Magento one-page checkout showing no payment method - magento

Am creating a module to add an additional payment system to Magento after creating the module. It is appearing in the admin panel and I have enabled it, but it is showing no payment method.

So payment methods are shown on the checkout page after they pass the function Mage_Checkout_Block_Onepage_Payment_Methods::_canUseMethod now this function basically checks if the method itself is setup and if it is valid against the current quote via two calls.
The payment methods own function canUseCheckout. Now since you are creating your own method I dont know what you function here looks like but I guess it would not be too complex to debug by yourself.
The payment forms Mage_Payment_Block_Form_Container::_canUseMethod. Now what this function does is check the payment method against the country, currency and quote total.
With the following
return $method->isApplicableToQuote($this->getQuote(), Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
| Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
);
Now if your payment method does not override anything here then it simply checks the config values of min_order_total, max_order_total, specificcountry and if you have any special currency checks.

Related

How to change magento shipment email template payment Method block

I am using magneto 1.9. How to i have change magento shipment email template payment Method block?
If you want to render a specific text/html for a particular payment method in shipment email template only then you have to override sendEmail function of Mage_Sales_Model_Order_Shipment class and play with $paymentBlockHtml variable.
In that function, you can add a condition like
if($order->getPayment()->getMethod()=='cashondelivery'){
$paymentBlockHtml = Mage::helper('sales')->__('Payment after delivery');
}
Hope it helps!
I have found found solution for payment block.
For change payment block need following below steps:
Step 1. Copy app\design\frontend\base\default\template\paygate\info\cc.phtml to app\design\frontend[Your Package][Your Theme]\template\paygate\info\cc.phtml
Step 2. Change here that you want to change
Step 3- Save

Braintree's Dropin UI, How to remove payment method

We are using braintree's dropin UI to help save time in having to create custom payment entry pages. What is hard to understand is why you can only add new payment method and not remove. I understand being able to add, but if there was a problem with a given payment method (later on). It is there forever because the customer cannot remove a payment method. I guess the only way to remove a payment method, is for us write a custom UI (thus defeating the purpose of using the dropin UI to begin with). Is there no way for a customer to remove a payment method using the dropin UI?
Braintree's DropIn UI doesn't allow users to remove or update saved payment method.
But there's a way to do that. For example, if you have a customer profile page where they can manage their settings, you can simply add a menu that shows all the payment methods associated with the customer.
To do this, you can simply use some Braintree functions which are explained here: https://developers.braintreepayments.com/guides/payment-methods/php
The idea is to get all the payment method associated with the customer using something like:
$customer = Braintree_Customer::find('a_customer_id');
$customer->paymentMethods // array of Braintree_PaymentMethod instances
It will return an object for all the payment methods. Then you can check the response of that object from the same page by clicking the specific payment method type here (credit card, paypal...)
Once you have these values, you can display them in a table for example, and add a simply button or whatever you want to delete that payment method.
To do this, you can use the following function passing the TOKEN as an argument
$result = Braintree_PaymentMethod::delete('the_token');
/*(token is a value of the object that comes from $customer->paymentMethods*/
Finally, you can check the response controlling the value of $result (true or false)
Hope this helps.
The ability to delete vaulted payment methods using the Braintree drop-in UI has been added around August 7, 2018 and is available in braintree-web-drop-in 1.12.0+. This feature is now listed in their documentation:
Name: vaultManager
Type: boolean
Attributes: optional
Default: false
Description:
Whether or not to allow a customer to delete saved payment methods when used with a client token with a customer id. Note: Deleting a payment method from Drop-in will permanently delete the payment method, so this option is not recomended for merchants using Braintree's recurring billing system. This feature is not supported in Internet Explorer 9.
To enable the "Vault Manager" (the ability to delete vaulted payment methods), set vaultManager: true when creating the drop-in:
braintree.dropin.create({
authorization: 'CLIENT_AUTHORIZATION',
vaultManager: true,
/* your other braintree options */
})

Magento placing order before paypal payment

i've a problem with paypal integration in magento.
If i choose paypal standard payment and confirm order, i'm correctly redirect to paypal site for payment, but if i press back button on the browser i am redirected in /checkout/cart (that is empty) and in my backend my order was placed and in PENDING status (it's not shown in customers order list)...
This happens because the order were placed before payment processing...
In OnepageController.php saveOrderAction method i can see
$this->getOnepage()->getQuote()->save();
/**
* when there is redirect to third party, we don't want to save order yet.
* we will save the order in return action.
*/
if (isset($redirectUrl)) {
$result['redirect'] = $redirectUrl;
}
What does it mean? It is exactly what i want "Don't want to save order yet....", unfortunatly few rows before...
$this->getOnepage()->saveOrder();
$redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
And the order were already placed....
I hate editing core file, but i've tried to comment the line above, but an exception shows me that order information are used inside paypal module itself (Standard.php file method getStandardCheckoutFormFields). So i can't modify core file easily....
What am I missing?
Thanks a lot and excuse me for my bad english.
You can use for this purpose PayPal express checkout. It works the way you want.
I'm dealing with exactly same problem as you were.
For now i'm thinking of rewriting onePage Model and saveOrder action in my module.
What Im thinking of is to remove part where session is cleared and make an event to observer after receive payment method response.
No idea if it'll work but well.

Magento; Modifying a payment module changing name in "method" field

Modifying a payment module I'm not having any success changing the "payment name" that is placed in table sales_flat_order_payment in field "method".
For example if payment is check, it is populated with checkmo.
I've tried changing
protected $_code = '.........'; in payment.php with no success.
I'm guessing this name may need changing in multiple places?
I have researched this but any answers I can find are assuming I have the skill level to know how to duplicate or modify the extension.
magento ver 1.4.1.1
more info; I'm using a Western Union payment extension as a Bpay payment extension and that field method is used to SMS payment type to me (and it would be more elegant it said what it really was!)
It's better to have a separate payment method for this. You can duplicate some existing method, and use your custom name.
Create a new payment module by duplicate one of your other payment module that closest matches what you are trying to do.
If you are trying to create a payment module for check then take a look at create a new payment method

Setting a shipment method and payment method programatically in magento

i am trying to enable shipping method, update the shipping costs and enable payment methods based on a condition through an observer. I was able to add a field to the checkout page to check for the condition but i am not sure how do i enable/disable shipping methods and payment methods and update the shipping costs? Could some one provide a code snippet to perform this or point me in the right direction? Thanks.
You can override the shipping and payment methods isAvailable() or isActive() methods to meet your conditions and show the availability or change the price of shipping method. If you need to add a payment method fee then you need to implement a total object for a payment method.
However in checkout/onepage the process is address > shipping > payment and if you change your conditions on last step then you ideally need a user confirmation to change the choices he has made in previous steps.

Resources