Hello all I own a used car website(www.usedcarsinkerala.com) where we can sell used cars, recently i got in contact with another site www.trovit.com. Here we can submit the xml feed of my website so that my car listings will be available in trovit also For that i imported whole listings of my website and it came out .xls format. So i converted it to xml using a software and uploaded the file in my server. But trovit has a type of format which is different from what i made. GUIDELINES FROM TROVIT The xml i made from the software is different from the example gave in above guideline. Can you plaese help me in solving the problem. I will be very thankful
Please post some of the XML that you have generated. You need your feed to be in the form of: <trovit> <ad> <id>7004578</id> <url>http://www.yourdomain.com/ad/7004578</url> <title>2007 Toyota Qualis</title> <content> Cruise control, Climate control,.... </content> <price>450000</price> ....... <car_type>hatchback</car_type> <warranty>until 2011</warranty> </ad> </trovit> (with a few extra tags missed out for simplicity.) What content management system does your site use? It may be a case of adding a simple plugin which pulls data from your database.
<Listings> − <ROW> <id>439</id> <listing_type>Car</listing_type> <username>girishankar</username> <active>1</active> − <keywords> 2004 18000 180000 ALTO LX Maruti Alto Hatchback White Manual petrol 2 wheel drive Air Conditioning AM/FM Radio Compact Disc Player Power Door Locks </keywords> <featured>0</featured> <views>839</views> <pictures>pictures/439_1.jpeg;</pictures> <activation_date>2010-02-15 00:07:42</activation_date> <expiration_date>2010-03-17 00:07:42</expiration_date> <Year>2004</Year> <Mileage>18000</Mileage> <Video/> <Price>180000</Price> <SellerComments>ALTO LX</SellerComments> </ROW> − <ROW> Its coming as like this, and the the CMS, its a php script i bought online,
Might need to build a custom function to output the rss in that format. Can you identify which php file is building this. I'd assume that it loops through a database to output everything in the table's row order, but I could be wrong. You might need to do a little reading up on the PHP DOM Document element - check it out on php.net.
Ok, so when you exported it, the row headings were taken as the new row headings in the .xls file. What software did you use to convert this? - There might be options in there to change structure /tag names. In php, you'll need a file that creates an empty XML DOM, and then build up a custom structure in the form of the Trovit Feed (above), injecting into it your database data on the way. If you provide a database schema, I might be able to offer a little more help. What level of server access do you have? Are you on shared hosting? More information on this can be found at php.net http://www.php.net/manual/en/ref.domxml.php
I've also just found this article on Tech Republic http://articles.techrepublic.com.com/5100-10878_11-6141415.html The cod eyou should be interested in is: <?php // create doctype $dom = new DOMDocument("1.0"); // create root element $root = $dom->createElement("toppings"); $dom->appendChild($root); $dom->formatOutput=true; // create child element $item = $dom->createElement("item"); $root->appendChild($item); // create text node $text = $dom->createTextNode("pepperoni"); $item->appendChild($text); // create attribute node $price = $dom->createAttribute("price"); $item->appendChild($price); // create attribute value node $priceValue = $dom->createTextNode("4"); $price->appendChild($priceValue); // create CDATA section $cdata = $dom->createCDATASection("\nCustomer requests that pizza be sliced into 16 square pieces\n"); $root->appendChild($cdata); // create PI $pi = $dom->createProcessingInstruction("pizza", "bake()"); $root->appendChild($pi); // save tree to file $dom->save("order.xml"); // save tree to string $order = $dom->save("order.xml"); ?> This is making an XML document for a pizzaria order, however you can see the potential for swapping out some variables for your car data. You'dprobably want to make this a function or subroutine in PHP, and loop through your database extracing the cell data that you need. This could all then be placed under a button or link in your administration area called something like "Update XML" - saving a file in your root directory called cars-feed.xml etc... Hope this helps.
And one more article that has a walk through of what I just described: http://www.tonymarston.net/php-mysql/dom.html
Hmm, why not to try some open source ETL tool - they are designed to do exactly this - convert between formats. They come with UI which is graphical thus easier to debug. You may look at tools like CloverETL ( also Talend or Pentaho).