bliscar Posted August 26 Share Posted August 26 Hello ! I am trying to modify style for credit card name field and credit number field, for module "Prestashop Checkout". I am using an external custom.css file to override the style of my website, and writing this line to change style of card name input field: input.card-field-name { color: #FFF !important; background: #222 !important; border: 1px solid #555 !important; } I am using the directive !important because the original style is included in a <style> parameter inside the code. But the style does not change ... Any idea ? Thank you. Prestashop 8.1.7 Prestashop Checkout module 8.4.1.0 Link to comment Share on other sites More sharing options...
Andrei H Posted August 26 Share Posted August 26 Hello, Have you checked if the <style> tag (and the input element) is actually injected into your page? I tried to have a look through their code and I cannot find it. I think this is actually injected into an iframe - but can you double check it, please? In order for the PSPs to keep PCI compliance, they are not allowed to add card related inputs directly to your page. The way it usually works, these inputs are each loaded in separate iframes (or in a single iframe in case of a Hosted Payment Page). If the above is true, you will not be able to make the changes via CSS. Best you can do is to directly contact their development team to see if they expose any way of adding custom styles to the iframe (maybe a custom hook or something similar). Link to comment Share on other sites More sharing options...
bliscar Posted August 27 Author Share Posted August 27 10 hours ago, Andrei H said: Hello, Have you checked if the <style> tag (and the input element) is actually injected into your page? I tried to have a look through their code and I cannot find it. I think this is actually injected into an iframe - but can you double check it, please? In order for the PSPs to keep PCI compliance, they are not allowed to add card related inputs directly to your page. The way it usually works, these inputs are each loaded in separate iframes (or in a single iframe in case of a Hosted Payment Page). If the above is true, you will not be able to make the changes via CSS. Best you can do is to directly contact their development team to see if they expose any way of adding custom styles to the iframe (maybe a custom hook or something similar). Yes. You are right. The <style> tag is actually injected into an iframe. I will try to contact the support team to see how I can manage to change the style. Thank you ! Link to comment Share on other sites More sharing options...
ps8modules Posted August 27 Share Posted August 27 (edited) Hi. You can change the style even in the iframe via JQuery. Just add a few lines of code to ./themes/your theme/assets/js/custom.js (if it doesn't exist, create it). For example: $(document).ready(function() { if (prestashop.page.page_name == 'order') { /* run the script only on the order page */ if ($('#iframe').length) { /* find out if there is a PayPal iframe by its id=??? */ $('#iframe').load(function() { $('#iframe').contents().find('head').append('<style>input.card-field-name { color: #FFF !important; background: #222 !important; border: 1px solid #555 !important; }</style>'); }); } } }); Edited August 27 by ps8modules.com (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now