Jump to content

Custom Module CSS


Recommended Posts

Hello Everyone,

 

I'm having a CSS-related issue, actually a few of them that are probably interrelated. I wrote a very simple module: basically just a glorified button that links to a certain page on the site. After upgrading Prestashop, the CSS broke but the module worked fine. I fiddled with it and got it to work again, but I just discovered that the CSS breaks on most of my CMS pages and also my individual product pages. It works fine on my category pages and home page.

 

it also may be helpful to know that CCC causes this module's CSS to break entirely...which I would also like to know how to fix, but one thing at a time :)

 

Here's the portion of the module.php file that links the CSS:

 

public function hookHeader($params)
 { Tools::addCSS($this->_path.'css/blockcustombutton.css', 'all'); }

public function hookLeftColumn()
 { global $css_files;
$css_files['modules/blockcustombutton/css/blockcustombutton.css'] = 'all';
return '<div class="block"><a id="commission-button" href=" '. Configuration::get($this->name.'_buttonlink') . ' "><span>'. Configuration::get($this->name.'_buttondisplay') . '</span></a></div>'; }

 

My CSS looks like:

 

#commission-button
{ display: block; width: 281px; height: 66px; background: url("commission-button.gif") no-repeat 0 0; }
#commission-button:hover
{ background-position: 0 -66px; }
#commission-button span
{ position: absolute; top: -999em; }

 

On a different yet probably related note, I've been trying to do things correctly by putting this module in my theme directory instead of the shop root, but I can never get Presta to recognize it here. It works perfectly in the root directory. Any advice?

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