View Issue Details

IDProjectCategoryView StatusLast Update
0004930OXID eShop (all versions)4.01. Database handlingpublic2013-02-15 10:57
Reportergpayer 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.7.3 / 5.0.3 revision 54408 
Target VersionFixed in Version4.7.4 / 5.0.4 revision 57063 
Summary0004930: Custom DB fields in table oxaddress not possible
DescriptionIf 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 Reproduce1. 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 InformationThe 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 );
$oAddress->save();

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.
TagsNo tags attached.
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Activities

Linas Kukulskis

2013-02-15 10:57

reporter   ~0008415

added oxaddress load;