Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Live Data Feed base class+Froogle - only 1 query!


Guest

Recommended Posts

  • Replies 140
  • Created
  • Last Reply

Top Posters In This Topic

Question about Froogle:

 

 

Froogle needs to rethink their navigation on their website. I need to adjust a setting which allows me to have quotation ("") marks in my description. I turned it off yesterday, and they dont link to that section anywhere on their website. If you know the actual URL to get there, I'd appreciate it....

Link to comment
Share on other sites

My images dont show up in Froogle.  It looks like the source path in froogle says "http://daggerdepot.com/product_info.php/products_id/images/*.img" when it should just be "http://daggerdepot.com/feeds/*.img

 

My feed that I send them looks correct.  Any suggestions?

 

Your images shouldn't be located in the "feeds" directory. They're supposed to be in the shop's images directory. go back and open your froogle configuration and make sure the defined images path there equals the images directory in your shop.

Link to comment
Share on other sites

  • 5 weeks later...
1104 - The SELECT would examine too many records and probably take a very long time. Check your WHERE and use SET OPTION SQL_BIG_SELECTS=1 if the SELECT is ok

 

SELECT * FROM products p LEFT JOIN products_description pd ON p.products_id = pd.products_id LEFT JOIN specials sp ON p.products_id = sp.products_id LEFT JOIN products_to_categories p2c ON p.products_id = p2c.products_id LEFT JOIN categories_description cd ON p2c.categories_id = cd.categories_id WHERE p.products_status = 1 GROUP BY p.products_id

 

[TEP STOP]

 

 

What did I miss here? Got suggestions?

Link to comment
Share on other sites

  • 3 weeks later...

Hi all,

 

great work on this contribution.

 

I just installed it last night. Had some issues but i was able to figure out my PATH problems but now i get this error and i'm not sure how to fix it. I get this when i click on upload.

 

Fatal error: Call to undefined function: ftp_connect() in /mnt/web_l/d15/s39/a0002sa6/www/movies/nfoscomm/catalog/admin/includes/classes/feed.php on line 71

 

Any ideas?

 

Thanks

Albert

Link to comment
Share on other sites

Hello!

 

I've just installed the contribution and get the same error. I don't see

the function ftp_connect defined anywhere. It's called, but not defined.

 

Any help is grately appreciated!

 

tks! Dennis

 

Hi all,

 

great work on this contribution.

 

I just installed it last night. Had some issues but i was able to figure out my PATH problems but now i get this error and i'm not sure how to fix it. I get this when i click on upload.

 

Fatal error: Call to undefined function: ftp_connect() in /mnt/web_l/d15/s39/a0002sa6/www/movies/nfoscomm/catalog/admin/includes/classes/feed.php on line 71

 

Any ideas?

 

Thanks

Albert

Link to comment
Share on other sites

Hello!

 

I've just installed the contribution and get the same error.  I don't see

the function ftp_connect defined anywhere.  It's called, but not defined.

 

Any help is grately appreciated!

 

tks!  Dennis

 

ftp_connect is a php function.

PHP 3>= 3.0.13, PHP 4 , PHP 5

 

So, I'm wondering what version of php you are using.

 

Paul

Link to comment
Share on other sites

Ladies and gentlemen,

 

I'll have the second version out directly that should deal with the majority of issues...

 

Great!

 

I just finished writing a derived class and page for a nextag feed, although it's not suitable for release since the mapping of categories is just if...then statements.

 

What feeds will this next version include support for? And do you have any idea when it will be out?

 

 

Also - for your version 2.0 you may want to consider changing the regex you used to strip tabs and newlines:

 

function strip ($content) {

  $search = array("![\t ]+$|^[\t ]+!m", '%[\r\n]+%m');

  $replace = array('','');

  return preg_replace($search, $replace, strip_tags( str_replace(">", "> ", $content) ) ) ;   

}

 

Using both ! and % as delimiters is very confusing. Perhaps you could use the usual / ... / or put in a comment to explain these delimiters. I had to search high and low to understand this regex.

Perhaps this function could also be made to quote out quotes (as in "" or \" for ")? Some feeds require this, but not all, so maybe it could be made configurable.

 

Great Contribution! Thanks for the work.

 

- Rinon

Link to comment
Share on other sites

Thanks Paul,

 

I found the following with a websearch:

 

In order to make ftp to work, you must use ./configure --enable-ftp when you build PHP binary.

 

Looks like I need rebuild php.

 

tks!  Dennis

 

Cool.

 

Post here if that solves the problem. I think it will. ;)

 

