How do I import product template inputs??

A forum where issues related to the DataPort utility can be discussed.
Post Reply
bemara579
Lieutenant (LT)
Lieutenant (LT)
Posts: 63
Joined: Thu Feb 19, 2009 6:15 pm

How do I import product template inputs??

Post by bemara579 » Wed Mar 11, 2009 5:57 pm

I am trying to upload new products and new product templates through DataPort and XML. It will not work and will only import the product template... but the inputs are not being created.

Below is a sample XML I am using. I even tried adding an element called: <InputFieldName>Some Name</InputFieldName> and <InputField>Some Name</InputField> so it would create the name like other objects, but it did not do anything.

I am also using the latest 7.0.2 DataPort (3/10). It is vital to upload the product template inputs.. Please help!

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<AbleCommerceExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ExportVersion>7.0</ExportVersion>
  <SourceVersion>7.0</SourceVersion>
  <SourcePlatform>ASPX</SourcePlatform>
  <SourceBuildNumber>1.0</SourceBuildNumber>
  <ExportPlatform>ASPX</ExportPlatform>
  <ExportBuildNumber>1.0</ExportBuildNumber>
  <Store>
    <StoreId>1</StoreId>
    <Products>
      <Product>
        <ProductId>0</ProductId>
        <Name>Mobile Bench Table</Name>
        <Price>879.99</Price>
        <CostOfGoods>0</CostOfGoods>
        <MSRP>1361.90</MSRP>
        <Weight>265.00</Weight>
        <Length>34.00</Length>
        <Width>56.00</Width>
        <Height>69.00</Height>
        <Sku>MBT10</Sku>
        <ThumbnailUrl>~/Assets/ProductImages/MBT_t.jpg</ThumbnailUrl>
        <ThumbnailAltText>Mobile Bench Table</ThumbnailAltText>
        <ImageUrl>~/Assets/ProductImages/MBT.jpg</ImageUrl>
        <ImageAltText>Mobile Bench Table</ImageAltText>
        <Summary>Many tables summary...</Summary>
        <Description>Some description..</Description>
        <IconUrl>~/Assets/ProductImages/MBT_i.jpg</IconUrl>
        <IconAltText>Mobile Bench Table</IconAltText>
        <ExtendedDescription>Save even more on quantities of 6 or more.</ExtendedDescription>
        <Assets />
        <CustomFields />
        <Images />
        <ProductTemplateId>0</ProductTemplateId>
        <ProductTemplate>MBT10</ProductTemplate>
        <TemplateFields>
          <ProductTemplateField>
            <ProductTemplateFieldId>0</ProductTemplateFieldId>
            <ProductId>0</ProductId>
            <InputFieldId>0</InputFieldId>
            <InputValue>Mobile Bench Unit</InputValue>
          </ProductTemplateField>
          <ProductTemplateField>
            <ProductTemplateFieldId>0</ProductTemplateFieldId>
            <ProductId>0</ProductId>
            <InputFieldId>0</InputFieldId>
            <InputValue>Rectangle</InputValue>
          </ProductTemplateField>
          <ProductTemplateField>
            <ProductTemplateFieldId>0</ProductTemplateFieldId>
            <ProductId>0</ProductId>
            <InputFieldId>0</InputFieldId>
            <InputValue>Solid industrial-grade particleboard</InputValue>
          </ProductTemplateField>
        </TemplateFields>
        <ProductOptions>
          <ProductOption>
            <ProductId>0</ProductId>
            <OptionId>0</OptionId>
            <Option>
              <OptionId>0</OptionId>
              <Name>Edge Band Color</Name>
              <ShowThumbnails>true</ShowThumbnails>
              <ThumbnailColumns>5</ThumbnailColumns>
              <Choices>
                <Choice>
                  <OptionChoiceId>0</OptionChoiceId>
                  <OptionId>0</OptionId>
                  <Name>Black Dyna-Rock</Name>
                  <ThumbnailUrl>~/Assets/ProductImages/Options/OPT647-15-15.jpg</ThumbnailUrl>
                  <ImageUrl>~/Assets/ProductImages/Options/OPT647jpg</ImageUrl>
                  <PriceModifier>98.00</PriceModifier>
                </Choice>
                <Choice>
                  <OptionChoiceId>0</OptionChoiceId>
                  <OptionId>0</OptionId>
                  <Name>Black</Name>
                  <ThumbnailUrl>~/Assets/ProductImages/Options/OPT648-15-15.jpg</ThumbnailUrl>
                  <ImageUrl>~/Assets/ProductImages/Options/OPT648.jpg</ImageUrl>
                  <PriceModifier>0</PriceModifier>
                </Choice>
                <Choice>
                  <OptionChoiceId>0</OptionChoiceId>
                  <OptionId>0</OptionId>
                  <Name>Brown</Name>
                  <ThumbnailUrl>~/Assets/ProductImages/Options/OPT649-15-15.jpg</ThumbnailUrl>
                  <ImageUrl>~/Assets/ProductImages/Options/OPT649.jpg</ImageUrl>
                  <PriceModifier>0</PriceModifier>
                </Choice>
                <Choice>
                  <OptionChoiceId>0</OptionChoiceId>
                  <OptionId>0</OptionId>
                  <Name>Grey</Name>
                  <ThumbnailUrl>~/Assets/ProductImages/Options/OPT650-15-15.jpg</ThumbnailUrl>
                  <ImageUrl>~/Assets/ProductImages/Options/OPT650.jpg</ImageUrl>
                  <PriceModifier>0</PriceModifier>
                </Choice>
                <Choice>
                  <OptionChoiceId>0</OptionChoiceId>
                  <OptionId>0</OptionId>
                  <Name>Putty</Name>
                  <ThumbnailUrl>~/Assets/ProductImages/Options/OPT651-15-15.jpg</ThumbnailUrl>
                  <ImageUrl>~/Assets/ProductImages/Options/OPT651.jpg</ImageUrl>
                  <PriceModifier>0</PriceModifier>
                </Choice>
              </Choices>
            </Option>
          </ProductOption>
          <ProductOption>
            <ProductId>0</ProductId>
            <OptionId>0</OptionId>
            <Option>
              <OptionId>0</OptionId>
              <Name>Plywood Core Top</Name>
              <ShowThumbnails>true</ShowThumbnails>
              <ThumbnailColumns>1</ThumbnailColumns>
              <Choices>
                <Choice>
                  <OptionChoiceId>0</OptionChoiceId>
                  <OptionId>0</OptionId>
                  <Name>Yes</Name>
                  <ThumbnailUrl>~/Assets/ProductImages/Options/OPT689-23-23.jpg</ThumbnailUrl>
                  <ImageUrl>~/Assets/ProductImages/Options/OPT689.jpg</ImageUrl>
                  <PriceModifier>48.00</PriceModifier>
                </Choice>
                <Choice>
                  <OptionChoiceId>0</OptionChoiceId>
                  <OptionId>0</OptionId>
                  <Name>No</Name>
                  <ThumbnailUrl />
                  <ImageUrl />
                  <PriceModifier>0</PriceModifier>
                </Choice>
              </Choices>
            </Option>
          </ProductOption>
        </ProductOptions>
        <TemplateFields />
        <Variants />
        <Categories>
          <Category>
            <CategoryId>1</CategoryId>
            <Path>Test</Path>
            <OrderBy>-1</OrderBy>
          </Category>
        </Categories>
      </Product>
    </Products>
  </Store>
