I have worked up a very simple hack (?) to make Gallery work better as a photo storefront. It uses Paypal for the shopping cart and credit-card processing, which I just got from another thread on this forum. The new stuff is:
- Sets default prices for each of a set of standard products (print sizes)
- Allows per-album pricing, overriding default
- Allows per-image pricing, overriding album and general default
- Allows for a "not for sale" price
- Allows per-user discounts (think of "user" as "special offer" or "coupon")
- Allows per-album discounts
- Discounts have expiration dates ("order today, 50% off")
- All this info is stored in a separate database (mysql), where it can be maintained independently of the rest of the code.
- "Business" code is separate from "UI" code.
The code is pretty darned small. About 200 lines of php code, plus some straightforward Gallery htmlwrap mods.
For a sample, see http:/www.photodad.com/testing/gallery The connection to Paypal is "live" so don't order unless you mean it!
I am just learning php/mysql/gallery, so I've probably done some stupid things. But it all seems to just work.
Comments/critiques/suggestions welcome.
Posts: 117
Hi,
It would be nice to see it in full action. With just the one album available there is nothing to compare it against!
That said, it seems to work well. Care to share the code???
-winky :wink:
Posts: 18
I will post it as soon as I can get it into a coherent form. The DB needs to be doc'd too. It may take a few days before I can get around to it.
Posts: 18
You can get the storefront code <!-- BBCode Start --><A HREF="http://www.photodad.com/misc/storefront.zip" TARGET="_blank">here</A><!-- BBCode End -->.
There is a readme.txt file that contains everything you (should) need to know.
I suggest you make a "test" installation of Gallery, and install this mod on your test install. Once the DB is set up, it's easy to make your 'main' Gallery installation use the same DB you created in the test install.
Posts: 18
I have replaced this with a revised version, that fixes two problems:
- The paypal buttons weren't picking up a global variable properly
- Doesn't use a ".inc" file anymore (potential security breach)
Posts: 6
This a very handy way to add PayPal as a shopping cart. I have had success with it. As it is, it works perfect for me.
However, I would like it to do one more thing. As it is written now it calulates shipping via the PayPal shipping settings. That would normally be very handy, but what if you weren't going to ship. What if the person that placed the order wanted to come by and pick up the order?
I have spent most of the day trying to figure out just how to do this. Being that my PHP is a little weak, I haven't had much success. I thought I might could add another database entry for defaultPrices called "pickup" and define it as "shipping=0.00" (PayPal shipping override). This could work if you had two sets of products listed. One for shipping and one for pickups. The products might look like this:
4x6(1.00)
Pickup 4x6(1.00)
The item with "Pickup" in the product name could have "shipping=0.00" set in the "pickup" field in the database.
This all seems fine. The hold up is that I can't seem to figure out how to pass the new function to PayPal. I can do it by manually entering it into the "payPalProductButton" function, but I can't figure out how to do it dynamically.
It would seem that if I could write a fuction that pulls the data from the database and places it if there is something in the field, I could get this to work. I have failed at every attempt at writing this fuction.
If anyone might know how to write this fuction or has an alternative way of doing it, I would would be grateful.
Posts: 18
I looked at this, and it would take MORE than a few minutes. I don't think if I'll get a chance to do anything further on it in the near future. But it seems to be perfectly feasible, for someone else to code up. Or for you to try again. If I do happen to have time/energy to work on it, I'll post it here.
Personally, I have wished for finer-grained computation of the shipping. E.g., a minimum per-order "handling" charge, plus a variable amount by total number of 4x6 or 5x7, plus a different variable amount for 8x10s, since they require more postage.
Good luck!
Posts: 6
Thanks for looking at this. I haven't figured it out yet. But I will continue to look at it.
Posts: 6
I was to make the modification to these scripts that I needed. I will post these files for download, as I have made other modifications as well. There may be others looking to do the samething I've done.
Posts: 4
Does using this require a Business account with PayPal or will it work with a Personal account? Does having a Business account with PayPal allow customers to pay with a credit card without having to sign up for PayPal?
Posts: 6
I have released my modifications to this script. If anyone would like to have a look at them or emplament them, go to the URL below.
I believe these scripts are the best and easiest way to make your Gallery work as a PayPal shopping cart, yet still be powerful.
http://www.dalton.net/ppstorefront/index.htm
Posts: 4
miracleman,
just wanted to let you know that I downloaded and installed your modified version today. It works perfectly. Thanks!
Posts: 126
Added to 1.3.5 B44 and phpNuke 6.7 and it works great. I hope to be able to add more functionality, but if anyone else is working on it or has ideas, please let me know!
http://www.cool-networks.net/modules.php?name=gallery
(if you visit, the postcards aren't working for some reason yet. same database, but for some reason won't make the connection)
Posts: 2
This is really great and been looking for this for a while. Made one or two changes so that mine displays £ and also passes currency info to paypal so my customers can order in GBP rather than USD.
Keep up the good work
Cheers
Posts: 8
Hi PaintBallPhotos,
Would you give me an insight into what you needed to do to Anglicanise these scripts?
Thanks in anticipation.
Bob P
Posts: 2
To make this work in the uk i found i needed to change the following..
in /mods/ui_functions.php i needed to tell the system to pass the costs in GBP so i added "¤cy_code=GBP" in the function.. Also you needed to change the single $ to a £ sign so that it displays correctly on your page.
You can see where in the code below..
function payPalProductButton($ship, $picture, $product, $price)
{
if ($price == $GLOBALS["g_notForSale"]) {
return $product . "(n/a)";
} else {
return "<option value=\"https://www.paypal.com/cart/add=1&business="
.
$GLOBALS["g_paypalEmail"]
.
getNoShipping($product)
.
"&item_name="
.
$product
.
"+-+"
.
$picture
.
"&item_number=&amount="
.
sprintf("%01.2f", $price)
.
"¤cy_code=GBP"
.
"\">"
.
$product
.
"(£"
.
sprintf("%01.2f", $price)
.
")</option>";
}
}
Regards
Chris
http://www.paintballphotos.co.uk
Posts: 51
Is there a fix for the multiple paypal windows that open when you order prints? Someone posted the following comments if it helps:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=3394&highlight=paypal+windows
Dan