Jump to content

placing the paypal express checkout button


donnytkc

Recommended Posts

Hi, Prestashop Masters

Just a quick question, how can i move paypal express checkout button from my product footer to product actions section ?i just add:

 

 

public function hookProductActions()

{

return $this->renderExpressCheckoutButton('product').$this->renderExpressCheckoutForm('product');

}

 

into paypal_abstract.php but it doesnt work,

it seems nearly correct but i just can't figure it out ....

any people have any ideas ? thanks in advanced

:)

Edited by donnytkc (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

For Prestashop 1.5.4 This will move ( Express Checkout ) button to above ( Add to Cart ) button and keep it mobile responsive etc. It worked for me anyway!!!

 

You can go to my site at printink.com.au and click on any product to see where it is placed.

 

SO...,

 

Go to modules/paypal/paypal.php

 

IN paypal.php SCROLL DOWN TO FIND:

 

/**
  * Hooks methods
  */

 

THEN INSERT THIS CODE DIRECTLY BELOW:

 

 public function hookProductActions()
{
$content = (!$this->context->getMobileDevice()) ? $this->renderExpressCheckoutButton('product') : '';
return $content.$this->renderExpressCheckoutForm('product');
}

 

THEN GOTO TRANSPANT MODULE AND TRANSPLANT PAYPAL MODULE INTO HOOK BELOW:

 

displayProductButtons (product page actions)

 

THEN GOTO MODULES THEN POSITIONS in Back Office scroll down to Product Footer Hook and click trashcanlogo to remove PAYPAL MODULE from Product Footer Hook

  • Like 4
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

i think i solved the problem. I just moved the $HOOK_PRODUCT_ACTIONS in product.tpl over the Cart form.

 

Thanks

 

 

Can you elaborate a bit more on what you did here?  I have 1.6.0.9 and have the same issue not being able to get a response when the button is clicked.  I found $HOOK_PRODUCT_ACTIONS in product.tpl in two places:

 

The first was this line, which was just above the <form id="buy_block"> line:

 

{if ($product->show_price && !isset($restricted_country_mode)) || isset($groups) || $product->reference || (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}

 

I moved it so that it was contained inside of the form but nothing changed, it still cannot be clicked on.

 

 

The second was this line, which appears inside the form just before the closing </form> tag:

 

{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}

 

 

 

I haven't tried removing the PayPal Express module from the footer hook yet though, is that also part of the problem?

Link to comment
Share on other sites

Hi Stylepop,

 

yes first of all you should delete the footer product hook and then link the module on product Action hook (after you have put this function on paypal.php). Then you should move this line: {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} over the cart form tag (</form>). Clear the cache on your site and try.

 

Bye

  • Like 1
Link to comment
Share on other sites

Hi Stylepop,

 

yes first of all you should delete the footer product hook and then link the module on product Action hook (after you have put this function on paypal.php). Then you should move this line: {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} over the cart form tag (</form>). Clear the cache on your site and try.

 

Bye

 

Hi bissio,

 

My Paypal module is version 3.7.2 with Presta 1.6.0.9 and when I try to click "update" to get the 3.8 version like you say you have, it does not show it as having any updates available. I however updated the paypal.php to include the hookProductActions() function, then transplanted the module into displayProductButtons() and removed from productFooterHook().  I moved the line {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} from it's original location to just over the </form> tag and cleared the cache but it didn't work.  I took a look at the source and firefox showed it in red with a message saying that it does not support nested <form> tags.  I then moved the line so it was underneath the </form> tag and while I do not get the error anymore, I still cannot click on the link!

 

Any more suggestions?  Could you take a quick look at stylepop.com.au ?

 

Thanks so much for your assistance!

Link to comment
Share on other sites

Hi stylepop,

 

honestly i do not know exactly if these actions work on ps 1.6.x themes (i guess yes), however you should install Paypal version 3.8.1 first of all. Also, the "hookProductActions()" is not included into this version but you have to put it manually inside the paypal.php file (read the top of this thread).

 

Bye

Link to comment
Share on other sites

Hi,

 

I can confirm. This solution works in Prestashop 1.6.0.9, with the new Paypal module V.3.8.1.
Note that I use the defaultbootstrap theme.

 

stylepop about Paypal module update, also not appeared to me any indication update available, so I had to do the manual mode.
That is, I completely deleted the previous Paypal module and installed the new module V.3.8.1

Link to comment
Share on other sites

  • 1 month later...

Hello Stylepop, i have prestashop 1.6.0.9 (default theme) and i had the same problem that you, and the solution of changed {HOOK_ACTION_PRODUCT} didnt worked for me (i see the button but i cant click). After more of 7 hours searching the solution i solved the problem.

I went to my shopping cart and i see that these paypal button is worked. Then i open firebug and compare the two bottoms and found the answer. The paypal button of the shopping cart have one line more and i tryed to run in the bottom of products pages and is working! 

 

Thats the line, but you have to catch then in your firebug because have info for your web: <form id="paypal_payment_form" action="http://www.example.com/modules/paypal/express_checkout/payment.php" title="Pay with PayPal" method="post" data-ajax="false"> 

 

You have to put that in modules/paypal/views/template/hook/express_checkout_shortcut_button.tpl just in the end, over this </div>

<div class="clearfix"></div>.
 
I hope that work for you, bye
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

hi folks, in modules / paypal you get this option twice it seems: Choose Express Checkout and Express Checkout shortcut

Offer your customers a 3-click checkout experience what difference do they both make to PS? Also i have both set to yes, however it shows me a paypal type button, but i cant click it. anyone who wants to get this to work needs to modify code? thank you have a nice day

Link to comment
Share on other sites

hi me again :)

so adding code to paypal.php, express checkout button.php , hook onto product actions, all this worked. 

and i still have 2 paypal buttons, the top one works fine

 

the bottom doesnt click. however if i remove from product footer hook, then i have 1 paypal button and that doesnt work.

 

anyway a) to get them both to work or B) remove bottom button so top button works?

 

