News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

BUG. 'Register and place your order' in Joomla 2.5 (fixed)

Started by serapol, May 02, 2012, 10:21:05 AM

Previous topic - Next topic

serapol

In order to the registration form there is no authorization in joomla 2.5.
The problem lies in the condition if ($ currentUser-> id == 0) in the controller user.php on line 271 in function saveData.

Since in joomla 2.5 is slightly different registration function and adding special flag "guest" condition if ($ currentUser-> id == 0) can not be true after the $ ret = $ userModel-> store ($ data); as the data about the user, including id, will be recorded in the session.

Solutions for joomla 2.5 replace condition
if ($ currentUser->id == 0)
on
if ($ currentUser->guest)

P.S. In the same controller and the function has an extra string $ data ['address_type'] = JRequest :: getWord ('addrtype', 'BT'); it should be removed as it is passed by the wrong type of address, while maintaining the delivery address is overwritten contact Information

Milbo

Thanks, I added the $currentUser->guest thing. But imho the addrtype must stay.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

serapol

Why addrtype should stay, he also violates all logic as you pass a parameter in the form of address_type and have indicated if it is empty by default BT. So before you save will always address of BT. Look better than the code, it is most likely the remnants of the old code.

I noticed this problem when you save the shipping address when I have to delete all the contact information.

I'm just trying to help you quickly find all the errors)))

Milbo

2of course you do, no question. Maybe a mass replace of all "addrtype" to "address_type" is the right way to go.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

serapol

You probably have not understood correctly. I do not speak English.

I mean that you are in the form of parameter passing is "address_type", it's going to replace the wrong values.

Look at the views /user/tmpl/edit_address.php line 146 is passed the parameter "address_type", as you are replacing the controller, this value defaults to BT, which is why parameter "addrtype" is always empty.

Stonedfury

Quote from: serapol on May 02, 2012, 10:21:05 AM
In order to the registration form there is no authorization in joomla 2.5.
The problem lies in the condition if ($ currentUser-> id == 0) in the controller user.php on line 271 in function saveData.

Since in joomla 2.5 is slightly different registration function and adding special flag "guest" condition if ($ currentUser-> id == 0) can not be true after the $ ret = $ userModel-> store ($ data); as the data about the user, including id, will be recorded in the session.

Solutions for joomla 2.5 replace condition
if ($ currentUser->id == 0)
on
if ($ currentUser->guest)

P.S. In the same controller and the function has an extra string $ data ['address_type'] = JRequest :: getWord ('addrtype', 'BT'); it should be removed as it is passed by the wrong type of address, while maintaining the delivery address is overwritten contact Information
The users are still not being logged into Joomla in VM 2.0.20b when they are on the cart and click the address link to put in billing and shipping address then the button "Register and Checkout" They user is logged in successfully and then, if on the cart, redirected back to the cart as logged in. However they are not actually logged into Joomla. I am currently looking at the components/com_virtuemart/controllers/user.php if($currentUser->guest==1){

$msg = (is_array($ret)) ? $ret['message'] : $ret;

$usersConfig = JComponentHelper::getParams( 'com_users' );

$useractivation = $usersConfig->get( 'useractivation' );

if (is_array($ret) and $ret['success'] and !$useractivation) {

// Username and password must be passed in an array

$credentials = array('username' => $ret['user']->username,

  'password' => $ret['user']->password_clear

);

$return = $mainframe->login($credentials);

}
I was led to that area by this post http://forum.virtuemart.net/index.php?topic=101699.msg345670#msg345670
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

Stonedfury

I am confusing myself. Is that code checking to see if the user is =1 and if not setting to the user id/session?
http://docs.joomla.org/Accessing_the_current_user_object
QuoteFrequently, you will just want to make sure the user is logged in before continuing. The 'guest' property will be set to '1' when the current user is not logged in. When the user is authenticated, 'guest' will be set to '0'.
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.