Upgrade Process

Hi Everyone,



I wanna get some info from you about the cs-cart upgrade process.We have some general info about css,tpl,hooks and my changes addon.However, if someone help us to get answers for these questions, that will be also helpful “pinned” post maybe not for developers but for cs-cart users.



1.We're now using 2.1.1, we will upgrade 2.1.4 or 2.2.1. Do we need to apply all packages separately right?

Meant that: first 2.1.1 to 2.1.2 then 2.1.2 to 2.1.3 and go on?



2. We got some changes done on Cs-Cart regarding design&Development, we're not sure if they are done via using hooks. If /home/*/public_html/skins/our skin/customer/addons/my_changes/hooks directory is empty and doesn't have any tpl,css files ,can we say that the changes were applied without using hooks? or it only proves the developers didn't use my changes addon?



3.As we know, to upgrade cs-cart without facing any problem, we need to use hooks via my changes addon, is this info right? and if we have the skin &code changes, how can we transfer this related codes to my changes addon folder.Does that mean: re-writing the codes from the scratch?



4.If you say “yes,need to rewrite” for the point 3, cs-cart will show us the local modifications while/after upgrade.So,do we have to use “diff tools” to find the changes and apply these changes into the new file? is it easy? and if we don't want to use my changes addon, we will have to apply these changes for every upgrade?



Thanks,

See below:


  1. Yes you would need to go from one version to another if you follow the standard upgrade process.
  2. He could have created some custom addons but that is probably unlikely, more than likely if there isn't anything in my changes then he didn't use hooks.
  3. Hooks is the best way to go where possible. If hooks are not used you don't need to rewrite your code completely. See 4 for more info.
  4. As part of the upgrade process CS-Cart provides you with a diff for each update of what has changed for each modified file. As always do a back up of your database and the folder of your cart before you start each step in the upgrade for good measure. I recommend you install WAMP or something similar on your home pc, install your cart locally on it and do the upgrade from there. This way you will have all the file changes already made and will just need to overwrite them after the upgrades.

Firstly,thank you for your response.


[quote] 1) Yes you would need to go from one version to another if you follow the standard upgrade process.[/quote]

understood.


[quote]2) He could have created some custom addons but that is probably unlikely, more than likely if there isn't anything in my changes then he didn't use hooks.[/quote]



Is there any way to verify if they used the hooks or not?


[quote]3) Hooks is the best way to go where possible. If hooks are not used you don't need to rewrite your code completely. See 4 for more info.[/quote]



Understood.


[quote]4) As part of the upgrade process CS-Cart provides you with a diff for each update of what has changed for each modified file. As always do a back up of your database and the folder of your cart before you start each step in the upgrade for good measure. I recommend you install WAMP or something similar on your home pc, install your cart locally on it and do the upgrade from there. This way you will have all the file changes already made and will just need to overwrite them after the upgrades.[/quote]



Doing backup before the upgrade ,installing WAMP to test in our local server are OK.What we wanna learn: Cs-cart provides us the diff. for each modified file BUT,as we know, if we overwrite the new files by using old files,some of the functions will be crashed.right? We have to find the codes what we've added,then paste the required places into the new file.am I wrong? if not, it will take too much time to search the added codes by using some tool ,then paste to the new files and maybe we should change some clauses of the codes while pasting.Also,we have to do that whenever we need an upgrade.





Thanks for your concern,

[quote name='getreal' timestamp='1310054174' post='116480']

Is there any way to verify if they used the hooks or not?



[/quote]



If there isn't anything in addons/my_changes I would say they didn't use hooks is a pretty safe bet. You can look at the other addons that are installed to see if they created some custom ones to do some of these changes but that is unlikely.


[quote name='getreal' timestamp='1310054174' post='116480']

Doing backup before the upgrade ,installing WAMP to test in our local server are OK.What we wanna learn: Cs-cart provides us the diff. for each modified file BUT,as we know, if we overwrite the new files by using old files,some of the functions will be crashed.right?



[/quote]



