I need the amount of payment required for publishing an advert to be arbitrarily chosen by the user. I have a CCK type which requires payment to be posted... There is actually a field called AMOUNT!

How can I charge the user the AMOUNT he chooses, using LM Paypal? I know this should involve custom coding... Where should I start?

Comments

alfredolopez’s picture

The cck depends on what version you're using but are you doing a customized template with the cck? It's relevant to the answer.

Anyway, the Paypal button you put on your page (or the template for your advert) has something like this in it

<input type="hidden" name="amount" value="25">

or something like where the value is the value you're chosen to charge.

You can leave it totally blank in the button with

<input type="text" name="amount" value="">

and you'll get a box that's blank. User puts in a number and that will go to Paypal as the amount.

(btw, the difference is the form field type which is "text" rather than "hidden")

Or, if the amount is coming from a cck form (as it appears to be in your case) and the field name is

field_amount

You could use something like

<input type="text" name="amount" value="<?php print $field_amount[0]['view']; ?>">

in the button code and the amount the person enters in the cck type form should pass to Paypal.

Not sure how it will work for you because I don't know what your situation is. It's a bit unclear to me from your description but that's the general idea. It's the "text" rather than "hidden" that makes the change. Hope that helps.

Alfredo

john franklin’s picture

Status: Active » Closed (fixed)

Closing all 5.x and earlier issues. If this is still an issue, please reopen and update with 6.x or 7.x details.