Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

AndrewRavenwood

Pioneers
  • Posts

    54
  • Joined

  • Last visited

Profile Information

  • Real Name
    Andrew
  • Gender
    Male

AndrewRavenwood's Achievements

  1. 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
  2. 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 '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!
  3. 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:- <?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
  4. 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:- 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 :) Thanks to author for such a useful contribution.
×
×
  • Create New...