Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: How to change PayPal button displayed on checkout/cart page?  (Read 4742 times)

Offline Geoffrey

  • Full Member
  • ***
  • Posts: 153
  • Karma: +28/-3
    • View Profile
My site uses only guest checkout, no registration. 

My only payment extension is default_pp_express.  Once I have it set up, I plan to load and use other additional payment methods, but for now, I only have this one payment extension loaded. 

When I setup the extension, I chose the particular paypal icon button that I want to use.  It's a standard jpg icon from Paypal.  I loaded it in the Storefront Icon box during extension setup.  It is saved in my root resources/image folder. 

This part works. 
It places my specified PP icon in the Payment Method window on the guest_step_2 page.   

However, the extension is using a different icon on the checkout/cart page.  I want to change it to use "my" preferred icon. 

I think I found the correct file to modify:
site/extensions/default_pp_express/storefront/controller/blocks/default_pp_express_button.php

Here are lines 27-28 of this file:
Code: [Select]
$this->data['image_src'] = 'https://www.paypal.com/'.$locale[1].'/i/btn/btn_xpressCheckout.gif';
$this->data['href'] = $this->html->getSecureURL('r/extension/default_pp_express/set_pp');

I have tried to replace the image_src link to point at my file in my root resources/image folders, but I encountered 2 problems:
1 - It didn't change the image, i think because i don't know how to code this properly.
2 - It didn't even break anything.  The wrong icon still appeared on the checkout/cart page, as though I hadn't changed anything, despite clearing cache everywhere. 

How can I change the paypal button image displayed on the checkout/cart page from the standard PP button specified in the file above to a different PP button jpg saved in my resources/image folders?

An example would be great!

Thanks!

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: How to change PayPal button displayed on checkout/cart page?
« Reply #1 on: July 08, 2017, 05:22:27 PM »
Correct file is https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_pp_express/storefront/view/default/template/blocks/default_pp_express_cart_button.tpl

Or any other file in https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_pp_express/storefront/view/default/template/blocks/

To check what template file is loaded check extension hook file:
https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_pp_express/core/default_pp_express.php

See line 122:
Code: [Select]
$that->view->addHookVar('post_cart_buttons', $view->fetch('blocks/default_pp_express_cart_button.tpl'));

And line 129:
Code: [Select]
$that->view->addHookVar('pre_top_cart_buttons', $view->fetch('blocks/default_pp_express_cart_button.tpl'));

You can edit
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline Geoffrey

  • Full Member
  • ***
  • Posts: 153
  • Karma: +28/-3
    • View Profile
Re: How to change PayPal button displayed on checkout/cart page?
« Reply #2 on: July 08, 2017, 06:05:39 PM »
Thanks! 

This will take me a little bit, but i will give it a try and post results. 

Offline Geoffrey

  • Full Member
  • ***
  • Posts: 153
  • Karma: +28/-3
    • View Profile
Re: How to change PayPal button displayed on checkout/cart page?
« Reply #3 on: July 08, 2017, 11:08:32 PM »
OK, thanks again!  Got it.

Correct file is https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_pp_express/storefront/view/default/template/blocks/default_pp_express_cart_button.tpl

Or any other file in https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_pp_express/storefront/view/default/template/blocks/

The four files referenced above did not specify an image file to change, which was my goal.
 
To check what template file is loaded check extension hook file:
https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_pp_express/core/default_pp_express.php

While examining this file, I saw on line 103 the same call for the same PayPal icon gif that I referenced in my OP. 

I changed line 103 from:
Code: [Select]
$data['image_src'] = 'https://www.paypal.com/'.$locale[1].'/i/btn/btn_xpressCheckout.gif';to:
Code: [Select]
$data['image_src'] = 'resources/image/18/71/f.png';
It worked!  I now have a better paypal icon, one without paypal's "safer" marketing blurb, which I did not want. 

If anyone is interested, I attached the icon I am using.  My site bg is white, so I didn't make it transparent. 

FYI to other noobs: the resource folder designated above is on the site root.  The 18 and 71 folder designations are almost certain to be site specific.  These folders get created and filled in an apparently unpredictable manner when you populate your site with image files.  In other words, choose an image file, load it into AC, then go find which folder that AC put the file in.  Then link to that series of folders.  It likely won't match my 18 & 71 path.

Also FYI: this small edit to core files will get wiped every update.  Keep a list of all your core edits, so that you can go back and re-do them after they get wiped by future updates.  So far, this is my only core edit on a pretty massively customized AbanteCart site.  I may only have one other to add to the list: the Review Stars elimination I asked about in a different thread.  Generally, you should make all customization edits to a template extension clone, because they won't get wiped by updates.  See AbanteCart docs, search "Clone Template Developer Tools".  If i can do it, anyone can. 

See line 122:
Code: [Select]
$that->view->addHookVar('post_cart_buttons', $view->fetch('blocks/default_pp_express_cart_button.tpl'));

And line 129:
Code: [Select]
$that->view->addHookVar('pre_top_cart_buttons', $view->fetch('blocks/default_pp_express_cart_button.tpl'));

You can edit

What I learned from the last bit is to pay more attention to these hook calls so i can see what tpl file is being loaded instead of having to ask all the time which file controls what. 

Thanks much!

 

Powered by SMFPacks Social Login Mod