Signin Button

Can I alter the appearance and function of the account signin button that appears when a user is not signed into their customer account?

[quote name='techweb1' timestamp='1409071392' post='190704']

Can I alter the appearance and function of the account signin button that appears when a user is not signed into their customer account?

[/quote]



Please provide us with more details about the required changes

We are using CSCart as part of our main site. Our main site creates an account with the same username and password in CSCart for every new user on our site. When a user logs into our site, our site software also logs them into their CSCart account.



We want to add that functionality to CSCart login buttons as well. When they log out of CSCart, we want to log out of our site and when they log in, we want to log them into our site.



We might be able to do this with the hooks that CSCart documents if we can get access to the session. In tests, we found that the CSCart is not using the PHP session that we are.



Where in the code are the log in buttons generated?



Or alternatively, what is the login logout hook and how can we access the PHP session which we initiate?

[quote name='techweb1' timestamp='1409142143' post='190816']

We are using CSCart as part of our main site. Our main site creates an account with the same username and password in CSCart for every new user on our site. When a user logs into our site, our site software also logs them into their CSCart account.



We want to add that functionality to CSCart login buttons as well. When they log out of CSCart, we want to log out of our site and when they log in, we want to log them into our site.



We might be able to do this with the hooks that CSCart documents if we can get access to the session. In tests, we found that the CSCart is not using the PHP session that we are.



Where in the code are the log in buttons generated?



Or alternatively, what is the login logout hook and how can we access the PHP session which we initiate?

[/quote]



Ok. You can use the login_user_post hook which is located in the fn_login_user php function which is located in the app/functions/fn.users.php file. This function is used both for login and logout.



Hope that helps.

Thank you for your answer, but that script doesn't give us access to our session data which is what we need to log into our sites user accounts from CSCart. CSCart is using their own session.



app/functions/fn.users.php is called in response to a user clicking the signin button.



If we can find where in the code the HTML of the signin button is generated, we can add javascript to do our login simultaneously.



Where in the code is the HTML of the signin button is generated?

You can't access session data from one site to another. That would open up so many security holes that the net would implode.



The controller for login is in

app/controllers/common/auth.php



The template (based on the mode which is most probably 'login_form') would be at:

Frontend: design/themes/[your_theme]/templates/views/auth/login_form.tpl

Backend: design/backendtemplates/views/auth/login_form.tpl (there is no hook on the admin side)



In the theme view, there is a hook for index:login_buttons where you can probably add add a 'post' hook to include some JS to detect when the submit is done and capture the info to pass to your other site for simultaneous login.

Thank you very much for your answers, but altering the content of [color=#282828][font=arial, verdana, tahoma, sans-serif]design/backendtemplates/views/auth/login_form.tpl does not seem to change login dialog box.[/font][/color]



I presume that .tpl is a template from which the dialog box is generated and that that template is rebuilt for any changes in the scheme that are made through the CSCart controls. And that any changes I make to it would last only until a scheme change is made. Also I presume that the template would only effect the dialog box after a reload. Which I tried.



login_form.tpl appears four times in various directories. You sound like you know what you're talking about so I presume that backend/templates/views/auth is the directory that contains the file that is used to generate the dialog box. Since changes to it didn't change the dialog box even on page reload, could it be another directory.



/dev/CSCart/design/backend/templates/views/auth/login_form.tp /dev/CSCart/design/themes/responsive/templates/views/auth/login_form.tpl /dev/CSCart/var/themes_repository/basic/templates/views/auth/login_form.tpl /dev/CSCart/var/themes_repository/responsive/templates/views/auth/login_form.tpl



Also this is the actual login dialog. In addition to that dialog, there is a “sign in” and “register” that appears in “my account” drop down menu. From what template or page is that generated? I could find nothing searching the CSCart file directory.



Also our main site is in the same domain as the CSCart so the php session cookie is available to fn_user.php as well as session variables if I start the session, but of course that destroys the session that CSCart is using.



Answers to any of these would be very helpful. Thank you so much

[quote]

And that any changes I make to it would last only until a scheme change is made.[/quote]

Not how templates work. You probably needed to clear the cache if you modified the standard template. But I strongly suggest using the hook I mentioned for “upgrade independence”.


[quote]backend/templates/views/auth[/quote]

Is the admin template

themes/[your theme]/templates/views/auth is the customer viersion.


[quote]“sign in” and “register”[/quote]

These are ajax requests and if not HTTPS then it will show as a pop-up versus a new page. If https then it uses the same login_form.tpl


[quote]php session cookie[/quote]

cs-cart crafts their own session id and uses a different cookie.



Not sure why you're wanting to modify the template. If all you're interested in is using the captured information then you should be doing this at the controller level (business layer - php), not the template level (presentation layer - smarty templates/html).