Yes writing an older file over a newer file can cause issues from nothing, to loss of functionality to a non-functioning page. This depends on what they changed. My suggestion is (if your developer didn't do it already) is put comments around the code they have added/modified so for the next upgrade you can easily spot your code changes by doing a simple search in their diff files.


[quote name='getreal' timestamp='1310054174' post='116480']

We have to find the codes what we've added,then paste the required places into the new file.am I wrong? if not, it will take too much time to search the added codes by using some tool ,then paste to the new files and maybe we should change some clauses of the codes while pasting.Also,we have to do that whenever we need an upgrade.

[/quote]



You are not wrong this is what you have to do. You look at the diff file see what has changed and take the changes you made to your original file and add them to the new file. Some times they are an easy cut and paste but sometimes they require you restructuring their new code. One of the updates changed how they did url's so you couldn't just paste the old code into the correct spots you had to use their new url structures. I haven't been pushed this update yet so I am not sure if there are any changes like this as part of this update.

Hi whiplash13,



Thanks for your detailed answers. We made you tired but we wanna get some info more from you.




  1. New skins/designs are generally exists in their new folder under skins/new_Skin so: cs-cart upgrade will not be affected.Why we're using hooks for design elements if we don't have to change the Main scheme of the cs-cart(ie.basic skin).We're creating a new design not playing on the cs-cart default skins.For the little changes, it's not logical to create a new skin and reasonable to play with the default cs-cart skins and while doing that hooks/my changes will take place. The details mentioned above right or anything missed?



    2.If the point 1 is true,so: only for the development tasks ,we will have to search for the diff. by using comments close to the codes?? And if they didn't put any comments, we have to use compare the old&new file by using a tool like “Beyond Compare” ?? after found, pasting them into the new file by putting our comments to spot them easily in the next time.





    Thanks for your help,

[quote]

  1. New skins/designs are generally exists in their new folder under skins/new_Skin so: cs-cart upgrade will not be affected.

    [/quote]

    Not true. if the filenames match they will be upgraded regardless of the “skin” being used. I.e. if you have a file named views/products/view.tpl in your new skin and this file is modified as part of an upgrade, then it will be replaced.

[quote name='getreal' timestamp='1310071389' post='116509']

Hi whiplash13,



Thanks for your detailed answers. We made you tired but we wanna get some info more from you.


  1. New skins/designs are generally exists in their new folder under skins/new_Skin so: cs-cart upgrade will not be affected.Why we're using hooks for design elements if we don't have to change the Main scheme of the cs-cart(ie.basic skin).We're creating a new design not playing on the cs-cart default skins.For the little changes, it's not logical to create a new skin and reasonable to play with the default cs-cart skins and while doing that hooks/my changes will take place. The details mentioned above right or anything missed?



    2.If the point 1 is true,so: only for the development tasks ,we will have to search for the diff. by using comments close to the codes?? And if they didn't put any comments, we have to use compare the old&new file by using a tool like “Beyond Compare” ?? after found, pasting them into the new file by putting our comments to spot them easily in the next time.



    [/quote]



    First off no problem, upgrading can be a daunting task as all of us owners know. Second, as tbirnseth stated above, it doesn't matter if you are not using a default skin name, the files will still get overwritten during the upgrade process. So you will still have to go through each modified file that was updated by CS-Cart and re-apply your customizations.

[quote]

So you will still have to go through each modified file that was updated by CS-Cart and re-apply your customizations.

[/quote]

This can be avoided by renaming all the template files with a 'my_' prefix so that filenames no longer match if you truly want to separate your self.



But then the question is, “why upgrade at all”. If it works, don't fix it!

Thanks both of you for the answers.



-What do you offer: find the diff. and paste them into the upgraded files>>[quote]look at the diff file see what has changed and take the changes you made to your original file and add them to the new file. Some times they are an easy cut and paste but sometimes they require you restructuring their new code. One of the updates changed how they did url's so you couldn't just paste the old code into the correct spots you had to use their new url structures [/quote]and these local modification have to be done for every upgrade OR



spending some time to re-create the skin/development by using hooks/my changes addon to save time further. OR your answer can vary depending on how many files need a local modification?



Your suggestions are crucial for us to move forward.



Thank you,

[quote]OR



spending some time to re-create the skin/development by using hooks/my changes addon to save time further[/quote]



Well, I can promise you that “the sooner” you put the effort into re-creating your skin utilizing the My Changes/Hooks method the sooner you will fully appreciate the benefits (aka: serious time savings when you perform your next upgrade!) ;)

Thank you Struck, we'll take your comment into consideration definitely.



