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)
-   -   Froogle Google (https://forum.x-cart.com/showthread.php?t=2286)

jgkiefer 04-14-2003 06:49 AM

Froogle Google
 
Has anyone an easy way to create a file for Froogle Google?

jpsowin 04-14-2003 08:35 AM

Froogle Export Filter
 
Here is the new export filter.
If you need help with it, I can do work on the side integrating it into your cart if you do not know how, but this should certainly get you started, as it's pretty much all done right here. This took me hours of work and going back and forth with froogle to get this exactly right, so if you have problems then I'd be happy to help, just go to my x-cart services page.

/main/products_export.tpl
Quote:

{* HEADER FOR GOOGLE FEED By Joshua Sowin*}
{* If you remove these headers or change them you do not have permission to use this code. This code is copyright 2003 Joshua Sowin www.gracehost.net *}
{strip}
product_url{$delimiter}
name{$delimiter}
description{$delimiter}
price{$delimiter}
image_url{$delimiter}
category{$delimiter}
offer_id{$delimiter}
shipping
{/strip}
{* END HEADER *}
{section name=prod_num loop=$products}
{strip}
http://www.YOURWEBSITENAME.com/store/customer/product.php?productid={$products[prod_num].productid|replace:"\"":""}&cat={$products[prod_num].categoryid|replace:"\"":""}&partner=froogle{$deli miter}
{$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.YOURWEBSITENAME.com/store/image.php?productid={$products[prod_num].productid|replace:"\"":""}{$delimiter}
{$products[prod_num].category|replace:"/":" > "|replace:"\"":""}{$delimiter}
{$products[prod_num].productcode|replace:"\"":""}{$delimiter}
0.00
{/strip}
{/section}

jgkiefer 04-14-2003 12:01 PM

Wow, how cool. Do I replace main/export_products.tpl with this or add to it?

jpsowin 04-14-2003 12:52 PM

Replace

arismo 04-29-2003 01:55 PM

Thank you. I did it and I got this from Froogle:

"Thank you for submitting your feed to Froogle.
We have reviewed your feed and need you to make the following changes to it.

- Please remove all empty newlines from your file."

Where the problem may be?

minorgod 04-30-2003 08:41 AM

What the heck is Froogle Google?
 
Could someone tell me what Froogle Google is and why I might want to use it?

Also, I'd suspect you just need to do a final search/replace for \n\n on the data you're sending to Froogel Google. Basically just replace any double newlines with single newlines to strip out the blank lines. Or do a search and replace for any lines that start and end with a newline. I could easily show you this in PHP, but I've never tried anything like it in SMARTY code.

POSDepot 04-30-2003 09:19 AM

First of all, thanks so much for the Froogle export. We used it and all our products were on Froogle in 2 days.

The export does put a blank line between records.
Just load the file into Excel and click Data>> Filter>> Autofilter.
One of the choices is to show only blank lines.
Highlight all the blank lines and delete.
Resave the file and upload to Froogle.

Randy

jgkiefer 04-30-2003 11:41 AM

Re: What the heck is Froogle Google?
 
Quote:

Originally Posted by minorgod
Could someone tell me what Froogle Google is and why I might want to use it?


You can read about it here.
http://froogle.google.com/froogle/about.html

BeZerk 05-19-2003 11:08 AM

Great script - how can it be modified to remove the blank line?

magnumkp 05-20-2003 01:11 AM

I'm just waiting for a UK Google Froogle. Though good to get it tested on someone else for a change before they bring it here :D

cotc2001 06-19-2003 03:58 PM

I tried the script and it nearly works for me, I submitted to froogle but they say that the images point to the thumbnails rather than the full images :(

successful 06-30-2003 01:46 PM

I used POSDepot Excel workaround to get rid of the lines in between but Google responded:

Please also remove the quotes which are currently surrounding the header
and each product.

I did that manually and then they responded:

We are unable to process feeds that contain line breaks in the
descriptions. Please remove any line breaks from your item descriptions;
each product's information should take up exactly one line in the feed.
For example, the product Partner - English<->English appears to have line
breaks in either the description or name fields.

Your feed contains some extra tabs. There should be only one tab
separating each field from the next and there should not be any tabs after
the last field on any given line. Please make sure there are no extra tabs
in your feed. For example, the product Language Teacher - English <->
Czech Talking Dictionary with 128K Bilingual Business Organizer appears to have extra tab spaces.


Have any of you gotten the code to work ?

davesphoto 07-16-2003 07:46 AM

My main problem with using x-cart's product export for Froogle is that my store has multiple providers. X-cart only exports products for one provider from that providers page. I need a way to export all of the products in my store at the same time.

Wouldn't this whole proposal be easier if we just started from scratch with a new product_export.php. I am not much of a programer but I recall that PHP has very powerful text handeling and formating commands. But most importantly the SQL could be set up to export products from all providers. The new .php page could be called from the admin area.

I doubt that I can remember enough php to do this but if sombody else did and wanted to share that would be cool :wink: !

Thanks,
Chad
www.davesphotoemporium.com

groovico 07-16-2003 07:53 AM

We've already coded an export module for Froggle from x-cart data that does a clean data output.

We haven't released it for sale yet though. It's coming as part of a larger package.

PM me if you are interested and I'll let you know when it's available.

We'll also be offering customisable outputs as needed.

jpsowin 07-16-2003 11:23 AM

I had to change the multiple providers manually in the PHP code. Works like a charm. And, uh, hope you did your module from scratch ;) That wouldn't be cool since what I have posted here works just fine, especially if you customize it a little to your needs.

HockeyGuy 07-16-2003 11:52 AM

Works fine, but...
 
This export products mod worked fine for me, but just like another user found, it puts quotes at the beginning and end of each line.

I unfortunately had to delete these quotes manually.

It also provides the Thumnail image (which is fine so far as Froogle has not noticed, but they do specifically ask for a detailed image).

If anybody can post any workarounds for these 2 issues that would be very cool.

groovico 07-16-2003 01:10 PM

Quote:

Originally Posted by jpsowin
I had to change the multiple providers manually in the PHP code. Works like a charm. And, uh, hope you did your module from scratch ;) That wouldn't be cool since what I have posted here works just fine, especially if you customize it a little to your needs.


All our code is from scratch.

Break out box from x-cart admin. Much more pleasant. :)

