View Issue Details

IDProjectCategoryView StatusLast Update
0006066OXID ERP InterfaceOXID ERP Interface - subpublic2024-01-25 09:29
Reportermichael_keiluweit Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.14.0 
Summary0006066: OXERPSetObject2Category creates rows for each shop
DescriptionFirstly I will describe the behavior of the shop, when assigning a product to a category:
A shop (5.3.2) setup with two shops. Shop 2 inherits all products from shop 1, so both have the same products. When assigning product A to category B in shop 1, you will have one row in the table oxobject2category:

mysql> select * from oxobject2category where oxid = '3ab8a90cea3965f4bf94cf1ada19233d'\G
*************************** 1. row ***************************
       OXID: 3ab8a90cea3965f4bf94cf1ada19233d
   OXSHOPID: 1
 OXOBJECTID: 05848170643ab0deb9914566391c0c63
   OXCATNID: fad4d7e2b47d87bb6a2773d93d4ae9be
      OXPOS: 0
     OXTIME: 0
OXTIMESTAMP: 2015-03-03 13:02:33
1 row in set (0,00 sec)

mysql>



But if you are using the ERP SOAP module (2.14.0) and you want to create one relationship of an product to a category for shop id 1, the module will create 2 rows in the table oxobject2category:

<oxer:OXERPLogin>
    <oxer:sUserName>admin</oxer:sUserName>
    <oxer:sPassword>admin</oxer:sPassword>
    <oxer:iShopID>1</oxer:iShopID>
    <oxer:iLanguage>0</oxer:iLanguage>
</oxer:OXERPLogin>


<oxer:OXERPSetObject2Category>
    <oxer:sSessionID>9ol3nm6jkrjlsqne31savlt8m2</oxer:sSessionID>
    <oxer:aObject2Category>
        <oxer:OXERPType>
            <oxer:aResult>
                <oxer:ArrayOfString>
                    <oxer:string>OXID</oxer:string>
                     <oxer:string>05848170643ab0deb9914566391c0c63</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXOBJECTID</oxer:string>
                    <oxer:string>michael12</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXCATNID</oxer:string>
                    <oxer:string>michael13</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXSHOPID</oxer:string>
                    <oxer:string>1</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXTIME</oxer:string>
                    <oxer:string>665</oxer:string>
                </oxer:ArrayOfString>
            </oxer:aResult>
            <oxer:blResult>1</oxer:blResult>
            <oxer:sMessage></oxer:sMessage>
        </oxer:OXERPType>
    </oxer:aObject2Category>
</oxer:OXERPSetObject2Category>


mysql> select * from oxobject2category where OXOBJECTID = 'michael12'\G
*************************** 1. row ***************************
       OXID: 046b46b1bb92b9c7aea5485e58b5354e
   OXSHOPID: 2
 OXOBJECTID: michael12
   OXCATNID: michael13
      OXPOS: 0
     OXTIME: 1425386150
OXTIMESTAMP: 2015-03-03 13:35:50
*************************** 2. row ***************************
       OXID: michael11
   OXSHOPID: 1
 OXOBJECTID: michael12
   OXCATNID: michael13
      OXPOS: 0
     OXTIME: 665
OXTIMESTAMP: 2015-03-03 13:35:50
2 rows in set (0,00 sec)

mysql>

As you can see, the fields OXSHOPID and OXTIME are overwritten by the ERP SOAP module.

When I try to set the entries for the shop id 2 by myself:
<oxer:OXERPSetObject2Category>
    <oxer:sSessionID>9ol3nm6jkrjlsqne31savlt8m2</oxer:sSessionID>
    <oxer:aObject2Category>
        <oxer:OXERPType>
            <oxer:aResult>
                <oxer:ArrayOfString>
                    <oxer:string>OXID</oxer:string>
                    <oxer:string>michael11</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXOBJECTID</oxer:string>
                    <oxer:string>michael12</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXCATNID</oxer:string>
                    <oxer:string>michael13</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXSHOPID</oxer:string>
                    <oxer:string>1</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXTIME</oxer:string>
                    <oxer:string>665</oxer:string>
                </oxer:ArrayOfString>
            </oxer:aResult>
            <oxer:blResult>1</oxer:blResult>
            <oxer:sMessage></oxer:sMessage>
        </oxer:OXERPType>
        <oxer:OXERPType>
            <oxer:aResult>
                <oxer:ArrayOfString>
                    <oxer:string>OXID</oxer:string>
                    <oxer:string>michael21</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXOBJECTID</oxer:string>
                    <oxer:string>michael12</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXCATNID</oxer:string>
                    <oxer:string>michael13</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXSHOPID</oxer:string>
                    <oxer:string>2</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXTIME</oxer:string>
                    <oxer:string>665</oxer:string>
                </oxer:ArrayOfString>
            </oxer:aResult>
            <oxer:blResult>1</oxer:blResult>
            <oxer:sMessage></oxer:sMessage>
        </oxer:OXERPType>
    </oxer:aObject2Category>
