Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Help: How to import this XML from my wholesaler? 
 
Vic24
Jr. Member
 
Total Posts:  3
Joined:  2008-08-26
 

Hi Magento Community,

I am planning a new shop based on Magento. After the first templates edits are done now, I want to import the XML my wholesaler offers me. It is formed like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<dsProduct>
<
product>
<
id>123456</id>
<
product_type>
<
name>Game</name>
<
product_id>123456</product_id>
<
product_type_id>2</product_type_id>
</
product_type>
<
title>Title</title>
<
owner_group_id>2</owner_group_id>
<
description>Description of the product.</description>
<
publisher>Electronic Arts</publisher>
<
product_family>Product-Family</product_family>
<
ean>1234567890123</ean>
<
ean2/>
<
ean3/>
<
supplier>Suppliernamee</supplier>
<
release_date>2002-03-25</release_date>
<
erp_product_id>123456</erp_product_id>
<
packshot>packshot.jpg</packshot>
<
created>2002-01-02</created>
<
last_access>2007-10-02</last_access>
<
changed>2007-10-02</changed>
<
run_time>0</run_time>
<
number_media>1</number_media>
<
properties>e.gSystemrequirements</properties>
<
content>e.gPacking-Unit</content>
<
studio>Studioname</studio>
<
publisher_url>http://www.publisher.com</publisher_url>
<original_title>Original-Title</original_title>
<
age_rating>
<
name>6 years or older</name>
<
product_id>123456</product_id>
<
age_rating_id>2</age_rating_id>
5
</age_rating>
<
availability>
<
name></name>
<
product_id>123456</product_id>
<
availability_id>1</availability_id>
</
availability>
<
blocked>0</blocked>
<
recommended_price>24,99 â‚¬</recommended_price>
<
buying_price>16,77 â‚¬</buying_price>
<
vat>19</vat>
<
item_category>
<
name>PC</name>
<
product_id>123456</product_id>
<
item_category_id>1</item_category_id>
</
item_category>
<
unit>PIECE</unit>
<
pegi>No PEGI Rank</pegi>
<
number_players>1</number_players>
<
street_price>18,99 â‚¬</street_price>
<
product_url>http://www.producthomepage.com</product_url>
<rating>AAA</rating>
<
gross_weight>0,0</gross_weight>
<
width>13,7</width>
<
height>19,2</height>
<
depth>1,4</depth>
<
release_date_text>2008-12-04</release_date_text>
<
short_description>Short Description</short_description>
<
main_genre_name>Maingenre</main_genre_name>
<
main_genre_id>0</main_genre_id>
<
media>
<
extension_name>jpg</extension_name>
<
product_id>123456</product_id>
<
width>1475</width>
<
height>1475</height>
<
filename>ps1139577234Qio.jpg</filename>
<
file_type_name>jpg</file_type_name>
<
file_type_id>1</file_type_id>
<
media_type_name>packshot</media_type_name>
<
media_type_id>3</media_type_id>
<
media_id>494719</media_id>
</
media>
<
plattform>
<
name>Game Boy Advance</name>
<
product_id>123456</product_id>
<
plattform_id>66</plattform_id>
</
plattform>
<
genre>
<
name>Adventures RPGs</name>
<
product_id>123456</product_id>
<
genre_id>1</genre_id>
</
genre>
<
genre>
<
name>Action-Adventure</name>
<
product_id>123456</product_id>
<
genre_id>8</genre_id>
</
genre>
<
language>
<
product_id>123456</product_id>
<
language_id>2</language_id>
<
name>English</name>
6
<language_type>SPOKEN</language_type>
</
language>
<
person>
<
name>Bernie Smith</name>
<
product_id>123456</product_id>
<
person_id>123</person_id>
<
person_type>Producer</person_type>
<
person_type_id>1</person_type_id>
</
person>
<
person>
<
name>John Doe</name>
<
product_id>123456</product_id>
<
person_id>592</person_id>
<
person_type>Main Character</person_type>
<
person_type_id>2</person_type_id>
</
person>
<
audio_format>
<
name>DolbyDigital 5.1</name>
<
product_id>123456</product_id>
<
audio_format_id>6</audio_format_id>
</
audio_format>
<
audio_format>
<
name>DTS 5.1</name>
<
product_id>123456</product_id>
<
audio_format_id>2</audio_format_id>
</
audio_format>
<
video_format>
<
name>16:9</name>
<
product_id>123456</product_id>
<
video_format_id>3</video_format_id>
</
video_format>
<
keywords>
<
keyword>keyword1</keyword>
<
keyword>keyword2</keyword>
<
keyword>keyword3</keyword>
</
keywords>
<
product_families>
<
product_family>Productfamily1</product_family>
<
product_family>Productfamily2</product_family>
<
product_family>Productfamily3</product_family>
</
product_families>
</
product>
</
dsProduct>

What is the best way to import such a XML? Magento itself doesn’t seem to offer support on XMLs, which is very bad, as I plan to auto-import the products and stock from my wholesaler in the future. Any hints?

Thank you guys for your help!

Vic24

 
Magento Community Magento Community
Magento Community
Magento Community
 
Vic24
Jr. Member
 
Total Posts:  3
Joined:  2008-08-26
 

Is a XML import possible at magento or not? I need to know that, because on this answer depends whether i continue setting up my magento store or I will have to switch to another ecommerce solution.

Vic24

 
Magento Community Magento Community
Magento Community
Magento Community
 
mart3ndo
Jr. Member
 
Total Posts:  13
Joined:  2008-08-14
 

I’d also like to know if this is possible, also would a live XML feed work?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

So you want to write a script / module that imports products based a certain XML schema provided to you by a wholesaler?

Is this given to you in the form of a file or via a web service?

It is very possible to create products using an XML schema like this in Magento. It is not something you can do without some modification / development, however.

This is most easily done by writing a module that will create a bridge between Magento’s API and the XML file / API providing by your wholesaler.

A stock magento build can import products via a CSV file, but it needs to be of a certain format.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mart3ndo
Jr. Member
 
Total Posts:  13
Joined:  2008-08-14
 

mine would be in the form of a live xml feed.

dont suppose you have any info on how to build a bridge between the API and the XML feed

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

The easiest way would be to read Magento’s docs / wikis / people’s examples to get a handle on how Magento’s API works.

Then you can create an external script to do the dirty work for you. This basically gathers products from the wholesaler API, uses simpleXML to go through each product, and then makes calls to Magento’s API to insert the product and product information.

Once you get a working script going, you can then (if you choose) try to convert that into a backend module in Magento.

You could also not use Magent’s API (which is really meant to be used externally) and use Magento’s framework to insert products, but I’m not sure what that is rasberry (Can check out the Product section in the code, but it’s a lot to muck through).

If you’re a developer, you will be making SOAP calls. PHP5 has a SOAP class built in that you would use. This basically sends and received XML formatted data.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top