Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Can someone explain me the "My changes" addon? Rate Topic   - - - - -

 
  • Triplex
  • Senior Member
  • Members
  • Join Date: 12-Mar 08
  • 622 posts

Posted 05 September 2009 - 07:28 PM #1

Hello,

how it works the "My changes" Addon? I would like to change Template things and i wouldn´t that after updates are my changes overwrite.

Thanks

best regards!

 
  • jobosales
  • Senior Member
  • Members
  • Join Date: 04-Nov 06
  • 3114 posts

Posted 05 September 2009 - 09:44 PM #2

Unfortunately, I do not think anyone knows for sure because there is little documentation. It probably works the same as the Local Configuration add-on described here:
http://forum.cs-cart...ead.php?t=11656

However, it may not support local stylesheets. Hopefully, more information will be available soon.

Bob
CS-Cart 2.0.14 (testing)

 
  • Triplex
  • Senior Member
  • Members
  • Join Date: 12-Mar 08
  • 622 posts

Posted 06 September 2009 - 03:52 PM #3

mhh O.K. thanks, but who can tell me how it work´s this addon?

 
  • roban
  • Senior Member
  • Moderators
  • Join Date: 23-Oct 06
  • 1132 posts

Posted 06 September 2009 - 04:24 PM #4

From the CS-Cart Knowledge Base:

The My changes addon is intended for modifying the default CS-Cart functionality without changing its core. Using this addon for custom changes prevents problems with upgrading a store to the later versions.

My interpretation of this addon is that it works in the background and there is no user functionality.

 
  • Struck
  • Teetering on Genious
  • Members
  • Join Date: 07-Mar 09
  • 2502 posts

Posted 06 September 2009 - 07:56 PM #5

I wish someone from CS-Cart would explain to us exactly how to use & take advantage of this feature.....I cant even tell if it is operational yet. :confused:
Cooking with Gas on Version 4.1.2 (But proceeding with caution....)

 
  • nodame
  • Senior Member
  • Members
  • Join Date: 20-Feb 09
  • 149 posts

Posted 06 September 2009 - 08:04 PM #6

Basically, it is meant for template modifications using the hooks found within the tpl files.

Since the my_changes addon is enabled by default in the Addons adminstration, so whatever modifications you placed within the addons/my_changes folder in the skins directory will be executed.

A simple example:
I wish to change the bottom footer html code completely.
Replacing the default text:
Copyright © 2005-2009 CS-Cart.com. Powered by CS-Cart - Shopping Cart Software

with my own HTML code.
Inside bottom.tpl, I will see that there is a hook I can use for this modification:
{hook name="index:bottom"}
<p class="bottom-copyright class">{$lang.copyright} © {if $smarty.const.TIME|date_format:"%Y" != $settings.Company.company_start_year}{$settings.Company.company_start_year}-{/if}{$smarty.const.TIME|date_format:"%Y"} {$settings.Company.company_name}.  {$lang.powered_by} <a href="https://www.cs-cart.com" target="_blank" class="underlined">{$lang.copyright_shopping_cart}</a>
</p>
{/hook}
The hook name found in the above code, "index:bottom", define the structure which you must use within the <skin name>/customer/addons/my_changes folder.
So I create a folder name "index", and inside the "index" folder, I will create a file name "bottom.override.tpl"

Inside "bottom.override.tpl", I will paste my own custom HTML code for my own bottom footer. Example: "<b>This is my footer. Copyrighted!"</b>"

After saving this "bottom.override.tpl" file, and refreshing your site, you can see that the bottom footer code have been updated to your own custom HTML code.

So the final structure/path will be something like
<skin name>/customer/addons/my_changes/index/bottom.override.tpl

And the benefit of such is that your changes are kept to a separate file. And so if cscart updates and overwrite the bottom.tpl file, your code are not overwritten at all.
Also always keep an update copy of the contents within the my_changes folder inside the vars/skin_repository/base/customer/addons/my_changes directory, so if you change a new skin, your changes will still be copied over to the new skin directory and be executed.

For more detailed information, you can refer to tbirnseth's thread: http://forum.cs-cart...ead.php?t=11656
His pdf documentation is very useful, and he includes the hooks that can be used, with instructions on how to use it. His "local changes" addon is created before cscart came out with the "my_changes" addon. In essence, the "my_changes" addon is the similar as his "local_changes" addon, so you do not have to create a new addon, and just use the "my_changes" addon will do for simple changes.

 
  • nodame
  • Senior Member
  • Members
  • Join Date: 20-Feb 09
  • 149 posts

Posted 06 September 2009 - 08:18 PM #7

To explain further, I will try to provide another common example :

For example, you want to add your own stylesheet to the site.
Instead of directly modifying the code within the tpl files provided by cscart, you can do the following:

Found within customer\common_templates is the styles.tpl, which defines the stylesheets used by cscart.
You can see within the styles.tpl, they've provided a hook for you to use, where the hook name is
{hook name="index:styles"}

So within the customer/addons/my_changes folder, create an "index" folder (if you have not done so already).
Then create a new tpl file to link to your stylesheet.
As you do not want to overwrite cscart's stylesheets but to add your own stylesheet. You create a new tpl file named "styles.post.tpl"

