Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Export Shop data - compatable with AffiliateWindow, Kelkoo &

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 11-12-2003, 02:20 PM
 
kevinbrown kevinbrown is offline
 

Newbie
  
Join Date: Feb 2003
Posts: 4
 

Default 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}
Reply With Quote
  #2  
Old 06-11-2005, 04:39 AM
 
cotc2001 cotc2001 is offline
 

X-Man
  
Join Date: Feb 2003
Location: Shrewsbury, UK
Posts: 2,351
 

Default

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.
__________________
x-cart 4.0.5 (live and heavily modded)
Server: freebsd
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:16 PM.

   

 
X-Cart forums © 2001-2020