thank you

Link to comment
Share on other sites

  • 3 months later...

Hi Stylepop,

 

yes first of all you should delete the footer product hook and then link the module on product Action hook (after you have put this function on paypal.php). Then you should move this line: {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} over the cart form tag (</form>). Clear the cache on your site and try.

 

Bye

Hi Dear Bissio, can you kindly tell me how to " link the module on product Action hook " ? i am new..\

thank you so much

Link to comment
Share on other sites

  • 4 months later...

hi me again :)

so adding code to paypal.php, express checkout button.php , hook onto product actions, all this worked. 

and i still have 2 paypal buttons, the top one works fine

 

the bottom doesnt click. however if i remove from product footer hook, then i have 1 paypal button and that doesnt work.

 

anyway a) to get them both to work or B) remove bottom button so top button works?

 

thank you

 

Hi,

 

I added the paypal module in the hook ('productActions') 

 

the button appears and it is clickable while the button in the productFooter is not clickable.

 

Only 1 button works correctly.

 

I add also the button of paypal express in the blockcart, it works but the buttons in the shopping cart doesn't work.

 

Ps.1.6.08 and Paypal 3.10.2

 

How do you solve it?

 

Many thanks

Angela

 

 

I add the paypal button in the product

Link to comment
Share on other sites

  • 1 month later...

Add some JS in your product.js, do like this :

 

Open the product.js file

/themes/YOURTHEME/js/product.js

 

Find this code: 

 

$(document).ready(function()
{
var url_found = checkUrl();
 
 
}
 
then add the js like this:
 
$(document).ready(function()
{
var url_found = checkUrl();
 
$('#payment_paypal_express_checkout').insertAfter('#add_to_cart');
$('#payment_paypal_express_checkout').css('float', 'right');
$('#payment_paypal_express_checkout').css('margin-top', '10px');
$('#container_express_checkout').hide();
 
}

 

 

Works perfect for me !

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Ok, works now. Check it out on my webstore : http://www.carpalwatch.com/shop

 

Had to add target="_blank" in xXX_form.tpl to make it work in quick view...Anyone knows how to close quick view and load the form?

Steps:

 

1) Add the following above hookProductFooter() - Not sure if that affects it but nevertheless.

 

public function hookProductActions()

{
$content = (!$this->useMobile()) ? $this->renderExpressCheckoutButton('product') : null;
return $content.$this->renderExpressCheckoutForm('product');
}
 
Save the file. 
 
2) Add target="_blank" in <form> in express_checkout_shortcut_form.tpl
 
3) Remove {if isset($include_form) && $include_form} /if> in express_checkout_shortcut_button.tpl
 
3) Go to Transplant a module and hook Paypal to DisplayProductButtons
 

4) Remove Paypal from DisplayFooterProduct

 

5) Clear Cache and good luck!

Link to comment
Share on other sites

  • 1 month later...

Hello, following this post I was able to move paypal express checkout button from my product footer to product actions section, under the cart button on product page.

But I have a problem with quick view function: the paypal express checkout button appears in the quick view but it does not work.

Link to comment
Share on other sites

  • 6 months later...

Hi Stylepop,

 

yes first of all you should delete the footer product hook and then link the module on product Action hook (after you have put this function on paypal.php). Then you should move this line: {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} over the cart form tag (</form>). Clear the cache on your site and try.

 

Bye

 

 

not work for me

Link to comment
Share on other sites

  • 5 months later...

Hi,

I've made this mod and it works for me apart from a couple of hicups.

1. The button doesn't appear on mobiles

2. If you click on the button in quick view it works but if you cancel the transaction at the paypal screen it doesn't return you to the your site properly. You get the quick view pop up as a full page with no way to navigate off it.

Any suggestions welcome.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...