So the final structure/path will be something like:
customer/addons/my_changes/index/styles.post.tpl

Inside styles.post.tpl, you add the HTML code to link to your stylesheet.
Example for me, I decided to put my own stylesheet inside the my_changes folder too for convenience sake, so I create a folder named "css" and add a new css file named "styles.css" inside there. And then inside styles.post.tpl, I write the HTML code as such:
<link href="{$config.skin_path}/addons/my_changes/css/styles.css" rel="stylesheet" type="text/css" />

After doing these, I do a refresh of my web site, and the HTML code will be appended after the css links code of cscart.

Note: the my_changes addon must be set to "Active" in the admin addons area.

Of course you can place your stylesheet anywhere, and then provide a absolute link to link to your css files like:
<link href="http://link.to.whereever.you.like/stylename.css" rel="stylesheet" type="text/css" />


 
  • Struck
  • Teetering on Genious
  • Members
  • Join Date: 07-Mar 09
  • 2502 posts

Posted 06 September 2009 - 08:19 PM #8

Thank you very much Nodame for spending your time to clarify all of this!! ;)
Cooking with Gas on Version 4.1.2 (But proceeding with caution....)

 
  • jobosales
  • Senior Member
  • Members
  • Join Date: 04-Nov 06
  • 3114 posts

Posted 06 September 2009 - 09:21 PM #9

Thanks for clarifying that, nodame. It appears the "My changes" add-on provides the same functionality as tbirnseth's "Local configuration" add-on with one exception - The "Local Configuration" add-on also allows controller-specific CSS. The good news is that anyone who created a hook using the "Local configuration" add-on can just copy it into place in order to use the developer-supported "My changes" add-on.

I hope that the developers will expand the conflict resolution in the upgrade to check to see if a hooked file exists when code is updated within a hook. They don't need to (and really cannot) attempt resolution but they can let us know that we need to review our hooked files.

Bob
CS-Cart 2.0.14 (testing)

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11428 posts

Posted 07 September 2009 - 05:29 AM #10

developer-supported


Falling out of my chair laughing...

When have you ever seen a cs-cart developer discuss (or document) any of the internals about how something is intended to work? Hope you're not holding your breath! :-)

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • jobosales
  • Senior Member
  • Members
  • Join Date: 04-Nov 06
  • 3114 posts

Posted 07 September 2009 - 05:45 AM #11

Falling out of my chair laughing...

When have you ever seen a cs-cart developer discuss (or document) any of the internals about how something is intended to work? Hope you're not holding your breath! :-)

Nope. I am using your Local Configuration add-on. But I do hope they provide some real documentation and some way to highlight potential conflicts in hooked files.

Bob
CS-Cart 2.0.14 (testing)

 
  • nodame
  • Senior Member
  • Members
  • Join Date: 20-Feb 09
  • 149 posts

Posted 07 September 2009 - 06:12 AM #12

Thanks for clarifying that, nodame. It appears the "My changes" add-on provides the same functionality as tbirnseth's "Local configuration" add-on with one exception - The "Local Configuration" add-on also allows controller-specific CSS. The good news is that anyone who created a hook using the "Local configuration" add-on can just copy it into place in order to use the developer-supported "My changes" add-on.

I hope that the developers will expand the conflict resolution in the upgrade to check to see if a hooked file exists when code is updated within a hook. They don't need to (and really cannot) attempt resolution but they can let us know that we need to review our hooked files.

Bob


Hi Bob,
Yeap, as I said, the "my_changes" addon is similarly to the "local_changes" addon and more for "simple changes" or people who do not have much understanding of how smarty works or indepth HTML knowledge. I did not install the tbirnseth's addon so I am not completely sure of all the features it supports. But from the thread, tbirnseth's "Local configuration" addon seems to provide more/better out-of-the-box support. And tbirnseth's himself does provide better support, and you get faster replies to your queries from him rather than from cscart themselves.
You can always use tbirnseth's addon since it is very well documented.

For me, as my changes are sometimes quite complex, e.g. adding a custom jready hook to place all my custom jquery document ready code at the bottom of the document (recommended for fasting loading of pages rather than littering various snippets of code everywhere around the HTML source and calling jQuery(document).ready function only once), so sticking them all at one location in my_changes is more convenient for me.

For css, I prefer to have it all in one external file for tracking/maintenance reasons, regardless of controller, since the css file will be cached and do not need reloading when customers navigate around the site. This is of course unless the solution provides dynamically generated compressed minimized cachable combined-into-one-file css files, which I seriously doubt will be anywhere near the top of cscart's to-do list (provided it's even on that list.)

 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1179 posts

Posted 07 September 2009 - 11:09 AM #13

I posted this in another forum post earlier, but I felt I should repeat it here:

Hooks are not everything they are made out to be and actually can be very dangerous when upgrading. In many places you will not be using the latest functionality or features if you used a hook. For example from 2.06 to 2.07 a lot of new functionality was added to the cart. The new code is within some very popular hooks. If you used hooks to overwrite or make changes to these areas you will not be utilizing the new features or code. Instead your old hook will be processed and not the new code. Then you will think it is a cs-cart bug, but actually it was your hook causing the problem.

