Support » Plugin: PayPal IPN for WordPress » Confused about processing after ipn

  • Resolved jwest100

    (@jwest100)


    Hi,
    New to hooks etc. please bear with my ignorance.

    When the Ipn arrives…
    Is that when my function fires??? Or is it upon a post loading into a browser? I am trying to understand whether I need to work at the database or whether I can change inline CSS with an if then statement.

    Example:
    Page loads.
    if then statement in inline style checks for current post Id.
    If current post I’d matches $item_number created by plugin then change style value.

    How would that work???
    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor angelleye

    (@angelleye)

    IPN will not be happening within a browser at all. PayPal’s server sends the data to a listener script on your server (our plugin), which then triggers the hooks you might have setup.

    There won’t be any CSS or anything like that involved. You’ll just be building PHP code to process the PayPal transaction data passed by IPN however you need to.

    Thread Starter jwest100

    (@jwest100)

    Thanks for the reply 🙂 So here is what I want to do. Is it possible?

    -I have two divs on every post. Div A, id=”sold”, contains the word “sold” and has inline CSS style display: none;
    -Div B, id=”buy_now”, contains the PayPal buy now button and the price “$45.00” as text. It has inline CSS style display: initial;
    -The WordPress post_id is sent to PayPal in the button parameters as item_number.

    When the IPN is returned with status complete, I want to find post_id (which is PayPal item_number) and change the display of Div A and Div B in that post.
    Div A will become display: none;.
    Div B will become display: block;

    Make sense? After the sale is complete, the PayPal button disappears and the word “sold” becomes visible.
    (I sell my paintings one at a time at auction on my site. I still want the painting displayed after it is sold. It just needs to say “sold”.)

    Is this possible? If so, can you tell me how to do it? I’m not asking for code. I Just don’t understand programmatically what needs to happen 🙂 I can figure out the code once I know what the code needs to do.

    Thanks!
    James

    Plugin Contributor angelleye

    (@angelleye)

    You should add a meta data field to the product data called something like “status” and it could default to something like “available”.

    Build your post styles based on this meta data value, so if the product is available it would display your divs that way, and if the status is sold it would display that way.

    Within the IPN function you build you can update the meta data from available to sold.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Confused about processing after ipn’ is closed to new replies.