I use that process to integrate client legacy systems with OFBiz, and NDAs prevent me from posting any of it. I could create a generic example if I had time.

-Adrian

On 1/2/2012 12:13 AM, Mike wrote:
Sounds like a great plan Adrian.  Would it be possible to post a
working example?  Never too old to learn new tricks [grin].

On Sun, Jan 1, 2012 at 2:13 PM, Adrian Crum
<adrian.c...@sandglass-software.com>  wrote:
 From my perspective, it is easier to import the CSV data into a temporary
entity that mirrors the CSV file structure. Then I write a service in
mini-language to read the temporary entity and process the data it contains.
Categories, products and prices can be generated with just a few lines of
mini-language code.

-Adrian


On 1/1/2012 10:07 PM, Mike wrote:
Here is another reference:


https://cwiki.apache.org/confluence/display/OFBIZ/Handling+of+External+data

See "Use the OFBiz's Data File Tools to read you Cvs in" for (maybe)
an easy way of mapping entities.

I've never tried the above, even so, you'll STILL need to become
intimately familiar with ofbiz's product-related entities to properly
create the maps, or do it the manual way (below).

You have to turn each line into separate ofbiz entities:  Here they
are, in sequence, for the following example:


https://demo-trunk.ofbiz.apache.org/webtools/control/ViewGeneric?entityName=ProductCategory

https://demo-trunk.ofbiz.apache.org/webtools/control/FindGeneric?entityName=ProductCategoryRollup

https://demo-trunk.ofbiz.apache.org/webtools/control/ViewGeneric?entityName=Product

https://demo-trunk.ofbiz.apache.org/webtools/control/ViewGeneric?entityName=ProductCategoryMember

https://demo-trunk.ofbiz.apache.org/webtools/control/ViewGeneric?entityName=ProductPrice

There ARE more..  For instance you want to create variant products, or
products/categories/descriptions in multiple languages.  To do this
advanced stuff, there is no way around this.  Yes, it can get very
complex.

Here would be ONE simple product (including category and price, which
are separate entities)

File: specialpurpose/ecommerce/data/TestProduct.xml

--------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<entity-engine-xml>

      <!-- BEGIN OF RECORD -->
     <ProductCategory description="DropShip Products"
primaryParentCategoryId="CATALOG1" productCategoryId="dropShip"
productCategoryTypeId="CATALOG_CATEGORY"/>

     <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0"
parentProductCategoryId="CATALOG1" productCategoryId="dropShip"/>

     <Product productId="dropShip1" productTypeId="FINISHED_GOOD"
internalName="DropShip from DemoSupplier" productName="DropShip from
DemoSupplier" smallImageUrl="/images/products/dropShip1/small.jpg"
mediumImageUrl="/images/products/dropShip1/medium.jpg"
largeImageUrl="/images/products/dropShip1/large.jpg" isVirtual="N"
isVariant="N" requirementMethodEnumId="PRODRQM_DS"
billOfMaterialLevel="0" createdDate="2007-05-05 14:50:58.584"
createdByUserLogin="admin" lastModifiedDate="2007-05-05 15:05:41.62"
lastModifiedByUserLogin="admin" inShippingBox="N"
lastUpdatedStamp="2007-05-06 15:02:03.466"
lastUpdatedTxStamp="2007-05-06 15:02:02.465" createdStamp="2007-05-05
14:50:58.586" createdTxStamp="2007-05-05 14:50:58.21"/>

     <ProductCategoryMember productCategoryId="dropShip"
productId="dropShip1" sequenceNum="1" fromDate="2001-05-13
12:00:00.0"/>

     <ProductPrice productId="dropShip1"
productPricePurposeId="PURCHASE" productPriceTypeId="DEFAULT_PRICE"
currencyUomId="USD" productStoreGroupId="_NA_" fromDate="2001-05-13
12:00:00.0" price="13.99" createdDate="2001-05-13 12:00:00.0"
createdByUserLogin="admin" lastModifiedDate="2001-05-13 12:00:00.0"
lastModifiedByUserLogin="admin"/>

<!-- NOW REPEAT FOR EACH PRODUCT -->

</entity-engine-xml>

--------------------------------------------------------------------------------------------------------------------

Save as a file, then manually test the import (ofbiz can be running), like
this:

./ant run-install-file
-Ddata-file=specialpurpose/ecommerce/data/TestProduct.xml

Look for errors and correct:

If you want to add additional fields, just look at the entity (i.e.
Product), and add the field: description="whatever"

There is no shortcut around this.  Eventually, you'll need to import
other types of data, and this is the only bullet proof way to do it.
You have to become familiar with the data structure, so it is
important to carefully study the demo data.  Sequence is everything,
For the above product, you must pre-defne the category first, then
rollup, then product, product_category_member, then price.  If you
define one before the other, an error will occur.

To do this on a mass scale, a little (or a lot) programming
(perl/other) expertise is helpful.

On Sun, Jan 1, 2012 at 10:19 AM, Tom<t...@limepepper.co.uk>    wrote:
Hi,

I have an excel sheet with some 500 products, each with a price and image
url.

Is there a typical process for importing the product database to maintain
the price and image associations correctly?

Thanks
Tom

Reply via email to