Hello:
How can I generate the products.csv file with landing pages (buy url) on my domain instead of merchant landing pages?
Right now is generating landing urls:
http://www.merchant-site.com/gateway.asp?REF=QCM1131663
and I want the BuyUrl to be:
http://www.mysite.com/product/product-name.html
Thanks,
David:
Thanks for the reply.
I am using the code I found on this board and added a new file called products.php. So can you tell me exactly what I am supposed to do with the code from http://www.pricetapestry.com/node/1252
Hi,
I'm not quite sure what you're currently using to generate your Froogle file, as the script in the other thread already uses the URL on your site, not the merchant URL. Can you post the script you are using and i'll show you how to change it to use the URL on your site. Alternatively you can email it to me if you like - reply to your reg code or forum registration email is the easiest way to get me...
Cheers,
David.
here is the code for the export file:
<?php
set_time_limit(0);
require("includes/common.php");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=products.csv");
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products`";
print "Merchant,Name,Description,ImageURL,BuyURL,Price,Category,Brand\n";
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
print $row["merchant"].",";
print $row["name"].",";
print $row["description"].",";
print $row["image_url"].",";
print $row["buy_url"].",";
print $row["price"].",";
print $row["category"].",";
print $row["brand"]."\n";
}
}
?>
Hi,
That makes sense now! Here's the changes to your export file to make it use the product URL on your site instead of the merchant URL:
<?php
set_time_limit(0);
require("includes/common.php");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=products.csv");
$baseUrl = "http://".$_SERVER["HTTP_HOST"].$config_baseHREF;
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products`";
print "Merchant,Name,Description,ImageURL,BuyURL,Price,Category,Brand\n";
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
if ($config_useRewrite)
{
$url = $baseUrl."product/".urlencode(str_replace(" ","-",$row["name"])).".html";
}
else
{
$url = $baseUrl."products.php?q=".urlencode($row["name"]);
}
print $row["merchant"].",";
print $row["name"].",";
print $row["description"].",";
print $row["image_url"].",";
print $url.",";
print $row["price"].",";
print $row["category"].",";
print $row["brand"]."\n";
}
}
?>
Hope this helps!
Cheers,
David.
David:
I ran this export.php and returned an empty file :(
Hiya,
The changes shouldn't make any difference at all to the output. Can you roll back to the old version and see if that returns any products; and if so - re-apply the changes and try again...
Cheers,
David.
I rolled back to the original export.php contents and still is returning an empty file.
Hi,
Have you had this script working before? If so, have there been any changes that you might have made in the mean time?
the export file was working fine before I apply those changes and is the same code that I posted earlier.
Hi chiquita,
Can you please email me your current export.php and I will incorporate the changes for you and send it back to you... reply to your reg code or forum registration email is the easiest way to get me. Please make sure to sent it as an attachment rather than just copy and pasted - and make sure of course that it is the version that is working before sending it...!
Cheers,
David.
I've tried implenting this but I'm having no joy.
I created a file called froogle and copied the baove code.
the problem is froogle is looking for the following file build up in order
"title" "description" "image_link" "link" "price"
can this be implemented from the above code?
thanks
Mally
Hi Mally,
If you just need a different layout that can be done quite easily. Does froogle require quote delimited values, with the line you provided as a header row? And are they comma separated? If so, the following script should do this:
<?php
set_time_limit(0);
require("includes/common.php");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=products.csv");
$baseUrl = "http://".$_SERVER["HTTP_HOST"].$config_baseHREF;
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products`";
print '"title","description","image_link","link","price"';
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
if ($config_useRewrite)
{
$url = $baseUrl."product/".urlencode(str_replace(" ","-",$row["name"])).".html";
}
else
{
$url = $baseUrl."products.php?q=".urlencode($row["name"]);
}
print '"'.$row["name"].'",';
print '"'.$row["description"].'",';
print '"'.$row["image_url"].'",';
print '"'.$url.'",';
print '"'.$row["price"].'"\n';
}
}
?>
Hope this helps,
Cheers,
David.
I've checked http://base.google.com/base/products.txt and it appears to be without "" and tab delimited (if that makes any sense
I just checked my inbox and found the following email from google telling me the layout required
QUOTE! It looks like you've sent us a text file in a format that Google Base does not support. Our system is currently able to accommodate only tab-delimited text files. Your tab-delimited file should have one tab separating each attribute from the next and should not include any tabs after the last attribute on any given line. An example tab-delimited header line would be:
link(tab)title(tab)description(tab)price(tab)image_link(tab)product_type
For more detailed tab-delimited bulk upload instructions, please visit the link below:
http://base.google.com/support/bin/answer.py?answer=58083&hlrm=en
Please resubmit your bulk upload after you've saved it in the tab-delimited format. We'll notify you if we need you to make any additional corrections. Otherwise, we'll send you an email to let you know that your bulk upload has been approved
Hi,
Is "product_type" mandatory? If so, do you know what it should contain in this instance?
Cheers,
David.
Hi Mally,
Based on the format specification above, try this:
<?php
set_time_limit(0);
require("includes/common.php");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=products.csv");
$baseUrl = "http://".$_SERVER["HTTP_HOST"].$config_baseHREF;
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products`";
print "link\ttitle\tdescription\tprice\timage_link\tproduct_type\n";
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
if ($config_useRewrite)
{
$url = $baseUrl."product/".urlencode(str_replace(" ","-",$row["name"])).".html";
}
else
{
$url = $baseUrl."products.php?q=".urlencode($row["name"]);
}
print $url."\t";
print $row["name"]."\t";
print $row["description"]."\t";
print $row["price"]."\t";
print $row["image_url"]."\t";
print "Magazine"."\n";
}
}
?>
Cheers,
David.
just checked and its worked and shown as processing
thanks David!
Mally
Could this script be modified to show only products from one merchant instead of all products?
Hi Clare,
Sure - on the line that generates the SQL...
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products`";
...simply change this as follows:
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE merchant='Merchant Name'";
(replacing Merchant Name with the merchant you wish to use)
Cheers,
David.
Hello Chiquita,
The script in the following thread will generate the landing page you want:
http://www.pricetapestry.com/node/1252
If you're not using the script in that thread (I assume that you're not because as you say your's is printing the buy_url), can you post the code that you are using and I'll show you how to modify it to use the local page instead of buy_url...
Cheers,
David.