PaypalPayment::renderSmartButtonsPage() Hardcodes Layout Path and Ignores Template Overrides
- Product: JoomShaper EasyStore PayPal Plugin (
plg_easystore_paypal) - Product Version:
2.1.1 - Component Version:
com_easystore3.1.1 - Joomla Version:
6.2.0(PHP8.4) - File:
plugins/easystore/paypal/src/Extension/PaypalPayment.php(renderSmartButtonsPage(), lines 1011-1013)
What the Bug Is
PaypalPayment::renderSmartButtonsPage() passes $layoutPath = JPATH_ROOT . '/plugins/easystore/paypal/src/layouts' as the third argument ($basePath) to LayoutHelper::render('directCheckout.default', $layoutData, $layoutPath). Because the standalone layout directCheckout/default.php renders its own <!DOCTYPE html> document with hardcoded light-mode colors (background-color: #f8fafc, .easystore-paypal-card { background: #ffffff }) and $basePath overrides standard com_easystore layout lookup, dark-mode templates cannot cleanly override it under templates/<template>/html/layouts/com_easystore/directCheckout/default.php.
How to Reproduce It
- Enable Direct PayPal Checkout in
plg_easystore_paypal(2.1.1). - Create a template override at
templates/<active_template>/html/layouts/com_easystore/directCheckout/default.php. - Proceed to PayPal checkout;
plugins/easystore/paypal/src/layouts/directCheckout/default.phpis rendered instead of thecom_easystoretemplate layout override.
Fix (Unified Patch Against Clean plg_easystore_paypal 2.1.1)
--- a/plugins/easystore/paypal/src/Extension/PaypalPayment.php
+++ b/plugins/easystore/paypal/src/Extension/PaypalPayment.php
@@ -1008,7 +1008,11 @@
header('Content-Type: text/html; charset=utf-8');
- $layoutPath = JPATH_ROOT . '/plugins/easystore/paypal/src/layouts';
+ $template = $this->app->getTemplate();
+ $override = JPATH_THEMES . '/' . $template . '/html/layouts/com_easystore/directCheckout/default.php';
+ $layoutPath = is_file($override)
+ ? JPATH_THEMES . '/' . $template . '/html/layouts/com_easystore'
+ : JPATH_ROOT . '/plugins/easystore/paypal/src/layouts';
echo LayoutHelper::render('directCheckout.default', $layoutData, $layoutPath);