Latest News: (loading..)
The Feedmachine Solution
Started by lech, Nov 21 2009 04:26 PM
249 replies to this topic
#241
Posted 14 May 2012 - 03:36 PM
My Currencies don't change, they always use my default county no matter what I change them to in Feedmachne. I have 4 countries set up.
Any ideas where I should look. I cannot find anything in the forums about this issue.
Steve
Any ideas where I should look. I cannot find anything in the forums about this issue.
Steve
#243
Posted 27 July 2012 - 02:08 AM
raiwa, on 10 October 2011 - 01:22 PM, said:
Hello,
There is one ")" missing in line 455 at the end with a huge amount of them.
regards
raiwa
<?php
/*
* @[member='licensed2kill'] http://opensource.org/licenses/gpl-license.php GNU Public License
*/
/*
Google Product feed configuration for The Feedmachine Solution
based on google-simple.php by: Lech Madrzyk
----------------------------
This configuration is complient with the Google-Feed specifications of march 2012.
It has to be used together with the modified feedmachine.php file which includes the 'IS_IN_STOCK' Keyword definition.
*/
$feed_config = array('name' => 'Google Product Search',
'authors' => 'raiwa',
'filename' => 'google-product-search-feed-us-en.txt', //change the name and the filename to a unique name for each language and country
'schema_version' => '2.0',
'fields' => array('id' => array('output' => 'FM_RS_product_id_us_en', //change the name to the name used for the function
'type' => 'FUNCTION'
),
'title' => array('output' => 'products_name',
'type' => 'DB',
'options' => array('STRIP_HTML', 'STRIP_CRLF')
),
'price' => array('output' => 'FINAL_PRICE_WITH_TAX',
'type' => 'KEYWORD',
),
'brand' => array('output' => 'manufacturers_name',
'type' => 'DB',
'options' => array('STRIP_HTML', 'HTML_ENTITIES', 'STRIP_CRLF')
),
'mpn' => array('output' => 'products_model',
'type' => 'DB'
),
'google_product_category' => array('output' => 'FM_RS_google_categories_us_en', //change the name to the name used for the function
'type' => 'FUNCTION'
),
'product_type' => array('output' => 'CATEGORY_TREE',
'type' => 'KEYWORD',
'options' => array('STRIP_HTML', 'STRIP_CRLF')
),
'link' => array('output' => 'PRODUCTS_URL',
'type' => 'KEYWORD'
),
'image_link' => array('output' => 'IMAGE_URL',
'type' => 'KEYWORD'
),
'condition' => array('output' => 'new', //change to 'used' or 'refurbished' if needed
'type' => 'VALUE'
),
'description' => array('output' => 'products_description',
'type' => 'DB',
'options' => array('STRIP_HTML', 'STRIP_CRLF')
),
'shipping_weight' => array('output' => 'FM_RS_shipping_weight_and_unit',
'type' => 'FUNCTION',
),
'availability' => array('output' => 'IS_IN_STOCK',
'type' => 'KEYWORD'
),
/*'gender' => array('output' => 'female', //change to male or unisex if needed
/'type' => 'VALUE'
),
'age_group' => array('output' => 'adult', //change to kids if needed
'type' => 'VALUE'
),
'color' => array('output' => 'FM_RS_google_colors_us_en', //change the name to the name used for the function
'type' => 'FUNCTION',
),
'size' => array('output' => 'FM_RS_google_sizes_us_en', //change the name to the name used for the function
'type' => 'FUNCTION',
),
'material' => array('output' => 'products_material',
'type' => 'DB',
'options' => array('STRIP_HTML', 'STRIP_CRLF')
),
'pattern' => array('output' => 'products_pattern',
'type' => 'DB',
'options' => array('STRIP_HTML', 'STRIP_CRLF')
),
'online_only' => array('output' => 'y', //change to 'n' if your shop is physical
'type' => 'VALUE'
) //here no comma ( , ) if it's the last line*/
),
'currency_decimal_override' => false,
'currency_thousands_override' => '',
'add_field_names' => true,
'category_tree_seperator' => ' ',
'seperator' => "\t",
'text_qualifier' => '',
'newline' => "\n",
'encoding' => 'false',
'include_record_function' => ''
);
//FEED FUNCTIONS BEGIN
function FM_RS_product_id_us_en($product) { //change the name to a unique name for each language and country
return 'Azariahs-Fine-Things_' . $product['products_model'] . '';
}
function FM_RS_google_categories_us_en($product) { //change the name to a unique name for each language and country
$output_field_category = $product['categories_id'];
return (($output_field_category == 128) ? 'Health & Beauty > Personal Care > Massage & Relaxation' :
(($output_field_category == 42) ? 'Health & Beauty > Personal Care > Cosmetics > Bath & Body':
(($output_field_category == 122) ? 'Home & Garden > Decor > Candles':
(($output_field_category == 78) ? 'Health & Beauty > Personal Care > Cosmetics > Perfume & Cologne':
(($output_field_category == 44) ? 'Health & Beauty > Personal Care > Cosmetics > Perfume & Cologne':
(($output_field_category == 45) ? 'Health & Beauty > Personal Care > Hair Care':
(($output_field_category == 100) ? 'Health & Beauty > Personal Care > Cosmetics > Makeup':
(($output_field_category == 48) ? 'Health & Beauty > Personal Care > Cosmetics > Skin Care':
''))))))));
}
/*function FM_RS_google_condition_us_en($product) { //change the name to a unique name for each language and country
return (($product['products_condition'] == 'New') ? 'new' : //change to the terms used in your shop for the feed-language
(($product['products_condition'] == 'Used') ? 'used':
(($product['products_condition'] == 'Overhauled') ? 'refurbished':
'')));
}
function FM_RS_google_gender_us_en($product) { //change the name to a unique name for each language and country
return (($product['products_gender'] == 'Woman') ? 'female' : //change terms to the terms you use for each language in your shop
(($product['products_gender'] == 'Men') ? 'male':
(($product['products_gender'] == 'Unisex') ? 'unisex':
'')));
}
function FM_RS_google_age_group_us_en($product) { //change the name to a unique name for each language and country
return (($product['products_age_group'] == 'Adult') ? 'adult' : //change terms to the terms you use for each language in your shop
(($product['products_age_group'] == 'Kids') ? 'kids':
''));
}
function FM_RS_google_colors_us_en($product) { //change the name to a unique name for each language and country
$color_query = tep_db_query("select pov.products_options_values_name as color
from products_attributes as pa,
products_options_values as pov,
products_options as po
where pa.options_id = po. products_options_id
and pa.options_values_id = pov.products_options_values_id
and po.language_id = 1 and pov.language_id = 1
and pa.options_id = 1
AND pa.products_id = " . $product['products_id']);
while($color = tep_db_fetch_array($color_query)) {
$colors .= $color["color"] .", ";
}
$replace_color = array('01-', '02-', '03-', '04-', '05-', '06-', '07-', '08-', '09-','10-', '11-', '12-', '1-', '2-', '3-', '4-', '5-', '6-', 'A-', 'B-', 'C-');
$colors = str_replace($replace_color, '', $colors);
$colors = rtrim($colors, ", "); //this strips the last comma and white space
(($colors == '')? $colors = $product['products_color'] : '');
return $colors;
}
function FM_RS_google_sizes_us_en($product) { //change the name to a unique name for each language and country
$size_query = tep_db_query("select pov.products_options_values_name as size
from products_attributes as pa,
products_options_values as pov,
products_options as po
where pa.options_id = po. products_options_id
and pa.options_values_id = pov.products_options_values_id
and po.language_id = 1 and pov.language_id = 1
and pa.options_id = 2
AND pa.products_id = " . $product['products_id']);
while($size = tep_db_fetch_array($size_query)) {
$sizes .= $size["size"] .", ";
}
$replace_size = array('01-', '02-', '03-', '04-', '05-', '06-', '07-', '08-', '09-','10-', '11-', '12-', '1-', '2-', '3-', '4-', '5-', '6-', 'A-', 'B-', 'C-');
$sizes = str_replace($replace_size, '', $sizes);
$sizes = rtrim($sizes, ", "); //this strips the last comma and white space
(($sizes == '')? $sizes = $product['products_size'] : '');
return $sizes;
}
//FEED FUNCTIONS END
*/
?>
Knowledge is useless, unless transferred.
#244
Posted 09 August 2012 - 11:59 AM
Hi,
This is how I got this contribution working in my 2.3.1 store, hope its of help to some.
I added the files to the site as per the instructions and it will work as expected if you follow the link www.yoursite/admin/feedmachine_admin.php
The resulting page does not fit nicely within your admin system though.
To make it play nice, instead of adding --- require(DIR_WS_BOXES . 'feedmachine.php'); --- to admin/includes/column_left I instead assed the following to the tools dropdown --- admin/includes/boxes/tools.php after the who's online link:-
and added FEEDMACHINE to the bottom of --- admin/includes/filename.php...
Now feedmachine_admin.php writes out it's own html document and that was breaking my styles and additionally adding duplicates of the left column so I edited the file to make it all fit nicely and display the proper 'update' button - see below. (Note I have changed some of the column headings to make them smaller to fit on my page and commented out a couple of drop-down menus that I don't need)
As mentioned, I hope this is of use to someone
Thanks to author for such a useful contribution.
This is how I got this contribution working in my 2.3.1 store, hope its of help to some.
I added the files to the site as per the instructions and it will work as expected if you follow the link www.yoursite/admin/feedmachine_admin.php
The resulting page does not fit nicely within your admin system though.
To make it play nice, instead of adding --- require(DIR_WS_BOXES . 'feedmachine.php'); --- to admin/includes/column_left I instead assed the following to the tools dropdown --- admin/includes/boxes/tools.php after the who's online link:-
array( 'code' => 'Feedmachine', 'title' => 'Feedmachine', 'link' => tep_href_link(FILENAME_FEEDMACHINE) )
and added FEEDMACHINE to the bottom of --- admin/includes/filename.php...
define('FILENAME_FEEDMACHINE', 'feedmachine_admin.php');
Now feedmachine_admin.php writes out it's own html document and that was breaking my styles and additionally adding duplicates of the left column so I edited the file to make it all fit nicely and display the proper 'update' button - see below. (Note I have changed some of the column headings to make them smaller to fit on my page and commented out a couple of drop-down menus that I don't need)
<?php /** * The Feedmachine Solution * * Generate feeds for any product search engine, e.g. Google Product Search, PriceGrabber, BizRate, * DealTime, mySimon, Shopping.com, Yahoo! Shopping, PriceRunner. * @package the-feedmachine-solution * @[member='licensed2kill'] http://opensource.org/licenses/gpl-license.php GNU Public License * @version 5.03 * @[member='Link'] http://www.osc-solutions.co.uk/ osCommerce Solutions * @[member='copyright'] Copyright 2005-, Lech Madrzyk * @[member='author'] Lech Madrzyk */ require('includes/application_top.php'); ini_set('display_errors', 'On'); $action = isset($_POST['action']) ? $_POST['action'] : ( isset($_GET['action']) ? $_GET['action'] : false ); $installation_path = dirname(__FILE__) . '/'; require_once($installation_path . 'feedmachine_config.php'); $catalog_path = defined('FM_CATALOG_DIRECTORY') ? FM_CATALOG_DIRECTORY : '../'; chdir($catalog_path); $catalog_path = getcwd() . '/'; chdir($installation_path); require_once($installation_path . 'feedmachine_loader.php'); $feeds_location_web = HTTP_CATALOG_SERVER . DIR_WS_CATALOG . FM_SAVE_LOCATION; $feeds_location_fs = $catalog_path . FM_SAVE_LOCATION; switch( $action ) { case 'update': if( !empty($_POST['feeds_update']) && is_array($_POST['feeds_update']) ) { foreach( $_POST['feeds_update'] as $config_filename => $config ) { $data = array('filename' => tep_db_prepare_input($config['filename']), 'ftp_status' => tep_db_prepare_input($config['ftp_status']), 'ftp_server' => tep_db_prepare_input($config['ftp_server']), 'ftp_path' => tep_db_prepare_input($config['ftp_path']), 'ftp_username' => tep_db_prepare_input($config['ftp_username']), 'ftp_password' => tep_db_prepare_input($config['ftp_password']), 'ftp_upload_period' => tep_db_prepare_input($config['ftp_upload_period']), 'language_code' => tep_db_prepare_input($config['language_code']), 'currency_code' => tep_db_prepare_input($config['currency_code']), 'countries_iso_2' => tep_db_prepare_input($config['countries_iso_2']), 'url_parameters' => tep_db_prepare_input($config['url_parameters'])); tep_db_perform('feedmachine', $data, 'update', 'config_filename = \'' . $config_filename . '\''); } $messageStack->add_session('Feed settings updated!', 'success'); } break; } require(DIR_WS_INCLUDES . 'template_top.php'); ?> </td> <td width="100%" valign="top"> <?php echo tep_draw_form('feedmachine_admin', 'feedmachine_admin.php') . tep_draw_hidden_field('action', 'update'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading">Feedmachine Admin</td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td class="smallText"><input onclick="runFeedmachine()" type="button" value="Generate and Upload Feeds Now"></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent">Filename</td> <td class="dataTableHeadingContent">Name</td> <td class="dataTableHeadingContent"> </td> <td class="dataTableHeadingContent">Lang</td> <!--<td class="dataTableHeadingContent">Currency</td> <td class="dataTableHeadingContent">Country</td>--> <td class="dataTableHeadingContent">URL Params</td> <td class="dataTableHeadingContent">FTP</td> <td class="dataTableHeadingContent">FTP Server</td> <td class="dataTableHeadingContent">FTP Path</td> <td class="dataTableHeadingContent">FTP Username</td> <td class="dataTableHeadingContent">FTP Password</td> <td class="dataTableHeadingContent">Period</td> </tr> <?php //Build Languages Array $languages_info = array(); $languages_info_query = tep_db_query('SELECT * FROM ' . TABLE_LANGUAGES . ' ORDER BY code'); while( $languages_info_row = tep_db_fetch_array($languages_info_query) ) { $languages_info[] = array('id' => $languages_info_row['code'], 'text' => $languages_info_row['code']); } // //Build Currencies Array $currencies_info = array(); $currencies_info_query = tep_db_query('SELECT * FROM ' . TABLE_CURRENCIES . ' ORDER BY code'); while( $currencies_info_row = tep_db_fetch_array($currencies_info_query) ) { $currencies_info[] = array('id' => $currencies_info_row['code'], 'text' => $currencies_info_row['code']); } // //Build Countries Array $countries_info = array(); $countries_info_query = tep_db_query('SELECT * FROM ' . TABLE_COUNTRIES . ' ORDER BY countries_iso_code_2'); while( $countries_info_row = tep_db_fetch_array($countries_info_query) ) { $countries_info[] = array('id' => $countries_info_row['countries_iso_code_2'], 'text' => $countries_info_row['countries_iso_code_2']); } // foreach( $feeds as $config_filename => $feed ) { ?> <tr class="dataTableRow"> <td class="main" style="font-size: 9px;"><?php echo current(explode('.php', $config_filename)); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][filename]', $feed['filename'], 'size="14"'); ?></td> <td class="main"><?php echo file_exists($feeds_location_fs . $feed['filename']) ? '<a href="' . $feeds_location_web . $feed['filename'] . '" target="_blank">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>' : ''; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('feeds_update[' . $config_filename . '][language_code]', $languages_info, $feed['language_code']); ?></td> <!--<td class="main"><?php // echo tep_draw_pull_down_menu('feeds_update[' . $config_filename . '][currency_code]', $currencies_info, $feed['currency_code']); ?></td> <td class="main"><?php //echo tep_draw_pull_down_menu('feeds_update[' . $config_filename . '][countries_iso_2]', $countries_info, $feed['countries_iso_2']); ?></td> --> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][url_parameters]', $feed['url_parameters'], 'size="11"'); ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('feeds_update[' . $config_filename . '][ftp_status]', array(array('id' => '0', 'text' => 'Off'), array('id' => '1', 'text' => 'On')), $feed['ftp_status']); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_server]', $feed['ftp_server'], 'size="12"'); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_path]', $feed['ftp_path'], 'size="8"'); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_username]', $feed['ftp_username'], 'size="12"'); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_password]', $feed['ftp_password'], 'size="12"'); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_upload_period]', $feed['ftp_upload_period'], 'size="2"'); ?></td> </tr> <?php } ?> </tr> </table> <!--</div>--> </td> </tr> <tr> <td class="main" align="left"> <?php echo tep_draw_button(IMAGE_UPDATE, 'disk') //. tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td> </tr> <tr> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"> <table border="0" width="300" cellspacing="0" cellpadding="2" align="right" style="padding: 3px;"> <tr class="infoBoxHeading"> <td class="infoBoxHeading"><b>Key</b></td> </tr> <tr> <td class="infoBoxContent"> <b>Config Filename:</b> Filename of the feed configuration in <i>fm-feed-configs/</i> (displayed without the ".php" extension)<br> <b>Feed Filename:</b> Filename of the feed that is created from the configuration<br> <b>View:</b> Click on icon to view the feed (if it exists)<br> <b>Country:</b> This is used to determine the tax set-up of the feed.<br> <b>URL Params:</b> Additional parameters (in the form <i>var1=val1&var2=var2</i>) to add to the links output in the feed. E.g. for Google Analytics: <i>utm_source=[SOURCE]&utm_medium=[MEDIUM]&utm_campaign=[CAMPAIGN]</i><br> <b>Period:</b> How often (in days) to re-upload a feed if there haven't been any changes. This can be set to prevent your feeds from expiring. <i>Applies to Feedmachine Auto only</i><br> </td> </tr> </table> <p><b>File System Location of your feeds configuration directory (where to upload new feed configurations)</b><br><?php echo $installation_path . 'fm-feed-configs/'; ?></p> <p><b>Web Location of your feeds</b><br><?php echo $feeds_location_web; ?></p> <p><b>File System Location of your feeds</b><br><?php echo $feeds_location_fs; ?></p> <p><b>Automation</b><br>To automate feed generation and upload, create a cron job to run the following command every 2 hours:<br><br>php <?php echo $installation_path . 'feedmachine_auto.php'; ?><br><br>Feedmachine Auto will generate and upload your feeds when it detects that your catalog has been updated. It also features a period of grace to ensure that your feeds are not generated in the middle of a catalog update.</p> <p><b>Development</b><br>If you need help setting up more complex feed configurations or have other osC development work, please visit my website <a href="http://www.osc-solutions.co.uk/">osc-solutions.co.uk</a>.</p> </td> </tr> </table> </form> </td>
As mentioned, I hope this is of use to someone
Edited by AndrewRavenwood, 09 August 2012 - 12:02 PM.
#245
Posted 09 August 2012 - 12:58 PM
Too late to edit my original post...
I realised that I had lost the required Javascript from the previous example, so here it is with the alteration:-
Sorry for any inconvenience
I realised that I had lost the required Javascript from the previous example, so here it is with the alteration:-
<?php /** * The Feedmachine Solution * * Generate feeds for any product search engine, e.g. Google Product Search, PriceGrabber, BizRate, * DealTime, mySimon, Shopping.com, Yahoo! Shopping, PriceRunner. * @package the-feedmachine-solution * @[member='licensed2kill'] http://opensource.org/licenses/gpl-license.php GNU Public License * @version 5.03 * @[member='Link'] http://www.osc-solutions.co.uk/ osCommerce Solutions * @[member='copyright'] Copyright 2005-, Lech Madrzyk * @[member='author'] Lech Madrzyk */ require('includes/application_top.php'); ini_set('display_errors', 'On'); $action = isset($_POST['action']) ? $_POST['action'] : ( isset($_GET['action']) ? $_GET['action'] : false ); $installation_path = dirname(__FILE__) . '/'; require_once($installation_path . 'feedmachine_config.php'); $catalog_path = defined('FM_CATALOG_DIRECTORY') ? FM_CATALOG_DIRECTORY : '../'; chdir($catalog_path); $catalog_path = getcwd() . '/'; chdir($installation_path); require_once($installation_path . 'feedmachine_loader.php'); $feeds_location_web = HTTP_CATALOG_SERVER . DIR_WS_CATALOG . FM_SAVE_LOCATION; $feeds_location_fs = $catalog_path . FM_SAVE_LOCATION; switch( $action ) { case 'update': if( !empty($_POST['feeds_update']) && is_array($_POST['feeds_update']) ) { foreach( $_POST['feeds_update'] as $config_filename => $config ) { $data = array('filename' => tep_db_prepare_input($config['filename']), 'ftp_status' => tep_db_prepare_input($config['ftp_status']), 'ftp_server' => tep_db_prepare_input($config['ftp_server']), 'ftp_path' => tep_db_prepare_input($config['ftp_path']), 'ftp_username' => tep_db_prepare_input($config['ftp_username']), 'ftp_password' => tep_db_prepare_input($config['ftp_password']), 'ftp_upload_period' => tep_db_prepare_input($config['ftp_upload_period']), 'language_code' => tep_db_prepare_input($config['language_code']), 'currency_code' => tep_db_prepare_input($config['currency_code']), 'countries_iso_2' => tep_db_prepare_input($config['countries_iso_2']), 'url_parameters' => tep_db_prepare_input($config['url_parameters'])); tep_db_perform('feedmachine', $data, 'update', 'config_filename = \'' . $config_filename . '\''); } $messageStack->add_session('Feed settings updated!', 'success'); } break; } require(DIR_WS_INCLUDES . 'template_top.php'); ?> <script language="javascript" src="includes/general.js"></script> <script language="javascript"><!-- function runFeedmachine() { window.open('<?php echo tep_href_link('feedmachine_auto.php', 'force_update=1'); ?>','feedmachine_console','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=400,screenX=150,screenY=150,top=150,left=150') } </script> </td> <td width="100%" valign="top"> <?php echo tep_draw_form('feedmachine_admin', 'feedmachine_admin.php') . tep_draw_hidden_field('action', 'update'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading">Feedmachine Admin</td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td class="smallText"><input onclick="runFeedmachine()" type="button" value="Generate and Upload Feeds Now"></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent">Filename</td> <td class="dataTableHeadingContent">Name</td> <td class="dataTableHeadingContent"> </td> <td class="dataTableHeadingContent">Lang</td> <!--<td class="dataTableHeadingContent">Currency</td> <td class="dataTableHeadingContent">Country</td>--> <td class="dataTableHeadingContent">URL Params</td> <td class="dataTableHeadingContent">FTP</td> <td class="dataTableHeadingContent">FTP Server</td> <td class="dataTableHeadingContent">FTP Path</td> <td class="dataTableHeadingContent">FTP Username</td> <td class="dataTableHeadingContent">FTP Password</td> <td class="dataTableHeadingContent">Period</td> </tr> <?php //Build Languages Array $languages_info = array(); $languages_info_query = tep_db_query('SELECT * FROM ' . TABLE_LANGUAGES . ' ORDER BY code'); while( $languages_info_row = tep_db_fetch_array($languages_info_query) ) { $languages_info[] = array('id' => $languages_info_row['code'], 'text' => $languages_info_row['code']); } // //Build Currencies Array $currencies_info = array(); $currencies_info_query = tep_db_query('SELECT * FROM ' . TABLE_CURRENCIES . ' ORDER BY code'); while( $currencies_info_row = tep_db_fetch_array($currencies_info_query) ) { $currencies_info[] = array('id' => $currencies_info_row['code'], 'text' => $currencies_info_row['code']); } // //Build Countries Array $countries_info = array(); $countries_info_query = tep_db_query('SELECT * FROM ' . TABLE_COUNTRIES . ' ORDER BY countries_iso_code_2'); while( $countries_info_row = tep_db_fetch_array($countries_info_query) ) { $countries_info[] = array('id' => $countries_info_row['countries_iso_code_2'], 'text' => $countries_info_row['countries_iso_code_2']); } // foreach( $feeds as $config_filename => $feed ) { ?> <tr class="dataTableRow"> <td class="main" style="font-size: 9px;"><?php echo current(explode('.php', $config_filename)); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][filename]', $feed['filename'], 'size="14"'); ?></td> <td class="main"><?php echo file_exists($feeds_location_fs . $feed['filename']) ? '<a href="' . $feeds_location_web . $feed['filename'] . '" target="_blank">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>' : ''; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('feeds_update[' . $config_filename . '][language_code]', $languages_info, $feed['language_code']); ?></td> <!--<td class="main"><?php // echo tep_draw_pull_down_menu('feeds_update[' . $config_filename . '][currency_code]', $currencies_info, $feed['currency_code']); ?></td> <td class="main"><?php //echo tep_draw_pull_down_menu('feeds_update[' . $config_filename . '][countries_iso_2]', $countries_info, $feed['countries_iso_2']); ?></td> --> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][url_parameters]', $feed['url_parameters'], 'size="11"'); ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('feeds_update[' . $config_filename . '][ftp_status]', array(array('id' => '0', 'text' => 'Off'), array('id' => '1', 'text' => 'On')), $feed['ftp_status']); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_server]', $feed['ftp_server'], 'size="12"'); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_path]', $feed['ftp_path'], 'size="8"'); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_username]', $feed['ftp_username'], 'size="12"'); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_password]', $feed['ftp_password'], 'size="12"'); ?></td> <td class="main"><?php echo tep_draw_input_field('feeds_update[' . $config_filename . '][ftp_upload_period]', $feed['ftp_upload_period'], 'size="2"'); ?></td> </tr> <?php } ?> </tr> </table> <!--</div>--> </td> </tr> <tr> <td class="main" align="left"> <?php echo tep_draw_button(IMAGE_UPDATE, 'disk') //. tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td> </tr> <tr> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"> <table border="0" width="300" cellspacing="0" cellpadding="2" align="right" style="padding: 3px;"> <tr class="infoBoxHeading"> <td class="infoBoxHeading"><b>Key</b></td> </tr> <tr> <td class="infoBoxContent"> <b>Config Filename:</b> Filename of the feed configuration in <i>fm-feed-configs/</i> (displayed without the ".php" extension)<br> <b>Feed Filename:</b> Filename of the feed that is created from the configuration<br> <b>View:</b> Click on icon to view the feed (if it exists)<br> <b>Country:</b> This is used to determine the tax set-up of the feed.<br> <b>URL Params:</b> Additional parameters (in the form <i>var1=val1&var2=var2</i>) to add to the links output in the feed. E.g. for Google Analytics: <i>utm_source=[SOURCE]&utm_medium=[MEDIUM]&utm_campaign=[CAMPAIGN]</i><br> <b>Period:</b> How often (in days) to re-upload a feed if there haven't been any changes. This can be set to prevent your feeds from expiring. <i>Applies to Feedmachine Auto only</i><br> </td> </tr> </table> <p><b>File System Location of your feeds configuration directory (where to upload new feed configurations)</b><br><?php echo $installation_path . 'fm-feed-configs/'; ?></p> <p><b>Web Location of your feeds</b><br><?php echo $feeds_location_web; ?></p> <p><b>File System Location of your feeds</b><br><?php echo $feeds_location_fs; ?></p> <p><b>Automation</b><br>To automate feed generation and upload, create a cron job to run the following command every 2 hours:<br><br>php <?php echo $installation_path . 'feedmachine_auto.php'; ?><br><br>Feedmachine Auto will generate and upload your feeds when it detects that your catalog has been updated. It also features a period of grace to ensure that your feeds are not generated in the middle of a catalog update.</p> <p><b>Development</b><br>If you need help setting up more complex feed configurations or have other osC development work, please visit my website <a href="http://www.osc-solutions.co.uk/">osc-solutions.co.uk</a>.</p> </td> </tr> </table> </form> </td>
Sorry for any inconvenience
#246
Posted 09 August 2012 - 03:07 PM
Last post today, honestly!
Had some trouble with the feed that this contribution produced by defauls - I assume certain database tables have altered since V2.2 OSCom.... So to get what I needed I altered the following in admin/fm-feed-configs/google-simple.php:-
The script wasn't producing a price so I changed the value to this
Then added this simple function at the top of the page under the introduction
In addition I added a new array for Googles product category
which meant that I had to add a new column to my database in the 'products' table and populate it with Googles relevant catagories in the following format.
Category > Sub category
It means I will have to play with the admin page so that these can be added when the products are added.
Now, to be honest, at this stage I don't know if I will need to tinker more to get this and Google to be best friends but at least this covers the most immediate issues that I faced.
I think this contribution could do with an update and hope the original author is willing to keep it current. I consider a lot of what I've done today to be hacks!
Had some trouble with the feed that this contribution produced by defauls - I assume certain database tables have altered since V2.2 OSCom.... So to get what I needed I altered the following in admin/fm-feed-configs/google-simple.php:-
The script wasn't producing a price so I changed the value to this
'price' => array( 'output' => 'FM_UF_addprice', 'type' => 'FUNCTION' ),
Then added this simple function at the top of the page under the introduction
function FM_UF_addprice($product) {
return '£' . $product['products_price'];
}
In addition I added a new array for Googles product category
'google product category' => array('output' => 'google_product_category',
'type' => 'DB'
)
which meant that I had to add a new column to my database in the 'products' table and populate it with Googles relevant catagories in the following format.
Category > Sub category
It means I will have to play with the admin page so that these can be added when the products are added.
Now, to be honest, at this stage I don't know if I will need to tinker more to get this and Google to be best friends but at least this covers the most immediate issues that I faced.
I think this contribution could do with an update and hope the original author is willing to keep it current. I consider a lot of what I've done today to be hacks!
Edited by AndrewRavenwood, 09 August 2012 - 03:10 PM.
#247
Posted 09 August 2012 - 03:26 PM
Okay I lied before... This is the last post today...This time for real.
Here is where you can find the catogories that google currently use... http://support.google.com/merchants/bin/answer.py?hl=en&answer=1705911
Here is where you can find the catogories that google currently use... http://support.google.com/merchants/bin/answer.py?hl=en&answer=1705911
Edited by AndrewRavenwood, 09 August 2012 - 03:27 PM.
#248
Posted 25 September 2012 - 04:45 PM
Hi,
i have installed this contribution, version 5.03 of 15 may 2010, on my oscommerce 2.2
I will advance that my site has two active languages: Italian(code = it, languages_id = 6) and English(en, 7).
From the admin panel I want to create two separate feed for the two languages, for example, using the configuration file "google-simple."
Problem: if i set language = en and create the feed, this selects all products in the "it" instead of those in the "en".
In the file / admin / feedmachine.php
the follow code always generates the code, and only the following value:
$ languages_list = 6 and also $ languages_used = 6
This piece of code should do what exactly?
I make a mistake?
Thank for your help.
i have installed this contribution, version 5.03 of 15 may 2010, on my oscommerce 2.2
I will advance that my site has two active languages: Italian(code = it, languages_id = 6) and English(en, 7).
From the admin panel I want to create two separate feed for the two languages, for example, using the configuration file "google-simple."
Problem: if i set language = en and create the feed, this selects all products in the "it" instead of those in the "en".
In the file / admin / feedmachine.php
the follow code always generates the code, and only the following value:
$ languages_list = 6 and also $ languages_used = 6
//Build Languages Array
$languages = array();
$languages_query = tep_db_query('SELECT * FROM ' . TABLE_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();
//
// Debug: STAMPA ARRAY $languages
print_r($languages);
//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($feed['language_code']) && isset($languages[ $feed['language_code'] ]['languages_id']) ) {
$feeds[$key]['language_id'] = $languages[ $feed['language_code'] ]['languages_id'];
}
if( isset($feeds[$key]['language_id']) ) {
$languages_used[ $feeds[$key]['language_id'] ] = $feeds[$key]['language_id'];
}
}
$languages_list = implode(',', $languages_used);
//
This piece of code should do what exactly?
I make a mistake?
Thank for your help.
Ad Maiora
#249
Posted 25 September 2012 - 08:07 PM
I have insert this code
before this:
The values printed are:
ERROR!
I have insert language_code=en !!!
I have insert different values for ftp_server,ftp_path,ftp_username,ftp_password !!!
The valuesa are stored correctly in the table feedmachine at row 1, but are not used.
Help me, thanks
// Debug: STAMPA ARRAY $feeds print_r($feed);
before this:
//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($feed['language_code']) && isset($languages[ $feed['language_code'] ]['languages_id']) ) {
$feeds[$key]['language_id'] = $languages[ $feed['language_code'] ]['languages_id'];
}
if( isset($feeds[$key]['language_id']) ) {
$languages_used[ $feeds[$key]['language_id'] ] = $feeds[$key]['language_id'];
}
The values printed are:
......... [id] => 1 [config_filename] => google-simple.php [ftp_status] => 0 [ftp_server] => [ftp_path] => [ftp_username] => [ftp_password] => [ftp_upload_period] => 30 [language_code] => it [currency_code] => EUR [countries_iso_2] => IT [url_parameters] => utm_source=google-simple&utm_medium=product_search&utm_campaign=google-simple
ERROR!
I have insert language_code=en !!!
I have insert different values for ftp_server,ftp_path,ftp_username,ftp_password !!!
The valuesa are stored correctly in the table feedmachine at row 1, but are not used.
Help me, thanks
Ad Maiora
#250
Posted 07 December 2012 - 10:53 AM
I have searched every page of this thread and the issue of excluding diabled categories has come up a couple of times both with unsatisfactory answers and no solution, other than write a custom function. Well i know i need to use a custom function but i am struggling to write that function. I am using 'Enable & Disable Categories - http://addons.oscommerce.com/info/326' and ask if anybody has a function to exclude categories or can help in writing the function i would really appreciate hearing from you.
Thanks,
Thanks,









