Overwriting Login Function

Does anyone have any code examples of overriding the login function on the login button?

We have a site with widget mode enabled and we have written code to create a session so when someone logs into our site it logs them into the store as well but I want to override the login button on the site to perform our function and not the main cs cart login function of popping up their login form.

I don't want to change the core so we can upgrade in the future so I would like to do it via jquery. Is this possible after the widget mode is done loading?


I don't think your site has any idea whether it's been invoked via the widget mode or not (unless cartservices.com is passing a custom header on first reference which I don't believe they are). Hence you would have to substitute your functionality regardless of how the page is invoked.

Just copy the block to a new name and then make the changes you want and use the new block.

So I have edited the my_account.tpl file and got it working the way I want it but I would rather have a copy of that file and leave the original in tact.

So I tried to copy the block but the my_account block isn't a standard add-on. It is a single tpl file in the [theme]\templates\blocks\ folder.

So following the add-on walkthrough I tried to create my own add-on with my new account login block.

So I created a folder in [theme]\templates\addons\mynew_account\blocks and copied the the existing my_account.tpl file to that folder renaming it to mynew_account.tpl.

I then created a folder in the addon folder called mynew_account and under that I added a addon.xml that looks like this:




Custom My Account

Custom Account Add On



Then in the addons\mynew_account\schemas\block_manager I added a blocks.post.php with this:


$schema['3drep_my_account'] = array(
'templates' => array(
'addons/mynew_account/blocks/mynew_account.tpl' => array(),
'wrappers' => 'blocks/wrappers',
return $schema;

I got most of this from looking at some files in the banners add on.

So after installing the add on and making it active it shows up in my block list and I can add it to the template but I never see the new my_account section on the live site.

Do I have to initialize it somehow? Am I WAY over complicating this and there is a easier way to copy the my_account.tpl file and making my own custom one?


Probably wouldn't have created an addon for this but instead, just added your new block to the my_changes addon.

You will probably have to create a language variable that resolves the block_name to a value (but it's not absolutely necessary).

Are you not seeing your new block on the Other blocks tab in the block manager? If so, just use it to create a new block and then drag it into the same place(s) that the standard my_account block is being used.

But again, given what I think you're doing, I think you are making this much more complicated but trying to do it at the template level rather than the PHP level.

I see it in the block manager and I can add it to the layout but I don't see anything in the actual store. It doesn't display the login buttons or info. I see nothing at all.

I don't need to do it at the php level. The template level would be fine. I tried adding the new [color=#282828][font=arial, verdana, tahoma, sans-serif]mynew_account.tpl into the my_changes folder at the template level at first but I couldn't get the block to show up at all on the block manager. What do I do after I stick it in the my_changes folder to get it to display?[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]In the add-ons section in admin there is an add-on named My changes and it is installed and active. The description is “A dummy add-on for easier hook design editing” but it doesn't have any kind of settings what so ever.[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]Thanks again![/font][/color]

Clear the cache

Thanks but I have cleared the cache 1000 times trying to get this to work. Just so I understand correctly, your saying in the [color=#282828][font=arial, verdana, tahoma, sans-serif][theme]\templates\addons\my_changes\blocks\ I should be able to copy the my_account.tpl to mynew_account.tpl and after clearing cache I can go to the template editor add a new block and under Create a new block I should see the copy of the [/font][/color][color=#282828][font=arial, verdana, tahoma, sans-serif]mynew_account[/font][/color][color=#282828][font=arial, verdana, tahoma, sans-serif].tpl as a new block ready to go?[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]There is 0 documentation on how to use the my_changes folder under the template.[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]Thanks again![/font][/color]

Path should be:

design/themes/[your theme]/templates/addons/my_changes/blocks/static_templates/mynew_account.tpl

I don't think you need the schema entry if you use this location since it's read dynamically…

Not really zero documentation (but it's in the developer's guide for addons, not the my_changes addon specifically). The my_changes addon is simply a placeholder for a merchant to add little things as they go along.

Hello techweb1,

You can find the developer documentation tbirnseth mentioned here: Welcome to CS-Cart Documentation! — CS-Cart 4.2.x documentation