Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Guest

Recommended Posts

  • 3 weeks later...
  • Replies 140
  • Created
  • Last Reply

Top Posters In This Topic

Great contri. BUT I need to include, brand in my feed. Also need to show price inc tax at 17.5% (UK).

 

In order to use the feed for my purpose I would also like to be able to export as a csv AND XML.

 

Anyone done this or know how?

Link to comment
Share on other sites

  • 2 weeks later...
This thread is for support of the Live Data Feed base class contribution and also the included Froogle extended class.

 

Download it here: Live Data Feed base class + Froogle

 

Bobby

 

Hello Bobby, thank you kindly for your contribution. I had followed step by step and double check them, thus I still receive these errors when I log in to Store Feeder in Administration. Please review the errors and help me fix them. Thank you. Kady

 

PS: I am very new in this area and thank you kindly for your patience. Kady

 

Warning: main(DIR_WS_CLASSESfeed.php): failed to open stream: No such file or directory in /home/julielan/public_html/admin/froogle.php on line 19

 

Warning: main(DIR_WS_CLASSESfeed.php): failed to open stream: No such file or directory in /home/julielan/public_html/admin/froogle.php on line 19

 

Fatal error: main(): Failed opening required 'DIR_WS_CLASSESfeed.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/julielan/public_html/admin/froogle.php on line 19

Link to comment
Share on other sites

This thread is for support of the Live Data Feed base class contribution and also the included Froogle extended class.

 

Download it here: Live Data Feed base class + Froogle

 

Bobby

 

 

Hi, I had revised the "froogle.php" in the "admin" and now, this is a new error message.

 

Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/julielan/public_html/admin/froogle.php on line 94

 

Here is the code for line 94 which per your instruction, not to change it. Pls. advise what needs to be done to fix it. Thank you kindly. Kady

 

CODE: $this->fields = "product_url\tname\tdescription\tprice\timage_url\tcategory\n"; //basic feed

 

 

Yes I do, go on Froogle and type Manix Condom, you will see products from my website: Le Roi de la Capote

 

Cheers B)

 

Hi, it seems like you get this contribution works. Would you please help me out. I received the following error message.

 

Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/julielan/public_html/admin/froogle.php on line 94

 

AND when I review the line 94, it is an instruction not to change these codes:

 

$this->fields = "product_url\tname\tdescription\tprice\timage_url\tcategory\n"; //basic feed

 

What I have done wrong??? Please help me. Thank you kindly. Kady

Link to comment
Share on other sites

I'm not sure if this is the right place for this question. If not someone can advise as to where I should look/post.

 

Does anyone know where and how to place the Bizrate survey code into checkout success so that it only pops up after the customer hits the continue button?

 

Any help would be appreciated.

Link to comment
Share on other sites

I think this has been asked a few times......but can someone please answer how we can have the product price shown with tax added????

 

This is really important to us in the UK as we must show products with VAT added!!!

 

I've spent hours trying to figure this out and have got no-where, please please can someone help?!?!?!?!?

 

Thanks!

 

Russ

Link to comment
Share on other sites

Hi everybody,

 

It seems like everybody just asks questions but nobody really answers them. Why is this happening? Is anybody still working on this contribution or it's just slowly fading after its originator?

I'm still having problem with adding a Brand to my Froogle feed. Any suggestions how is this can be done?

 

Thanks a lot.

Link to comment
Share on other sites

I think this has been asked a few times......but can someone please answer how we can have the product price shown with tax added????

 

This is really important to us in the UK as we must show products with VAT added!!!

 

I've spent hours trying to figure this out and have got no-where, please please can someone help?!?!?!?!?

 

Thanks!

 

Russ

 

This isn't strictly speaking correct (the VAT rate is hard-coded at the current 17.5%) but works for me as a quick-fix to export prices including VAT: -

 

in froogle.php, around line 81, replace: -

	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
			}

