Developer forum

Forum » Ecommerce - Standard features » Import of variants via data integration

Import of variants via data integration

Morten Fink Eriksen
Reply

Hey

 

I have some questions regarding import of variants via data integration, if have the following XML:

 

<?xml version="1.0" encoding="UTF-8"?>
<tables>
  <table tableName="EcomProducts">
    <item table="EcomProducts">
      <column columnName="ProductID"><![CDATA[Y3E4134301]]></column>
      <column columnName="ProductVariantID"><![CDATA[]]></column>
      <column columnName="ProductStock"><![CDATA[9997]]></column>
      <column columnName="ProductVariantCounter"><![CDATA[0]]></column>
      <column columnName="ProductVariantProdCounter"><![CDATA[0]]></column>
    </item>
    <item table="EcomProducts">
      <column columnName="ProductID"><![CDATA[PROD983]]></column>
      <column columnName="ProductVariantID"><![CDATA[V050]]></column>
      <column columnName="ProductStock"><![CDATA[9998]]></column>
      <column columnName="ProductVariantCounter"><![CDATA[2]]></column>
      <column columnName="ProductVariantProdCounter"><![CDATA[0]]></column>
    </item>
    <item table="EcomProducts">
      <column columnName="ProductID"><![CDATA[PROD983]]></column>
      <column columnName="ProductVariantID"><![CDATA[VO55]]></column>
      <column columnName="ProductStock"><![CDATA[9999]]></column>
      <column columnName="ProductVariantCounter"><![CDATA[2]]></column>
      <column columnName="ProductVariantProdCounter"><![CDATA[1]]></column>
    </item>
  </table>
</tables>

 

1) Is the "ProductVariantProdCounter" necessary when importing with variants, i know the "ProductVariantCounter" is needed or the product removes its variant relation in the backend, but what is the function of "ProductVariantProdCounter"?

 

2) When importing to the primary product, i can't seem to import to it if i supply the variantid that the product has (V050), but if i remove it it imports to the primary product, but how does it know which variant is the primary when i don't specify the "ProductVariantID", somehow it behind the scenes seems to know to update the primary variant. Anybody know how this works?

 

 


Replies

 
Morten Snedker
Reply

Hi Morten,

1)
Both ProductVariantCounter and ProductVariantProdCounter are for internal use regarding the behaviour of the GUI in backend. ProductVariantCounter is the amount of records of a given variant in table EcomVariantOptionsProductRelation

ProductVariantProdCounter is a running key with base in 0. Main product will have "0", first variant "0", second variant "1", third variant "2"..

 

2)
Given the nature of you question I take it that you are using the Dynamicweb Provider. If so, make sure that you are putting data to proper tables before getting to the products - and in proper order:

 

- EcomVariantGroups
- EcomVariantsOptions
- EcomVariantgroupProductRelation
- EcomVariantOptionsProductRelation

 

If your variant groups a static (they often are), you may want to leave out EcomVariantGroups.

 

Now, putting data to those tables requires quite some knowledge of the DW table structure and can be quite a hazzle. That is one of the reasons of why we have made an Ecom Provider: to help doing some of the logic. If you use the Ecom Provider you can simplify the format of you import file tremendously. The downside is that the logic of the Ecom Provider has some costs in regards of overhead.

 

See http://vimeo.com/album/2042889/video/57368733 for a simple example for importing variants.

 

Hope the above helps to clarify! :-)

 

Regards /Snedker

 

 
Morten Fink Eriksen
Reply

I am using the Ecom provider to import products.

 

With regards to your answer for question 2, the variants, variantsgroups etc. are already created, im just trying to "match" them in the import.

But im still confused as to why leaving out the variantid automatically means you are importing to the "main" product even though the main product has a variantid?

 

Say i have 3 products/variants:

 

ProdId1 (Main Product)

VariantId1 (Main Product)

 

ProdId1

VariantId2

 

ProdId1

VariantId3

 

Why does importing to the product with its variantid differ from importing to the product without specifying its variantid?

 

If i import to ProdId1 with VariantId1 it doesn't import anything to that product, but if i remove the variantid it imports to the main product just fine. Is it because the main product isn't really the variant product?

 

 

 

 

 
Morten Snedker
Reply

The Dynamicweb eCommerce has to types of variants:

- Simple
- Extended

 

A simple variant will have just one entry (row) in EcomProducts. The structure of variants are kept in table EcomVariantOptionsProductRelation where you will find VariantOptionID and ProductID being the joined key of the table. EcomProducts.ProductVariantID you will find is blank.This scenario you will have when price/description/etc is the same for all variants.

 

An extended variant will have one entry (row) in EcomProducts for each variant, and you'll find that EcomProducts.ProducVariantID now has a value indicating the variant. This scenario you will have when price/description/stock/what-ever varies from one variant to another.

 

The above is also explained in the video link (at 10:20).  ;-)

 

Regards /Snedker

 

 
Morten Fink Eriksen
Reply

Yes i understand the extended variant part, but you haven't answered my question.

 

As an example i have these Products

 

ProductID       ProductVariantID
PROD1308 

PROD1308    VO44
PROD1308    VO99

 

And VariantOptionsProductRelations:

 

VariantOptionsProductRelationProductID     VariantOptionsProductRelationVariantID
PROD1308                                                        VO44
PROD1308                                                        VO49
PROD1308                                                        VO99

 

My question is since VO49 in this case is the mainproduct, how come i can't update it using the variantid in import? i can only seem to update the mainproduct when not specifying the variantid. Does the ecomprovider use the defaultvariantcomboid in some way during import to know that when a variantid hasn't been specified, then update the variant which is the defaultvariantcomboid or something like this?

 

 

 
Morten Snedker
Reply

From an eCom perspective VO49 is not the main product. PROD1308 without ProductVariantID is the eCom definition of main product.

 

With the data you have presented VO49 is considered a simple variant, as it has no entry in EcomProducts table.

 

VO49 should be inheriting its information from the parent product. Is that not the case? Otherwise, please elaborate "can't update"...what it is you expect to see changed which is not changed.

 

Regards /Snedker

 

You must be logged in to post in the forum