Is it possible to insert information from a node, into another as a button? What I want to do ultimately, is as follows:

  • I have a node for a book, that includes its title, author, ISBN and price.
  • I can already insert the title and price into another node.
  • But I'd like to be able to create a Paypal "Buy" button from the node information, which requires certain form information:
    <form name="f7" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="submit" border="0" value="Add" sc="cart.gif" name="submit" alt="Buy" />
    <input type="hidden" name="add" value="1" />
    <input type="hidden" name="cmd" value="_cart" />
    <input type="hidden" name="business" value="QQ4DK3RFE22PC" />
    <input type="hidden" name="item_name" value="BOOK TITLE GOES HERE" />
    <input type="hidden" name="item_number" value="ISBN No GOES HERE" />
    <input type="hidden" name="amount" value="PRICE GOES HERE" />
    <input type="hidden" name="cn" value="Notes" />
    <input type="hidden" name="currency_code" value="GBP" />
    <input type="hidden" name="bn" value="PP-ShopCartBF" />
    <input type="hidden" name="no_shipping" value="2" />
    </form>

Comments

AlexisWilke’s picture

Hi ianstresman,

Well... 8-)

Everything is possible but this is just way too specialized for this very module.

However, this being said, we may want to have a way to let people write a hook and code a function to generate such complex entries.

Could you write that code if I were to offer you the hook?

Thank you.
Alexis Wilke

iantresman’s picture

Unfortunately I don't have the skills, but thanks for the offer.

AlexisWilke’s picture

iantresman,

If you can pay for that specialized module, I can still do it.

Thank you.
Alexis

iantresman’s picture

I'll keep that in mind. Thanks.

AlexisWilke’s picture

Assigned: Unassigned » AlexisWilke

Hi iantresman,

It seems to me that this is now possible since you can include CCK fields with the cck parameter. So all you have to do is include your form and for the parameters, use one of the CCK field as in:

<input type="hidden" name="item_number" value="[node:123 cck=field_isbn;]" />

Does that sound reasonable?

Thank you.
Alexis

iantresman’s picture

You're good, and fast. Do you do house decorating? :-)

Thanks for all your help, appreciated.

AlexisWilke’s picture

He! He! Is this sarcastic?! 8-)

If house decorating means displaying all the computers & parts I have, then yes.

Let me know if that works for you so we can mark this entry as fixed.

Thank you.
Alexis

iantresman’s picture

Looking good, but a minor bug. If I add:
<input type="hidden" name="item_name" value="[node:* cck=title;]" />

It should produce:
<input type="hidden" name="item_name" value="Node title" />

But it adds some superfluous tags:
<input type="hidden" name="item_name" value="<span class="insert-node insert-node2 insert-nid62">Make button</span>" />
... and the <span> tags break the form <input> tag.

Here's a test block of code if you need it:

Item: [node:* cck=title;]
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="submit" border="0" value="Add" sc="cart.gif" name="submit" alt="Buy" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="business" value="QQ4DK3RFE22PC" />
<input type="hidden" name="item_name" value="[node:* cck=title;]" />
<input type="hidden" name="item_number" value="ISBN No GOES HERE" />
<input type="hidden" name="amount" value="PRICE GOES HERE" />
<input type="hidden" name="cn" value="Notes" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="bn" value="PP-ShopCartBF" />
<input type="hidden" name="no_shipping" value="2" />
</form>
AlexisWilke’s picture

Status: Active » Fixed

Okay!

I added two more keywords: plain and repeat.

To use those properly, it is a bit tricky, you want to use plain to avoid the <span> tag in the input tags.

And the repeat is used at the top (where you include the macro) so the content being included is filtered too (repeat filter on the output).

More info in my doc here:

http://www.m2osw.com/doc_insert_node_macro

Thank you.
Alexis

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.