Jump to content

How to override .tpl files of the PayPal Module?


babu_babu

Recommended Posts

I try to override shop/modules/paypal/views/templates/front/paypal.tpl and tried to add a modyfied version in shop/themes/myTheme/modules/paypal/views/templates/front/paypal.tpl , but prestashop doesn't switch to the new file.

 

How to do this? And how can I debug this?

 

I'm running PrestaShop 1.4.3 and PayPal module v3.0.6.

 

Thanks!

Edited by babu_babu (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Thanks, but it doesn't work.

 

Did you ever figure this one out? I'm using a paypal pro module from egrove and overrides don't work. Just so everyone knows.

 

I created a copy of the module folder and the tpl file I edited and placed it in the themes/mytheme/modules folder...so I did the override correctly but it just doesn't work. Only able to edit the tpl file from the root/modules folder which is obviously undesirable.

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hello,

 

You cannot, because in the paypal module :

 


public function fetchTemplate($path, $name, $extension = false)
{
if (_PS_VERSION_ < '1.4')
$this->context->smarty->currentTemplate = $name;

return $this->context->smarty->fetch(_PS_MODULE_DIR_.'/paypal/'.$path.$name.'.'.($extension ? $extension : 'tpl'));
}

 

They have hardcoded this instead use the Prestashop core function. I hope it's a bug, I may add it to their JIRA?

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

I don't have time to log this with them, but you can fix this by the following in PrestaShop 1.5

 

Line 320 of /modules/paypal/paypal_abstract.php, change:

return $this->context->smarty->fetch(_PS_MODULE_DIR_.'/paypal/'.$path.$name.'.'.($extension ? $extension : 'tpl'));

to:

return $this->display('paypal', $path.$name.'.'.($extension ? $extension : 'tpl'));

 

Then copy the tpl files from the Paypal module to your theme. For instance, I've copied:

/modules/paypal/views/templates/front/express_checkout/express_checkout.tpl

to:

/themes/my-cool-new-theme/modules/paypal/views/templates/front/express_checkout/express_checkout.tpl

 

Hope this helps someone.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I can confirm that 4mdev's fix works on Prestashop 1.5.2. It's a sin that they hard coded it plus hard coded the style information directly onto the div making it impossible to update just your Global Style sheet.

 

4mdev, you should submit this as a fix to the GitHub repository.

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...