# Integrating Lightroom Web Galleries with Shopping Cart and Paypal



## henchard

First a Newbie alert!

Following a request from a friend (as there are no free solutions I know of) I think I *may* have found an easy way to integrate Lightroom's standard Web templates with a shopping cart. It's still rough and ready but I think it is time to ask others to evaluate how well it works (particularly in version 4 which I don't have). 

Of course it might be rubbish but I have got it working and there may be people out there who can write real Javascript (not dabble like me) and make this much more sophisticated.

Looking forward to your feedback (please don't be too critical of my amateur coding!)

I've posted details here

http://www.imat.co.uk/ligtroom_paypal.html


----------



## Victoria Bampton

Welcome to the forums henchard.  I have to say, that's a very neat solution.  I use Mal's cart myself, but I'd never considered dropping it into a gallery like that.


----------



## henchard

*Next Step?*



Victoria Bampton said:


> Welcome to the forums henchard.  I have to say, that's a very neat solution.  I use Mal's cart myself, but I'd never considered dropping it into a gallery like that.



Glad you don't think I'm not completely mad! Not sure how I came up with the idea of seeing if you could add code via the Caption Text Box in the Web Gallery. 

If you use Mals could you (or someone) possibly  try and see if it still works in Lightroom 4.* 

At least we'll know if it is worth trying to develop further.

regards

John Burton


----------



## Victoria Bampton

Sure, I'll give it a shot on Monday.  (I'm trying not to spend the whole weekend working, that's all!)


----------



## Victoria Bampton

It certainly added the code to the gallery in LR4, as it would in LR3.  I couldn't get the cart to work, but I'm guessing that's an incorrect setup at my end, possibly because my Mals account is set up for other shopping cart software.


----------



## Marshall Black

So, if I view the source of this code from the webpage produced...would I get the info needed to hack something valuable?
I must admit this seems an interesting use of LR, just wondering if it would be safe for what you are trying to do.
Got me thinking about other possibilities for adding navigation and such like easily.
Cheers
Marshall


----------



## henchard

Marshall Black said:


> So, if I view the source of this code from the webpage produced...would I get the info needed to hack something valuable?
> I must admit this seems an interesting use of LR, just wondering if it would be safe for what you are trying to do.
> Got me thinking about other possibilities for adding navigation and such like easily.
> Cheers
> Marshall



Not really (as far as I'm aware) the worst someone could do is try to tamper with the code to buy something at a lower price than it should be. If this is a real issue (when in reality most people would not despatch the prints) this can be dealt with in Mals shopping cart by using more sophisticated link verification

see here

http://www.mals-e.com/support_topicbody.php?topic_id=27


----------



## henchard

Just to update

The first improvement to my idea has been received and I've posted the updated code on the same webpage

http://www.imat.co.uk/ligtroom_paypal.html

This puts a thumbnail of the print in the shopping cart.


----------



## Victoria Bampton

Well done henchard.  Erm, did you realise you missed to h in lightroom in your link?  Just thinking of your seo!


----------



## henchard

Yes I saw my url error. As long as people can find it!

I have now put an example gallery built using this ides here. The code now adds a thumbnail to the shopping cart

http://www.imat.co.uk/paypal/index.html

Please remember this is early days and should be regarded as a beta version!


----------



## Yann

Hi all,

I'm the guy who came across this thread last saturday and began to enhance Henchard's bright idea. I was not joking when I wrote him he deserves an award.
I put all the javascript code into an external js file. The item list with the account information settle into an xml file which is parsed by some javascript code.
Putting the javascript and the item list away from lightroom generated web pages results in writing only 2 lines into the web gallery caption text box. The user only has to write some information regarding his item list and account configuration into the xml file (for those who are not fond of computer thing, an xml file is like a list along with its self description).
I've uploaded a demo site right here: http://ilg-photo.com/glamour2/index.html. It's in french but I think you won't have any difficulty giving it a try. If you view the page source you will see the 2 lines that have been added.
This code needs some further improvement, like writing all text, style and so on into the xml file so that anyone may customize the look and feel to fit his own gallery requirement. I want to add as well the ability to deal with options like BW or sepia print turning the dispayed image to this tone when selected.
I'll work further on it and give you more information when I'll be back from vacation.
Looking forward to reading your feedback. I hope that you could catch up my explanations as English isn't my native language. 

Regards,

Yann


----------



## henchard

I can't thank Yann enough for improving my original code. I know that he has some great ideas to take this to a new level!

Merci, Yann


----------



## Victoria Bampton

Welcome to the forum Yann.  You two make a great team!


----------



## Wendell

This is great. Just what I've been looking for. Is there any way to modify the code to email a customer order directly without going through a 3rd party shopping cart?  Right now I'm using a form that i created on my website that the customer fills out with the image number, but is requires that they write down the information as they browse the photos. Not a very good way to do it.


----------



## johnbeardy

Wendell, do you want to contact me via my web site? I've been working on something.


----------



## henchard

Wendell said:


> This is great. Just what I've been looking for. Is there any way to modify the code to email a customer order directly without going through a 3rd party shopping cart?  Right now I'm using a form that i created on my website that the customer fills out with the image number, but is requires that they write down the information as they browse the photos. Not a very good way to do it.




Possibly - is the short answer but you would need someone to write the Javascript and I just don't have that knowledge. However, I don't think that you can send an email with JavaScript per se; you would have to get it to open the users email software and somehow pre populate the email. The honest answer is I don't know enough about this stuff! I just hit on the fact that you could use the Custom Text Box to insert the code. 

Personally as Mals is so customisable I can't see the advantage in not using it.


----------



## Wendell

henchard, the only reason that I'd rather not use a 3rd party shopping cart is that most collect money when the customer places the order.  I don't collect money from my print orders until the customer receives the prints.  Sometimes there is a delay from the lab and sometimes in the mail delivery, and I have found that if that happens and the customer hasn't paid yet, they don't constantly contact me for a status.  I've had good luck with getting paid after the fact.
Will Mals do that? Let customers check out without a transaction?


----------



## Wendell

John, I sent you an email through your website.


----------



## Wendell

Sorry, posted the original reply in the wrong place...I sent you an email through your website.
Wendell


----------



## henchard

Mals has a variety of payment types that can be enabled or disabled (As well as customising your own options). It has two standard offline payment options - Pay by cheque or pay by money order. You'd just need to enable this and customise the automatic email to tell you customer to pay by check on receipt; this email or your packing slip could also include your bank details for them to pay electronically.

Mals is pretty flexible. Hope this helps.


----------



## Wendell

henchard said:


> Mals has a variety of payment types that can be enabled or disabled (As well as customising your own options). It has two standard offline payment options - Pay by cheque or pay by money order. You'd just need to enable this and customise the automatic email to tell you customer to pay by check on receipt; this email or your packing slip could also include your bank details for them to pay electronically.
> 
> Mals is pretty flexible. Hope this helps.




This does help. Thanks.  Mals website doesn't elaborate on this and I didn't want to create an account with them and find out it doesn't do what I need.


----------



## Wendell

henchard said:


> Mals has a variety of payment types that can be enabled or disabled (As well as customising your own options). It has two standard offline payment options - Pay by cheque or pay by money order. You'd just need to enable this and customise the automatic email to tell you customer to pay by check on receipt; this email or your packing slip could also include your bank details for them to pay electronically.
> 
> Mals is pretty flexible. Hope this helps.




i signed up for an account with Mals and it works as you said. I justhave a couple of things to correct now:

1.  Several lines  of the script show up on the photo above the "buy button.  Have you experienced this?

2.  When I receive an email notifying me of an order, the image number is not included. Is there a setting that I'm missing. 

If I can get these two things ironed out this will be perfect. Thanks for all of your help.


----------



## baxterbradford

This has been such a fantastic find for me. It has helped me generate web galleries from which to sell some event pictures. Something I had been struggling to achieve prior to finding this thread. I've subsequently successfully opened up a Mals account and sold some prints using a modified script from John's website. I am having difficulty with my third product for sale, 'Hi res file'. This option can be successfully added to the cart, but when checking out I receive this error message... *SYNTAX ERROR: price not set.
*
This is puzzling me as to why it won't work as intended. Here is what I think is the relevant section of the script from image caption text 
<select size="1" name="productpr"> 
<option selected value="">Select size 
<option value="6x4 inch :6">6x4 inch £6.00</option> 
<option value="9x6 inch :9">9x6 inch £9.00</option> 
<option value="Hi res file">Hi res file £8.00</option> 
</select>   

Initially I found a space before the >Hi res file £8.00 part, I deleted the space and re-uploaded all web pages and images. Still the problem persists. I've looked at options on Mals site to see if I need to do anything else, but nothing has seemed relevant. Please note, it is my intention to place High res image file in a 'Dropbox' folder rather than try to use an automated download system. The two print sizes function correctly and I've sold several of the smaller size. So I know that part of the system is functioning correctly.

Can anyone please shed any light and solutions on this issue? 

Many thanks Bax


----------



## henchard

I've just woken up so still sleepy and haven't tried it but I think the syntax for High res should be (alteration in red)

<select size="1" name="productpr"> 
<option selected value="">Select size 
<option value="6x4 inch :6">6x4 inch £6.00</option> 
<option value="9x6 inch :9">9x6 inch £9.00</option> 
<option value="Hi res file :8">Hi res file £8.00</option> 
</select>


----------



## baxterbradford

Thanks so much. I could see the omission once you'd pointed it out. I tested it last night having recreated all the galleries and all seems to be working fine. Really appreciative of the initial idea and your support. 

Best wishes 

Baxter


----------



## henchard

First a Newbie alert!

Following a request from a friend (as there are no free solutions I know of) I think I *may* have found an easy way to integrate Lightroom's standard Web templates with a shopping cart. It's still rough and ready but I think it is time to ask others to evaluate how well it works (particularly in version 4 which I don't have). 

Of course it might be rubbish but I have got it working and there may be people out there who can write real Javascript (not dabble like me) and make this much more sophisticated.

Looking forward to your feedback (please don't be too critical of my amateur coding!)

I've posted details here

http://www.imat.co.uk/ligtroom_paypal.html


----------



## Ianspeed

Hi everybody, can anybody tell me if there is a PayPal version of this code floating around? And where I can find it?

All the best

Ian


----------



## miroperez

I wrote a LR Web Plugin to generate the standard PayPal Buy Now link which I haven't used in a while but I think it still works. The pricing for photos is determined on the PayPal side so you can't spoof the price. I had started looking into the PayPal Shopping Cart functionality but get much further than putting the button on the detail photo page. It's been a while since I wrote it so PayPal might have made the integration a little cleaner than it was 2 years ago. 

in terms of that the original post did, it's not that hard to copy one of the existing LR Web Plugin's and add that bit of code directly in the gallery generator so you don't have to deal with the hack of putting it into the Caption.  Adobe's LR area has a pretty good set of docs on creating your own Web Gallery Plugin if you wanted to go down that route.

Miro




Ianspeed said:


> Hi everybody, can anybody tell me if there is a PayPal version of this code floating around? And where I can find it?
> 
> All the best
> 
> Ian


----------



## WayneOPUK

Hi, Im currently developing my website, and I've just finished integrating Facebook logins on a seperate project.  For this reason, i was hoping to create my own "shopping cart" system which i would proceed to PayPal for payment with.

my idea is this: using javascript, set a cookie as the storage method.
for each print the user wants, add the following text to the cookie:
"Size%No of Prints%Image ID/"

So  the cookie will become:
"5x7%2%DSC5692/8x10%1%DSC5122/" etc...

its a matter of splitting the cookie string etc and checking each part, but my cart management would be in PHP...  this is entirely possible in JavaScript though...  

as for prepopulating the email, you could just create a "checkout" button and state "our checkout is a little different... please email the following text to [email protected]"

IMAGE ID - SIZE - COPIES
(parse the cookie to list them all)

If i take the plunge with the JS version, i will post it up. but I might well go the whole 9 and opt for PHP (im looking at creating a database of "purchases" etc to aid accounting etc, and automate some of the electronic purchases (IE: buy a full size jpeg, email it directly to the user - no interaction from myself)


----------



## Yann

I gave up doing further development on the javascript code I had written in summer 2012. Basically, I wanted the user to insert a single line into the lightroom code which would have been a link to a javascript file (this is what I did in the example I provided in my first post). This file would have done all the necessary things to have a menu below the picture by reading an xml file and then, sending info to a shopping cart service. But by lack of time and being stuck by not finding how to get some things working between javascript and xml, I gave up. Maybe I should have subcontracted to chinese developers .
Later I found that for a few bucks, I could get nicer pages and behaviors with selectable pics, sending mail with pic list by customers thanks to TTG plugin for lightroom. I saved time and was spared long nights and headache.


----------

