Jump to content

New CSS for Cart Module not "seen" in Prestashop 1.5.3


madc

Recommended Posts

I am using Prestashop 1.5.3 under local host XAMPP.

In order to modify the shopping cart to my liking, I have created a new cart module by just copying the stardard "blockcart" module to another name. In this cart I am going to make the modifications on the CSS according to the general layout of my webshop. I modified all the file names and strings from blockcart to the new module name. Within the .php file in the function hookRightColumn(...) I also included a new line adding the new CSS file I want to use to change the layout of my shopping cart,

 

$this->context->controller->addCSS(($this->_path).'myblockcart.css', 'all');

 

Within the corresponding .tpl file I also changed the entries "mod=blockcart" to the new module name.

So I thought I had made all the necessary changes in order to install the module and starting making the necessary changes in the CSS file. The module installs all right and I can hook it to the right column hook.

 

My problem is that all changes I make on the CSS file do not have any effect on the module layout!!! :( I am using Firebug in Firefox to trace the changes, and I see that the elements of the module template .tpl file keep on using CSS from "global" instead of my new "myblockcart.css"..... Weird!!

I already tried several times to clear the buffer/cache of my browser and still no result..... Please can anybody help me with this issue ? I am getting kind of desperate here....

Link to comment
Share on other sites

Hi Alexander,

 

Thank you for your reply to my post. I read the article and understand how the module could be overridden. However in my special case (modify the cart layout when hooked to the right column) I had to include the line with "addCSS" to the function hookRightColumn. This is because the standard module uses the standard blockcart.css exclusively when hooked to the header of the page. When hooked in the columns the template uses CSS coming from the "global" CSS file. In summary I need to modify the PHP file itself, and I do not see the possibility to override it. Am I correct about it, and do you see any other workaround ?

 

Thanks and have a nice day.

 

P.S: I already tried to uninstall the standard module blockcart to avoid any conflict with the new module "myblockcart".

Link to comment
Share on other sites

Alexander,

 

Sorry but I do not know what DOM means... Can you explain me this term? :unsure:

To clarify my last post: I do not know if it is possible to override a module PHP file in the themes/ directory, as it is possible to do with .tpl .css or .js files. Is it possible? Otherwise it seems I do not see any other solution than to create a new cart module and change it to my liking.

 

Cheers,

 

Dirceu.

Link to comment
Share on other sites

Alexander,

 

Answering your question: the line

$this->context->controller->addCSS(($this->_path).'myblockcart.css', 'all');

is supposed to enter the myblockcart.css into the DOM, however it seems that the "myblockcart.tpl" file is not seeing the new CSS file, and keeps on

getting information from the "global" CSS instead.... :( Very strange.......

 

Regards

Link to comment
Share on other sites

I took care to define an unique "id=" to the particular tag on the .tpl file, but it could be that I was not strict enough for "him" to understand it. Could you tell me what do you mean by "!important postfix"?

 

Cheers,

 

Dirceu.

Link to comment
Share on other sites

Alexander,

 

Thank you very much for your suggestions. The problem with the CSS is solved, and indeed I was too strict with the style in the CSS file. I played around a bit with the "id" and "class" in the .tpl file until it showed the correct layout.

 

Regards

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