Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Feedmachine


lech

Recommended Posts

This is probably due to an apache time-out. If you run the script from shell, it should finish.

 

 

Sorry i'm not a great programmer and know just about enough to add contributions so what does "run from shell" mean?

 

great contribution by the way, you don't happen to know if it can be set up to export to amazon merchant pro in the uk do you?

Link to comment
Share on other sites

  • Replies 115
  • Created
  • Last Reply

Top Posters In This Topic

Run from shell, means you need to login to the server via SSH and run the script directly: "php /path/to/feedmachine.php".

 

great contribution by the way, you don't happen to know if it can be set up to export to amazon merchant pro in the uk do you?

 

Absolutely.

Link to comment
Share on other sites

  • 2 weeks later...

I've installed this and it is not generating the output file. I'm getting this:

 

catalog path: /home/driscuba/public_html/catalog/

 

languages array built

currencies array built

taxes array built

countries array built

 

but that is it and no files are being output. The folder is chmod 777. Any ideas?

 

EDIT: I've looked, it's not making it past the categories array, not sure why because I'm not getting an error. Any help is appreciated!

Edited by frankc420
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

Hi, I've installed feedmachine for a client.

 

Thanks for the contrib - works great.

 

Sadly the feed is outputting style code in the product description and the company the feed is for, need it removed.

 

I have the standard install, no modifications with STRIP_HTML etc

 

Here is a sample of the output

 

christmas hampers		 <b style='mso-bidi-font-weight: normal'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family: Arial;mso-bidi-font-family:"Times New Roma

 

Looks to me like the client is pasting from word but any idea how I can strip this stuff out easily?

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

 

i have 250.000 products in my shop and want to use Feedmachine.

But there is a limitation of 100.000 products for each file at Google Base.

Is it possible to generate many files which each one contains maximum 100.000 products ?

 

This is my code:

 

<?php

/**
* Feedmachine - osCommerce MS-2.2
*
* Generates feeds for any product search engine, e.g. froogle, shopping.com,
* kelkoo. Simply configure the feeds and run the script to generate them from
* your product database. Highly flexible system and easy to modify.
* @package feedmachine
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version 2.20b2
* @link http://www.osc-solutions.co.uk/ osCommerce Solutions
* @copyright Copyright 2005-2007, Lech Madrzyk
* @author Lech Madrzyk
* @filesource http://www.osc-solutions.co.uk/
*/

/*
This file, feedmachine.php, should be put in your admin directory
*/

//I put in a check for this variable into application_top that prevents a session from starting
//- you can do the same (not very important...)
$start_session = false;

/*
This program uses the catalog's application_top (as oppose to admin's) in case any alternative url generator is used.
*/
if( !isset($feedmachine_auto) ) {
 $installation_path = getcwd() . '/';
 if( !file_exists('feedmachine_config_google_base_de.php') ) {
exit('Please ensure that feedmachine_config_google_base_de.php is in the admin directory - this is different to older versions where it is in admin/includes/');
 }
 require_once('feedmachine_config_google_base_de.php');
 $catalog_path = defined(CATALOG_DIRECTORY) ? CATALOG_DIRECTORY : '../';
 chdir($catalog_path);
 $catalog_path = getcwd() . '/';
 require_once('includes/application_top.php');
}
require_once($installation_path . 'feedmachine_loadingbay.php');

if( isset($_SERVER['HTTP_HOST']) ) echo '<pre>';

echo 'catalog path: ' . $catalog_path . "\n\n";

//The two functions below can be modified/extended to to modify/extend functionality

function field_generator($db_field_name) {

 global $product, $current_product_prices, $cur_feed, $currencies, $countries, $categories;

 switch( $db_field_name  ) {
case 'FEED_PRODUCTS_URL':
  $additional_params = array();
  if( $cur_feed['currency_code'] != DEFAULT_CURRENCY ) $additional_params[] = 'currency=' . $cur_feed['currency_code'];
  if( $cur_feed['language_code'] != DEFAULT_LANGUAGE ) $additional_params[] = 'language=' . $cur_feed['language_code'];
  if( !empty($cur_feed['url_parameters']) ) $additional_params[] = $cur_feed['url_parameters'];
  $additional_params_string = !empty($additional_params) ? '&' . implode('&', $additional_params) : '';
  $output_field_value = tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product['products_id'] . $additional_params_string, 'NONSSL', false);
  break;
case 'FEED_IMAGE_URL':
  $output_field_value = $product['products_image'] ? HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES_PRODUCTS . $product['products_image'] : '';
  break;
case 'FEED_CATEGORY':
  if( $product['categories_id'] == 0 ) {
	$output_field_value = '';
  }
  elseif( $cur_feed['category_output_type'] == 2 ) {
	$output_field_value = implode($cur_feed['category_seperator'], $categories[ $product['categories_id'] ][ $cur_feed['language_id'] ]);
  }
  elseif( $cur_feed['category_output_type'] == 3 ) {
	$output_field_value = $categories[ $product['categories_id'] ][ $cur_feed['language_id'] ][0];
  }
  else { //assume 1
	$output_field_value = $product['categories_name'];
  }
  break;
case 'FEED_PRICE':
  $output_field_value = $current_product_prices['products_price'];
  break;
case 'FEED_FINAL_PRICE':
  $output_field_value = $current_product_prices['final_price'];
  break;
case 'FEED_PRICE_WITH_TAX':
  $output_field_value = $current_product_prices['products_price_with_tax'];
  break;
case 'FEED_FINAL_PRICE_WITH_TAX':
  $output_field_value = $current_product_prices['final_price_with_tax'];
  break;
case 'FEED_SPECIAL_PRICE':
  $output_field_value = !empty($product['specials_new_products_price']) ? $current_product_prices['specials_new_products_price'] : '';
  break;
case 'FEED_SPECIAL_PRICE_WITH_TAX':
  $output_field_value = !empty($product['specials_new_products_price']) ? $current_product_prices['specials_new_products_price_with_tax'] : '';
  break;
case 'FEED_UNIQUE_ID':
  //kept for configuration backwards compatibility
  $output_field_value = $product['products_id'];
  break;
case 'TITLE':
  $output_field_value = $product['products_name'] . ' - Herst.Art-Nr.: ' . $product['products_hersteller_id'];	   
  break;
 }

 return $output_field_value;

}

