GUIDE: How to properly install/modify CS-Cart to limit problems during an update.

Im learning all of this and I see it asked/discussed a lot on the forums. If this belongs in the design forum (or copied there) please do so.



How to modify CS-Cart and not get screwed when there is an update.





Phase 1: Initial Setup/Installation of base skin



1. Let’s start with a clean install of the latest version of CS-Cart (2.0.12 as of this writing)



2. In the /var/skins_repository folder make a copy of the folder you are going to use as your base skin and rename it something unique (i.e. /var/skins_repository/my_skin)



3. Inside you’re my_skin folder edit the first few lines of the manifest.ini file to look like this:



description = “My skin”

customer = “Y”



4. Log in to the administration panel and go to the Design tab then click on Skin selector. Select “My skin” from the drop down menu and hit save.



You now have your base skin and this should prevent any changes to the base skin done by future CS-Cart updates from affecting your base skin. This doesn’t mean that future updates won’t affect the look of your site, it just means you can go back to your base skin by reselecting it like you did in step 4 above and it will reload back to how it was from the beginning.





Phase 2: Making changes to your base skin



1. Under the Administration tab, click on Addons and be sure that the my_changes addon is installed and enabled. This guide will not discuss how to use this addon but its required in order to make changes via hooks. (see below for an explanation of hooks)



2. ALL CHANGES TO THE VISUALS OF THE SKIN SHOULD BE DONE VIA HOOKS.



I’m going to spend a minute to clarify this because admittedly it’s confusing as hell and overwhelming for new users. Normally when you modify a skin or template you would edit the CSS or HTML file directly. When that edited file gets replaced or changed during a CS-Cart update, you are required to go back in and either restore the file to its pre-update status (which will often remove new features added during the update) or modify the new file to include the custom changes you had before the update.



A better solution is to use hooks for all of your changes. Essentially, hooks are modifications to a file that are “hooked in” from another file. So instead of modifying the HTML or CSS directly, you create a new file that contains the modification you wish to make and the original file imports in the changes without actually making modifications to the original file. Hooks are overrides to the base file.



Learning how to use hooks and what can be changed via a hook file and what can’t is a topic for another day.



The end result is that when CS-Cart comes in and modifies your base skin during an update, it doesn’t modify your hook files, so your custom skin modifications will still be intact. There may still be some visual errors due to the update making a change to a base file that you have never edited, but this is rare and when it happens you are only correcting changes the update made and not also having to fix all of your original changes.





Phase 3: Patch day!



1. When an update for CS-Cart is released YOU SHOULD ALWAYS BACK UP YOUR SKINS DIRECTORY. You may also wish to keep a backup under the /var/skins_respository directory in case you need to reload your skin after the update.



2. When you begin the update process CS-Cart will show you a list of which files it knows have been modified and that it will be replacing or updating. Write these files down in case the update process fails half-way through.



3. When the update is complete you will be able to view the files that were listed in Step 2. And it will show you what was changed or modified in these files. Lines in green are lines that were added/modified and lines in red are lines that were deleted.



4. If the update changed some of the base skin files and it negatively affects the way your site looks, you can either edit the changed files listed above (if you have the knowledge) or you can reload your skin through the Administration panel as discussed in Phase 1. above. You can also elect to restore your skin if you made a backup.



More to come, since Im at work!

Rock On TIRADE!!



great info! thanks! :cool:

Awesome, thanks.



Now…

You said [QUOTE]Learning how to use hooks and what can be changed via a hook file and what can’t is a topic for another day.[/QUOTE]



When can we expect to see that. I am at the point of wanting to modify a custom skin and the way I did it before was not using hooks, and upgrades to the cart are a pain. I do not want to have that happen this time.

Hi,

If your manifest.ini file has any errors, the skin may not be shown in the “Select skin” dropdown list .

I accidentilly dropped a " off one of the variables. This prevented the Skin selector from showning the new skin and created errors if trying to do a skin re-install from the install/install.php





Cheers