</oxer:OXERPSetObject2Category>


I will get this error message:
<ns1:OXERPSetObject2CategoryResponse>
    <ns1:OXERPSetObject2CategoryResult>
        <ns1:OXERPType>
            <ns1:aResult>
                <ns1:ArrayOfString>
                    <ns1:string>OXID</ns1:string>
                    <ns1:string>michael11</ns1:string>
                </ns1:ArrayOfString>
            </ns1:aResult>
            <ns1:blResult>true</ns1:blResult>
            <ns1:sMessage/>
        </ns1:OXERPType>
        <ns1:OXERPType>
            <ns1:aResult>
                <ns1:ArrayOfString>
                    <ns1:string>OXID</ns1:string>
                    <ns1:string>michael21</ns1:string>
                </ns1:ArrayOfString>
            </ns1:aResult>
            <ns1:blResult>false</ns1:blResult>
            <ns1:sMessage>mysql error: [1062: Duplicate entry 'michael13-michael12-1' for key 'OXMAINIDXU'] in EXECUTE (Insert into oxobject2category set oxid = 'michael21',oxshopid = '1',oxobjectid = 'michael12',oxcatnid = 'michael13',oxpos = '0',oxtime = '665', ) with user root</ns1:sMessage>
        </ns1:OXERPType>
    </ns1:OXERPSetObject2CategoryResult>
</ns1:OXERPSetObject2CategoryResponse>


mysql> select * from oxobject2category where OXOBJECTID = 'michael12'\G
*************************** 1. row ***************************
       OXID: 046b46b1bb92b9c7aea5485e58b5354e
   OXSHOPID: 2
 OXOBJECTID: michael12
   OXCATNID: michael13
      OXPOS: 0
     OXTIME: 1425385989
OXTIMESTAMP: 2015-03-03 13:33:09
*************************** 2. row ***************************
       OXID: michael11
   OXSHOPID: 1
 OXOBJECTID: michael12
   OXCATNID: michael13
      OXPOS: 0
     OXTIME: 665
OXTIMESTAMP: 2015-03-03 13:33:09
2 rows in set (0,00 sec)

mysql> 


But as the documentation says I should be able to save more than one record into the table oxobject2category. Furthermore the documentation doesn't point out that for all existing shops records will be created by the ERP module itself.

So I am not able to set the field OXTIME for different relationships for one article at the same time. But I have to correct what the shop has done automatically when it doesn't have the wanted values.
Steps To Reproduce- install the latest shop version
- install the latest erp version
- create a second shop which inherits all products and categories from shop 1.
- execute the query:

<oxer:OXERPSetObject2Category>
    <oxer:sSessionID>9ol3nm6jkrjlsqne31savlt8m2</oxer:sSessionID>
    <oxer:aObject2Category>
        <oxer:OXERPType>
            <oxer:aResult>
                <oxer:ArrayOfString>
                    <oxer:string>OXID</oxer:string>
                     <oxer:string>05848170643ab0deb9914566391c0c63</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXOBJECTID</oxer:string>
                    <oxer:string>michael12</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXCATNID</oxer:string>
                    <oxer:string>michael13</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXSHOPID</oxer:string>
                    <oxer:string>1</oxer:string>
                </oxer:ArrayOfString>
                <oxer:ArrayOfString>
                    <oxer:string>OXTIME</oxer:string>
                    <oxer:string>665</oxer:string>
                </oxer:ArrayOfString>
            </oxer:aResult>
            <oxer:blResult>1</oxer:blResult>
            <oxer:sMessage></oxer:sMessage>
        </oxer:OXERPType>
    </oxer:aObject2Category>
</oxer:OXERPSetObject2Category>


- check the table:
select * from oxobject2category where OXOBJECTID = 'michael12'\
Additional InformationWorkaround:
To set the value of OXTIME for another sub-shop (id 2) you have to make a new login call with the shop specific shop id (id 2):
<oxer:OXERPLogin>
    <oxer:sUserName>admin</oxer:sUserName>
    <oxer:sPassword>admin</oxer:sPassword>
    <oxer:iShopID>2</oxer:iShopID>
    <oxer:iLanguage>0</oxer:iLanguage>
</oxer:OXERPLogin>

Else you will get an "Not sufficient rights to perform operation!" error.
TagsEE, ERP

Activities

There are no notes attached to this issue.