News:

Support the VirtueMart project and become a member

Main Menu

V1.1.2: Dont save vm user info and return always to addshopper page

Started by hieblmedia, October 16, 2008, 14:22:15 PM

Previous topic - Next topic

hieblmedia

Hello,
after user registration virtuemart dont save vm user informations.

I have found errors with
<?php if ($db->getErrorNum()) echo $database->stderr(); ?>

in File: ../classes/ps_shopper.php

Error Message:
--------------
Unknown column 'vm_extrafield' in 'field list' SQL=INSERT INTO `jos_vm_user_info` ...
--------------

Temporary Fix: Add Field 'vm_extrafield' in #__vm_user_info.

I have not seen, but suspect there is a bug in the installation script.

Greetings
Reinhard

warper

Well, the problem seems to come from javascript:


<input onchange="prep4SQL(this);" type="text" name="name" mosReq=1 mosLabel="Name" class="inputbox" value="delimiter_userinfo"  />

function prep4SQL(o){
if(o.value!='') {
o.value=o.value.replace('vm_','');
    o.value='vm_' + o.value.replace(/[^a-zA-Z]+/g,'');
}
  }


I have no idea why it happens yet (I am not a javascript guru), because it only happens in some fields (extra_field_x) that have two underline "_" in its name and exists in database table vm_user_info or any that does not exists in database table vm_user_info.  So my temporal fix is not to use any extra_field and create a new ones instead.

I am new here and I have no idea how to report this bug, so I left here my comment in order someone could read and fix it someday.

Maybe, as it is javascript problem, it happens only in Firefox (i am using 3.0.3), not sure, not tested in other web browsers.

Regards
warper

warper

Ok, now I have check better the vm_extrafield problem and one possible fix:

You should make two changes in
/administrator/components/com_virtuemart/html/admin.user_field_form.php.

FIRST CHANGE
------------
Look for this (line 135):

<td align="left"  width="20%"><input onchange="prep4SQL(this);" type="text" name="name" mosReq=1 mosLabel="Name" class="inputbox" value="<?php $db->sp('name'); ?>" <?php if($db->f('sys')) echo 'readonly="readonly"' ?> /></td>


and change to this:

<td align="left"  width="20%"><input <?php if ( $db->sf('name') == '') echo 'onchange="prep4SQL(this);"';?> type="text" name="name" mosReq=1 mosLabel="Name" class="inputbox" value="<?php $db->sp('name'); ?>" <?php if($db->f('sys')) echo 'readonly="readonly"' ?> /></td>


SECOND CHANGE:
Look for this (line 356):

<?php if( !$db->f('sys') ) : ?>
   prep4SQL( document.adminForm.name );
<?php endif; ?>


and change to this:

<?php if ( $db->sf('name') == '' AND  !$db->f('sys') ) { echo 'prep4SQL( document.adminForm.name );'; } ?>


Also, if you already have got the problem or still have problems after apply this fix you should check your table jos_vm_user_info and rename any vm_ name field (in estructure) already damaged to its original name (like extra_field_1, extra_field_2, extra_field_3, extra_field_4 and extra_field_5).

If you feel happy with this fix please feel free to post your comment here (just to know if I could help someone, this is first time that I try to help open source projects :)).
And if it does not run just explain the problem again, it runs well on my site.

Regards,
warper

fl00r

Thank you so much for this fix! I've been struggling for a hours to solve this. You're the best!  :)


warper

1.- Go to :

/administrator/index.php?pshop_mode=admin&page=admin.user_field_list&option=com_virtuemart

2.- Edit any extra_field_x

3.- See that the field name has changed to "vm_extrafield" and you can not modify it

4.- Save

In this point you have modified the field name (from extra_field_x to vm_extrafield) in jos_vm_userfield table and this produces unexpected results in several sections, like registering users, trying to modify other extra_fields_X, and others.

Regards,
warper



warper

Seems developers have fix it in next version:
https://dev.virtuemart.net/cb/issue/2631

Also there is another fix in this topic:

http://forum.virtuemart.net/index.php?topic=46403.0

No idea why moderator did not reply my last post, but anyway, seems them have found and fixed it using the other topic.

Regards,
warper