Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Specific Payment Methods per product basis? 
 
keith.mifsud
Jr. Member
 
Total Posts:  3
Joined:  2011-01-29
 

Hi Guys,

I hope I am not disrupting the structure of the forums but although I have been using Magento for over three years I never wrote on a forum. Usually the searches get me the info I require. Not this time smile

I have a Magento online store (community version) and it is quite a success but now my needs are growing as I expand to other countries. Basically I want to start offering Cash on Delivery on specific products. I have installed a ‘Cash on Delivery’ Payment module which I got through magento connect. It is very basic, I cannot even select which countries to apply it to but for now it will do. Once I check the success of this method then I will buy an extension.

My issue now is that I can offer this payment method on specific products and i need to see if it is possibel to set this somehow via a custom option, an attribute or a custom variable. I don’t mind if I will need to develop my own payment module as long as I get some good help and advice on how to do so. I don’t consider myself as a programmer but I understand PHP and i am not afraid to get a little dirty.

Also what would be nice is if there is any way to show available payment options + shipping options using icon images on the product detail view pages.

All help is appreciated and thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Web Developer02
Member
 
Total Posts:  31
Joined:  2010-12-29
 

As per my knowledge about Magento, it is not possible.

 
Magento Community Magento Community
Magento Community
Magento Community
 
keith.mifsud
Jr. Member
 
Total Posts:  3
Joined:  2011-01-29
 

Hi Web Developer02,

Thanks for your reply. i know that it is not a function that comes in the box with Magento but I am sure that with some tweeking or if I understand things alittle better it can be accomplished.

Basically I think I can create a custom module and then somehow call it (enable it) by a product attribute. I think this can be accomplished but I am a little unsure about how to call and enable a payment method module via a product attribute. I don’t know what I can pass to it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rachelkevans
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2011-05-04
 

I have never implemented this, but if i where you, I would do the following:
1) Create a product custom attribute with Yes / No value for each payment method. Example: CreditCardPayment (Y / N); CashOnDelivery (Y / N).
2) Now in the basket template, where the customer is asked to choose payment method:
3) Loop into the product line items
4) For each line item get the product model
5) Get the product payment methods that are set to Y and store in array.
6) Before displaying the payment method, check if payment method is in array and display it if found.

Did you consider the possibility of have multiple products with conflicting payment methods?

 
Magento Community Magento Community
Magento Community
Magento Community
 
keith.mifsud
Jr. Member
 
Total Posts:  3
Joined:  2011-01-29
 
rachelkevans - 04 May 2011 09:18 AM

I have never implemented this, but if i where you, I would do the following:
1) Create a product custom attribute with Yes / No value for each payment method. Example: CreditCardPayment (Y / N); CashOnDelivery (Y / N).
2) Now in the basket template, where the customer is asked to choose payment method:
3) Loop into the product line items
4) For each line item get the product model
5) Get the product payment methods that are set to Y and store in array.
6) Before displaying the payment method, check if payment method is in array and display it if found.

Did you consider the possibility of have multiple products with conflicting payment methods?

Hi Rachel,

Thanks a lot for your post and sorry for taking my time to get back.

It seems achievable but I cannot see how I can pass the data of the product attribute to the payment methid loop. Should I use a public variable or a megento custom variable? (I never did none of these)

Also in regards to conflicting methods it would be that if not all products in cart are allowed COD than it will not be offered. I am assuming I can do this as a IF function before the loop. Your help here is appreciated smile

Thanks again Rachel.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Asulpunto
Member
 
Avatar
Total Posts:  56
Joined:  2011-01-26
 

In the template or block where you are building the list of payment methods to show to the customer, you can get a list of the basket line items from the session.

I do not have the exact code in front of me, but if you google i am pretty sure you find a reply. Use the following algorithm:

session=Mage:getModel(’core/session’);
basket=session->getBasket();
lineitems=basket->getLineItems();
creditcardfound=0
paypalfound=0

foreach (lineitems as li)
{
if (li->getCreditCard==true) creditacardfound++;
if (li->getPaypal==true) paypalfound++;

}

if (credicardfound) echo ‘********creditcard code goes here’
if (paypalfound) echo ‘********paypal code goes here’

--
http://www.asulpunto.com
asulpunto@asulpunto.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sunovisio
Sr. Member
 
Avatar
Total Posts:  94
Joined:  2012-04-12
Ho Chi Minh
 

Hi keith.mifsud,

I guess that it is too late for you but I think it may help other people who would like to implement this feature.

Check Payment Method Per Product Extension

It seems to do what you need here.

Hope my answer will help someone

File Attachments
 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

Hello,

please have a look Shipping Rules extension. It seems to be able to solve your problem.

Hope that helps.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top