</AbleCommerceExport>

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: How do I import product template inputs??

Post by Naveed » Thu Mar 12, 2009 11:59 am

You can not import product template information nested inside the product node this way. You will have to import product templates separately like:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<AbleCommerceExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ExportVersion>7.0</ExportVersion>
  <SourceVersion>7.0</SourceVersion>
  <SourcePlatform>ASPX</SourcePlatform>
  <SourceBuildNumber>1.0</SourceBuildNumber>
  <ExportPlatform>ASPX</ExportPlatform>
  <ExportBuildNumber>1.0</ExportBuildNumber>
  <Store>
    <StoreId>1</StoreId>
    <Name>7.1 stable branch</Name>
    <ApplicationName />
    <LicenseKey />
    <DefaultWarehouseId>1</DefaultWarehouseId>
    <WeightUnitId>0</WeightUnitId>
    <MeasurementUnitId>0</MeasurementUnitId>
    <NextOrderId>1</NextOrderId>
    <OrderIdIncrement>1</OrderIdIncrement>
    <ProductTemplates>
      <ProductTemplate>
        <ProductTemplateId>0</ProductTemplateId>
        <StoreId>1</StoreId>
        <Name>Book</Name>
        <InputFields>
          <InputField>
            <InputFieldId>1</InputFieldId>
            <ProductTemplateId>1</ProductTemplateId>
            <Name>Author</Name>
            <UserPrompt>Author:</UserPrompt>
            <InputTypeId>2</InputTypeId>
            <Rows>0</Rows>
            <Columns>0</Columns>
            <MaxLength>0</MaxLength>
            <IsRequired>false</IsRequired>
            <RequiredMessage />
            <IsMerchantField>true</IsMerchantField>
            <OrderBy>1</OrderBy>
            <InputChoices />
          </InputField>
          <InputField>
            <InputFieldId>2</InputFieldId>
            <ProductTemplateId>1</ProductTemplateId>
            <Name>ISBN</Name>
            <UserPrompt>ISBN:</UserPrompt>
            <InputTypeId>2</InputTypeId>
            <Rows>0</Rows>
            <Columns>0</Columns>
            <MaxLength>0</MaxLength>
            <IsRequired>false</IsRequired>
            <RequiredMessage />
            <IsMerchantField>true</IsMerchantField>
            <OrderBy>2</OrderBy>
            <InputChoices />
          </InputField>
        </InputFields>
      </ProductTemplate>
    </ProductTemplates>
  </Store>
