Thanks everybody for answers.
I didn't like to put this .php file in root just to not list too many files into root.
For most this isn't a problem, I understand, but I like to keep things clean.
Anyway I publish here the solution I found, some may find it usefull.
Anyway since all I needed from application_top.php was the ability to get results from funcitons (i.e. I needed to use price functions in my feed generator).
So I created a zencart_lookups_api.php file which stands in root and outputs a json result (according to the $_GET variables in url).
Then my .php feed generator get those results from url and save it into $variables.
zencart_lookups_api.php
PHP Code:
<?php
header("Content-type: application/json");
require('includes/application_top.php');
// Getting actual price when in url ?get_actual_price&products_id=...
if(isset($_GET['get_actual_price'])) {
if($_GET['products_id']) {
$products_id = $_GET['products_id'];
$tax_rate_check = $db->Execute("select tax_rate
from " . TABLE_PRODUCTS . " p, " . TABLE_TAX_RATES . " t
where p.products_id = '" . (int)$products_id . "'
and t.tax_class_id = p.products_tax_class_id
limit 1");
$tax_rate = $tax_rate_check->fields['tax_rate'];
$base_price = number_format(zen_get_products_base_price($products_id) * (1+($tax_rate/100)), 2, '.', '');
$special_price = number_format(zen_get_products_special_price($products_id, true) * (1+($tax_rate/100)), 2, '.', '');
$sale_price = number_format(zen_get_products_special_price($products_id, false) * (1+($tax_rate/100)), 2, '.', '');
echo '{"base":"' . $base_price . '",
"special":"' . $special_price . '",
"sale":"' . $sale_price . '"
}';
}
}
?>
feed_generator.php
PHP Code:
// Getting actual price from zencart
$server_host = preg_replace('/^www\./','',$_SERVER['HTTP_HOST']);
$get_price = _zen_getURL((!empty($_SERVER['HTTPS']) ? 'https://www.' : 'http://www.') . $server_host . '/zencart_lookups_api.php?get_actual_price&products_id='.$products_id);
$get_price = json_decode($get_price, true);
$base_price = $get_price['base'];
$special_price = ($get_price['special'] != '0.00' ? $get_price['special'] : 0);
$sale_price = ($get_price['sale'] != '0.00' ? $get_price['sale'] : 0);
$discounted_price = min(array_filter([$sale_price, $special_price]));