View Issue Details

IDProjectCategoryView StatusLast Update
0006089OXID ERP InterfaceOXID ERP Interface - subpublic2015-12-01 12:54
Reportermichael_keiluweit Assigned To 
PrioritylowSeveritytextReproducibilityalways
Status acknowledgedResolutionopen 
Product Version2.14.0 
Summary0006089: ERP CSV documentation is at least for create/update product wrong
DescriptionThe documentation (4.2 Create/update products) says:

0: Indicator char
1: product id (OXID)
2: shop id
3: parent id
4: ...

But since the shop id isn't used from the CSV file but from the login process, the field is useless and confuses while developing the CSV files for an import.


My example CSV looks like this:

V; 2.11.0
A; TESTOXIDART1; 2; 3; 4; 5; 6; 0000-00-00 00:00:00; 0000-00-00 00:00:00; TESTART1; OXEAN; OXDISTEAN; OXMPN; ERP VOODOO1


As you see, I set the number "2" for the shop id field, according the documentation.

The important part of my import file:

$sMessage = $oERP->doImport(getShopBasePath() . IMPORTPATH . IMPORTFILENAME , ADMINUSER, ADMINPASS, SHOPID, LANGID);


The constant SHOPID has the value "1":
define ('SHOPID', '1');



Database record after executing the import script:

*************************** 1. row ***************************
        oxid: TESTOXIDART1
    oxshopid: 1
  oxshopincl: 3
  oxshopexcl: 4
  oxparentid: 5
    oxactive: 6
oxactivefrom: 0000-00-00 00:00:00
  oxactiveto: 0000-00-00 00:00:00
    oxartnum: TESTART1
       oxean: OXEAN
   oxdistean: OXDISTEAN
       oxmpn: OXMPN
     oxtitle: ERP VOODOO1

You see that the number "2" is missing and replaced by "1".

Steps To ReproduceI edited the method oxERPType::_preAssignObject():

if ($oCompat->isShopEE()) {
    if (!isset($aData['OXID']) || !$aData['OXID'] || !$oShopObject->exists( $aData['OXID'] )) {
        //$aData['OXSHOPID'] = $this->_iShopID;
        if (!$blAllowCustomShopId) {
            if (isset($aData['OXSHOPID'])) {
                $aData['OXSHOPID'] = oxConfig::getInstance()->getShopId();
[...]


to

if ($oCompat->isShopEE()) {
    if (!isset($aData['OXID']) || !$aData['OXID'] || !$oShopObject->exists( $aData['OXID'] )) {
        //$aData['OXSHOPID'] = $this->_iShopID;
        if (!$blAllowCustomShopId) {
            if (isset($aData['OXSHOPID'])) {
                echo '$aData[\'OXSHOPID\']: ' . $aData['OXSHOPID'];
                echo PHP_EOL;
                echo '$aData[\'OXSHOPID\'] overwritten by: ' . oxConfig::getInstance()->getShopId();
                echo PHP_EOL;
                $aData['OXSHOPID'] = oxConfig::getInstance()->getShopId();
[...]


While importing I got the following output:

user /var/www/shops/ee_506 $ php import_articles.php 

requested wsdl version: 2.11.0
used db version: 10
import file: /var/www/shops/ee_506/import/ERP-CSV-Testdata-v.2110.csv
$aData['OXSHOPID']: 2
$aData['OXSHOPID'] overwritten by: 1

user /var/www/shops/ee_506 $
Additional InformationMy proposal:

Use the list of database fields in oxERPType_Article::$_aFieldListVersions to get an idea which field is used at which position.
Please note that the field "OXID" isn't listed there but it is always at position 1 (after the indicator char). Also according to the bug entry from aboth, the shop id field isn't considered for creating or updating products.
TagsArticle, CSV, Documentation, EE, ERP

Activities

There are no notes attached to this issue.