Paul

Edited by Fourbit
Link to comment
Share on other sites

  • 2 weeks later...

Hi Bobbie,

 

Was breezing through, caught that this was your Contrib so I figured I would install it. Read previous posts and understand paths are the no.1 reason for failure... when I click on :Store Feeds in Admin I get this repeated a trillion times

Warning: getimagesize(): Read error! in /home/virtual/site37/fst/var/www/html/ecom/includes/classes/feed.php on line 185

 

Warning: getimagesize(): Read error! in /home/virtual/site37/fst/var/www/html/ecom/includes/classes/feed.php on line 185

 

Warning: getimagesize(): Read error! in /home/virtual/site37/fst/var/www/html/ecom/includes/classes/feed.php on line 185

 

 

 

my paths are as such......

 

(admin/includes/classes/feed.php)
class feed {

/***************************/
/**     File / Format     **/
/***************************/
var $downloadname = 'gokartsrus.txt'; //download text file name and extension
var $fields; //this will be populated later
var $format = array('delimiter' => "\t", 'newline' => "\n"); //standard format is tab delimited
var $connection = 'ftp'; //FTP or just save it to disk
var $data = array(); //this will be populated later
var $html; //used to store the HTML output

/***************************/
/**       FTP INFO        **/
/***************************/
var $ftp_user; //FTP username
var $ftp_pass; //FTP password
var $ftp_server; //FTP server

/***************************/
/**     Filename Info     **/
/***************************/
var $savefilename; //local file name
var $targetfilename; //remote file name

/***************************/
/**   Paths and Images    **/
/***************************/
var $autoenlarge = true; //autoenlarge on by default, 500 px / 500 px
var $imageurl = 'http://www.gokartsrus.com/images/'; //trailing slash on the address
var $imagepath = '/home/virtual/site37/fst/var/www/html/images/'; //trailing slash on the path
var $feedimageurl = 'http://www.gokartsrus.com/feeds/'; //trailing slash on the address
var $feedimagepath = '/home/virtual/site37/fst/var/www/html/feeds/'; //trailing slash on the path
var $producturl = 'http://www.gokartsrus.com/product_info.php/id/';//make sure you use the URL version of your store. This example is for search engine safe URL's ON.

/***************************/
/**      Main Query       **/
/***************************/
// Don't touch this query unless you know what you are doing.  Instead, create a derived class and define it there.
var $query = 'SELECT * FROM products p 
     LEFT JOIN products_description pd ON p.products_id = pd.products_id 
     LEFT JOIN specials sp ON p.products_id = sp.products_id 
     LEFT JOIN products_to_categories p2c ON p.products_id = p2c.products_id 
     LEFT JOIN categories_description cd ON p2c.categories_id = cd.categories_id 
     WHERE p.products_status = 1 GROUP BY p.products_id';

 

(admin/includes/classes/froogle.php)
/****************************/
/**     FTP and fields     **/
/****************************/
//
/// ! DON'T change these !
$this->fields = "product_url\tname\tdescription\tprice\timage_url\tcategory\n"; //basic feed
$this->connection = 'ftp'; //FTP the data
//
/// ! Change these settings !
$this->ftp_user = '*************'; //FTP username
$this->ftp_pass = '***************'; //FTP password
$this->ftp_server = 'hedwig.google.com'; //FTP server
$this->targetfilename = 'gokartsrus.txt'; //this is the name of the file once uploaded

/*****************************/
/**     Paths and URL's     **/
/*****************************/

 

Any insight would be appreciated!!!!

Thanks, KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

Sorry big guy...

I meant Bobby (I use to date a Bobbie...)

By the way, I'm not using safe search engine but I am using your rewrite ultimate seo contrib. Anything to do with it?

Thanks, KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

  • 3 weeks later...

Help please I can't get the feed to locate my products

 

var $autoenlarge = false; //autoenlarge on by default, 500 px / 500 px

var $imageurl = 'http://tncandlesupplies.com/catalog/images/'; //trailing slash on the address

var $imagepath = '/www/t/n/tncandlesupplies.com/htdocs/catalog/images/'; //trailing slash on the path

var $feedimageurl = 'http://tncandlesupplies.com/feeds/'; //trailing slash on the address

var $feedimagepath = '/www/t/n/tncandlesupplies.com/htdocs/catalog/feeds/'; //trailing slash on the path

var $producturl = 'http://tncandlesupplies.com/catalog/product_info.php/id/';//make sure you use the URL version of your store. This example is for search engine safe URL's ON.

Link to comment
Share on other sites

I've got this working as a shopping.com feed exporter for anyone who needs it!

 

It's not the most elegant of coding so if someone wants to clean it up we can post it as an addon to the contrib...

 

Copy your /admin/ froogle file to shoppingdotcom.php

Make the following simple changes, just changing froogle.php to shoppingdotcom.php in a few places:

