Paypal integration...

I'm loving Zenphoto, but I'm just wonder. Is it possible to hook up Paypal with Zenphoto to sell prints for example? Has anyone ever done this?

Cheers.
«1

Comments

  • I don't see any major complications that would arise from hard coding a paypal "buy it now" type button.
  • smsu Member
    Yes, it can be done very easily, just make sure you have this included in the pay pal code

    `

    ">

    `
    Here is an example, some areas need to be changed, e.g. yoursite.com to your own URL etc, but there is enough there to get you started

    `



















    ">





































    `

    Regards

    SMSU
  • Hi,

    I'd put the above form in the "Custom Data" field on the album/image edit page, right?

    But that has no effect.
  • acrylian Administrator, Developer
    Of course not, the field can't hold and execute php code...it's not meant for that. You need to add it to your theme image.php page.
  • I've created a simple Paypal plugin for zenphoto:
    http://blog.qelix.com/2008/04/07/paypal-integraion-for-zenphoto-zenpaypal/
  • acrylian Administrator, Developer
    Great, but please take a look at the current nightly because we have a real plugin system for custom theme functions now. You might want to modify it to fit into that. It's not really hard to do. That would be great.
  • Sure, I'll take a look later tonight.
  • Nimbuz, awesome plugin! This was very much needed.
  • I have made a plugin version. Added some flexibility with the pricelist. I have not checked it beyond making sure the HTML worked. (I don't have a paypal account.)

    Too many versions of this thread. Sorry for the multiple postings.
  • Hi, I've been trying to get paypal to work in a redesign of my site I'm currently working on (here's the gallery section: http://www.lightoverwater.co.uk/example/gallery/), unfortunately I can't seem to get it to work. I have the latest build of ZP installed.
    I select the plugin in the admin area and nothing happens...then I checked out the plugin - as linked to above - inserted the code into the page (and some css) as it says to in the read me but then I get horrible error messages about it being unable to find 'paypal.php'...is there something I'm missing??
  • acrylian Administrator, Developer
    Do you really use the nightly build and the there included plugin (it has been reworked for the nightly)? The above download won't work with the nightly.
  • yeah I tried both methods...the nightly one first, but didn't add anything to the image.php page as is suggested in the second, is this something that should be done?
  • acrylian Administrator, Developer
    Of course you need to add the paypal function to your theme page yourself.
  • right...and each time I do I get errors everywhere...
  • acrylian Administrator, Developer
    1. Activate the plugin on the plugins page in the admin.
    2. Look at the options on the options plugin page and fill in your PayPal account number.
    3. Add the function to your theme's image.php

    This should work, but I have no PayPal account to say if it really works.
  • DrSlony Member
    I sell photos on my site, however I also sell digital copies (or actually a license).
    My paypal price list in zp admin looks like this:
    10x15:Matte=20.00 10x15:Glossy=20.00 40x30:Matte=80.00 40x30:Glossy=80 60x40:Matte=120 60x40:Glossy=120

    I would like to be able to sell 3 image sizes of 2 different types - glossy and matte. I would also like an option at the bottom to sell "digital & license".

    How and what do I modify to be able to do this?
  • Documentation for zenPaypal is here: http://www.zenphoto.org/documentation-official/zenphoto/_plugins---zenPaypal.php.html

    You would have to create the digital & license as elements of your price list.
  • nizuya Member
    I have the newest version of zen photo, fresh install. I enabled the zenPayPal plug in and added:
    <div id="BuyNow">
    <?php require( 'zenPaypal.php' ) ?>
    </div>
    To image.php

    Then I added:
    #BuyNow {
    background:#f7f7f7;
    border:1px solid #ccc;
    text-align:center;
    padding:10px;
    margin:0 0 10px;
    }
    #BuyNow input.buynow_button {
    display:block;
    clear:both;
    text-align:center;
    margin:10px auto 0;
    }
    to styles/light.css

    I keep getting errors that the file zenPaypal.php does not exist in the directory.
    So I copied the file to the same directory as image.php, then got the error that variables had already been set (or something like that).
    Finally, I deleted the zenPaypal.php from the plugins directory and now I just get an empty box...

    Can someone help me!? Did I do something wrong?
  • Vaisak Member
    You don't have to require the zenpaypal file, just use <?php zenPaypal(); ?>

    I was wondering if there's a way to show zenpaypal in certain images, while it remains hidden in the rest of the gallery. I've been trying some things, like getting a customized price list from the custom data field and trying to hide zenpaypal if the field was empty. But my php knowledge is... well, almost nonexistant. Any help would be greatly appreciated, even if it just to tell me there's no way right now :)
  • You should not have the `<?php require ('zenPaypal.php')` statement. The readme file that came with zenPaypal and the 1.1.6 release was obsolete. The correct way to use zenPaypal (after you put the file back in the plugins folder) is to go to the plugins tab of admin and check the checkbox by zenPaypal. Then the plugin will automatically be loaded.
    In your theme just include <?php zenPaypal(); ?> in your theme where you want the button. See also the documentation linked by the `usage information` link on the plugin page.
  • Vaisak Member
    Nevermind my problem, now it seems to work. Thanks anyway!
  • mikecp Member
    Managed to integrate this plug-in fairly easily as a thickbox but I wondered if anyone would be kind enough to help with my struggles.

    What I am ideally looking for, is a set of radio buttons that take their values from the customdata field. The customer then just selects the size and finish from the options and presses the Buy Now button.

    Options would be, for example:
    6x4 Glossy 5.00
    8x10 Glossy 10.00
    22x18 Canvas 85.00

    My knowledge of php is very limited and the documentation on the site seems to be geared towards developers rather than photographers, so I would appreciate examples that I can play with to get the desired result.

    Thanks in advance
  • The Paypal plugin uses a selection drop-down to select the item/price. You would really have to learn PHP if you want to change that to radio buttons. However, if all you want is to have different pricing options based on the image there is a much simpler solution. (You will still have to write some PHP, though.)

    The documentation for the plugin is here: http://www.zenphoto.org/documentation/zenphoto/_plugins---zenPaypal.php.html

    You can put your 'price list' into the custom data field of the image and pass it on to the paypal button using the `zenPaypalPricelistFromString()` function to convert it from a string of prices to the array of prices that `zenPaypal()` requires. See the function definition for the format of the pricelist string.
  • mikecp Member
    Thanks for the reply.
    One of the biggest draw backs I can see with the drop-downs is that it doesn't display the price until after the visitor has clicked to go to PayPal. If that could be accomplished that would go some way to mitigating the lack of radio buttons.

    I have read the documentation but I am struggling to understand it due to my lack of php knowledge. My best guess is that I need a statement such as:

    zenPaypalPricelistFromString(getCustomData())

    Am I close?

    Thanks
  • I think we can modify the plugin to show the price. I will look into that.
  • mikecp Member
    That would be excellent if you can, and well worthy of a donation. Thank you.
  • I think it would be ideal if zenphoto implemented by default an extra field in the edit album page in the admin panel where we can set prices (using a string) for individual images/albums, and turn off paypal support for individual images/albums.
  • Tonight's build will have a new function--`zenPaypalPrintPricelist()` this will create a link on your image page. Clicking on the link will expose a price list table.

    DrSlony: We have such a field, it is called `custom_data`. The zenPaypal documentation will tell you the format for the string and how to pass it to the `zenPaypal()` function. (And now the `zenPaypalPrintPricelist()` function as well.)

    The only theme which has zenPaypal included is the example theme [because it is an example....] I suggest you use the following code for accomplishing what you describe:

    `$prices = getCustomData();

    if (!empty($prices)) {

    $pricelist = zenPaypalPricelistFromString($prices);

    zenPaypal($pricelist);

    }`
  • Thanks a lot sbillard! I will try that!
  • Just to provide an update for this. I wanted to use PayPal's shopping cart feature rather than it's single-item buy function, so I edited the code in zenPaypal.php. I followed these instructions from the paypal site;

    https://www.paypal.com/us/cgi-bin/webscr?cmd=_pdn_xclick_to_cart_outside

    Perhaps there could be an option in the administrator panel to switch between these modes?
Sign In or Register to comment.