Import Product not working

Posts: 29
Joined: 04/21/2008

Hi,
I'm trying to import a database into ubercart. I have categories working fine, but I can't find any evidence of any new nodes for product being created.

When I upload the file, I don't get any error messages. Any ideas on where to start looking?

I'll see if posting a product in html works

Thanks.
-Don-

<product><unique_hash>389838b0b303f2e713e3e70ab914fc7b</unique_hash>
<id>10030</id>
<type>product</type>
<name>ACRUniversalRemoteControlKit</name>
<description><b>UniversalRemoteControlKit</b></br></br>UniversalRemoteControl (URC-102)</br>and a Point Pad™ (URP-102)</br></br><UL></br> <LI>Consists of universal master control unit and a Point Pad; installed via single coaxial cable</br> <LI>URC-102 provides optimum voltage to ensure brightest performance and long lamp life, regardless of boat system voltage fluctuations</br> <LI>URC-102 XRCiZ feature rotates and moves light assembly every 30 days from activation to keep all bearing surfaces free of corrosion and all electrical contacts functional (can be disabled)</br> <LI>On-Off and light rotation speed control</br> <LI>Point Pad allows finger tip control; surface/flush mount options included</br> <LI>Has the capacity to perform up to six different duties; ideal for searchlights, winches and other electrical devices</br> <LI>Easily retrofitted to most servo-motor drives</br> <LI>Compatible with 12 or 24VDC operation</LI></br></UL></br><b>Master Size:</b></br><LI>2.8 x 3.0 x 1.6 in (7.1 x 7.6 x 4.0 cm)</LI></br></br><b>Remote Size:</b></br><LI>5 x 4.5 x 5 in (12.7 x 11.43 x 12.7 cm)</LI></br></br><b>Master Weight:</b></br><LI>.65 lbs (300g)</LI></br> </br><b>Remote Weight:</b></br><LI>10.5 oz (300 g)</LI></description>
<model>9283.3</model>
<manufacturer></manufacturer><sell_price>419</sell_price>
<weight>1.5</weight>
<weight_units>lb</weight_units>
<length>10</length>
<width>10</width>
<height>4</height>
<length_units>in</length_units>
<categories><category><id>54</id>
</category>
</categories>
</product>

Posts: 2243
Joined: 08/07/2007
AdministratoreLiTe!

I wouldn't think it matters, but the HTML in the <description> isn't very standardized. Tags should be lowercase, and the <br /> tag should look like that. The second thing is more likely the problem if the XML parser doesn't know what to do about it. It's rather odd that there aren't any errors.

Posts: 29
Joined: 04/21/2008

Yes, you're right. I ended up using htmlentities. But the main thing I found out was that a lot of the optional fields weren't really optional. Once i put an exit; near the problems the errors started showing up. If i skipped a field because I thought it was optional I got an unfound object error.

Posts: 54
Joined: 08/08/2007

This is a XML snippet of what has worked for me (with UC Beta 7). I noticed that manufacturers, attributes, adjustments and classes nodes must be included even if empty.

<?xml version="1.0" encoding="utf-8"?>
  <store xmlns="http://www.ubercart.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ubercart.org http://www.ubercart.org/files/store.xsd">
    <categories>
      <category>
        <id>2</id>
        <name>Guitars</name>
      </category>
      <category>
        <id>8</id>
        <name>Basses</name>
      </category>
    </categories>
    <manufacturers></manufacturers>
    <attributes></attributes>
    <classes></classes>
    <products>
      <product>
        <unique_hash>139d14a0b009b9ab06abc709c51395f1</unique_hash>
        <id>312</id>
        <type>product</type>
        <name>Bluedridge BR 140</name>
        <description> </description>
        <model>1234567890</model>
        <list_price>0.00</list_price>
        <cost>0.00</cost>
        <sell_price>0.0000</sell_price>
        <weight>0</weight>
        <weight_units>kg</weight_units>
        <length>0</length>
        <width>0</width>
        <height>0</height>
        <length_units>cm</length_units>
        <image>
          <path>/absolute_path_to_directory_with_images_to_import/VoxAC30.jpg</path>
          <alt>VoxAC30</alt>
          <title></title>
        </image>
        <fields>
          <field>
            <name>field_status</name>
            <delta>
              <value>new</value>
            </delta>
          </field>
        </fields>
        <categories>
          <category>
            <id>8</id>
          </category>
        </categories>
        <attributes></attributes>
        <adjustments>
          <adjustment></adjustment>
        </adjustments>
      </product>
    </products>
  </store>

These may be of interest too: this summary by rich and this thread from around post #78.

A warning I got (Invalid argument supplied for foreach()) was related to not having a class inside the classes element. I ignored that since my products still got imported.

Be careful to provide a unique model (SKU) for each of your products. Not doing so may create multiple revisions of the same product (same node id) in the DB instead of unique products (depending on your settings in admin/store/settings/importer under "How should similarly identified products be handled during import").

Posts: 8
Joined: 01/27/2008

futurist wrote:

Be careful to provide a unique model (SKU) for each of your products. Not doing so may create multiple revisions of the same product (same node id) in the DB instead of unique products (depending on your settings in admin/store/settings/importer under "How should similarly identified products be handled during import").

Not 100% related to this but... I noticed on Ubercart 1.0 that in admin/store/settings/importer, "How should similarly identified products be handled during import" repeats 5x. Anyone has this too?