Staff replied EasyStore Joomla 6 v3.1.1

PaypalPayment::renderSmartButtonsPage()` Hardcodes Layout Path and Ignores Template Overrides

Asked by Philip S. Hempel 3 days ago Last activity 3 days ago

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_easystore 3.1.1
  • Joomla Version: 6.2.0 (PHP 8.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

  1. Enable Direct PayPal Checkout in plg_easystore_paypal (2.1.1).
  2. Create a template override at templates/<active_template>/html/layouts/com_easystore/directCheckout/default.php.
  3. Proceed to PayPal checkout; plugins/easystore/paypal/src/layouts/directCheckout/default.php is rendered instead of the com_easystore template 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);

1 reply

Mehtaz Afsana Borsha Staff

Hi,

Thank you for the detailed bug report and for providing the reproduction steps and proposed patch.

We appreciate your efforts in identifying this issue with the EasyStore PayPal plugin.

Based on your findings, the hardcoded layout path in renderSmartButtonsPage() appears to prevent Joomla template overrides from being applied to the PayPal Direct Checkout page.

Your proposed solution provides a possible workaround by checking for a template override before falling back to the plugin's default layout. However, we'll need to review its compatibility with Joomla's layout rendering system and ensure it doesn't affect existing checkout functionality.

We'll forward your findings and suggested patch to our development team for further investigation and review.

Thank you again for your valuable contribution and for helping us improve EasyStore.

Best regards,

Log in to reply.