</AbleCommerceExport>
This is because One template may be used for multiple products. However, you will not be able to associate it products in same import. I suggest first import all product templates. And once you know the ID's for templates update your product xml and use exact product template ID's.

bemara579
Lieutenant (LT)
Lieutenant (LT)
Posts: 63
Joined: Thu Feb 19, 2009 6:15 pm

Re: How do I import product template inputs??

Post by bemara579 » Thu Mar 12, 2009 6:09 pm

This is a lot more trickier than it sounds.. I am fine with pre-uploading my product templates- but to go back to the AbleCommerce database, export the input ids, and associate them with my original product template input values is a bloody mess. The only way I can think of associating them is by input name.

Can you please, please allow us to add a <InputFieldName /> field in the product XML to define its value. It doesn't have to create them on the fly as you say, but at least this way I can upload my product templates first, then just upload my products with a template input name and value.

Everything else uses a name to find an existing object, why not this?

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: How do I import product template inputs??

Post by Naveed » Fri Mar 13, 2009 4:56 am

I think you misunderstanding that the "Name" field is used every where to find objects. It is not the case.

And regarding your product template <-> product association we can handle it in a better way. Please read the steps below carefully:

1. As previously I mentioned above that you have to import product templates separately before products. SORRY about that...
WE CAN IMPORT PRODUCTS AND RESPECTIVE TEMPLATES TOGETHER.
Just put all your products and respective product templates in a single xml file. Here is the structure of the file:

Code: Select all

<Store>
	<ProductTemplates>
		<ProductTemplate>
			<ProductTemplateId>0</ProductTemplateId>
			<Name>Book</Name>
		</ProductTemplates>
		<ProductTemplate>
			<ProductTemplateId>0</ProductTemplateId>
			<Name>Movie</Name>
		</ProductTemplates>
	</ProductTemplates>
	<Products>
		<Product>
			<ProductId>0</ProductId>
			<ProductTemplate>Book</ProductTemplate>
		</Product>
		<Product>
			<ProductId>0</ProductId>		
			<ProductTemplate>Movie</ProductTemplate>
		</Product>
	<Products>
</Store>
Look we are using the Product template "Name" fields to associate it to a product. Hope your issue will be solved.

NOTE: We can only associate a few objects in such a way using the "Name" field. Like

Vendor -> Product
Manufacturer -> Product
TaxCode -> Product
ProductTemplate -> Product

Please keep in mind that this is an extra feature. Otherwise the standard way to associate objects is to use the respective object ID fields. Only for these objects we first look by object name if provided and then the ID.

bemara579
Lieutenant (LT)
Lieutenant (LT)
Posts: 63
Joined: Thu Feb 19, 2009 6:15 pm

Re: How do I import product template inputs??

Post by bemara579 » Fri Mar 13, 2009 5:43 am

Thanks for the reply. The issue is not with importing products and their respective product templates- DataPort handles that part well, as your last XML sample shows.

The problem is with the product template input values. It gets messy at that point. I will see what I can come up with and will post my steps back here.

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: How do I import product template inputs??