with

	function makedata() {	
$data_query = tep_db_query($this->query);	
	while ( $data = tep_db_fetch_array($data_query) ) {
		$data['products_price'] = ($data['products_price']*1.175); //add the VAT
		if ($data['specials_new_products_price']) { //if it's on special
			$data['products_price'] = ($data['specials_new_products_price']*1.175); //show the special price inc VAT
			}

 

And around line 126 replace: -

		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'];

with

		while ( $data = tep_db_fetch_array($data_query) ) {
		if($on) {$class=' class="highlight"';$on=false; } else { $class='';$on=true; }	
		$data['products_price'] = ($data['products_price']*1.175);
		if ($data['specials_new_products_price']) {
			$data['products_price'] = ($data['specials_new_products_price']*1.175);

 

I'm working on the brands problem just now....meanwhile if anyone knows how to make it skip products with a price of 0.00 (I've got a separate contrib for Call For Price on 0.00) I'd be interested to know how it's done :)

Link to comment
Share on other sites

OK I'm stuck when trying to add Brands (manufacturers), I managed to add the Model in (easy as it's taken directly from the products table as products_model but I can't get the query to fetch manufacturers_name from the manufacturers table as I'm fairly sh*t at php :o

 

I think I have to do something in feed.php, here: -

	/***************************/
/**	  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';

but I'm not entirely sure what...some guesses produced a variety of errors!

Link to comment
Share on other sites

OK I'm stuck when trying to add Brands (manufacturers), I managed to add the Model in (easy as it's taken directly from the products table as products_model but I can't get the query to fetch manufacturers_name from the manufacturers table as I'm fairly sh*t at php :o

 

I think I have to do something in feed.php, here: -

	/***************************/
/**	  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';

but I'm not entirely sure what...some guesses produced a variety of errors!

Marc_J, could you please share how did you add Model to your feed? I'm still struggling with it. I'll really appreciate it.

 

Thanks.

Link to comment
Share on other sites

Marc_J, could you please share how did you add Model to your feed? I'm still struggling with it. I'll really appreciate it.

 

Thanks.

 

Sure, I'm running late right now though (it's AM in the UK) so I'll post when I get back tonight.

 

Meanwhile if anyone can solve my Brands problem I'd appreciate it, it'd be good to publish the whole thing (inc VAT, Brand & Model) as an update to this great contrib :)

Link to comment
Share on other sites

Marc_J, could you please share how did you add Model to your feed? I'm still struggling with it. I'll really appreciate it.

 

Thanks.

 

Here goes, in froogle.php: -

 

Around line 29, change: -

	$this->fields = "product_url\tname\tdescription\tprice\timage_url\tcategory\n"; //basic feed

to

$this->fields = "product_url\tname\tmanufacturer_id\tdescription\tprice\timage_url\tcategory\n"; //basic feed

 

Around line 89, change: -

			$this->data[$data['products_id']] = array ( 'product_url' => $this->producturl . $data['products_id'],
													'name' => $this->strip($data['products_name']),
													'description' => $this->strip($data['products_description']),
													'price' => number_format($data['products_price'], 2, '.', ''),
													'image_url' => $data['products_image'],
													'category' => $data['categories_name'] );

to

			$this->data[$data['products_id']] = array ( 'product_url' => $this->producturl . $data['products_id'],
													'name' => $this->strip($data['products_name']),
													'manufacturer_id' => $this->strip($data['products_model']), // Added by Marc_J to include model
													'description' => $this->strip($data['products_description']),
													'price' => number_format($data['products_price'], 2, '.', ''),
													'image_url' => $data['products_image'],
													'category' => $data['categories_name'] );

 

Around line 117, change: -

						<td>URL</td>
					<td>Name</td>
					<td>Description</td>
					<td>Price</td>
					<td>Image</td>
					<td>Category</td>

to: -

						<td>URL</td>
					<td>Name</td>
					<td>Model</td>
					<td>Description</td>
					<td>Price</td>
					<td>Image</td>
					<td>Category</td>

 

And finally around line 135 change: -

			$this->data[$data['products_id']] = array ( 'product_url' => '<a href="'.$this->producturl . $data['products_id'].'">'.$data['products_id'].'</a>',
													'name' => '<a href="'.$this->producturl . $data['products_id'].'">'.$this->strip($data['products_name']).'</a>',
													'description' => substr($this->strip($data['products_description']), 0, 100).' <b>...</b>',
													'price' => number_format($data['products_price'], 2, '.', ''),
													'image_url' => '<a href="'.$this->checkimage($data['products_image']).'">'.$data['products_image'].'</a>',
													'category' => $data['categories_name'] );

to: -

			$this->data[$data['products_id']] = array ( 'product_url' => '<a href="'.$this->producturl . $data['products_id'].'">'.$data['products_id'].'</a>',
													'name' => '<a href="'.$this->producturl . $data['products_id'].'">'.$this->strip($data['products_name']).'</a>',
													'manufacturer_id' => '<a href="'.$this->producturl . $data['products_id'].'">'.$this->strip($data['products_model']).'</a>', // Added by Marc_J to include model
													'description' => substr($this->strip($data['products_description']), 0, 100).' <b>...</b>',
													'price' => number_format($data['products_price'], 2, '.', ''),
													'image_url' => '<a href="'.$this->checkimage($data['products_image']).'">'.$data['products_image'].'</a>',
													'category' => $data['categories_name'] );

 

Hope this helps.

Edited by Marc_J
Link to comment
Share on other sites

Here goes, in froogle.php: -

 

Around line 29, change: -

	$this->fields = "product_url\tname\tdescription\tprice\timage_url\tcategory\n"; //basic feed

to

$this->fields = "product_url\tname\tmanufacturer_id\tdescription\tprice\timage_url\tcategory\n"; //basic feed

 

Around line 89, change: -

			$this->data[$data['products_id']] = array ( 'product_url' => $this->producturl . $data['products_id'],
													'name' => $this->strip($data['products_name']),
													'description' => $this->strip($data['products_description']),
													'price' => number_format($data['products_price'], 2, '.', ''),
													'image_url' => $data['products_image'],
													'category' => $data['categories_name'] );

to

			$this->data[$data['products_id']] = array ( 'product_url' => $this->producturl . $data['products_id'],
													'name' => $this->strip($data['products_name']),
													'manufacturer_id' => $this->strip($data['products_model']), // Added by Marc_J to include model
													'description' => $this->strip($data['products_description']),
													'price' => number_format($data['products_price'], 2, '.', ''),
													'image_url' => $data['products_image'],
													'category' => $data['categories_name'] );

 

Around line 117, change: -

						<td>URL</td>
					<td>Name</td>
					<td>Description</td>
					<td>Price</td>
					<td>Image</td>
					<td>Category</td>

to: -

						<td>URL</td>
					<td>Name</td>
					<td>Model</td>
					<td>Description</td>
					<td>Price</td>
					<td>Image</td>
					<td>Category</td>

 

And finally around line 135 change: -

			$this->data[$data['products_id']] = array ( 'product_url' => '<a href="'.$this->producturl . $data['products_id'].'">'.$data['products_id'].'</a>',
													'name' => '<a href="'.$this->producturl . $data['products_id'].'">'.$this->strip($data['products_name']).'</a>',
													'description' => substr($this->strip($data['products_description']), 0, 100).' <b>...</b>',
													'price' => number_format($data['products_price'], 2, '.', ''),
													'image_url' => '<a href="'.$this->checkimage($data['products_image']).'">'.$data['products_image'].'</a>',
													'category' => $data['categories_name'] );

to: -

			$this->data[$data['products_id']] = array ( 'product_url' => '<a href="'.$this->producturl . $data['products_id'].'">'.$data['products_id'].'</a>',
													'name' => '<a href="'.$this->producturl . $data['products_id'].'">'.$this->strip($data['products_name']).'</a>',
													'manufacturer_id' => '<a href="'.$this->producturl . $data['products_id'].'">'.$this->strip($data['products_model']).'</a>', // Added by Marc_J to include model
													'description' => substr($this->strip($data['products_description']), 0, 100).' <b>...</b>',
													'price' => number_format($data['products_price'], 2, '.', ''),
													'image_url' => '<a href="'.$this->checkimage($data['products_image']).'">'.$data['products_image'].'</a>',
													'category' => $data['categories_name'] );

 

Hope this helps.

I'll follow your instructions and see if it works.

 

Thanks a lot,

Irina.

Edited by Irin
Link to comment
Share on other sites

I don't have this code in my admin/froogle.php. Are you using an original froogle.php from "LiveDataFeed-baseclassWithFroogle-v1.1" contrib? Because my froogle.php is absolutely different from yours:

 

Thanks.

 

Sorry, my fault, I should have made myself clearer.

 

The froogle.php file to edit is admin\includes\classes\froogle.php

Link to comment
Share on other sites

Sorry, my fault, I should have made myself clearer.

 

The froogle.php file to edit is admin\includes\classes\froogle.php

Wow, awesome! I got it. But you know what... this is the most ridiculous part. Mine was almost right, except for that first piece of code:

$this->fields = "product_url\tname\tbrand\tdescription\tprice\timage_url\tcategory\n"; //basic feed

This is what I missed in my coding. Thank you very much. I really appreciate your help.

Link to comment
Share on other sites

Wow, awesome! I got it...Thank you very much. I really appreciate your help.

 

Glad you got it working...now all we need is a solution for the "Brands" problem...I've asked elsewhere for help so hopefully should get an answer one way or another...

Link to comment
Share on other sites

Is anybody else having a problem with saved pictures in catalog/feeds? Almost all of my pictures in catalog/images are .gif and in catalog/feeds they're file_name.gif.jpg and have black background. How can I change a background to white and have pictures saved in their original format?

 

Thanks a lot.

Irina.

Link to comment
Share on other sites

Hello.

I have some problem to upload items to froogle.

Please help me.

===========================================================

Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/content/o/a/k/oaks21c/html/catalog/admin/includes/classes/feed.php on line 72

The FTP connection to hedwig.google.com as user oaks21c FAILED.

===========================================================

<?php

/*

$Id: froogle.php,v 1.00 2004/09/07

 

Froogle Data Feed extended class

 

Contribution based on:

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 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 = "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 = 'oaks21c.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 = '/home/content/o/a/k/oaks21c/html/catalog/feeds/oaks21c.txt';

 

//Do you want to enable auto enlarging for images?

//Default is true and dimensions are proportional 500px by 500px

$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 = '/home/content/o/a/k/oaks21c/html/catalog/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://www.printing-t-shirts.com/catalog/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 = '/home/content/o/a/k/oaks21c/html/catalog/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.printing-t-shirts.com/catalog/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 = 'http://www.printing-t-shirts.com';

}

====================================================================

<?php

/*

$Id: feed.php,v 1.00 2004/09/07

 

Store Data Feed base class

 

Contribution based on:

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 - 2003 osCommerce

 

Released under the GNU General Public License

 

Contribution created by: Chemo

*/

 

class feed {

 

/***************************/

/** File / Format **/

/***************************/

var $downloadname = 'oaks21c.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 = false; //autoenlarge on by default, 500 px / 500 px

var $imageurl = 'http://www.printing-t-shirts.com/catalog/images/'; //trailing slash on the address

var $imagepath = '/home/content/o/a/k/oaks21c/html/catalog/images/'; //trailing slash on the path

var $feedimageurl = 'http://www.printing-t-shirts.com/catalog/feeds/'; //trailing slash on the address

var $feedimagepath = '/home/content/o/a/k/oaks21c/html/catalog/feeds/'; //trailing slash on the path

var $producturl = 'http://www.printing-t-shirts.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'm still struggling to add Brands, but in the meantime, if anyone knows how to edit the following piece of my admin/classed/froogle.php (around line 89): -

 

$this->data[$data['products_id']] = array ( 'product_url' => $this->producturl . $data['products_id'],
'name' => $this->strip($data['products_name']),
'manufacturer_id' => $this->strip($data['products_model']), // Added by Marc_J to include model
'description' => $this->strip($data['products_description']),
'price' => number_format($data['products_price'], 2, '.', ''),
'image_url' => $data['products_image'],
'category' => $data['categories_name'] );

 

So that it merges the 'name' and 'manufacturer_id' into one field, that would be really helpful!

 

I currently have in my text file (using A Bug's Life as an example):

 

product_url : http://demo.oscommerce.com/product_info.php?products_id=8

name : A Bug's Life

brand : BLANK (I'm working on this, too!)

manufacturer_id : DVD-ABUG

description : Regional Code....

etc. etc.

 

But I want the name and manufacturer_id merged to produce the following as the name: -

 

name : A Bug's Life [DVD-ABUG]

 

On the surface this seems easy, but I can't do it :(

Link to comment
Share on other sites

Hey I installed the mod fine and everything seemed to be working. I was playing around with the search-engine safe urls though and turned them on. then I turned them off again. the problem is now the froogle feed mod is showing the old urls from when search engine safe urls were on. Does anyone know how I can fix this?

Link to comment
Share on other sites

Hey I installed the mod fine and everything seemed to be working. I was playing around with the search-engine safe urls though and turned them on. then I turned them off again. the problem is now the froogle feed mod is showing the old urls from when search engine safe urls were on. Does anyone know how I can fix this?

 

Around line 52 of feed.php, change: -

	var $producturl = 'http://yourdomain.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.

to: -

	var $producturl = 'http://yourdomain.com/product_info.php?products_id=';

Link to comment
Share on other sites

Hi Bobby, first thanks for the contribution, and detailed install instructions.

 

Everything installed fine, and seemed to be running fine. From admin/store feeds/froogle the product list creates with no problems, but when I try to upload, after several seconds of attempting I get this error on top:

 

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

 

Warning: ftp_put(): PORT command successful. in

...(my store info)/htdocs/catalog/admin/includes/classes/feed.php on line 75

The FTP upload has FAILED!

Local file: ...(my store info)//htdocs/catalog/feeds/catalog.txt

Remote file: catalog.txt

 

And this error in the main body:

 

Froogle Feed

 

Upload | Download | View HTML Version | View TXT Version

 

--------------------------------------------------------------------------------

2013 - Lost connection to MySQL server during 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

 

[TEP STOP]

 

Any ideas? Thanks in advance for your help!

Edited by Mibble
Link to comment
Share on other sites

  • 5 weeks later...

Hi,

 

I've noticed that all my gif pics are not shown on Froogle pages. To my surprise, I found out that all my gif pics are saved in catalog/feeds as follows:

xxxxxx.gif.jpg

 

Is that why they can not be displayed on Froogle? Any idea how to solve this?

 

Thanks in advance.

 

Shams

Link to comment
Share on other sites

Hi can anyone help me i am getting error below:

 

Warning: imagecreatefromstring(): Data is not in a recognized format. in /homepages/42/d125170818/htdocs/admin/includes/classes/feed.php on line 148

 

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /homepages/42/d125170818/htdocs/admin/includes/classes/feed.php on line 160

 

Warning: imagedestroy(): supplied argument is not a valid Image resource in /homepages/42/d125170818/htdocs/admin/includes/classes/feed.php on line 174

 

i don't know what they mean.

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