function process_field_value($field_value, &$field_options) {

 if( in_array('STRIP_XHTML', $field_options) ) {
$field_value = preg_replace('#<([^\s]*+).*?>(.*?)</\1>#i', '$2', $field_value);
$field_value = preg_replace('#<.*? />#i', ' ', $field_value);
 }
 elseif( in_array('STRIP_HTML', $field_options) ) {
$field_value = preg_replace('#</?.*?>#i', ' ', $field_value);
 }
 if( in_array('HTML_ENTITIES', $field_options) ) {
$field_value = htmlentities(html_entity_decode($field_value));
 }
 if( in_array('STRIP_CRLF', $field_options) ) {
$field_value = preg_replace('#[\040\011]*+[\n\r]+[\040\011]*#s', ' ', $field_value);
 }

 return $field_value;

}

function category_path($categories_id, &$language_id, &$cat_path) {

 $query = tep_db_query('SELECT c.parent_id, cd.categories_name FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id AND c.categories_id = \'' . (int)$categories_id . '\' AND cd.language_id = \'' . (int)$language_id . '\'');
 $cat_info = tep_db_fetch_array($query);

 $cat_path = array_merge(array($cat_info['categories_name']), $cat_path);

 if( $cat_info['parent_id'] ) {
return category_path($cat_info['parent_id'], $language_id, $cat_path);
 }
 else {
return $cat_path;
 }

}

function combinations(&$options, $options_seperator = '|', $pos = 0, $combinations = false) {

 $new_combinations = array();
 if( $combinations ) {
foreach( $options[$pos]['values'] as $key1=>$value1 ) {
  foreach( $combinations as $key2=>$value2 ) {
	$new_combinations[$key2 . $options_seperator . $key1]['comb_name'] = $value2['comb_name'] . '; ' . $options[$pos]['comb_name'] . ': ' . $value1;
	$new_combinations[$key2 . $options_seperator . $key1]['comb_price'] = $value2['comb_price'] + ( $options[$pos]['price_prefix'][$key1] == '+' ? 1 : (-1) ) * $options[$pos]['options_values_price'][$key1];
	$new_combinations[$key2 . $options_seperator . $key1]['option_value'] = $value2['option_value'];
	$new_combinations[$key2 . $options_seperator . $key1]['option_value'][$options[$pos]['comb_name']] = $value1;
  }
}
 }
 else { //This is a modification of the above for the first pass
foreach( $options[$pos]['values'] as $key=>$value ) {
  $new_combinations[$key]['comb_name'] = $options[$pos]['comb_name'] . ': ' . $value;
  $new_combinations[$key]['comb_price'] = ( $options[$pos]['price_prefix'][$key] == '+' ? 1 : (-1) ) * $options[$pos]['options_values_price'][$key];
  $new_combinations[$key]['option_value'][$options[$pos]['comb_name']] = $value;
}
 }

 if( ++$pos < sizeof($options) ) {
return combinations($options, $options_seperator, $pos, $new_combinations);
 }
 else {
return $new_combinations;
 }

}

set_time_limit(2400);
ini_set('memory_limit', ( defined('FM_MEMORY_LIMIT') ? 'FM_MEMORY_LIMIT' : '800M' ));

$option_value_seperator = defined('OPTION_COMBS_OPTION_VALUE_SEPERATOR') ? OPTION_COMBS_OPTION_VALUE_SEPERATOR : ':';
$options_seperator = defined('OPTION_COMBS_OPTIONS_SEPERATOR') ? OPTION_COMBS_OPTIONS_SEPERATOR : '|';

$save_path = $catalog_path . SAVE_LOCATION;

