Problem using 2 hooks

Hi,



I don’t know if I have done this correctly, but I am trying to make adjustments to 2 css files (dropdown.css & styles.css) by using hooks. I made the styles.post.tpl file first containing the following code :




and put this file in the my_changes/hooks/index folder. Then I created my styles.css file (with the changes) and placed it in the /my_changes folder. This worked fine.

I am now trying to make a second hook for dropdown.css in the same way I did with styles.css, the only difference being the file dropdown.post.tpl contains :



and I have made the dropdown.css file and put it in the /my_changes folder. This doesn't work, and I have cleared the /compile and /cache folders, but still no luck.

Does anyone know why please?

[quote name=‘mikee’]Hi,



I don’t know if I have done this correctly, but I am trying to make adjustments to 2 css files (dropdown.css & styles.css) by using hooks. I made the styles.post.tpl file first containing the following code :




and put this file in the my_changes/hooks/index folder. Then I created my styles.css file (with the changes) and placed it in the /my_changes folder. This worked fine.

I am now trying to make a second hook for dropdown.css in the same way I did with styles.css, the only difference being the file dropdown.post.tpl contains :



and I have made the dropdown.css file and put it in the /my_changes folder. This doesn't work, and I have cleared the /compile and /cache folders, but still no luck.

Does anyone know why please?[/QUOTE]

Hello mikee,

In this case you need to add the following code to the "styles.post.tpl" file, located in the "my_changes/hooks/index" directory:

```php

```

You do not need to create the "dropdown.post.tpl" file.

Thank you.

---
Mikhail Ponomarev
CS-Cart Support team

Thanks Mikhail, that worked! Would I just follow this method when adding more hooks?

Remember that css is “cascading”. No matter how many files, selectors or class definitions you have, it will all end up being one set of styles.



I would suggest that you:

  1. name your custom css file something unique (like my_local_styles.css or something)
  2. Put any style changes you have in this file. It should be loaded last and anything that you do will superceed any previous definitions in all the standard files.



    The reason for the unique name is to avoid confusion when using tools like firebug, etc.

Thanks for the help.

[quote name=‘mikee’]Thanks for the help.[/QUOTE]



You are welcome!

I have copied the /mychanges folder from my live website to my /dev folder (for upgrade testing), but it isn’t making the desired changes to my /dev website. Do I need to change the path settings in my_changes/hooks/index/styles.post.tpl? If so, where would I add the /dev folder in the path?



Many thanks.

If you have your dev store configured properly and are using template variables for the path to the root of the skin {$config.skin_path} then it should all be done dynamically. If you’ve hard-coded paths then they need to be adjusted.

Thanks for that, I forgot to configure the .htaccess file!! Works now :slight_smile: