Problems, need help? Have a tip or advice? Post it here.
17 posts Page 1 of 2
Hello,

I'am testing paypal function.
I use Ajax in the website, for example :
http://www.domaine.com/#index it's a page
http://www.domaine.com/#page it's an another page

After validation of paypal I'm return on http://www.domaine.com/index.php...

How I can return on my real page ?

I see the price after the button, how i can hide it ?
Hi,

'paypal_button' tag is hard-coded to return to the canonical URL of the current page i.e the k_page_link variable.
This variable, however, does not take the additional parameters you are specifying into consideration.

I think, instead of the return URL being hard-coded, the 'paypal_button' tag should be given an extra parameter where any return URL can be specified.
We have taken note of this and the next release of Couch will have this amendment.

As for the second query (price after the button, how i can hide it ?), could you send in a screenshot of what you mean?
Hi,

where I can add/modify files for take a return attribut ?

For the capture, i attach the file to the post. You can see "10" and "0" after the button.
The code:
Code: Select all
<cms:paypal_button image='7' />
         <cms:editable name='pp_price' label='Price' desc='Somme En Euro (maximum 2 chiffres apr&egrave;s la virgule)'
              maxlength='10'
              search_type='decimal'
              validator='non_negative_decimal'
              type='text' />
         <cms:paypal_button image='5' />
         <cms:editable name='pp_price2' label='Price2' desc='Somme En Euro (maximum 2 chiffres apr&egrave;s la virgule)'
              maxlength='10'
              search_type='decimal'
              validator='non_negative_decimal'
              type='text' />

Attachments

The numbers that you see are the output of the editable tags.
You can suppress the output by adding a hidden='1' parameter, like this -

Code: Select all
<cms:editable name='pp_price' label='Price' desc='Somme En Euro (maximum 2 chiffres apr&egrave;s la virgule)'
              maxlength='10'
              search_type='decimal'
              validator='non_negative_decimal'
              hidden='1'
              type='text' />
Coming back to your return page problem -
paypal_button tag outputs a form that contains relevant info about the item being sold.
Instead of using the tag, we can manually code the form putting into it all the needed values.
The following mimics exactly what the tag does -

Code: Select all
<cms:if pp_price >
   <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
   <input type="hidden" name="cmd" value="_xclick"/>
   <input type="hidden" name="business" value="seller_123456789_biz@gmail.com"/>
   <input type="hidden" name="item_name" value="<cms:show k_page_title />"/>
   <input type="hidden" name="item_number" value="<cms:show k_page_id />"/>
   <input type="hidden" name="amount" value="<cms:show pp_price />"/>
   <input type="hidden" name="undefined_quantity" value="1"/>
   <input type="hidden" name="no_shipping" value="1"/>
   <input type="hidden" name="no_note" value="1"/>
   <input type="hidden" name="currency_code" value="USD"/>
   <input type="hidden" name="rm" value="2"/>
   <input type="hidden" name="return" value="<cms:show k_page_link />"/>
   <input type="hidden" name="cancel_return" value="<cms:show k_page_link />"/>
   <input type="hidden" name="notify_url" value="<cms:show k_page_link />?paypal_ipn=1"/>
   <input type="image" border="0" alt="Make payments with PayPal - it?s fast, free and secure!"name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif"/>
   <img width="1" height="1" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt=""/>
   </form>
</cms:if>


Make changes to the input named return to set the desired return page.
Also take care to fill in the rest of the values as appropriate for your situation (e.g. paypal's address is sandbox or live, the seller's email, currency etc.).
Please note that the URL set in the input named notify_url needs to have the ?paypal_ipn=1 appended for the paypal_processor to work correctly.

Please let me know if this helps.
Ok

I understand the manipulation.

There are a way to change a script of CouchCMS to add a "return" param ?

Other question:
How I can clean the database ? I test all fonctionnality, but when I delete it on my page, some things stay in administration panel !

EDIT:
I add :
<input type="hidden" name="business" value="<cms:show k_paypal_email />"/>
but it doesn't work.