Post by Naveed » Fri Mar 13, 2009 6:19 am

Sorry that I misunderstood your original issue...
Now I got it,

I am currently not sure but I think you will not be able to import product template inputs for new products. It is because you don't know(and can not specify) the product and input field ID's in advance for a new product.

I will confirm it a little later, after verification!

bemara579
Lieutenant (LT)
Lieutenant (LT)
Posts: 63
Joined: Thu Feb 19, 2009 6:15 pm

Re: How do I import product template inputs??

Post by bemara579 » Sat Mar 14, 2009 10:50 am

Thx--

Just to give you more background context, I have attached an Excel file to illustrate what my data looks like.

The first tab is my original data from a legacy system (not AbleCommerce). It is a simple (and common) key/value pair for product attributes.

After running some scripts against it to get it as close to something I can import into AbleCommerce, I end up with 4 tabs in the attached Excel file:

1.) The "Templates" tab is all the ProductTemplates I extracted from my original data (by finding products that have the same set of "SpecNames".

2.) The "TemplateInputs" tab is all the input names, input ids, and their associated ProductTemplate.

3.) The "Products-Templates Assoc" tab is my associations between my products and templates.

4.) The "Products-Inputs Assoc" tab is my input values for each product.

I have a fresh AbleCommerce install with nothing in it. This is the data I am trying to get into AbleCommerce via DataPort XML (I will convert it to a nested XML later, but wanted to just show my sample in simple form).

bemara579
Lieutenant (LT)
Lieutenant (LT)
Posts: 63
Joined: Thu Feb 19, 2009 6:15 pm

Re: How do I import product template inputs??

Post by bemara579 » Wed Mar 18, 2009 6:00 am

Any status on importing template and template inputs??

I can not put off my client any more and want to know if I should import straight into the SQL Server (and anything I have to be aware of when doing this). I do not really want to do this, but DataPort is not cutting it with any real migrations.

bemara579
Lieutenant (LT)
Lieutenant (LT)
Posts: 63
Joined: Thu Feb 19, 2009 6:15 pm

Re: How do I import product template inputs??

Post by bemara579 » Wed Mar 18, 2009 6:21 pm

I have attached my legacy database schema that I am transferring from. I can see this as being a common one. I can convert it to nested XML or may do direct SQL query.

Please advise from here.. Thx

euroluxantiques
Commander (CMDR)
Commander (CMDR)
Posts: 118
Joined: Sat Dec 20, 2008 11:27 pm

Re: How do I import product template inputs??

Post by euroluxantiques » Thu Mar 19, 2009 5:27 pm

Every time I've tried to upload products via direct SQL Server query, it blows the AbleCommerce database up. Back you db up first and give it a try, but I've never been able to make it work. I created queries to export the data in AbleCommerce csv format and haven't had much success, either. It sure would be great if you could just blow your products right into ac_Products, as I already have all my products in a separate db and it seems a bit ridiculous to have to go out of SQL and into DataPort to go back into SQL.

If you figure it out, please let me know! I have the same problems. I'll do the same.

User avatar
Shopping Cart Admin
AbleCommerce Admin
AbleCommerce Admin
Posts: 3055
Joined: Mon Dec 01, 2003 8:41 pm
Location: Vancouver, WA
Contact:

Re: How do I import product template inputs??

Post by Shopping Cart Admin » Thu Mar 26, 2009 1:42 pm

Hello,

Trying to explain how to directly import into AbleCommerce's database is really beyond the scope of the kinds of things that can be accomplished in the forums. It has been successfully accomplished but it requires a strong understanding of a highly complex database structure. We have a number of partners that can assist with this task and I'd suggest contacting them for a quote.
Thanks for your support

Shopping Cart Guru
AbleCommerce.com
Follow us on Facebook

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: How do I import product template inputs??

Post by sohaib » Tue Mar 31, 2009 5:19 am

bemara579 wrote:I have attached my legacy database schema that I am transferring from. I can see this as being a common one. I can convert it to nested XML or may do direct SQL query.

Please advise from here.. Thx
If you can convert to XML that DataPort accepts you should take that route. Direct database manipulation should be avoided. There are certain intricacies that you should better leave to AbleCommerce code to take care of. If you don't use the XML approach for some reason even then the recommended approach is to use the AbleCommerce API to add/remove data to the database.

Post Reply