if( !file_exists($save_path) ) {
 echo 'The SAVE_LOCATION directory: ' . SAVE_LOCATION . ' does not exist in ' . $catalog_path . '. Please create this directory or change the
 path to an existing directory';
 exit;
}

//Build Languages Array
$languages = array();
$languages_query = tep_db_query('SELECT * FROM languages');
while( $languages_row = tep_db_fetch_array($languages_query) ) {
 $languages[ $languages_row['code'] ] = $languages_row;
}
tep_db_free_result($languages_query);
echo 'languages array built' . "\n";
ob_flush();
//

//Which languages are needed for the feeds?
//If only some are needed, this will save time in the master query
$languages_used = array();
foreach( $feeds as $key=>$feed ) {
 if( isset($languages[ $feed['language_code'] ]['languages_id']) ) {
$feeds[$key]['language_id'] = $languages[ $feed['language_code'] ]['languages_id'];
 }
 $languages_used[ $feeds[$key]['language_id'] ] = true;
}
$languages_list = '';
foreach( $languages_used as $key=>$value ) {
 $languages_list .= ', ' . $key;
}
$languages_list = substr($languages_list, 2);
//

//Build Currencies Array
$currencies = array();
$currencies_query = tep_db_query('SELECT * FROM currencies');
while( $currencies_row = tep_db_fetch_array($currencies_query) ) {
 $currencies[ $currencies_row['code'] ] = $currencies_row;
}
tep_db_free_result($currencies_query);
echo 'currencies array built' . "\n";
ob_flush();
//

//Establish feed currency's decimal and thousand points
foreach( $feeds as $cur_feed_id => $cur_feed ) {
 $feeds[$cur_feed_id]['currency_decimal'] = $feeds[$cur_feed_id]['currency_decimal_override'] !== false ? $feeds[$cur_feed_id]['currency_decimal_override'] : $currencies[ $cur_feed['currency_code'] ]['decimal_point'];
 $feeds[$cur_feed_id]['currency_thousands'] = $feeds[$cur_feed_id]['currency_thousands_override'] !== false ? $feeds[$cur_feed_id]['currency_thousands_override'] : $currencies[ $cur_feed['currency_code'] ]['thousands_point'];
}
//

//Get Countries All-Zones Tax Rates
$taxes = array();
//FOLLOWING QUERY IS TEMPORARY - TAXES NEED TO BE HANDLED BETTER
$taxes_query = tep_db_query('SELECT * FROM countries c, zones_to_geo_zones z2gz, tax_rates tr WHERE c.countries_id = z2gz.zone_country_id AND ( z2gz.zone_id = 0 OR z2gz.zone_id IS NULL' . ( defined(STORE_ZONE) && STORE_ZONE != '' ? ' OR z2gz.zone_id = ' . STORE_ZONE : '' ) . ' ) AND z2gz.geo_zone_id = tr.tax_zone_id');
while( $taxes_row = tep_db_fetch_array($taxes_query) ) {
 $taxes[ $taxes_row['countries_iso_code_2'] ][ $taxes_row['tax_class_id'] ] = $taxes_row['tax_rate'];
}
tep_db_free_result($taxes_query);
echo 'taxes array built' . "\n";
ob_flush();
//

//Build Countries Array
$countries = array();
$countries_query = tep_db_query('SELECT * FROM countries');
while( $countries_row = tep_db_fetch_array($countries_query) ) {
 $countries[ $countries_row['countries_iso_code_2'] ] = $countries_row;
}
tep_db_free_result($countries_query);
echo 'countries array built' . "\n";
ob_flush();
//

//Build Categories
$categories = array();
$categories_query = tep_db_query('SELECT * FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id');
while( $categories_row = tep_db_fetch_array($categories_query) ) {
 $cat_path = array();
 $categories[ $categories_row['categories_id'] ][ $categories_row['language_id'] ] = category_path($categories_row['categories_id'], $categories_row['language_id'], $cat_path);
}
tep_db_free_result($categories_query);
echo 'categories array built' . "\n";
ob_flush();
//

$count_run = true;
$begin_output_run = true;

$cycle_length = floor(1000/sizeof($languages_used))*sizeof($languages_used);

$count = 0;
$counter = 0;