EDIT 2:
When I use the first code, now in the input name="amount", I have the same value. In admin panel the value are different.
There are a way to change a script of CouchCMS to add a "return" param ?
Not in the current version, as I admitted before. The hand coded form may be used to circumvent the problem.

Other question:
How I can clean the database ? I test all fonctionnality, but when I delete it on my page, some things stay in administration panel !

Once you delete an editable region, the admin panel will sense this and show the deleted regions in red and prompt you to remove them completely.
Are you sure you refreshed (revisited) the changed template as super-admin for the changes to be picked up?

EDIT:
I add :
<input type="hidden" name="business" value="<cms:show k_paypal_email />"/>
but it doesn't work.

There is no system variable named k_paypal_email. You'll have to hard-code the address here.

EDIT 2:
When I use the first code, now in the input name="amount", I have the same value. In admin panel the value are different.

Not sure if I understood the question.
But from your first snippet I see that you are using a field named 'pp_price2'.
A paypal button is usually associated with only one item and one item is represented by one page and that one item can have only one price (hence only one pp_price field). Maybe that is the problem.
KK wrote: There are a way to change a script of CouchCMS to add a "return" param ?
Not in the current version, as I admitted before. The hand coded form may be used to circumvent the problem.


Ok

KK wrote: Other question:
How I can clean the database ? I test all fonctionnality, but when I delete it on my page, some things stay in administration panel !

Once you delete an editable region, the admin panel will sense this and show the deleted regions in red and prompt you to remove them completely.
Are you sure you refreshed (revisited) the changed template as super-admin for the changes to be picked up?


It's ok, delete work in admin panel

KK wrote: EDIT:
I add :
<input type="hidden" name="business" value="<cms:show k_paypal_email />"/>
but it doesn't work.

There is no system variable named k_paypal_email. You'll have to hard-code the address here.


I can't use the variable specified in config.php ?
Code: Select all
// 18.
// Email address of your PayPal 'business' account selling the item
define( 'K_PAYPAL_EMAIL', 'xxxxx' );


KK wrote: EDIT 2:
When I use the first code, now in the input name="amount", I have the same value. In admin panel the value are different.

Not sure if I understood the question.
But from your first snippet I see that you are using a field named 'pp_price2'.
A paypal button is usually associated with only one item and one item is represented by one page and that one item can have only one price (hence only one pp_price field). Maybe that is the problem.


It's true, in my page 3 paypal buttons appears in a table. How i can do that ?
I can't use the variable specified in config.php ?

That variable in config.php is a PHP variable, not Couch variable.
You'll have to either hand code it again or use this to call PHP for getting the variable -
Code: Select all
<input type="hidden" name="business" value="<cms:php>echo K_PAYPAL_EMAIL; </cms:php>"/>

.. in my page 3 paypal buttons appears in a table. How i can do that ?

The way paypal_button works in Couch is this (and you'll find the full discussion at http://www.couchcms.com/docs/concepts/paypal.html ) -
Each item to be sold is given an entire page.
Thus, for example, you can have a template called products.php. Make it clonable and then create multiple pages out of it where each page will stand for a separate item.
The page's title will become the item's name and the pp_price field will be the item's price.

Point is, we can have only one price for an item (remember it is a simple Paypal integration). If you need multiple prices, you'll have to create as many pages (i.e. multiple items).

So basically, one item can have only one PayPal button.

Of course you can always list multiple items on a single page and then there can be as many buttons on the page as there are items being displayed.
So, if for example you have six cloned pages of template product.php, the following snippet will list all the six and show six PayPal button - one for each item:
Code: Select all
<cms:pages masterpage='products.php'>
   <h2>Product Name: <cms:show k_page_title /></h2>
   <cms:paypal_button />
</cms:pages>


Hope the answer helps.
First, thank KK,

In fact, the item isn't really un product.

It's a service with differents options. I would like to present this in a table, like the hotfile premium page (http://hotfile.com/premium.html).

There are no description page by service because there are only one.

So if I understand, I must do manually the paypal button.
Is it that ?
17 posts Page 1 of 2