   //include the files
  require ('includes/application_top.php');
  require (DIR_WS_CLASSES . 'shoppingdotcom.php');
$froogle = new froogle; //new Froogle class
$froogle->makedata(); //make the data
$froogle->savetofile(rtrim($froogle->fields, $froogle->format['newline']), $froogle->savefilename); //save the data to file

//this section is to send the headers before output to the screen
switch($_REQUEST['action']) {
case upload:
$froogle->upload(rtrim($froogle->fields, $froogle->format['newline']), $froogle->targetfilename);
break;
case download:
$froogle->file_download($froogle->savefilename, $froogle->targetfilename);
break;
case viewtext:
$froogle->viewfile(rtrim($froogle->fields, $froogle->format['newline']), $froogle->savefilename, 'text/plain');
break;
default:
break;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Froogle Feed</title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body>
 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
  	 <td width="<?php echo BOX_WIDTH; ?>" valign="top">
	 <table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
 <!-- left_navigation //-->
 <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
 <!-- left_navigation_eof //-->
       </table>
 </td>
  <td>
 <p class="pageHeading">Froogle Feed</p>

<div align="center"><a href="shoppingdotcom.php?action=upload">Upload</a>
      | 
     <a href="shoppingdotcom.php?action=download">Download</a>
      | 
     <a href="shoppingdotcom.php?action=viewhtml">View HTML Version</a>
      | 
     <a href="shoppingdotcom.php?action=viewtext" target="_blank">View TXT Version</a>
     </div>
<hr>

 

Edit your /admin/includes/classes/ feeds.php

I added a line at 63 to pull the manufactures name

	/***************************/
/**      Main Query       **/
/***************************/
// Don't touch this query unless you know what you are doing.  Instead, create a derived class and define it there.
var $query = 'SELECT * FROM products p
     LEFT JOIN products_description pd ON p.products_id = pd.products_id
     LEFT JOIN specials sp ON p.products_id = sp.products_id
     LEFT JOIN products_to_categories p2c ON p.products_id = p2c.products_id
     LEFT JOIN categories_description cd ON p2c.categories_id = cd.categories_id
     LEFT JOIN manufacturers ma ON p.manufacturers_id = ma.manufacturers_id
     WHERE p.products_status = 1 GROUP BY p.products_id';

 

Finally create a shoppingdotcom.php in your /admin/includes/classes/ directory, here is what mine looks like:

<?php
/*
 $Id: shoppingdotcom.php,v 1.00 2005/03/13

 Froogle Data Feed extended class

 Contribution based on:

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 - 2003 osCommerce

 Released under the GNU General Public License

 Contribution created by: Chemo
*/

require (DIR_WS_CLASSES . 'feed.php');
class froogle extends feed {
var $links; //optional list of links to be displayed above the content
function froogle (){ //class contructor

/****************************/
/**     FTP and fields     **/
/****************************/
//
/// ! DON'T change these !
$this->fields = "mpn\tmanufacturer\tproduct name\tproduct description\tprice\tin stock\tstock description\tproduct url\timage url\tcategory\tproduct weight\tzip code\tshipping: ground rate\n"; //basic feed
$this->connection = 'ftp'; //FTP the data
//
/// ! Change these settings !
$this->ftp_user = '*'; //FTP username
$this->ftp_pass = '*'; //FTP password
$this->ftp_server = '*'; //FTP server
$this->targetfilename = 'shopping.txt'; //this is the name of the file once uploaded

/*****************************/
/**     Paths and URL's     **/
/*****************************/

//Where do you want to save the generated TXT file?  Be sure to include the FULL path and title.
// ! REQUIRED !
/// Make sure this is your FULL path to the save directory and name of file
$this->savefilename = '/var/www/html/feeds/homewetbar.txt';

//Do you want to enable auto enlarging for images?
//Default is true and dimensions are proportional 400px by 400px
$this->autoenlarge = false;

//Where do you want to save the enlarged image? Be sure to include the FULL path and title.
// ! REQUIRED !
/// Make sure this is the FULL path to your feed image directory
$this->feedimagepath = '/var/www/html/feeds/'; //Trailing slash required!

//What is the URL for the feed (enlarged) image folder?
// ! REQUIRED !
/// This is the URL to the feed images directory
$this->feedimageurl = 'http://homewetbar.com/feeds/'; //Trailing slashes required

//What is the path to your images folder?
// ! REQUIRED !
/// This is the FULL path to your normal images directory
$this->imagepath = '/var/www/html/images/'; //Trailing slash required!

//What is the URL for the images folder?
// ! REQUIRED !
/// This is the URL to your images directory
$this->imageurl = 'http://www.homewetbar.com/images/'; //Trailing slashes required!

//Use this to output links above the content
// ! OPTIONAL !
///Put your own links that are displayed above the content
$this->links = '';
}

/******************************************************/
/**                  Class Methods                   **/
/******************************************************/

function makedata() {
$data_query = tep_db_query($this->query);
 while ( $data = tep_db_fetch_array($data_query) ) {
	 if ($data['specials_new_products_price']) { //if it's on special
   $data['products_price'] = $data['specials_new_products_price']; //show the special price
   }
	 // Define shopping.com categories
	 if ($data['categories_id'] == 41) {
   $categoryname = 'Home Furnishings';
   } else {
   $categoryname = 'Kitchen';
   }
	 /**********************************************/
	 $addweight = '.5'; //How much weight for packing supplies to add to each product
	 $zipcode = '73120'; // Ship zipcode
	 /**********************************************/
	 $data['products_weight'] = $data['products_weight'] + $addweight; // Add weight for packing materials

	 // Free shipping on specific order amount
	 if ($data['products_price'] >= '95') {
   $shipfree = '0';
	 } else {
   $shipfree ='';
	 }

	 $data['products_image'] = $this->checkimage($data['products_image']); //check to see if the image is already enlarged

	 $this->data[$data['products_id']] = array ( 'mpn' => $data['products_mpn'],
             'manufacturer' => $data['manufacturers_name'],
             'product name' => $this->strip($data['products_name']),
             'product description' => $this->strip($data['products_description']),
             'price' => number_format($data['products_price'], 2, '.', ''),
             'in stock' => 'Y',
             'stock description' => 'Ships in 1-2 Days, New',
             'product url' => $this->producturl . 'bar-p-' . $data['products_id'] . '.html',
             'image url' => $data['products_image'],
             'category' => $categoryname,
             'product weight' => $data['products_weight'],
             'zip code' => $zipcode,
             'shipping: ground rate' => $shipfree
             );
   foreach ($this->data[$data['products_id']] as $column => $value) {
  	 $this->fields .= $value . $this->format['delimiter'];
  	 }
   $this->fields = rtrim($this->fields, $this->format['delimiter']) . $this->format['newline'];
 }
}

function viewfileHTML ($links='') {
$this->html = $links.'<style type="text/css">
  	 <!--
  	 td, a {
     font-family: Arial, Helvetica, sans-serif;
     font-size: 12px;
     }
  	 .highlight {
  	 background-color: #CCCCCC;
  	 }
  	 -->
  	 </style>
  	 <table width="100%">
  	 <tr>
     <td>mpn</td>
     <td>manufacture</td>
     <td>product name</td>
     <td>product description</td>
     <td>price</td>
     <td>in stock</td>
     <td>stock description</td>
     <td>product url</td>
     <td>image url</td>
     <td>category</td>
     <td>product weight</td>
     <td>zip code</td>
     <td>shipping: ground rate</td>
  	 </tr>';
 $data_query = tep_db_query($this->query);
 $on=false;
 while ( $data = tep_db_fetch_array($data_query) ) {
	 if($on) {$class=' class="highlight"';$on=false; } else { $class='';$on=true; }
	 if ($data['specials_new_products_price']) {
   $data['products_price'] = $data['specials_new_products_price'];
   $b = '<b>'; $bend = '</b>';
   } else {$b = ''; $bend = '';}
	 $this->html .= '<tr>';
	 $this->data[$data['products_id']] = array ( 'mpn' => $data['products_mpn'],
             'manufacturer' => $data['manufacturers_name'],
             'product name' => $this->strip($data['products_name']),
             'product description' => substr($this->strip($data['products_description']), 0, 100).' <b>...</b>',
             'price' => number_format($data['products_price'], 2, '.', ''),
             'in stock' => 'Y',
             'stock description' => 'Ships in 1-2 Days, New',
             'product url' => $this->producturl . 'bar-p-' . $data['products_id'] . '.html',
             'image_url' => $data['products_image'],
             'category' => $categoryname,
             'product weight' => $data['products_weight'],
             'category' => $zipcode,
             'shipping: ground rate' => $shipfree
             );
   foreach ($this->data[$data['products_id']] as $column => $value) {
  	 $this->html .= '<td valign="top" align="left"'.$class.'>'.$b .$value . $bend .'</td>';
  	 }
   $this->html .= '</tr>';
 }
 $this->html .= '</table>';
 echo $this->html;
}
}
?>

 

A couple of things to keep in mind I have the Ultimate SEO installed so I modifed the lines 2 times in the file you don't need to do this if you don't have this contrib

 
'product url' => $this->producturl . 'bar-p-' . $data['products_id'] . '.html',

 

The second thing is I know the preview in admin doesn't work perfectly but I really don't care it is just for looks and the txt version, download, and such work fine and output the proper fields.

 

Hope you can follow along with the code, its not too hard but I was writing it fast and I'm not an expert coder so like I said if anyone wants to clean it up lets do it and post an addon for everyone to use.

 

Have fun!

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

I am getting this error when I try to upload:

 

Connected to hedwig.google.com as user myusername ready to upload...

 

Warning: ftp_put(): PORT command successful. in /home/virtual/site1/fst/var/www/html/admin/includes/classes/feed.php on line 75

The FTP upload has FAILED!

Local file: /home/virtual/site1/fst/var/www/html/feeds/myusername.txt

Remote file: myusername.txt

 

Anyone know why?

 

Regards

Mike

Link to comment
Share on other sites

  • 3 weeks later...

FTP CONNECTION ERROR

 

I have everything setup perfectly and want to test out on my server before going live.

 

I setup an account which I could connect to and verified it was working.

 

I get this error when trying to run the admin/cron.php

 

Warning: ftp_login(): Not logged in. in /home/xxxx/public_html/catalog/admin/includes/classes/feed.php on line 69

The FTP connection to 24.xx.xx.xxx as user pricegrabber FAILED.

 

 

Anyone have any ideas?

 

Feeds are in the directories and everything looks good to go. I'm hitting my head on the desk. Please help!

 

Thanks,

Brad

Link to comment
Share on other sites

FTP CONNECTION ERROR

 

I have everything setup perfectly and want to test out on my server before going live.

 

I setup an account which I could connect to and verified it was working.

 

I get this error when trying to run the admin/cron.php

 

Warning: ftp_login(): Not logged in. in /home/xxxx/public_html/catalog/admin/includes/classes/feed.php on line 69

The FTP connection to 24.xx.xx.xxx as user pricegrabber FAILED.

Anyone have any ideas?

 

Feeds are in the directories and everything looks good to go. I'm hitting my head on the desk. Please help!

 

Thanks,

Brad

 

Fixed, I have my configuration in the database and the FTP password varible was different from what I have in the code. That was a fun 3 hours.

Link to comment
Share on other sites

Hi,

 

I post this message before but in the wrong tread.

 

I installed the contrib. without any mistake, meaning I didn't get any errors or something like that

 

I'm able to upload to froogle so., that is going ok also

 

But.....in my froogle store the products link back to the website but not to the correct produkt-id and the pictures don't show.

 

In my froogle.php I pointed for the images to /images/....., this because the pictures are, just to keep it all organized, filled in there respectieve file so bracelets in /images/bracelets and earrings in /images/earrings.

 

And in regards to the redirect to the wrong product-info, can the fact that I installed ultimated seo.... and the re-writing of the the urls play a roll in this.If so how can I fix this.

 

I hope somebody can help we with this, but please explain it to my stap-by-stap, somehow php and I are not the best of friends :(

Link to comment
Share on other sites

Hi,

 

I post this message before but in the wrong tread.

 

I installed the contrib. without any mistake, meaning I didn't get any errors or something like that

 

I'm able to upload to froogle so., that is going ok also

 

But.....in my froogle store the products link back to the website but not to the correct produkt-id and the pictures don't show.

 

In my froogle.php I pointed for the images to /images/....., this because the pictures are, just to keep it all organized, filled in there respectieve file so bracelets in /images/bracelets and earrings in /images/earrings.

 

And in regards to the redirect to the wrong product-info, can the fact that I installed ultimated seo.... and the re-writing of the the urls  play a roll in this.If so how can I fix this.

 

I hope somebody can help we with this, but please explain it to my stap-by-stap, somehow php and I are not the best of friends :(

 

Ok, pfffffffffffff, the linking problem I had is solved, don't ask me how, I wouldn't be able to repeat it :blink:

 

Now I still have the problem with the pictures not showing up, any suggestions?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...