tbirnseth, whiplash13 what is your opinion about my last message?





-And I wanna ask 1 thing more: If we start the upgrade process via WAMP on our local server, for the 2nd step we will see diff files right? Even the store will be closed, Cs-cart will not be starting to copy the new files before proceeding diff files step so: we can verify how many files require local modifications and then go back&open the store to exit from the upgrade??





Thanks,

I always use hooks to do modifications.

If there is not a hook available and the code change would be more than 1 line, then I add a new hook to the standard file and then make the changes within a hooked file. There's nothing magic about hooks, it is all done symbolically…



For upgrading, I create a subdirectory that is password protected (to prevent shoppers from getting there by mistake) and then do the upgrade there using a copy of the database. I create local copies of only the files that are modified by me. I have the client review and if okay, we upgrade the main store and then I apply the changes from my local copy. No need to move all that data back and forth.



Just my two cents.

Thanks to all for your responses.



Can you give us a small example of how we can turn our skin into a new skin with my changes/hooks method.Before allocating a senior developer ,we wanna get a clear understanding of the method.


  • We've read customize_your store.pdf and have some basic knowledge about hook links and tags.
  • We had opened the cs-cart default sytles.css and our new styles.css at the same time via Beyond Compare,it highlighted the diff. in red.



    How we will go towards from here(step by step)? You can go over 1 line of codes for your example.





    Thanks,

If you want a view, just go look at an addon and see for yourself how it's implemented. The directories you'll be interested in are:

addons/

skins//admin/addons/

skins//customer/addons/

skins//mail/addons/



That's it, everything related to the addon you chose will be in those 3 directories. They could be empty or non-existent if the addon doesn't have anything to add to that 'AREA'.



You're getting beyond the scope of the forum. Why not just hire someone to do a sample job for you where you can review their work, etc. at lower risk? Maybe just redo the 'top' (hook name=“index:main_content”} for you?

Thanks all for your concerns.



Let me summarize the issue:



-We have a new skin for cs-cart --not used hooks/my changes addon – not commenting close to the code they added



What we need to do right now?


  1. Start the upgrade,see the diff files
  2. Using some diff tool such as Beyond Compare to compare cs-cart default file and the newest file.The changes will be highlighted in red color.
  3. Just copying the red ones and paste to the new ones doesn't seem logical ,how we can go forward?





    Thank you,

Unfortunately the request is like “I have burnt my toast, how can I get just 'browned' instead of 'burnt'”…

Whether you used a new skin name or not doesn't matter. Using a standard skin simply gives someone a starting place.

When the upgrade runs, it looks for filenames relative to the 'customer', 'admin' and 'mail' directories. It doesn't care what the skin name is. So when it finds a path/filename that has been changed, it backs up the old one and replaces it with the new one. Then when you compare files you have old/new to compare against, but new is always installed in “all skins”.



It is going to be a labor intensive process and is going to be proportional to the amount of customization you have.



Find someone who enjoys working on the front-end of things (not me) and pay them to do it for you. But while they're implementing your changes this time, have them utilize hooks so that future upgrades have much less of an impact on your changes. CSS is the most important area to “localize”. Files are easy to compare and see what the differences are. CSS is another matter entirely.

I definitely got what you said:



Lastly, What is your opinion? –



Finding the diff files(using cs-cart upgrade), then spot the changes and find how many tpl's are using and utilize them by the hooks,creating new files for them to transfer into the my changes addon OR



Sending the old skin into the trash, copying default cs-cart skin ,creating new htmls and integrate the new addon to the cs-cart using hooks.





Thank you for your help,

Not knowing the extent of changes, whether they were commented or not, the quality of the work that was done and how much was layout versus style changes, I can give you an unqualified “I have no idea”! :-)



Generally, I would say to look at the changes related to each conflict and either utilize an existing hook (in the existing skin) or create a new hook to adjust the functionality. ANY change made to a standard file should have a comment that can be searched for. I start all mine with {**EZms which lets me find anything I might have had to do to a standard file and it makes identifying changes much easier in future upgrades too.



But, if the original work was shoddy, then the send to trash option might be your best approach. But I would discuss with a qualified front-end developer before taking that radical of action.



Find a developer who is fair (not cheap) and whom you can work with. Then let them do their job and make recommendations to you so you can choose between different approaches.