Ours also limits the data outputted to what is publically available. The code above will export wholesale/special prices out too which most people don't want appearing in the search engines.

davesphoto 07-18-2003 10:38 AM

I got rid of the multiple user problem, but the posted code sill puts in lots of blank lines. Has anybody modified the code to fix this? And if so might they share with us less savy users :wink: ?

If not does anybody have any sugestions on how to remove the extra lines? I do not have Excel as one person mentioned, but I am sure there is another way. Perhapse in emacs or vi? Or with some free or GLP utility?

Thanks for the help.

Chad
Dave's Photo Emporium
www.davesphotoemporium.com

jeeya 07-22-2003 02:40 AM

.
 
Hello,

Ok I have paste code in my product_export.tpl in main directory,


Also Do I need to submit my website to froogle.com to be listed or this will work by self?

thanks

groovico 07-22-2003 11:09 AM

You need to do a bit more than that, you need to register an account with froogle.com and actually submit the generated data to them if you want to do it properly.

jeeya 07-22-2003 04:13 PM

.
 
I have filled up form and now they said that they will send information to upload database.



jeeya 07-23-2003 02:41 PM

.
 
ok, I sent them data feed and they want me to delete lines, now I don't know what lines! I open my data in exel and saw blank lines between products - Are they Talking about those lines? OR I have some lines blank for shipping charges where I had not put any values are they one?

Please let me know the quick way to delete them lines.
Thanks

davesphoto 07-25-2003 09:49 AM

I think I got it!
This does not print any extra lines. It also removes any extra tabs created by multiple carrage returns in the description (I am not sure why this happened with the old code but another |strip did the trick). Anyways, this is what I am using now for product_export.tpl:

Code:

