Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

new paypal payment code for ecommerce


Reply


20 Posts   34979 Views

Avatar
BIMMAN

Community Member, 8 Posts

1 May 2008 at 9:34pm

Hi ak,

I'm new to SS and PHP etc - can i pls get some more detailed instructions on how to setup the paypal extensions - i've tried to copy and paste the code samples but all i've managed to do is to break my ecommerce install :-(

any help would be greatly appreciated

thx

J

Avatar
Flea

Community Member, 1 Post

6 June 2008 at 2:08am

I would love to see some step by step ( line by line ) instructions also...
Would be great for many who are new to SS.

Cheers.

Avatar
BigB

Community Member, 9 Posts

7 June 2008 at 11:22am

Hi Nicolaas, Thanks for all the great work and advice with SS. We are beginning to develop some really dynamic sites on this platform. This post is the most relevant to our needs now... in the states, most small to midsize businesses utilize paypal opposed to other costly merch ant services. So, we are about to follow your lead with the code posted... have there been any updates or developments to paypal integration since your last post in March which asked for a code review. Wondering if you or anyone in the community have had continued success or have needed/added any tweaks.

Thanks in advance. Also, if you are ever searching for design/dev work, please contact me, all of the team that works with me are freelance.

Brian
www.designbstudios.com

Avatar
WorldNZ

Community Member, 7 Posts

9 June 2008 at 10:17am

Hi All

Hope this helps

Yes we have implemented the paypal plugin successfully into Silverstripe

First of all download the paypal.rar file from here http://open.silverstripe.com/ticket/1760

Copy PayPalPayment.php from the archive to [yoursite]/ecommerce/code

Open up this file and set self::$payPalRealAccount to the paypal email address of the merchant account

Copy PaypalPaymentPage.ss to [yoursite]/ecommerce/templates/Includes

Go to your _config.php file for your site....usually located under the mysite folder and add the following code to it

// Define which payment methods your site uses.
Payment::set_supported_methods(array(
'ChequePayment' => 'Cheque',
'PayPalPayment' => 'Credit Card'
));

If you aren't going to accept offline payments then remove the chequepayment line

Finally run db/build?flush=1 and that should be it

Avatar
Ingo

Forum Moderator, 801 Posts

20 June 2008 at 9:20am

we've got a paypal class in ecommerce trunk that romain currently works on.
looks like its a mod of nicolaas' class, not sure what the story behind that is - but have a look at:
http://open.silverstripe.com/browser/modules/ecommerce/trunk/code/payments/PayPalPayment.php

i've asked romain to have a look at this thread as well.

Avatar
BigB

Community Member, 9 Posts

20 June 2008 at 9:58am

We were able to successfully integrate the PayPal code for the eCommerce module. The help Nicolass provided on this thread as well as the links were right on track. I think the only think left is a quick fix for a "View My Cart" button on each preliminary product without having to click through to that product page. Easy enough. You can take a look at our client's site/store/checkout on our server at http://www.ucfi.designbstudios.com... we are still in beta, but it is fully operation besides all of the content. Thanks again to all, great instruction Nicolass... saved us from going to a third party solution.

Avatar
cindycin

Community Member, 20 Posts

6 August 2008 at 12:54pm

in your steps you mention to...

Copy PayPalPayment.php from the archive to [yoursite]/ecommerce/code

Open up this file and set self::$payPalRealAccount to the paypal email address of the merchant account

is this where I'm suppose to make the changes

[ code]
protected static $payPalRealAccount; static function setPayPalRealAccount($payPalRealAccount) { self::$payPalRealAccount = [ b]$payPalRealAccount;[ /b] }
[ /code]

is this how it should be...

[ code]
protected static $payPalRealAccount; static function setPayPalRealAccount($payPalRealAccount) { self::$payPalRealAccount = [ b]MY EMAIL ADDRESS GOES HERE;[ /b] }
[ /code]

is this the only place I need to change the code?

Avatar
Nicolaas

Forum Moderator, 213 Posts

6 August 2008 at 3:06pm

The idea is that the class are not altered and that you create configuration in the /ecommerce/_config.php file using something like

{name of class here}::setAccount($yourPPEmailHere);

where setAccount is the static function in the class

e.g. class could contain something like:

class {
static function setAccount($name) {

}
}