Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using paypal ec with a localised site that uses language prefixes, the path to the paypal logo is created wrong (with a language prefix), which results in a "not found" logo.
When changing the file modules/ec/commerce_paypal_ec.module line 1561 to:
function commerce_paypal_ec_mark_url() {
return preg_replace(array('|^(.*/)[a-z]+/profiles|','|^(.*/)[a-z]+/sites|'),array('$1profiles','$1sites'),url(drupal_get_path('module', 'commerce_paypal_ec') . '/images/paypal-ec-logo.gif', array('absolute' => TRUE)));
}
The language prefix is stripped out and the logo is loaded correctly.
Comments
Comment #1
joel_osc CreditAttribution: joel_osc at OpenPlus commentedI am seeing this issue too, basically on a multilingual site when you call url() you get the language prefix in the path which results in a 404 for the image logo. ie. the path returned looks like www.mysite.com/en/sites/all/modules/contrib/commerce_paypal/module/ec/im... which does not exist. I think the fix should be to just remove the url() function and use the absolute path:
I tested it and it works for me... if the maintainers think this is the correct fix I can provide a patch.
Comment #2
afagioli#1 worked fine to me.
Thanks for sharing with us
Comment #3
joel_osc CreditAttribution: joel_osc at OpenPlus commentedNoticed the code has been updated to reflect this fix, closing.