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

How to generate Custom requires XML Feed in magento
 
kifayati
Jr. Member
 
Total Posts:  2
Joined:  2012-03-24
 

Hi

I am planning to submit all of my products to a comparison based search engine.
They asked me to send the feed in this format.

http://www.comparethebazaar.com/img/SampleProductFeed.xml

The specification is given in detail at this link

http://www.comparethebazaar.com/merchant/FeedSpecification.html#

Please help me with some codes which i can put in the root, so that a supported feed can be generated.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
kifayati
Jr. Member
 
Total Posts:  2
Joined:  2012-03-24
 

Hi

Please check at this link

http://kifayati.com/export/export.php

I am getting 500 Internal server error

I created 2 files export.php and ArrayXml.php in root/export/

Please see I written in export.php

<?php
header(’Content-Type: text/xml’); // XML’s a handy dandy format

include ‘../app/Mage.php’; // Include the magento core

include ‘ArrayXml.php’;

Mage::app(); //And start up the Magento app

$_products = Mage::getModel(’catalog/product’)->getCollection();

$_result = array(); // Make sure we have a result array to store our products

foreach($_products as $_product) {
$_product = $_product->load();
$_result[’products’][’product’][] = array(
‘product_name’ => $_product->getName(),
‘product_description’ => $_product->getDescription(),
‘product_price’ => $_product->getPrice(),
‘product_special_price’ => $_product->getSpecial_price(),
‘product_url_path’ => $_product->getUrl_path(),
‘product_free_shipping_discount’ => $_product->getFree_shipping_discount(),
‘product_availability’ => $_product->getavailability(),
‘product_category’ => $_product->getCategory(),
‘product_image’ => $_product->getImage(),
);
}
$_converter = new ArrayXML();
echo $_converter->toXML($_result);

And in ArrayXml.php I written

<?php
// Filename: ArrayXml.php
class ArrayXml
{

private $xml;

public function __construct($root=’root’)
{
$this->xml = new SimpleXMLElement("<$root></$root>");
}

private function iterate($element, $xmlNode)
{
foreach($element as $name=>$value) {
if(is_string($value) || is_numeric($value)) {
$xmlNode->$name = $value;
} else {
$xmlNode->$name = null;
$this->iterate($value, $xmlNode->$name);
}
}
}

public function toXML($array)
{
$this->iterate($array, $this->xml);
return $this->xml->asXML();
}

}

 
Magento Community Magento Community
Magento Community
Magento Community
 
bastuijnman
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2009-10-20
 

What does your server error log say? There should be more info there about why you\’re getting a 500 error.
My best guess is that you are using a couple of methods not supported by the product model, like:

getSpecial_price()
getFree_shipping_discount()
getUrl_path()

Primarily because Magento uses camel casing for its methods. Check the documentation for further reference:
http://docs.magentocommerce.com/Mage_Catalog/Mage_Catalog_Model_Product.html

Hope this helps.

 
Magento Community Magento Community
Magento Community
Magento Community
 
GoMageTeam
Guru
 
Avatar
Total Posts:  356
Joined:  2013-01-13
Warsaw, Poland
 

Hello,

It would be better to use some third party extension for creating the feed file. Some extensions allow you creating the feed files in different formats such as CSV, TXT and XML formats. They also have useful instructions how to create the feed files in these formats.

We can advise you to try GoMage Feed Pro extension for doing this.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mirasvit
Guru
 
Avatar
Total Posts:  639
Joined:  2009-08-22
 

Hi!

Take a look at Advanced Product Feeds http://mirasvit.com/magento-extensions/advanced-product-feeds-generator.html

The extension has 23 (!) ready configurations for all key comparison shopping engines.
The extension supports the various formats, has the large-scale opportunities for filtering the uploaded products, supports creation of dynamic attributes.

Generation of feeds occurs very quickly. At that, the generation process is broken into the smaller processes, due to which the generation of feeds even for 200000 products makes no problem.

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