Making Paypal checkout work correctly

What i would like to do is set prices for individual albums and photo's with paypal plugin. I have put this code into image.php

'$prices = getImageCustomData();
if (!empty($prices)) {
$pricelist = zenPaypalPricelistFromString($prices);
zenPaypal($pricelist);
}'

This then loads the data from the Custom Data and puts it in the drop down menu but it does not show a new Price list only the default one i set in admin toolbox.

Also i cant get it to add the checkout to an entire folder only individual photo's. What am i doing wrong?

My website for testing is http://www.2photo.co.uk/zenphoto

Comments

  • I am not sure I am following you. To have any pricelist show you need to set the second parameter to `zenPaypal()` to true. Since it is not so set there would be no pricelist link displayed.

    I visited your site, but did not see any Paypal ordering items.
  • here is the one that is with custom data
    http://www.2photo.co.uk/zenphoto/index.php?album=Gallery/Football/Gresley+Rovers+vs+Lincoln+United&image=0010.jpg

    but when i get the custom data working in the price it does not print the new pricelist with the data from the custom data only the default i put in when i was setting up zenpaypal in the admin plugin options.

    If i put zenpaypal() instead of

    $prices = getImageCustomData();
    if (!empty($prices)) {
    $pricelist = zenPaypalPricelistFromString($prices);
    zenPaypal($pricelist);
    }

    the custom data is not used but the zenpaypal() works on every image but at the same prices.
  • Can you post an example of the Custom data you are using?

    The reason I ask is that from my limited knowledge of php you are still asking for the standard paypal price list(zenPaypal($pricelist);) and hence that is what you are getting.

    I abandoned the use of this plugin myself and went with a third party cart system built into ZP, however I am interested to watch and read about how this paypal (and other payment systems) get integrated better into ZP.
  • the custom data is 10x15:glossy=5.00 which works on the price list that is a drop down menu but does not print this info on my page so you can see it all the time.
  • Got the individual price list now working,
    cheanged the zenpaypal.php to this from
    <?php
    if ($pricelistlink) {
    zenPaypalPrintPricelist($pricelist, $text, $textTag, $idtag);
    }
    ?>

    Can i add custom data for an album so it applies the prices to all pics in that album instead of doing each picture at a time?

    Thanks
    Ian
  • I'll get your fix into the nightly build tonight. Thanks.

    Sorry, there is no mass-edit for images. You could do that with an SQL query, though. There is probably an SQL management tool on your site such as phpMyAdmin.
  • acrylian Administrator, Developer
    If you really want all images in one album to have the same pricelist you could use the album custom data the same way as the image one.
  • acrylian, i did do that but it does not display anything when i do that. no paypal buttons or anything.
  • If nothing is displaying, usually there is some kind of error occurring. What was your code to use the album custom data?
  • The only code i put into image.php is
    $prices = getImageCustomData();
    if (!empty($prices)) {
    $pricelist = zenPaypalPricelistFromString($prices);
    zenPaypal($pricelist);
    }

    do i need to put something else to make it check for album cutom data?

    sorry for sounding thick but i hae never dealt with php before.

    Ian
  • acrylian Administrator, Developer
    It should work if you add the price list to the album custom field and then use `http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetAlbumCustomData instead of the image one.

    Note I never used the paypal plugin nor am I familiar with it at all.
  • What code would i put in if i wanted it to check to see if the image custom data is empty, then if it is empty use the album data?
  • pischla Member
    Hi!
    Thought I would share my lines of code that I put in image.php to get "getImageCustomData" and "getAlbumCustomData" to work together:

    `
    <?php $prices = getImageCustomData();
    if (!empty($prices))
    {
    $pricelist = zenPaypalPricelistFromString($prices);
    zenPaypal($pricelist);
    }else {$prices = getAlbumCustomData();
    $pricelist = zenPaypalPricelistFromString($prices);
    zenPaypal($pricelist);
    }
    ?>
    `
    Took me a while to realize that I had to remove ";" after if empty to get it working...

    regards, pischla
  • pischla Member
    Here's a refined code that hides the paypal function if there are no prices for an album or image:

    `
    <?php $prices = getImageCustomData();
    $aprices = getAlbumCustomData();
    if (!empty($prices))
    {
    $pricelist = zenPaypalPricelistFromString($prices);
    zenPaypal($pricelist);
    }elseif (!empty($aprices))
    {
    $pricelist = zenPaypalPricelistFromString($aprices);
    zenPaypal($pricelist);
    }

    ?>
    `
    /pischla
  • I would also like to set individual pricing for images in albums. But I am having trouble implimenting it.
    Paypal plugin installed fine. Super in fact. I also got the Nopaypal option working no problem. Insrtructions were very clear.
    However when i try the last two blocks of code above in image.php. It doesn't work.
    Can someone help confirm I have the following correct.
    1.Add to image.php
    <?php $prices = getImageCustomData();
    if (!empty($prices))
    {
    $pricelist = zenPaypalPricelistFromString($prices);
    zenPaypal($pricelist);
    }else {$prices = getAlbumCustomData();
    $pricelist = zenPaypalPricelistFromString($prices);
    zenPaypal($pricelist);
    }
    ?>

    or add
    <?php
    $prices = getImageCustomData();
    if (!empty($prices)) {
    $pricelist = zenPaypalPricelistFromString($prices);
    zenPaypal($pricelist);
    }
    ?>
    2. Add to options>plugins> zenpaypal > the pricelist field eg
    4x6:Paper Matte Thin=5.75|8x10:Xtrem Glossy=20.00|11x14:Paper=15.35

    3.Add to album> choose gallery > choose images tab > paste in Special data field - the different pricelist eg
    20x30:Paper Matte Thin=5.75|8x10:Xtrem Glossy=50.00
    is that correct formatting for the Special data field??

    Fatal error: Call to undefined function zenpaypalpricelistfromstring() in /home/public_html/gal2/themes/mytheme/image.php on line 77

    Can anyone see what i missed or i am doing wrong.
    Many thanks for any guidance.
  • Hi
    Has anyone got multiple price lists working on the paypal plugin?
    Or have I misinterpreted the features built in?
    I followed instructions as far as I could,I have been through plugin help plus checked instructions on all relevant forum posts. I am still getting the following error.
    Fatal error: Call to undefined function zenpaypalpricelistfromstring() in /home/public_html/gal2/themes/mytheme/image.php on line 77
    I inserted data in the image special/custom data field.
    Any guidance really appreciated.
  • The plugin's function names have changed since these older posts (a year old!). I haven't used this plugin, but I believe you should be able to change `zenPaypalPricelistFromString()` with `getZenPayPalPriceList()` to get it to work.
  • Hi kagutsuchi

    Thank you for the reply. I tried this and it has removed the error which is a step in the right direction... but still no joy getting it all working. No change in status. The default payment list still displays.
    Any other guidance much appreciated
    cheers
    e
Sign In or Register to comment.