{strip}
product_url{$delimiter}
name{$delimiter}
description{$delimiter}
price{$delimiter}
image_url{$delimiter}
category{$delimiter}
offer_id{$delimiter}
shipping{$line}
{section name=prod_num loop=$products}
http://www.davesphotoemporium.com/store/customer/product.php?productid={$products[prod_num].productid|replace:"\"":""}&cat={$products[prod_num].categoryid|replace:"\"":""}&partner=froogle{$delimiter}
{$products[prod_num].product|replace:"\"":""}{$delimiter}
{$products[prod_num].descr|replace:"\r":" "|replace:"\n":" "|replace:"\t":" "|replace:"\"":""|replace:",":","|strip_tags |strip}{$delimiter}
{$products[prod_num].price|replace:"\"":""}{$delimiter}
http://www.davesphotoemporium.com/store/image.php?productid={$products[prod_num].productid|replace:"\"":""}{$delimiter}
{$products[prod_num].category|replace:"/":" > "|replace:"\"":""}{$delimiter}
{$products[prod_num].productcode|replace:"\"":""}{$delimiter}
0.00{$line}
{/section}
{/strip}


Now be carefull! This tpl seems very sensitive to extra spaces or lines in the code, so don't leave any! Also notice I am using the short description, not the full one (I dont use it for display on the website so now it is the "froogle" description).

Also please note: You must define and assign the variable $line as the line delimiter in the export.php.

Put this at the top:
Code:

$line = "\n";

And this right after $smarty->assign("delimiter", $delimiter);:
Code:

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


This should export data ready for upload to froogle without modification (at least it does for me :wink: ).

I am not a programmer and do not know all the etiquette so I hope I am not stepping on any toes posting this code seeing as how some of the lines are unchanged from the code posted earlier in the discussion. The idea is quite different though. Anyway, I make no claim to the code; use it for anything you want! Hopefully it helps!

HairGuy 07-26-2003 11:35 AM

Automatic Froogle Update Code - No Templates Needed!
 
Here's some code that will automatically create a product file and send it to Froogle.

You can call it from X-Cart or it can be run automatically from 'cron' (on a Unix/Linux system).

I suggest you install it in the xcart/provider directory.

Jeff

Code:

<?
#
# $Id: froogle_update.php,v 1.6 2003/05/25 15:09:08 lfhair Exp $
#
# froogle_update.php
#
# This module will automatically export your products and send
# (using FTP) a properly-formatted file to Froogle.
#
# It can be run from X-Cart or it can also be run from the command
# line.  Running it from the command line is useful for setting
# up a 'cron' job that will automatically update your Froogle listings
# periodically (like once a week or once a day).  For example,
# the following crontab entry would update Froogle every Saturday
# at 2:00am:
#  0 2 * * 6 /usr/bin/php -q /home/mydir/www/xcart/provider/froogle_update.php
#
# In order for things to work, you must define the following variables in
# your config.php file:
#
#    $froogle_username = 'myfroogle';
#    $froogle_password = 'mypass';
#
# Values for the above are assigned by Google when you sign up for their
# Froogle service (see froogle.google.com for more info).
#
# The following variables are optional:
#
#    $froogle_host    - defaults to 'hedwig.google.com'
#    $froogle_partner  - set this if you want to track Froogle hits as
#                        an affiliate (i.e. set $froogle_partner="froogle")
#    $froogle_filename - name of the file that will be sent to Froogle
#
#------------------------------------------------------------------------
# Copyright 2003 by Jeff Groves (jeff@lfhair.com - www.lfhair.com)
# You have permission to use this code as long as you include the
# header lines above.  There are no guarantees that this code will
# work as expected.
#
#------------------------------------------------------------------------
#
require "../smarty.php";
require "../config.php";

$command_line_mode = false;

if ($_SERVER[DOCUMENT_ROOT]) {
        #
        #  Running from the web, make sure we authenticate the user
        #
        require "./auth.php";
        require "../include/security.php";
        set_time_limit(1800);
        $BR = '
';
} else {
        #
        #  Running from command line
        #
        $command_line_mode = true;
        ini_set('html_errors', '0');
        $BR = "\n";
}

$tab = "\t";
$partner_track = "";


# Use this condition when single mode is disabled

$provider_condition = ($single_mode ? "" : "and $sql_tbl[products].provider='$login'");

if (! $froogle_host) {
        $froogle_host = "hedwig.google.com";  # default Froogle host
}

if (! $froogle_username) {
        echo "ERROR: \$froogle_username is not set, it should be defined in your 'config.php' file.".$BR;
}

if (! $froogle_password) {
        echo "ERROR: \$froogle_password is not set, it should be defined in your 'config.php' file.".$BR;
}

if ($froogle_partner) {
        # if set, track froogle hits as an affiliate
        $partner_track="&partner=$froogle_partner";
}

if (! $froogle_filename) {
        $froogle_filename = $froogle_username.'.txt';  # default Froogle filename
}

if ($froogle_username && $froogle_password) {
        echo "Exporting products".$BR;
        $products = func_search_products("1 $provider_condition group by $sql_tbl[products].productid order by $sql_tbl[products].productid", $user_account['membership']);
}

if ($products) {
        #
        # These patterns will remove HTML tags, javascript sections
        # and white space. It will also convert some
        # common HTML entities to their text equivalent.
        #
        $search = array (
                "'<script[^>]*?>.*?</script>'si",  // Strip out javascript
                "'<[\/\!]*?[^<>]*?>'si",          // Strip out html tags
                "'[\s]+'",                // Strip out white space
                "'&(quot|#34);'i",                // Replace html entities
                "'&(amp|#38);'i",
                "'&(lt|#60);'i",
                "'&(gt|#62);'i",
                "'&(nbsp|#160);'i",
                "'&(iexcl|#161);'i",
                "'&(cent|#162);'i",
                "'&(pound|#163);'i",
                "'&(copy|#169);'i",
                "'&(lsquo|#8216);'i",
                "'&(rsquo|#8217);'i",
                "'&(ldquo|#8220);'i",
                "'&(rdquo|#8221);'i",
                "'&#(\d+);'e");                    // evaluate as php

        $replace = array (
                "",
                "",
                " ",
                "\"",
                "&",
                "<",
                ">",
                " ",
                chr(161),
                chr(162),
                chr(163),
                chr(169),
                "'",
                "'",
                '"',
                '"',
                "chr(\\1)");

        $fp = tmpfile();
        #
        #  Set up Froogle header
        #
        $product_url = 'product_url';
        $name        = 'name';
        $description = 'description';
        $price      = 'price';
        $image_url  = 'image_url';
        $category    = 'category';
        $offer_id    = 'offer_id';

        fwrite($fp, $product_url.$tab.
            $name.$tab.
            $description.$tab.
            $price.$tab.
            $image_url.$tab.
            $category.$tab.
            $offer_id."\n");

        #
        #  Build an export file
        #
        $count = 0;
        foreach ($products as $key => $value) {
                if ($products[$key][forsale] == 'N' ||  # skip products not available for sale
                    $products[$key][price] <= 0.00) {  # skip products with zero price
                        continue;
                }
                $count++;

                $product_url = $http_location.'/customer/product.php?productid='.$products[$key][productid].$partner_track;
                $name = preg_replace($search, $replace, strip_tags($products[$key][product]));
                $description = preg_replace($search, $replace, strip_tags($products[$key][fulldescr]));

                # if fulldescr is blank, use short description
                if ($description == "") {
                        $description = preg_replace($search, $replace, strip_tags($products[$key][descr]));
                }
                $price = $products[$key][price];
                $image_url = $http_location.'/image.php?productid='.$products[$key][productid];

                # convert '/' to '>' in category
                $category = eregi_replace('/', '>', $products[$key][category]);
                $offer_id = $products[$key][productcode]; # jjj - use productid ???
                fwrite($fp, $product_url.$tab.
                            $name.$tab.
                            $description.$tab.
                            $price.$tab.
                            $image_url.$tab.
                            $category.$tab.
                            $offer_id."\n");
        }

        rewind($fp);

        #
        #  Connect to Froogle and send file via FTP
        #
        $conn_id = ftp_connect($froogle_host);
        $login_result = ftp_login($conn_id, $froogle_username, $froogle_password);

        if ((!$conn_id) || (!$login_result)) {
                echo "FTP connection failed!".$BR;
                echo "User '$froogle_username' unable to connect to $froogle_host".$BR;
        } else {
                echo "User '$froogle_username' connected to $froogle_host".$BR;
                echo "Beginning FTP transfer of $count products".$BR;
                if (ftp_fput($conn_id, $froogle_filename, $fp, FTP_ASCII)) {
                        echo "OK - Transfer of file '$froogle_filename' was successful".$BR;
                } else {
                        echo "ERROR - Unable to transfer file '$froogle_filename'".$BR;
                };
        }
        fclose($fp);
}

if (! $command_line_mode) {
        echo '
Return to previous page';
}

?>

[/code]

jeeya 07-27-2003 02:52 PM

.
 
Hello

So How do I upload that Code??

And After that Will it send product data feeds byself or I will have to use ftp and upload it on froogle's server??

And If it sends automatically, How Do I know it has been sent? Also, Where do I put my User Name and Password for Froogle?

Thanks.

jpsowin 07-27-2003 06:36 PM

Did you read the instructions? It's all right there for you ;)

BTW, this looks like a very good mod. I haven't tried it myself, but it looks pretty solid from looking at the code. Great work!

HairGuy 07-28-2003 06:09 PM

It has been running in production for the past month
 
I've been running the above code on my production system for over a month and it works fine. I have it set up in 'cron' to also email me a message when it runs. You can do something like this in your crontab:
Code:

15 2 * * * /usr/bin/php -q $HOME/public_html/xcart/provider/froogle_update.php | mail -s 'Froogle Update' me@mydomain.com
Sorry, but I don't have time to explain the basics of crontab and PHP coding to newbies. However, if you want to pay my normal consulting fees, I'll be happy to set things up for you.

cloud9 07-28-2003 06:44 PM

For anybody using Froogle, can you comment on how much traffic you are getting from getting listed there? Thanks...

kpayne 07-28-2003 06:54 PM

Cloud9, you can install X-Affiliate and assign froogle a partner id and track it that way.

Or, you can use your own tracking system. I have all froogle links pointing to "/froogle/?id=$productid" and I wrote my own tracking and redirection code. There's tons of code out there if you want to use that solution -- just check hostscripts or resourceindex.

Hope this helps!

cloud9 07-28-2003 07:38 PM

Thanks Kurt, but I don't anticipate a problem tracking my stats once I'm in Froogle, I was just wondering what kind of hits stores that are already in Froogle were getting?

HairGuy, thanks so much for that script it made this process a breeze!

For those that want to actually see what is being generated, you can modify the php above like this...

# $fp = tmpfile();

$fp = fopen("./froogle_temp.txt", "w+");

kpayne 07-29-2003 03:36 AM

Ah, in that case, I've gotten 9 clicks. I'm sure like 5 of those were in-house clicks.

jgkiefer 07-29-2003 05:04 AM

Quote:

For those that want to actually see what is being generated, you can modify the php above like this...

# $fp = tmpfile();

$fp = fopen("./froogle_temp.txt", "w+");

How would I set it to download the froogle feed to a directory on my website server? That way I could set a cron tab to do this - give it a quick check and submit it myself. I like to check what is being auto-generated before submitting.

HairGuy 07-29-2003 07:30 AM

How to test it
 
To test the froogle_update.php script, just set the following variables (in the config.php file) to point to your FTP server:

$froogle_host = your FTP host
$froogle_username = your FTP username
$froogle_password = your FTP password

If you do this, it will send the export file to your FTP server (instead of Google's).

jgkiefer 08-04-2003 05:20 AM

It is putting in an extra slash / following the .com - example
Code:

http://officeemergencysupplies.com//customer/product.php?productid=16134
Where can I remove the extra / in the froogle code?

HairGuy 08-05-2003 09:56 AM

Check the setting of the $xcart_web_dir variable in config.php. It is probably set to '/'.

The product URL uses $http_location to build the link, so check to see if it has a trailing slash. If it does, you could use preg_replace() to remove it.
Try this:

Code:

$product_url = preg_replace('/\/$/', '', $http_location).'/customer/product.php?productid='.$products[$key][productid].$partner_track;

You may also need to do the same thing to $image_url

If the above does not work, then you may be using a version of X-Cart that I am not familiar with.

jgkiefer 08-05-2003 12:09 PM

Thank you, worked like a charm. :)

successful 08-05-2003 01:55 PM

Quote:

Originally Posted by davesphoto
I think I got it!
This does not print any extra lines. It also removes any extra tabs created by multiple carrage returns in the description (I am not sure why this happened with the old code but another |strip did the trick). Anyways, this is what I am using now for product_export.tpl:

Code:

{strip}
product_url{$delimiter}
name{$delimiter}
description{$delimiter}
price{$delimiter}
image_url{$delimiter}
category{$delimiter}
offer_id{$delimiter}
shipping{$line}
{section name=prod_num loop=$products}
http://www.davesphotoemporium.com/store/customer/product.php?productid={$products[prod_num].productid|replace:"\"":""}&cat={$products[prod_num].categoryid|replace:"\"":""}&partner=froogle{$delimiter}
{$products[prod_num].product|replace:"\"":""}{$delimiter}
{$products[prod_num].descr|replace:"\r":" "|replace:"\n":" "|replace:"\t":" "|replace:"\"":""|replace:",":","|strip_tags |strip}{$delimiter}
{$products[prod_num].price|replace:"\"":""}{$delimiter}
http://www.davesphotoemporium.com/store/image.php?productid={$products[prod_num].productid|replace:"\"":""}{$delimiter}
{$products[prod_num].category|replace:"/":" > "|replace:"\"":""}{$delimiter}
{$products[prod_num].productcode|replace:"\"":""}{$delimiter}
0.00{$line}
{/section}
{/strip}


Now be carefull! This tpl seems very sensitive to extra spaces or lines in the code, so don't leave any! Also notice I am using the short description, not the full one (I dont use it for display on the website so now it is the "froogle" description).

Also please note: You must define and assign the variable $line as the line delimiter in the export.php.

Put this at the top:
Code:

$line = "\n";

And this right after $smarty->assign("delimiter", $delimiter);:
Code:

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


This should export data ready for upload to froogle without modification (at least it does for me :wink: ).

I am not a programmer and do not know all the etiquette so I hope I am not stepping on any toes posting this code seeing as how some of the lines are unchanged from the code posted earlier in the discussion. The idea is quite different though. Anyway, I make no claim to the code; use it for anything you want! Hopefully it helps!



Hmmm.....I tried this and Google responded as follows:

Thank you for submitting your data feed. We have reviewed your feed and
need you to make some changes so that we can successfully process your
feed.

Please remove the first line of "$line = "\n";" from your data feed.
Please also separate the header and each product from other products by
using a line break. For example, after the shipping field for each
product, there should be a line break to separate it from the next
product.

After you have made this change, please upload a new version of your feed
with the same filename as before, and email us so that we can check the
new version.



Any suggestions ?

jgkiefer 08-05-2003 04:56 PM

Quote:

Any suggestions ?

Yes use the froogle_update.php mod from HairGuy on the previous page. It is the best!!! I think x-cart developers should include it in the x-cart package.

cloud9 08-05-2003 06:47 PM

Yep, HairGuy's script rocks. The only things I had to tweak to get my feed accepted by Froogle was to remove the offer_id (I didn't have any), and modify the script to not add an image link if I didn't actually have an image for a product.

jgkiefer 08-05-2003 07:40 PM

Quote:

Originally Posted by cloud9
modify the script to not add an image link if I didn't actually have an image for a product.


Oop's I forgot about that. How did you modify the code to not add an image link for products with no images?

What's an offer_id?


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

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