I want to export my own XML stream from Magento, and this is the following code that I use:
<?php
header('Content-Type: text/xml');
include '../app/Mage.php';
include 'ArrayXml.php';
Mage::app();
$_result = array();
$_products = Mage::getModel('catalog/product')->getCollection();
foreach($_products as $_product) {
$_result['produs'][] = array(
'denumire' => $_product->getName(),
'descriere_scurta' => $_product->getShortDescription(),
'descriere_lunga' => $_product->getDescription(),
'pret_intreg' => $_product->getPrice(),
'pret_redus' => $_product->getSpecialPrice(),
'url_produs' => $_product->getProductUrl(),
'fotografie_produs' => $_product->getImageUrl()
);
}
$_converter = new ArrayXML();
echo $_converter->toXML($_result);
However, only the product URL and image URL give me the correct values. The rest are empty.
What gives?
source
share