View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004930||OXID eShop (all versions)||4.01. Database handling||public||2013-02-14 15:38||2013-02-15 10:57|
|Product Version||4.7.3 / 5.0.3 revision 54408|
|Target Version||Fixed in Version||4.7.4 / 5.0.4 revision 57063|
|Summary||0004930: Custom DB fields in table oxaddress not possible|
|Description||If you try to use custom db fields in oxaddress, which the user is NOT supposed to see, they will be overridden every time the user selects a delivery address in checkout step 2 and continues to step 3.|
|Steps To Reproduce||1. Add custom db field to oxaddress (e.g. some internal flag)|
2. do NOT add this field in the delivery address form in checkout step 2 (because this is an internal field, the user has no business with it)
3. Add a module to fill/use this field e.g. in finalizeOrder
=> every time the user will use a delivery address this field will reset to a default value after checkout step 2, the value your module set in finalizeOrder will be gone.
|Additional Information||The reason for this is the way oxbase::assign works and the fact that oxuser::_assignAddress does not take care of its flaws.|
Here is the relevant code snippet taken from _assignAddress:
$oAddress = oxNew( 'oxaddress' );
$oAddress->assign( $aDelAddress );
$oAddress->oxaddress__oxuserid = new oxField( $this->getId(), oxField::T_RAW );
$oAddress->oxaddress__oxcountry = $this->getUserCountry( $oAddress->oxaddress__oxcountryid->value );
As we see no values from a potentially already existing oxaddress row are taken into account, it is assumed that (nearly) all values come from $aDelAddress.
The next two lines are due to the fact that "assign" is not clever in any way, oxuserid and oxcountry are set explicitly.
So if you have a custom field in oxaddress its value will be gone after this careless treatment.
|Tags||No tags attached.|