In my opinion hooks are not very useful if you are making a lot of changes. After each upgrade you will still need to do a lot of work to make sure your old hooks are not overwriting any new functionality.

Also, many features you may want to change are not within hooks and you will need to go several files back to find an appropriate hook.

For these reasons, and many others, I found it easier and more efficient to just rename the skin I am using (so cs-cart upgrades will not affect it) and not use hooks. After each upgrade I use the WinMerge (http://www.winmerge.org) program to compare files and see what has changed and update my custom skin accordingly. It only takes a few minutes to do this.

I believe the hooks were put into cs-cart for add-on development and not for skin modification. Yes, it sort of works for simple skin modiifcations, but advanced users beware.

David

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11428 posts

Posted 07 September 2009 - 05:16 PM #14

For example from 2.06 to 2.07 a lot of new functionality was added to the cart.


Could you provide a specific example? There should be no "functionality" within the hooks, only "presentation".

No one ever said that using hooks will keep you current with the base if you are using code from the base. However, using hooks will get your store back up in minutes versus hours and allow you to review changes in your time, not in the time the developers have allotted for an upgrade.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1179 posts

Posted 07 September 2009 - 05:23 PM #15

One simple example, see my post here http://forum.cs-cart...ead.php?t=11307

If you use Winmerge to look at 2.06 to 2.07 you will see many files with changes within hooks.

As new functionality is added it is impossible for cs-cart to keep them outside of hooks.

 
  • thenutrishop
  • Junior Member
  • Members
  • Join Date: 05-Aug 07
  • 23 posts

Posted 20 September 2009 - 06:49 AM #16

Hi,

I've tried getting hooks to work. No luck. I'm using the "Default Green" template. Have verified that the actual template files have hooks embedded in them. My addon is "active"

I'm trying to build a "bottom.overide.tpl" hook.

I've tried placing the file in different folders, none of which work:

/addons/my_changes/index/
/addons/my_changes/hooks/index/
/addons/my_changes/index/hooks/

/addons/local/index/
/addons/local/hooks/index/
/addons/local/index/hooks/


Any suggestions?

 
  • jobosales
  • Senior Member
  • Members
  • Join Date: 04-Nov 06
  • 3114 posts

Posted 20 September 2009 - 05:06 PM #17

I'm trying to build a "bottom.overide.tpl" hook.

You need another "r" in overide - the filename should be bottom.override.tpl.

Bob
CS-Cart 2.0.14 (testing)

 
  • nodame
  • Senior Member
  • Members
  • Join Date: 20-Feb 09
  • 149 posts

Posted 22 September 2009 - 09:24 PM #18

I hope that the developers will expand the conflict resolution in the upgrade to check to see if a hooked file exists when code is updated within a hook. They don't need to (and really cannot) attempt resolution but they can let us know that we need to review our hooked files.


After thinking it through, and upgrading yet again to v2.0.8, I do feel that I agree more and more with bob on this.

For me, I do not blindly modify/copy/apply hacks/addons/code to the cscart files.
I version control my source code in local drive (using Mercurial),
I ensure that for any modifications code I added, it will be commented properly, including adding my nick. (so if I need to, I do a "search all" for my nick and I can find back every single piece of code which I've edited before.)
I do differences comparison for each and every file before I do any upgrade, so I can ensure my modified code don't get overwritten.

And even with these, sometimes I can forget that I've used a custom hook for that particular block of code.

As bob have mentioned, during upgrade, cscart can let us know that we need to review our hooked files. It will be very helpful.

To me, even a additional note in their changelog stating which hooks block have been modified would ensure that I will do the additional checks to ensure the compatibility of my code with the modified upgraded ones.

Something like:
*v2.0.9 Changelog
The code within these hooks have been updated.
- product:hook1
- index:bottom
- xxxx
will help in the very least.
v4.1.1

 

Posted 31 October 2009 - 04:47 PM #19

I have my_changes enabled

I created a folder "/cscart/skins/default_blue/customer/addons/my_changes", and placed the file: "addon.xml" . Then I created a folder "index", to which I added a file "bottom-override.tpl". The code of this file is:
{hook name="index:bottom.override.tpl"}
<b>This is my footer. Copyrighted!"</b>
{/hook}

I have saved everything, yet it does not work...please, what am I missing?

 
  • brandonvd
  • is Super Awesome
  • Members
  • Join Date: 19-Dec 06
  • 2633 posts

Posted 31 October 2009 - 05:00 PM #20

The file:

bottom.orverride.tpl

would need to be saved in:

skins/default_blue/customer/addons/my_changes/hooks/index/

Then your bottom.override.tpl file wouldn't have the code that you have above. You can't put the {hook} into this file because this file is the {hook}

For this file you would put what ever code you want to override the original file so in this case you would only have:

<b>This is my footer. Copyrighted!</b>

Basically you would fill this file with what ever code you want and it will become your footer.

Also I don't know if it matters, but you don't need a xml file in your:

skins/default_blue/customer/addons/my_changes

folder.

I hope this helps

Brandon