while( true ) {
++$counter;
$master_query = tep_db_query('SELECT ' . ( $count_run ? 'COUNT(*) as count' : 's.*, cd.*, c.*, ptc.*, mi.*, m.*, pd.*, p.*, IF(s.status, s.specials_new_products_price, p.products_price) as final_price' ) . '
						  FROM products p LEFT JOIN products_description pd ON p.products_id = pd.products_id
										  LEFT JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
										  LEFT JOIN manufacturers_info mi ON m.manufacturers_id = mi.manufacturers_id AND pd.language_id = mi.languages_id
										  LEFT JOIN products_to_categories ptc ON pd.products_id = ptc.products_id
										  LEFT JOIN specials s ON ptc.products_id = s.products_id
										  LEFT JOIN categories c ON ptc.categories_id = c.categories_id
										  LEFT JOIN categories_description cd ON c.categories_id = cd.categories_id AND pd.language_id = cd.language_id
						  WHERE pd.language_id IN(' . $languages_list . ')
							AND p.products_status = 1
						  ORDER BY p.products_id' . ( $count > 0 ? '
						  LIMIT ' . (($counter-1)*$cycle_length) . ', ' . $cycle_length : '' ));

if( $count_run ) {
 $master_query_row = tep_db_fetch_array($master_query);
 $count = $master_query_row['count'];
 echo "\n" . 'number of products: ' . ($count/sizeof($languages_used)) . "\n" . 'number of cycles: ' . ceil($count/$cycle_length) . "\n";
 ob_flush();
 $count_run = false;
 --$counter;
 continue;
}

if( $begin_output_run ) {
//Open Files and Check configurations
$fps = array();
foreach( $feeds as $cur_feed_id => $cur_feed ) {
 $file = $save_path . $feeds[$cur_feed_id]['filename'];
 if( file_exists($file) ) {
if( BACK_UP_OLD_FEEDS ) {
  $old_file_last_modified = date('Y-m-d-H.i.s', filemtime($file));
  $file_info = array();
  preg_match('#^(.*?)(\..*?)?$#', $feeds[$cur_feed_id]['filename'], $file_info);
  rename($file, $save_path . $file_info[1] . '-' . $old_file_last_modified . ( isset($file_info[2]) ? $file_info[2] : '' ));
}
else {
  unlink($file);
}
 }

 $fps[$cur_feed_id]['fp'] = fopen($file, 'a');
 chmod($file, 0777);
 $fps[$cur_feed_id]['file'] = $file;
}

$mysqli = defined('MYSQL_EXTENSION') && MYSQL_EXTENSION == 'mysqli';

$i=0;
$fields = array();
while( $i < ( $mysqli ? mysqli_num_fields($master_query) : mysql_num_fields($master_query) ) ) {
 ++$i;
 $cur_field = ( $mysqli ? mysqli_fetch_field($master_query) : mysql_fetch_field($master_query) );
 $fields[] = $cur_field->name;
}

foreach( $feeds as $cur_feed_id => $cur_feed ) {
 $output_line = '';
 foreach( $cur_feed['fields'] as $output_field_name=>$db_field ) {
if( $db_field['type'] == 'DB' && !in_array($db_field['name'], $fields) ) {
  echo 'The field ' . $db_field['name'] . ' specified in the ' . $cur_feed['filename'] . ' feed does not exist in any of the queried tables.
		Please ensure you have entered the correct field name and that it exists in one of the tables queried in $master_query (see code)';
  exit;
}
elseif( $cur_feed['add_field_names'] ) {
  $output_line .= $cur_feed['seperator'] . $cur_feed['text_qualifier'] . $output_field_name . $cur_feed['text_qualifier'];
}
 }
 $additional_header_lines = '';
 if( !empty($cur_feed['additional_header_lines']) && is_array($cur_feed['additional_header_lines']) ) {
$additional_header_lines = implode($cur_feed['newline'], $cur_feed['additional_header_lines']) . $cur_feed['newline'];
 }
 $output_line = substr($output_line, strlen($cur_feed['seperator'])) . ( $cur_feed['add_field_names'] ? $cur_feed['newline'] : '' );
 $output = $additional_header_lines . $output_line;
 fwrite($fps[$cur_feed_id]['fp'], $output);
}
echo "\n" . 'feed configurations checked... output begun.' . "\n";
ob_flush();
//
$begin_output_run = false;
--$counter;
continue;
}

echo "\n" . 'cycle: ' . $counter . "\n";
ob_flush();

//Build Products Array
$products = array();
$products_id_low = 0;
$products_id_high = 0;
while( $master_query_row = tep_db_fetch_array($master_query) ) {
 if( $products_id_low == 0 ) $products_id_low = $master_query_row['products_id'];
 $products_id_high = $master_query_row['products_id'];
 $products[$master_query_row['language_id']][$master_query_row['products_id']] = $master_query_row;
}
//
//make products defined by attributes
//
tep_db_free_result($master_query);

echo "\n" . 'products array built' . "\n";
ob_flush();
//

//Build Attributes Array
$products_attributes = array();
$i_rows = array();

if( !defined('PERFORMANCE_SKIP_LOAD_ATTRIBUTES') || ( defined('PERFORMANCE_SKIP_LOAD_ATTRIBUTES') && !PERFORMANCE_SKIP_LOAD_ATTRIBUTES ) ) {

 $products_attributes_query = tep_db_query('SELECT *
										 FROM products_attributes pa LEFT JOIN products_options po ON pa.options_id = po.products_options_id
																	 LEFT JOIN products_options_values pov ON pa.options_values_id = pov.products_options_values_id AND po.language_id = pov.language_id
										 WHERE pa.products_id BETWEEN ' . (int)$products_id_low . ' AND ' . (int)$products_id_high);

 if( tep_db_num_rows($products_attributes_query) > 0 ) {
while( $products_attributes_row = tep_db_fetch_array($products_attributes_query) ) {
  if( isset($products[ $products_attributes_row['language_id'] ][ $products_attributes_row['products_id'] ]) ) {
	$products_attributes[ $products_attributes_row['language_id'] ][ $products_attributes_row['products_id'] ][ $products_attributes_row['options_id'] ][] = $products_attributes_row;
  }
}

//check if i_rows required
$i_rows_required = false;
foreach( $feeds as $feed ) {
  if( !empty($feed['attributes_handling']) && $feed['attributes_handling'] == 2 ) {
	$i_rows_required = true;
	break;
  }
}
//

//"i_rows" - individual rows, for feeds where individual records are needed for each option variation
if( $i_rows_required ) {
  foreach( $products_attributes as $language_id => $value ) {
	foreach( $value as $products_id => $options_values ) {
	  $options = array();
	  $i = 0;
	  ksort($options_values);
	  foreach( $options_values as $products_options_id => $values ) {
		$options[$i]['comb_name'] = $values[0]['products_options_name'];
		ksort($values);
		foreach( $values as $products_options_values ) {
		  $options[$i]['values'][ $products_options_id . $option_value_seperator . $products_options_values['products_options_values_id'] ] = $products_options_values['products_options_values_name'];
		  $options[$i]['price_prefix'][ $products_options_id . $option_value_seperator . $products_options_values['products_options_values_id'] ] = $products_options_values['price_prefix'];
		  $options[$i]['options_values_price'][ $products_options_id . $option_value_seperator . $products_options_values['products_options_values_id'] ] = $products_options_values['options_values_price'];
		}
		++$i;
	  }
	  $combinations = combinations($options, $options_seperator);

	  foreach( $combinations as $combination_id => $combination ) {
		$combination['combination_id'] = $combination_id;
		$i_rows[ $language_id ][ $products_id ][] = array_merge($combination, $products[ $language_id ][ $products_id ]);
	  }
	}
  }
}

 }

 echo 'products attributes array built' . "\n";
 ob_flush();
 tep_db_free_result($products_attributes_query);

}
//

echo 'feed generation in process...' . "\n";
ob_flush();
foreach( $feeds as $cur_feed_id => $cur_feed ) {
 foreach( $products[$cur_feed['language_id']] as $row ) {
$rows = array();
if( isset($i_rows[ $cur_feed['language_id'] ][ $row['products_id'] ]) && $cur_feed['attributes_handling'] == 2 ) {
  $rows =& $i_rows[$cur_feed['language_id']][ $row['products_id'] ];
}
else {
  $rows[] =& $row;
}

foreach( $rows as $product ) {

  if( !empty($cur_feed['include_record_function']) ) {
	$include_record = call_user_func_array($cur_feed['include_record_function'], array(&$product));
	if( !$include_record ) continue;
  }

  //Calculate Prices in Feed Currency and Prices with Tax
  $tax_multiplier = isset($taxes[ $cur_feed['countries_iso_2'] ][ $product['products_tax_class_id'] ]) ? (1+$taxes[ $cur_feed['countries_iso_2'] ][ $product['products_tax_class_id'] ]/100) : 1;

  $current_product_prices = array();
  $currency_conversion_field_list = array('products_price', 'final_price', 'specials_new_products_price', 'comb_price');
  foreach( $currency_conversion_field_list as $field_name ) {
	$current_product_prices[$field_name] = isset($product[$field_name]) ? round(( $product[$field_name] * ( isset($cur_feed['currency_code']) ? $currencies[ $cur_feed['currency_code'] ]['value'] : 1 ) ), 4) : '';
	$current_product_prices[($field_name . '_with_tax')] = isset($current_product_prices[$field_name]) ? number_format($tax_multiplier * $current_product_prices[$field_name], $currencies[ $cur_feed['currency_code'] ]['decimal_places'], $cur_feed['currency_decimal'], $cur_feed['currency_thousands']) : '';
  }

  $output_line = '';

  foreach( $cur_feed['fields'] as $output_field_name=>$db_field ) {
	$output_field_value = '';
	switch( $db_field['type'] ) {
	  case 'DB':
		$output_field_value = $product[$db_field['name']];
		break;
	  case 'KEYWORD':
		$output_field_value = field_generator($db_field['name']);
		break;
	  case 'LOGIC':
		eval($db_field['name']);
		break;
	  case 'FUNCTION':
		$params = explode('|', $db_field['name']);
		$function = $params[0];
		unset($params[0]);
		$params[0] = &$product;
		ksort($params);
		$output_field_value = call_user_func_array($function, $params);
		break;
	  case 'VALUE':
	  default:
		$output_field_value = $db_field['name'];
		break;
	}

	if( isset($db_field['options']) ) $output_field_value = process_field_value($output_field_value, $db_field['options']);
	if( isset($db_field['filters']) && is_array($db_field['filters']) ) {
	  $output_field_value = preg_replace($db_field['filters']['patterns'], $db_field['filters']['replacements'], $output_field_value);
	}

	$output_field_value = empty($cur_feed['text_qualifier']) ? preg_replace('#[' . $cur_feed['seperator'] . $cur_feed['newline'] . ']+#s', ' ', $output_field_value) : preg_replace('#' . $cur_feed['text_qualifier'] . '#s', $cur_feed['text_qualifier'] . $cur_feed['text_qualifier'], $output_field_value);

	$output_line .= $cur_feed['seperator'] . $cur_feed['text_qualifier'] . trim($output_field_value) . $cur_feed['text_qualifier'];

  }
  $output_line = substr($output_line, strlen($cur_feed['seperator'])) . $cur_feed['newline'];
  if( !empty($feeds[$cur_feed_id]['encoding']) && $feeds[$cur_feed_id]['encoding'] !== false ) {
	switch( $feeds[$cur_feed_id]['encoding'] ) {
	 case 'utf8':
	  $output_line = utf8_encode($output_line);
	  break;
	}
  }
	fwrite($fps[$cur_feed_id]['fp'], $output_line);
}
 }
}

//clean up
unset($products);

if( ($counter*$cycle_length) >= $count ) break;

}//end while

foreach( $fps as $cur_feed_id => $fp ) {
 fclose($fp['fp']);

 if( isset($feeds[$cur_feed_id]['copies']) && is_array($feeds[$cur_feed_id]['copies']) ) {
foreach( $feeds[$cur_feed_id]['copies'] as $location ) {
  copy($fp['file'], $location);
  chmod($location, 0777);
}
 }

 if( isset($feeds[$cur_feed_id]['compression_compress']) && $feeds[$cur_feed_id]['compression_compress'] ) {

$compression_filename = $save_path . $feeds[$cur_feed_id]['compression_filename'];
if( empty($feeds[$cur_feed_id]['compression_type']) ) $feeds[$cur_feed_id]['compression_type'] = 'gzip';

switch( $feeds[$cur_feed_id]['compression_type'] ) {
  case 'zip':
	$zip = new ZipArchive();
	$zip->open($compression_filename);
	$zip->addFile($fp['file'], $feeds[$cur_feed_id]['filename']);
	$zip->close();
	break;
  default:
	$compression_level = isset($feeds[$cur_feed_id]['compression_level']) && is_numeric($feeds[$cur_feed_id]['compression_level']) && $feeds[$cur_feed_id]['compression_level'] < 10 ? (int)$feeds[$cur_feed_id]['compression_level'] : 9;
	$compressed_data = gzencode(file_get_contents($fp['file']), $compression_level);
	$comp_fp = fopen($compression_filename, 'w');
	fwrite($comp_fp, $compressed_data);
	fclose($comp_fp);
	chmod($compression_filename, 0777);
	unset($compressed_data);
	break;
}

if( isset($feeds[$cur_feed_id]['compression_delete_original']) && $feeds[$cur_feed_id]['compression_delete_original'] ) {
  unlink($fp['file']);
}

if( isset($feeds[$cur_feed_id]['compression_copies']) && is_array($feeds[$cur_feed_id]['compression_copies']) ) {
  foreach( $feeds[$cur_feed_id]['compression_copies'] as $location ) {
	copy($compression_filename, $location);
	chmod($location, 0777);
  }
}

 }

}

echo "\n" . 'done.' . "\n\n";

if( isset($_SERVER['HTTP_HOST']) ) echo '</pre>';

if( !isset($feedmachine_auto) ) tep_exit();

?>

 

 

Please help.

 

Regards,

dunax

Link to comment
Share on other sites

Hello Everybody...

 

I installed this contribution but I am getting this error... any idea why?

 

Fatal error: Call to a member function add_current_page() on a non-object in /mnt/w0207/d47/s36/b02d662b/www/lamodaamericana.com/includes/application_top.php on line 319

 

The installation and configuration is very simple but no idea why it doesn't want up load up.

Ed

Link to comment
Share on other sites

Looks at the links in my posts here: Click Me

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

  • 1 month later...

Hi Lech,

 

me again! The last few months or so I have been getting a couple of errors from Google when I upload a feed The first one I imagine is them just now allowing more attributes which the feed could upload:

 

We recommend including this attribute. help

 

weight

 

 

We recommend including this attribute. help

 

mpn

 

 

We recommend including this attribute. help

 

isbn

 

 

We recommend including this attribute. help

 

image link

 

 

We recommend including this attribute. help

 

ean

 

 

We recommend including this attribute.

 

The second batch though is causing many of my products to not be listed, where exactly the same descriptions were fine before. Does anyone know if Google have changed what they will allow or if there is something I can do with the feedmachine app to make this work? Otherwise I'm gonna have to work out what the characters are that Google doesn't like and go through and edit hundreds of my product descriptions!!!! Have copied an example of a few below, I have hundreds of them... Really hope there is something that can be done

 

There is a problem with the character encoding of this attribute. help

 

description:• High quality screen fabric with black back ensures optimum image quality • Improved perceived image clarity through black borders • Easily installed and operated Viewable Screen Size: 305cm x 229cm Viewable Screen Diagonal: 381cm Case size: 9cm x 10cm x 336cm

 

397

There is a problem with the character encoding of this attribute. help

 

description:The Sonos ZonePlayer 90 lets you play all the music you want, all over your house, on all the audio equipment you already own — your home cinema receiver, stereo system, powered speakers, and more. Just connect the ZP90 to any amplified audio device in any room and it’s instantly part of the wireless Sonos system. The ZP90’s digital and analogue outputs deliver superior sound to every room. And with the ZP90’s superior wireless range, no room is out of reach. The ZP90 is super small, so it will fit just about anywhere. Plus, every ZP90 includes a Sonos Desktop Controller for the ultimate in control and convenience. Best-in-class wireless technology for multi-room music The ZP90 brings great-sounding music wirelessly to any room in your house, without a big wiring project. SonosNet 2.0, our latest wireless mesh network technology, provides double the wireless range for whole-house coverage, ensures synchronous music playback, and avoids sources of wireless interference. Which means the music gets to all the right rooms — near or far — at exactly the right time. Instant access to endless music Sonos liberates the music on your computer and the Internet so you can play it all, all over the house. Wherever there’s a ZP90 (or any other ZonePlayer), you can listen to your personal collection of music stored on your computer, plus thousands of free Internet radio stations. And Sonos works seamlessly with the most popular music services so you can stream millions of songs and stations from the Internet to the rooms of your choice. You can even connect the ZP90 to your favourite audio source such as an iPod or CD player and listen on all the ZonePlayers throughout your house. Simple setup Setting up your ZP90 is incredibly easy. No technical or wiring expertise required. And no need to break through walls or re-wire your entire house. All you need is a high-speed Internet connection and a router to get started. One ZonePlayer or ZoneBridge in your system must be connected to the router and all the rest will work wirelessly. Add more ZonePlayers in more rooms without adding wires. New features and music services with automatic updates Unlike most other consumer electronic products, the ZP90 and the entire Sonos system keep getting better even after you buy it. With free automatic software updates, you’ll always have the newest features and music services to enjoy. Just register your system and Sonos will automatically notify you when software updates are available. Simply press one button and your system updates itself.itself.

 

119

There is a problem with the character encoding of this attribute. help

 

description:As the reference model for the Avanti range, the A100 DC (Design Collection) combines every aspect of AudioProÂ’s expertise to create a speaker of exceptional authority and refinement. The A100 DC exploits fully the advantages of Audio ProÂ’s Ace-Bass technology. Within each A100 DC cabinet resides an 8” long-throw down-firing woofer driven by a 150W amplifier. Independent level controls allow the fine-tuning of both bass extension and LFE information. Such an arrangement allows the A100 DC to extend all the way down to 22 Hz, removing the need for external subwoofers. At the opposite end of the frequency spectrum, the ¾Â” super-tweeter is combined with two 5 ¼Â” drive units to provide a precise sound field extending all the way up to 40 kHz. The structural integrity of the A100 DC cabinet is assured by quadruple cross-bracing, whilst its teardrop shape eliminates standing waves. In keeping with such engineering, each A100 DC is hand lacquered with eight individually applied layers, creating a deep lustrous finish. Two finishes are available: High Gloss White or Piano Gloss Black. Music, home theatre and multi-channel audio are reproduced with equal refinement and authority by the A100 DC, a sophisticated loudspeaker for any environment.

 

130

There is a problem with the character encoding of this attribute. help

 

description:In-Ceiling Speaker. 6.5" Graphite Bass. 1" Pivoting Aluminium Tweeter An excellent performer in numerous applications, the C640 is a compact in-ceiling speaker capable of providing both wide dynamic range and excellent stereo imaging. At the heart of the C640’s design is a high-power 6.5" Injection Moulded Graphite bass driver combined with an independently mounted 1” pivoting aluminium dome tweeter. This combination provides wide dynamic range and stereo separation. The C640’s 92dB sensitivity and 125W power handling allows this speaker to reproduce high sound pressure levels without compression or distortion. In-room response tailoring is provided by bass and treble contour switches, which provide a cut or boost of 3dB. The C640 is an excellent compact speaker, ideal for both main and secondary rooms such as the dining room, master bedroom and study.

Link to comment
Share on other sites

  • 2 months later...

Hi, first of all what a fantastic contribution, it's saved me hours of work and a lot of head scratching and it's so simple to use.

 

I have been sucessfully using feedmachine for at least 2 years with no problems at all.

 

I have added some new products to my store and now get an error when generating the feed. So I'm thinking it may have something to do with the amount of products (I now have 930 products).

 

Below is a copy of the error which occurs when the feed is generated

 


languages array built
currencies array built
taxes array built
countries array built
categories array built
1104 - The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okaySELECT s.*, cd.*, c.*, ptc.*, mi.*, m.*, pd.*, p.*, IF(s.status, s.specials_new_products_price, p.products_price) as final_price
                             FROM products p LEFT JOIN products_description pd ON p.products_id = pd.products_id
						                  LEFT JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
								          LEFT JOIN manufacturers_info mi ON m.manufacturers_id = mi.manufacturers_id AND pd.language_id = mi.languages_id
						                  LEFT JOIN products_to_categories ptc ON pd.products_id = ptc.products_id
										  LEFT JOIN specials s ON ptc.products_id = s.products_id
										  LEFT JOIN categories c ON ptc.categories_id = c.categories_id
										  LEFT JOIN categories_description cd ON c.categories_id = cd.categories_id AND pd.language_id = cd.language_id
						  WHERE pd.language_id IN(1)
						    AND p.products_status = 1
						  ORDER BY p.products_id[TEP STOP]

 

Any help on this from the osCommerce community would be really appreciated.

 

I have also tried all the other feed generating contributions and I can't find any others that generate feeds for the different PPC / Search engines. So it would be a real shame if feedmachine can not be fixed, as I know many of the osCommerce community rely on it.

 

The version I had installed was version 2.13, I have tried using all the other later versions as well but get the exact same error.

 

Thanks

Jim

Link to comment
Share on other sites

  • 3 weeks later...

catalog/admin/feedmachine.php

 

Approx line 270 find the line that starts

$master_query = tep_db_query('SELECT s.*, cd.*, c.*, ptc.*, mi.

 

And add before this line

// SQL_BIG_SELECTS = 1 - added to solve 1104 MYSQL error message

tep_db_query("set sql_big_selects=1");

 

 

That’s it!

Cheers Frank

 

 

Hi, first of all what a fantastic contribution, it's saved me hours of work and a lot of head scratching and it's so simple to use.

 

I have been sucessfully using feedmachine for at least 2 years with no problems at all.

 

I have added some new products to my store and now get an error when generating the feed. So I'm thinking it may have something to do with the amount of products (I now have 930 products).

 

Below is a copy of the error which occurs when the feed is generated

 


languages array built
currencies array built
taxes array built
countries array built
categories array built
1104 - The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okaySELECT s.*, cd.*, c.*, ptc.*, mi.*, m.*, pd.*, p.*, IF(s.status, s.specials_new_products_price, p.products_price) as final_price
                             FROM products p LEFT JOIN products_description pd ON p.products_id = pd.products_id
						                  LEFT JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
								          LEFT JOIN manufacturers_info mi ON m.manufacturers_id = mi.manufacturers_id AND pd.language_id = mi.languages_id
						                  LEFT JOIN products_to_categories ptc ON pd.products_id = ptc.products_id
										  LEFT JOIN specials s ON ptc.products_id = s.products_id
										  LEFT JOIN categories c ON ptc.categories_id = c.categories_id
										  LEFT JOIN categories_description cd ON c.categories_id = cd.categories_id AND pd.language_id = cd.language_id
						  WHERE pd.language_id IN(1)
						    AND p.products_status = 1
						  ORDER BY p.products_id[TEP STOP]

 

Any help on this from the osCommerce community would be really appreciated.

 

I have also tried all the other feed generating contributions and I can't find any others that generate feeds for the different PPC / Search engines. So it would be a real shame if feedmachine can not be fixed, as I know many of the osCommerce community rely on it.

 

The version I had installed was version 2.13, I have tried using all the other later versions as well but get the exact same error.

 

Thanks

Jim

Link to comment
Share on other sites

  • 2 weeks later...

Hi all,

 

I notice that over a few months on this thread, a couple of people have asked if anything is available to make this contribution suitable for use with eDirectory. Did anyone get anywhere with that one?

 

Thanks

Link to comment
Share on other sites

  • 3 months later...

Feedmachine has been running well for a while now, with just the occasional skipped entry because of some description being entered wrong. Suddenly today it is only generating a file with no products. It has the field headings, but nothing else.

 

I appears to run through properly. One thing I notice I think it used to take 2 passes, now it does only one. The output screen seems to have about the right number of products, but none are being put in the output file.

 

I don't think I did anything to cause this. I haven't touch any of the feedmachine files, and added Free Shipping by Catagory module but can't see where that would cause trouble.

 

Any help would be appreciated.

Link to comment
Share on other sites

  • 3 months later...

Hi,

 

I just wanted to leave a note to say that the "Feedmachine" contribution has been superseded by "The Feedmachine Solution" contribution which is available at http://addons.oscommerce.com/info/7129.

 

The new support thread is at http://www.oscommerce.com/forums/topic/349319-the-feedmachine-solution/

 

For those people who have been using Feedmachine and want to move over to The Feedmachine Solution, please note that the new configuration system, though very similar, is not backwards compatible. You can bring configurations from the old system into the new system by examining one of the new configuration files and making changes as required.

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