How do I get addons/my_changes to work ?

followed all of the steps for example 1 here:



[URL=“http://docs.cs-cart.com/common.php?dispatch=docs/view&node_name=examples1”]http://docs.cs-cart.com/common.php?dispatch=docs/view&node_name=examples1[/URL]



I’m editing the austere skin, so I created the follwoing directories:



skins/austere/customer/addons/my_changes

skins/austere/customer/addons/my_changes/hooks

skins/austere/customer/addons/my_changes/hooks/index



and the following files:



styles.css - placed in: skins/austere/customer/addons/my_changes

a, a:visited, a:hover, a:active {
color: #f27a00;
}




and



styles.post.tpl - placed in: skins/austere/customer/addons/my_changes/hooks/index





then logged into the admin, Administration tab, Addons, and verified that the “My Changes” was enabled (it was)



but any changes I make to the styles.css file have no effect.



I have treid this on my localhost and on a live server, neither work.





What do I need to do to make this work???



Thank you in advance for any help

gave up trying to get the above code to work and just started to edit the styles.css file directly, which was going fine for a while until…



the above code suddenly started working and added a second styles.css file !!!


  • even though I hadn’t been touching that code at all !!!



    So, because this decided to start working, and I don’t want to directly edit files that could get overwritten during an upgrade, I decided to go with the addons/my_changes method.



    I soon realized that my site design would require enough changes to the css that using styles.override.tpl would be a better solution than styles.post.tpl



    This should completely replace the original styles.css file with my new styles.css file



    But it’s not.



    it’s still behaving the same as if it was set to styles.post.tpl, and is loading the original styles.css file and THEN it loads my new one.



    Is there some kind of weird caching for system settings that I don’t know about ???



    Why do these addons changes not seem to take affect right away???



    Does anybody know enough about this to shed some light on my situation ???



    Thanks in advance.

did you clear the cache after making the changes?



John

[quote]

but any changes I make to the styles.css file have no effect.

[/quote]



As johnbol1 said, clear your cache via /admin.php?cc



You should also clear your browser’s cache just to be sure.



It all works fine and the info you’ve provided is also correct.

[quote]

I soon realized that my site design would require enough changes to the css that using styles.override.tpl would be a better solution than styles.post.tpl

[/quote]


  1. this is a really bad idea
  2. it will not “override” the styles.base.css nor the styles.css file specific to the skin. These “links” are not “within” the hook. The hook will only append them to what exists.



    You might want to take a look at [url]http://www.ez-ms.com/docs/customizing_your_store.pdf[/url] for more details about hooks and how they work.

Yes I finally discovered the &cc method for clearing the cache,



thanks



with regards to hooks:



excuse me if I don’t quite get this, but the other info I have read about hooks explains it like this:



the content of a “pre” hook gets "pre"pended (added before) the hook point.



the content of a “post” hook gets appended (added after) the hook point.



and the content of an “override” hook replaces the default content that would normally be loaded at the hook point.



By what you are saying, pre, post, and override hooks all behave like the post description above and only add the content after the hook point, which leads to the obvious question…



what’s the point of pre and override hooks then ?

If you’re using 2.0.15 admin.php&cc wont clear your cache, it will need to include a “dispatch” page in the url



[url]Instant Demo - CS-Cart Multi-Vendor Demo Try Free for 15 days



such as above. Assuming you figured that out, but just a helpful tip.

[quote name=‘ETInteractive’]If you’re using 2.0.15 admin.php&cc wont clear your cache, it will need to include a “dispatch” page in the url



[url]Instant Demo - CS-Cart Multi-Vendor Demo Try Free for 15 days



such as above. Assuming you figured that out, but just a helpful tip.[/QUOTE]



Not sure where you get that info from… Here’s the lines from init.php


if (isset($_GET['cc']) && (AREA == 'A' || defined('DEVELOPMENT'))) {
fn_rm(DIR_COMPILED, false);




Long before fn_dispatch();… so admin.php?cc works just fine.



@brent


[quote]

By what you are saying, pre, post, and override hooks all behave like the post description above and only add the content after the hook point, which leads to the obvious question…



what’s the point of pre and override hooks then ?

[/quote]



Here’s how it works. Pre and post work as you described above. I think what you’re missing in the way things work is the function of “priority” or “order” in which addons are processed. They are processed by priority first (lowest to highest) and then alphabetically.



When an override is encountered ,it first throws away everything (pre, post, override or original content) that has been seen so far in the “flow”. So any later override destroys any prior content. If no override, pre and post have content appended to prior pre/post. But when an override is encountered, it basically starts from scratch with the override content.



I don’t agree with the way it is done, but it is what it is and when confronted with the implications of one addon being able to effectively disable another, the response received was “it would break to many things to change the behavior”.

Thank you for all of your help tbirnseth.


[QUOTE]When an override is encountered ,it first throws away everything (pre, post, override or original content) that has been seen so far in the “flow”. [/QUOTE]

so in other words, override “overrides” the other content!!! :stuck_out_tongue:



When dealing with downloadable addons (or plugins, or modules, or whatever you want to call them) and a CMS system that uses Hooks, you always have the potential issue of having to deal with one addon overwriting another addon’s (or your own) code.



If cs-cart can set the order of this overwriting with “priorities”, then it is doing better than most other CMS’s out there.



I can’t even think how else you could do it.



How else could you decide how to choose between two addons that each want to override the same template ? Random? Biggest addon wins? Rock-Paper-Scissors? Virtual binary thumb war?



Order seems to make the most sense.



I guess the only thing you could do to make it better in this case is rename the “my_changes” folder to “zzzmy_changes” to ensure that your own changes are the last ones to overwite any templates.



with regards to priority:



Where can you set the priority ??? I see it in the addon.xml files, but is there a form somewhere in the admin section to change this, or do you have to directly edit these files?



Thanks again tbirnseth

Unlike most other “addon” architectures, cs-cart addons only allow for installation within the addon’s protected area. This applies to PHP code, controllers and skins.



Yes, override really overrides everything that was done previously.



My opinion is that when an override is encountered, it should override the “standard” or “hooked” content only (I.e. the original content). If a prior “override” was done then the new content should be appended to the existing new content just like pre and post. Otherwise no one can determine if their “override” code will ever been seen.



99% of the time, overrides are used to add “element” to a page, replacing the original. The other 1% of the time they are used to delete conent. I think 99-1 indicates that ovrerrides should behave like their counterparts.



But it doesn’t matter what I think, it behaves as described above.



The prioirity is set in the addon.xml and needs to be directly edited. If changed, an uninstall and install needs to be done to get the new xml data to be re-read and stored with the addon options in cscart_addons table.

Can somone please tell me how to load the my_changes folder if it is not in my addons directory. I have tried to uninstall and re-install the addon, but the folder still does not show up. Is there a step I am missing. I went back and checked my original cs-cart install files and it is missing from the original install as well.



Thanks so much

What version are your running?

addons/my_changes has been around since about the 2.0.4 era.



It is an empty addon. I.e. there’s nothing there but a directory and a skeletal addon.xml file.



It is intended to be extended by the local developer to meet the localization needs of a particular site. In and of itself, it has NO FUNCTIONALITY.

I am running 2.0.09. And I do know it is an empy addon. The issue I have is that I am not seeing the directory or the skeletal addon.xml file. I am looking at skins/defaultblue/customer/addon and there is no my_changes directory.

I think you simply create the folder and then add your customizations to it.



it doesn’t need to exist if you aren’t going to create custom overrides

Thanks, Brent. Actually, I am creating custom overrides. That is why I am trying to locate the directory and related file.



Update: For those of you who, like me, are new to php, you simply need to manually create the “my_changes” directory in the “addons” directory by using the template editor. You will also want to create a “hooks” directory within your “my_changes” directory to hold your hooks revision files.

I had the same problem as brent’s. It was confusing to a rookie. This is what I found. To avoid any confusion …



First of all, depending on the scope you want to change there would be two my_changes directories:

  1. [web_site]\addons\my_changes\
  2. \skins[skin_name]\customer\addons\my_changes.



    The first one exists by default regardless the installation of the My Change addon in admin. It has addon.xml.



    However, the second one does not exist until you create it as tuari stated. Follow the steps below.


  1. Go to admin/addons/ - uninstall and install My Changes (this will delete all files and directories under 2) skin[skin_name]\customer\addons\my_changes, so back up any if you want to keep. If this is the first time it is ok since it does not exist yet.)


  2. Create the following directories:
  • \skins[skin_name]\customer\addons\my_changes
  • \skins[skin_name]\customer\addons\my_changes\hooks
  • \skins[skin_name]\customer\addons\my_changes\hooks\index


  1. Create and save tpl and css files appropriately


  2. Clear cache using ?cc
  • \admin.php?cc
  • \index.php?cc



    Note: In my case \index.php&cc gives an error, but index.php?cc works. I am not sure why. If someone has different experience or know why, I apprecaite your post.



    I hope this helps rookies :slight_smile:

Do folders/files need special permissions i’ve created the folders in my skins directory double checked i did everything correct, even checked [url]http://docs.cs-cart.com/common.php?dispatch=docs/view&node_name=examples1[/url]



I’ve cleared cache and viewed the site in two browsers but the css in my changes isn’t taking affect.

[quote name=‘panag’]Do folders/files need special permissions i’ve created the folders in my skins directory double checked i did everything correct, even checked [url]http://docs.cs-cart.com/common.php?dispatch=docs/view&node_name=examples1[/url]



I’ve cleared cache and viewed the site in two browsers but the css in my changes isn’t taking affect.[/QUOTE]



No special permissions required. But you have to have something that is creating the “link” tag for your css to become part of a page. See above.

The only two things I did which may have got it to work were, clearing cache of the admin panel which doesn’t make sense. Then I created all the folders in the top level addons / my_changes cleared cache delted them put them back in my skins folder / addons etc and it started working. Thanks though

[quote name=‘lekristine’]I had the same problem as brent’s. It was confusing to a rookie. This is what I found. To avoid any confusion …



First of all, depending on the scope you want to change there would be two my_changes directories:

  1. [web_site]\addons\my_changes\
  2. \skins[skin_name]\customer\addons\my_changes.



    The first one exists by default regardless the installation of the My Change addon in admin. It has addon.xml.



    However, the second one does not exist until you create it as tuari stated. Follow the steps below.


  1. Go to admin/addons/ - uninstall and install My Changes (this will delete all files and directories under 2) skin[skin_name]\customer\addons\my_changes, so back up any if you want to keep. If this is the first time it is ok since it does not exist yet.)


  2. Create the following directories:
  • \skins[skin_name]\customer\addons\my_changes
  • \skins[skin_name]\customer\addons\my_changes\hooks
  • \skins[skin_name]\customer\addons\my_changes\hooks\index


  1. Create and save tpl and css files appropriately


  2. Clear cache using ?cc
  • \admin.php?cc
  • \index.php?cc



    Note: In my case \index.php&cc gives an error, but index.php?cc works. I am not sure why. If someone has different experience or know why, I apprecaite your post.



    I hope this helps rookies :)[/QUOTE]



    As a rookie I followed every step and checked things more 50 times and still can’t get my skin changes to show up.!!@@#



    I have cleared the cache, I have uninstalled and installed the my-changes add-on 3 times, and I have tried everything I can see on this forum in every other thread related to this and I am on the edge…!!



    Please help…some of my questions might be stupid but I have to ask.



    I am using redskin template to modify(minor modiifcations to colurs and text).



    Firstly, I’ve done the styles.post.tpl as suggested and put that in …/hooks/index.

    Secondly I’ve used firebug to see what lines or colours I’d like changed…so I’ve added the required code in styles.css and still nothing happens!



    So, the silly question is:

    1.in my styles.css, do I just put the 5 or 6 lines of code I need changed related to my change?, or;
  1. Do I need to copy the whole content of styles.css into …hooks/index and make the changes in that file under the index directory?



    I have done no. 1 in my case and as suggested on KB & th forum without any luck.:confused: