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

Froogle Google

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 07-22-2003, 04:13 PM
 
jeeya jeeya is offline
 

X-Adept
  
Join Date: May 2003
Location: USA
Posts: 807
 

Default .

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


Reply With Quote
  #22  
Old 07-23-2003, 02:41 PM
 
jeeya jeeya is offline
 

X-Adept
  
Join Date: May 2003
Location: USA
Posts: 807
 

Default .

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
Reply With Quote
  #23  
Old 07-25-2003, 09:49 AM
 
davesphoto davesphoto is offline
 

Member
  
Join Date: May 2003
Posts: 24
 

Default

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 ).

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!
Reply With Quote
  #24  
Old 07-26-2003, 11:35 AM
 
HairGuy HairGuy is offline
 

Member
  
Join Date: Oct 2002
Posts: 12
 

Default 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]
Reply With Quote
  #25  
Old 07-27-2003, 02:52 PM
 
jeeya jeeya is offline
 

X-Adept
  
Join Date: May 2003
Location: USA
Posts: 807
 

Default .

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.
Reply With Quote
  #26  
Old 07-27-2003, 06:36 PM
 
jpsowin jpsowin is offline
 

X-Adept
  
Join Date: Sep 2002
Posts: 459
 

Default

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!
__________________
Joshua Sowin
...taking things one TPL at a time.
Reply With Quote
  #27  
Old 07-28-2003, 06:09 PM
 
HairGuy HairGuy is offline
 

Member
  
Join Date: Oct 2002
Posts: 12
 

Default 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.
Reply With Quote
  #28  
Old 07-28-2003, 06:44 PM
 
cloud9 cloud9 is offline
 

Advanced Member
  
Join Date: Dec 2002
Posts: 43
 

Default

For anybody using Froogle, can you comment on how much traffic you are getting from getting listed there? Thanks...
Reply With Quote
  #29  
Old 07-28-2003, 06:54 PM
  kpayne's Avatar 
kpayne kpayne is offline
 

X-Adept
  
Join Date: Dec 2002
Location: Firetanksoftware.com
Posts: 469
 

Default

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!
__________________
X-cart Featured Products Manager from http://www.firetanksoftware.com - Put your products where you want, how you want.
Reply With Quote
  #30  
Old 07-28-2003, 07:38 PM
 
cloud9 cloud9 is offline
 

Advanced Member
  
Join Date: Dec 2002
Posts: 43
 

Default

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+");
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:58 PM.

   

 
X-Cart forums © 2001-2020