X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Export Shop data - compatable with AffiliateWindow, Kelkoo & (https://forum.x-cart.com/showthread.php?t=5207)

kevinbrown 11-12-2003 02:20 PM

Export Shop data - compatable with AffiliateWindow, Kelkoo &
 
Here is a crude but working mod of export.php/tpl to allow exporting all product data for use by
AffiliateWindow.com
Kelkoo.com
PriceRunner.com

Is displays in pipe delimited format all products that are on sale and in stock.



Save this as affiliatewindow.php under /provider/affiliatewindow.com

<?

#
# /provider/affiliatewindow.php
#

@set_time_limit(1800);

require "../smarty.php";
require "../config.php";



$excluded_columns = array("provider",
"distribution", "weight", "categoryid1", "categoryid2", "categoryid3",
"productcode", "descr", "avail", "forsale", "shipping_freight", "free_shipping", "discount",
"image_x", "discount_avail",
"param00", "param01", "param02", "param03", "param04", "param05", "param06", "param07", "param08", "param09",
"min_amount", "dim_x", "dim_y", "dim_z", "low_avail_limit", "orderby", "vat", "free_tax", "apply_gst", "apply_pst",
"list_price",
"image_y",
"add_date",
"rating",
"sales_stats",
"views_stats",
"del_stats",
"brand",
"model");


$chunk_size = 35;
$show_column_headers = "N";
$images_dir = $HTTP_POST_VARS["images_dir"];


# To block everything that has a stock level of less than 1 add the folling line to the sql statement
# $sql_tbl[products].avail>0 AND

$search_query = "SELECT $sql_tbl[products].*, $sql_tbl[categories].category, MIN($sql_tbl[pricing].price) AS price FROM $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[categories] WHERE $sql_tbl[pricing].productid=$sql_tbl[products].productid AND $sql_tbl[pricing].quantity=1 AND $sql_tbl[products].categoryid=$sql_tbl[categories].categoryid AND $sql_tbl[products].forsale='Y' AND $sql_tbl[pricing].membership='' $provider_condition GROUP BY $sql_tbl[products].productid ORDER BY $sql_tbl[products].productid";

$result = db_query($search_query);

$total_products = db_num_rows($result);

if ($total_products > 0) {


$_tmp_smarty_debug = $smarty->debugging;
$smarty->debugging = false;

$smarty->assign("delimiter", "|");
$smarty->assign("line", $line);

$counter = 0;

while ($product_data = db_fetch_array($result)) {



$product_data_2 = array();
if (is_array($product_data)) {
if ($config["Images"]["thumbnails_location"] == "DB" && $HTTP_POST_VARS["donot_backup_images"] != "Y")
$product_data["thumbnail"] = func_copy_image_to_fs($product_data["productid"], $images_dir);
elseif ($config["Images"]["thumbnails_location"] == "FS")
$product_data["thumbnail"] = array_pop(func_query_first("SELECT image_path FROM $sql_tbl[thumbnails] WHERE productid='$product_data[productid]'"));
foreach ($product_data as $key => $value) {
if (!in_array($key, $excluded_columns)) {
$product_data_2[$key] = strtr($value, "\r\n\t", "");
$product_data_2[$key] = "".str_replace("\"", "\"\"", $value)."";
}
}

}

$products[] = $product_data_2;
$counter++;

if ($counter%$chunk_size==0 || $counter==$total_products) {
$smarty->assign("products", $products);
$smarty->assign("total_columns", (is_array($products)?count($products[0]):0));
$smarty->assign("show_column_headers", $show_column_headers);
if ($show_column_headers == "Y")
$show_column_headers = "";
$smarty->display("main/aw_feed.tpl");
flush();
unset($products);
}

}

$smarty->debugging = $_tmp_smarty_debug;
exit;
}


$line = "\n";
$smarty->assign("line", $line);
$smarty->assign("products", $products);


?>



THEN save this as aw_feed.tpl under /skin1/main

{section name=prod_num loop=$products}
{strip}
http://www.citybreakaways.com/customer/product.php?productid={$products[prod_num].productid|replace:"\"":""}&cat={$products[prod_num].categoryid|replace:"\"":""}{$delimiter}
{$products[prod_num].product|replace:"\"":""}{$delimiter}
{$products[prod_num].fulldescr|replace:"\r":" "|replace:"\n":" "|replace:"\t":" "|replace:"\"":""|replace:",":","|strip_tags}{$del imiter}
{$products[prod_num].price|replace:"\"":""}{$delimiter}
http://www.citybreakaways.com/image.php?productid={$products[prod_num].productid|replace:"\"":""}{$delimiter}
{$products[prod_num].category|replace:"/":" > "|replace:"\"":""}{$delimiter}
{$products[prod_num].productcode|replace:"\"":""}
{/strip}

{/section}

cotc2001 06-11-2005 04:39 AM

Anyone got a working 4.0.5 feed generator that will work with kelkoo, comparestoreprices.co.uk etc???

One thing that is needed for a feed generator like this is to automatically add the vat rate to the price because nativley x-cart only exports the price as you have entered into add product (which is usually not including the VAT price)

If not im going to see if x-cart will build it for me.


All times are GMT -8. The time now is 06:42 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.