That is the code of the plugin that works
/**
* Get all the ads from de bbdd
*
* @return array
*/
function retrieveAds()
{
$dao = new DAO();
$select = $dao->getTablePrefix() . 't_category_description.s_name, ' . $dao->getTablePrefix() . 't_item_description.s_title, ' .
$dao->getTablePrefix() . 't_item_description.s_description, ' . $dao->getTablePrefix() . 't_item_location.s_country, ' .
$dao->getTablePrefix() . 't_item_location.s_address, ' . $dao->getTablePrefix() . 't_item_location.s_zip, ' .
$dao->getTablePrefix() . 't_item_location.s_region, ' . $dao->getTablePrefix() . 't_item_location.s_city, ' .
$dao->getTablePrefix() . 't_item_location.s_city_area, ' . $dao->getTablePrefix() . 't_item.i_price, ' .
$dao->getTablePrefix() . 't_item.fk_c_currency_code, ' . $dao->getTablePrefix() . 't_item.s_contact_name, ' .
$dao->getTablePrefix() . 't_item.pk_i_id, ' . $dao->getTablePrefix() . 't_item.s_contact_email';
$from = $dao->getTablePrefix() . 't_category_description, ' . $dao->getTablePrefix() . 't_item_description, ' .
$dao->getTablePrefix() . 't_item_location, ' . $dao->getTablePrefix() . 't_item';
$where = $dao->getTablePrefix() . 't_category_description.fk_i_category_id =' . $dao->getTablePrefix() . 't_item.fk_i_category_id AND ' .
$dao->getTablePrefix() . 't_item.pk_i_id =' . $dao->getTablePrefix() . 't_item_description.fk_i_item_id AND ' .
$dao->getTablePrefix() . 't_item.pk_i_id =' . $dao->getTablePrefix() . 't_item_location.fk_i_item_id';
$query = "SELECT " . $select . " FROM " . $from . " WHERE " . $where;
$results = $dao->dao->query($query);
return $results->result();
}
function getCustomFields($item_id) {
$dao = new DAO();
$select = $dao->getTablePrefix() . 't_meta_fields.s_name, ' . $dao->getTablePrefix() . 't_item_meta.s_value';
$from = $dao->getTablePrefix() . 't_meta_fields, ' . $dao->getTablePrefix() . 't_item_meta';
$where = $dao->getTablePrefix() . 't_item_meta.fk_i_item_id =' . $item_id . ' AND ' .
$dao->getTablePrefix() . 't_meta_fields.pk_i_id =' . $dao->getTablePrefix() . 't_item_meta.fk_i_field_id';
$query = "SELECT " . $select . " FROM " . $from . " WHERE " . $where;
$results = $dao->dao->query($query);
return $results->result();
}
/**
* Export the ads tp the xml output file
*
* @param array $data
* @param array $tags
*/
function doExport($data, $tags)
{
if (count($data) > 0) {
$xml_output = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><listings></listings>');
foreach ($data as $item) {
$xml_item = $xml_output->addChild("listing");
$xml_item->addChild($tags['title'] == "" ? "title" : $tags['title'], $item['s_title'] == null ? "" : $item['s_title']);
****** $xml_item->addChild($tags['basic_land'] == "" ? "basic_land" : $tags['basic_land'], $item['basic_land'] == null ? "" : $item['basic_land']);
$xml_item->addChild($tags['description'] == "" ? "description" : $tags['description'], $item['s_description'] == null ? "" : $item['s_description']);
$xml_item->addChild($tags['category'] == "" ? "category" : $tags['category'], $item['s_name'] == null ? "" : $item['s_name']);
$xml_item->addChild($tags['price'] == "" ? "price" : $tags['price'], $item['i_price'] == null ? "" : $item['i_price']/1000000);
$xml_item->addChild($tags['currency'] == "" ? "currency" : $tags['currency'], $item['fk_c_currency_code'] == null ? "" : $item['fk_c_currency_code']);
$xml_item->addChild($tags['country'] == "" ? "country" : $tags['country'], $item['s_country'] == null ? "" : $item['s_country']);
$xml_item->addChild($tags['region'] == "" ? "region" : $tags['region'], $item['s_region'] == null ? "" : $item['s_region']);
$xml_item->addChild($tags['city'] == "" ? "city" : $tags['city'], $item['s_city'] == null ? "" : $item['s_city']);
$xml_item->addChild($tags['area'] == "" ? "area" : $tags['area'], $item['s_city_area'] == null ? null : $item['s_city_area']);
$xml_item->addChild($tags['zip'] == "" ? "zip" : $tags['zip'], $item['zip'] == null ? "" : $item['zip']);
$xml_item->addChild($tags['address'] == "" ? "address" : $tags['address'], $item['s_address'] == null ? "" : $item['s_address']);
$xml_item->addChild($tags['name'] == "" ? "name" : $tags['name'], $item['s_contact_name'] == null ? "" : $item['s_contact_name']);
$xml_item->addChild($tags['email'] == "" ? "email" : $tags['email'], $item['s_contact_email'] == null ? "" : $item['s_contact_email']);
In order to get more fields i tried:
On the export part i added this : ******** $xml_item->addChild($tags['basic_land'] == "" ? "basic_land" : $tags['basic_land'], $item['basic_land'] == null ? "" : $item['basic_land']);
------------------
Since i know from the Attributes plugin each Identifier and in my case the "basic_land" is the identifier.
This line alone of course will not write anything on the xml file since it needs to read this i think at the 1st part of the code like it does with $dao->getTablePrefix() . 't_item_description.s_description, ' . $dao->getTablePrefix() . 't_item_location.s_country, ' .
Could you please help me with a custom field? and i can write all the others......
What i need replace to this in order to read the basic_land custom attribute : $dao->getTablePrefix() . 't_item_description.s_description, ' . $dao->getTablePrefix() . 't_item_location.s_country, ' .