bjunix Posted October 16, 2006 Share Posted October 16, 2006 (edited) Right here we go! Apologies if this solution is somewhere in the 'easypopulate thread' but i have trawled it and can't find a thing. I'm using EP 2.76 - i've installed it with no errors. I have a temp directory with all the relevant permissions (777). When i go to admin and try to download an EP file like 'Download Complete tab-delimited .txt file to edit' i get nothing - in fact i get nothing from any of the download links. No errors - nothing. I've tried uploading the sample file but i get nothing again (no errors) - the page just refreshes. I'm obviously missing something simple but i can't for the life of me work out what it is. Can anyone help - it's driving me mad. Many thanks Mike Hi its exactly the same problem here (with EP 2.90). Unfortunately it seem this issue has not been solved by now. I use the newest osCommerce version with PHP5 and MYSQL5. In 'admin/ includes/configure.php' I set : define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT); ,as stated somewhere earlier in this thread, but with no success. Any hints to solve this problem? Thanks Bjunix Edited October 16, 2006 by bjunix Quote Link to comment Share on other sites More sharing options...
bjunix Posted October 16, 2006 Share Posted October 16, 2006 (edited) Hi its exactly the same problem here (with EP 2.90). Unfortunately it seem this issue has not been solved by now. I use the newest osCommerce version with PHP5 and MYSQL5. In 'admin/ includes/configure.php' I set : define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT); ,as stated somewhere earlier in this thread, but with no success. Any hints to solve this problem? Thanks Bjunix OK I solved it by myself... I applied the register globals patch and forgot to modify easypopulate.php! :-" Edited October 16, 2006 by bjunix Quote Link to comment Share on other sites More sharing options...
sonictrip.net Posted October 17, 2006 Share Posted October 17, 2006 Ok, seeing as i didnt get a reply to this earlier, i thought i'd post the whole thing here: Im able to download the full catalogue as a text file. But when i upload the exact same file back up to the server, everything seems fine until i check a product that has an image link in it. The image links, which are in the product description, seem to be given the following format: http://www.bwear.ie/catalog/%22images/pSep...-150x150.jpg%22 Notice the %22 around the part of the url that is in the description, the html looks like this: src="images/pSeppFleece2Tone-150x150.jpg" So, its replacing the quotes with %22 instead. I have checked the easy_populate.php file for the replacing quotes part, and it looks like so: $replace_quotes = false; So, why is it still replacing the quotes? Even though its only the html version of the quote that its replacing it with, how would i change that in the easy_populate.php file? The downloaded file, when viewed in Excel, still has the normal proper quotes "" around the url. It seems to only change them to %22 after the file is uploaded again, so its the uploading process thats changing them. Any ideas, anyone? Pixclinic? :) Thank you Quote Link to comment Share on other sites More sharing options...
Guest Posted October 17, 2006 Share Posted October 17, 2006 Ok, seeing as i didnt get a reply to this earlier, i thought i'd post the whole thing here: Im able to download the full catalogue as a text file. But when i upload the exact same file back up to the server, everything seems fine until i check a product that has an image link in it. The image links, which are in the product description, seem to be given the following format: http://www.bwear.ie/catalog/%22images/pSep...-150x150.jpg%22 Notice the %22 around the part of the url that is in the description, the html looks like this: src="images/pSeppFleece2Tone-150x150.jpg" So, its replacing the quotes with %22 instead. I have checked the easy_populate.php file for the replacing quotes part, and it looks like so: $replace_quotes = false; So, why is it still replacing the quotes? Even though its only the html version of the quote that its replacing it with, how would i change that in the easy_populate.php file? The downloaded file, when viewed in Excel, still has the normal proper quotes "" around the url. It seems to only change them to %22 after the file is uploaded again, so its the uploading process thats changing them. Any ideas, anyone? Pixclinic? :) Thank you you said "when viewed in Excel, still has the normal proper quotes "" around the url." please note that in your exel file, the only value that need to be in the product_image field is the image name. Please explain why you are talking about url the value that you should have is pSeppFleece2Tone-150x150.jpg and not images/pSeppFleece2Tone-150x150.jpg Quote Link to comment Share on other sites More sharing options...
sonictrip.net Posted October 17, 2006 Share Posted October 17, 2006 (edited) you said "when viewed in Excel, still has the normal proper quotes "" around the url."please note that in your exel file, the only value that need to be in the product_image field is the image name. Please explain why you are talking about url the value that you should have is pSeppFleece2Tone-150x150.jpg and not images/pSeppFleece2Tone-150x150.jpg Sorry, im not talking about the v_products_image field. They are all fine... Im talking about HTML which points to other images from inside v_products_description in the format <img src="images/blah.jpg"> being renamed to <img src=%22images/blah.jpg%22> This only happens in the v_products_description as that is the only place where there are quotes because of the HTML descriptions ive been using... I also tried removing the product description data and uploading all the other data but it just deletes all product descriptions instead of leaving them the way they are. So there's no work around for it that i can see, know what i mean? The replace_quotes variable is turned off so it really should be leaving the quotes the way they are instead of changing them all to %22. Would it be an excel issue, or the fact that im uploading to a windows server? Thanks for the reply! :) Edited October 17, 2006 by sonictrip.net Quote Link to comment Share on other sites More sharing options...
Guest Posted October 17, 2006 Share Posted October 17, 2006 Sorry, im not talking about the v_products_image field. Im talking about HTML contained inside v_products_description which includes normal html links in the format <img src="images/blah.jpg"> being renamed to <img src=%22images/blah.jpg%22> This only happens in the v_products_description as that is the only place where there are quotes because of the HTML descriptions ive been using... I also tried removing the product description data and uploading all the other data but it just deletes all product descriptions instead of leaving them the way they are. So there's no work around for it that i can see, know what i mean? The replace_quotes variable is turned off so it really should be leaving the quotes the way they are instead of changing them all to %22. Would it be an excel issue, or the fact that im uploading to a windows server? Thanks for the reply! :) just rmove all the quotes from your image tags <img src=images/blah.jpg> instead of <img src="images/blah.jpg"> and it should work fine Quote Link to comment Share on other sites More sharing options...
sonictrip.net Posted October 17, 2006 Share Posted October 17, 2006 just rmove all the quotes from your image tags <img src=images/blah.jpg> instead of <img src="images/blah.jpg"> and it should work fine How do i replace them all in Excel? When i try to do a find and replace, it says "formula is too long" Thanks. Quote Link to comment Share on other sites More sharing options...
Guest Posted October 17, 2006 Share Posted October 17, 2006 (edited) How do i replace them all in Excel? When i try to do a find and replace, it says "formula is too long" Thanks. dont open the file in Excel: (this is a stupid application that only wants to do calculations :-) open the txt file with Word and do a seach and replace Edited October 17, 2006 by pixclinic Quote Link to comment Share on other sites More sharing options...
scottybalotty Posted October 17, 2006 Share Posted October 17, 2006 Can anybody link me to a full stable version to download thanks? Quote Link to comment Share on other sites More sharing options...
scottybalotty Posted October 17, 2006 Share Posted October 17, 2006 Can anybody link me to a full stable version to download thanks? Quote Link to comment Share on other sites More sharing options...
Guest Posted October 17, 2006 Share Posted October 17, 2006 Can anybody link me to a full stable version to download thanks? All versions are stable, not all users are ;-) Quote Link to comment Share on other sites More sharing options...
sonictrip.net Posted October 18, 2006 Share Posted October 18, 2006 Easy Populate v2.90b is working great for me now, thanks pixclinic! :) Quote Link to comment Share on other sites More sharing options...
Noy Posted October 19, 2006 Share Posted October 19, 2006 Hi all, sorry for my bad english, but It has a long time since I studied English at Italian school :-" The matter: I installed Access with Level Account v. 2.2a and Easy Populate 2.8 on my osC. Well, when I write an url in a products_description field of the products_description table of my db, through the .txt Easy Populate file, like this: In vimini.<br>Da riempire eventualmente con <a class="mainLink" href="index.php?cPath=23_165">truciolo o paglietta</a>. and I upload it, it's right. But when I download the same complete .txt, the code changes in: In vimini.<br>Da riempire eventualmente con <a class="mainLink" href="index.php?cPath=23_165&osCAdminID=9b6aeaab2e1fad0968a7b0729ff2e2d2">truciolo o paglietta</a>. Why? How I can prevent this? Thanks. Quote Link to comment Share on other sites More sharing options...
steveorg Posted October 19, 2006 Share Posted October 19, 2006 I'm just starting out with OSC and it seems that Easy Populate will be an essential component of my installation. Instead of downloading and then uploading, I'll be using a frequently updated FTP feed from another system, which will then be inserted into the database. I'd appreciate input on these questions: Would it be possible to do the insertion through a chron job? File splits would also be required. I'd probably use a script that first checks to see if the feed has been updated since the last insertion. In light of this info, which OSC and Easy Populate versions woul be best to start with? I'll eventually want to add a multiple images contribution (suggestions welcome). Fantastico installed 2.2 MS2 (051113). Thanks in advance for all feedback. Steve Quote Link to comment Share on other sites More sharing options...
steveorg Posted October 19, 2006 Share Posted October 19, 2006 I'm just starting out with OSC and it seems that Easy Populate will be an essential component of my installation. Instead of downloading and then uploading, I'll be using a frequently updated FTP feed from another system, which will then be inserted into the database. I'd appreciate input on these questions:Would it be possible to do the insertion through a chron job? File splits would also be required. I'd probably use a script that first checks to see if the feed has been updated since the last insertion. In light of this info, which OSC and Easy Populate versions woul be best to start with? I'll eventually want to add a multiple images contribution (suggestions welcome). Fantastico installed 2.2 MS2 (051113). Thanks in advance for all feedback. I forgot to mention that I'll also be using an SEO contrib. Steve Quote Link to comment Share on other sites More sharing options...
Plascual Posted October 19, 2006 Share Posted October 19, 2006 Hi! I installed Easy Populate v2.76c with Master products (a long time ago). There is a wierd problem that never happened before I updated my version of Register_Globals contribution (to Register Globals V 1.5 - Bug Fixes v2) with fix to get uploads working Easy Populate. Now everything works right, upload is okay, processing is ok, then products are added to products table , but not in the products_to_categories table, so I can't see my products on the website or the admin side. I verified my tabbed-file for fields order, categories names are okay... I just do as I always did. So I have to go in phpMyAdmin and make the link manually, this is very annoying. Here is the code for /admin/easypopulate.php, hoping somebody can help me : <?php // Current EP Version$curver = '2.76c-MS2'; /* $Id: easypopulate.php,v 2.75 2005/04/05 AL Exp $*/ ////*******************************//*******************************// C O N F I G U R A T I O N// V A R I A B L E S//*******************************//******************************* // **** Temp directory ****// if you changed your directory structure from stock and do not have /catalog/temp/, then you'll need to change this accordingly.//$tempdir = "temp/";$tempdir2 = "temp/"; /*fix by jb 20040815 set the strings to http post/request, since they don't seem to work on the new server, with register globals=off... $dltype=$_REQUEST['dltype'];$download=$_REQUEST['download']; global $HTTP_POST_FILES; foreach( $HTTP_POST_FILES as $varname => $fileinfo ){$GLOBALS[$varname] = $fileinfo["tmp_name"];$GLOBALS[$varname.'_name'] = $fileinfo["name"];}// end fix jb */ //**** File Splitting Configuration ****// we attempt to set the timeout limit longer for this script to avoid having to split the files// NOTE: If your server is running in safe mode, this setting cannot override the timeout set in php.ini// uncomment this if you are not on a safe mode server and you are getting timeouts// set_time_limit(330); // if you are splitting files, this will set the maximum number of records to put in each file.// if you set your php.ini to a long time, you can make this number biggerglobal $maxrecs;$maxrecs = 300; // default, seems to work for most people. Reduce if you hit timeouts//$maxrecs = 4; // for testing //**** Image Defaulting ****global $default_images, $default_image_manufacturer, $default_image_product, $default_image_category; // set them to your own default "We don't have any picture" gif//$default_image_manufacturer = 'no_image_manufacturer.gif';//$default_image_product = 'no_image_product.gif';//$default_image_category = 'no_image_category.gif'; // or let them get set to nothing$default_image_manufacturer = '';$default_image_product = '';$default_image_category = ''; //**** Status Field Setting ****// Set the v_status field to "Inactive" if you want the status=0 in the system// Set the v_status field to "Delete" if you want to remove the item from the system <- THIS IS NOT WORKING YET!// If zero_qty_inactive is true, then items with zero qty will automatically be inactive in the store.global $active, $inactive, $zero_qty_inactive, $deleteit;$active = 'Active';$inactive = 'Inactive';//$deleteit = 'Delete'; // not functional yet$zero_qty_inactive = true; //**** Size of products_model in products table ****// set this to the size of your model number field in the db. We check to make sure all models are no longer than this value.// this prevents the database from getting fubared. Just making this number bigger won't help your database! They must match!global $modelsize;$modelsize = 12; //**** Price includes tax? ****// Set the v_price_with_tax to// 0 if you want the price without the tax included// 1 if you want the price to be defined for import & export including tax.global $price_with_tax;$price_with_tax =true; // **** Quote -> Escape character conversion ****// If you have extensive html in your descriptions and it's getting mangled on upload, turn this off// set to 1 = replace quotes with escape characters// set to 0 = no quote replacementglobal $replace_quotes;$replace_quotes = true; // **** Field Separator ****// change this if you can't use the default of tabs// Tab is the default, comma and semicolon are commonly supported by various progs// Remember, if your descriptions contain this character, you will confuse EP!global $separator;$separator = "\t"; // tab is default//$separator = ","; // comma//$separator = ";"; // semi-colon//$separator = "~"; // tilde//$separator = "-"; // dash//$separator = "*"; // splat // **** Max Category Levels ****// change this if you need more or fewer categoriesglobal $max_categories;$max_categories = 3; // 7 is default // VJ product attributes begin// **** Product Attributes ****// change this to false, if do not want to download product attributesglobal $products_with_attributes;$products_with_attributes = false; // change this if you want to download selected product options// this might be handy, if you have a lot of product options, and your output file exceeds 256 columns (which is the max. limit MS Excel is able to handle)global $attribute_options_select;//$attribute_options_select = array('Size', 'Model'); // uncomment and fill with product options name you wish to download // comment this line, if you wish to download all product options// VJ product attributes end // ****************************************// Froogle configuration variables// -- YOU MUST CONFIGURE THIS! IT WON'T WORK OUT OF THE BOX!// **************************************** // **** Froogle product info page path ****// We can't use the tep functions to create the link, because the links will point to the admin, since that's where we're at.// So put the entire path to your product_info.php page hereglobal $froogle_product_info_path;$froogle_product_info_path = "http://www.stylishbydesign.com/catalog/product_info.php"; // **** Froogle product image path ****// Set this to the path to your images directoryglobal $froogle_image_path;$froogle_image_path = "http://www.stylishbydesign.com/catalog/images/"; // **** Froogle - search engine friendly setting// if your store has SEARCH ENGINE FRIENDLY URLS set, then turn this to true// I did it this way because I'm having trouble with the code seeing the constants// that are defined in other places.global $froogle_SEF_urls;$froogle_SEF_urls = false; // ****************************************// End Froogle configuration variables// **************************************** //*******************************//*******************************// E N D// C O N F I G U R A T I O N// V A R I A B L E S//*******************************//******************************* //*******************************//*******************************// S T A R T// INITIALIZATION//*******************************//******************************* require('includes/application_top.php');require('includes/database_tables.php'); // >>> BEGIN REGISTER_GLOBALSlink_get_variable('download');link_get_variable('dltype');link_get_variable('split'); link_post_variable('MAX_FILE_SIZE');link_post_variable('buttoninsert');link_post_variable('buttonsplit');link_post_variable('localfile'); link_files_variable('usrfl');// <<< END REGISTER_GLOABLS //*******************************// If you are running a pre-Nov1-2002 snapshot of OSC, then we need this include line to avoid// errors like:// undefined function tep_get_uploaded_file if (!function_exists(tep_get_uploaded_file)){ include ('easypopulate_functions.php'); }//******************************* // VJ product attributes beginglobal $attribute_options_array;$attribute_options_array = array(); if ($products_with_attributes == true) { if (is_array($attribute_options_select) && (count($attribute_options_select) > 0)) { foreach ($attribute_options_select as $value) { $attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " where products_options_name = '" . $value . "'"; $attribute_options_values = tep_db_query($attribute_options_query); if ($attribute_options = tep_db_fetch_array($attribute_options_values)){ $attribute_options_array[] = array('products_options_id' => $attribute_options['products_options_id']); } } } else { $attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " order by products_options_id"; $attribute_options_values = tep_db_query($attribute_options_query); while ($attribute_options = tep_db_fetch_array($attribute_options_values)){ $attribute_options_array[] = array('products_options_id' => $attribute_options['products_options_id']); } }}// VJ product attributes end global $filelayout, $filelayout_count, $filelayout_sql, $langcode, $fileheaders; // these are the fields that will be defaulted to the current values in the database if they are not found in the incoming fileglobal $default_these;$default_these = array( 'v_products_image', #'v_products_mimage', #'v_products_bimage', #'v_products_subimage1', #'v_products_bsubimage1', #'v_products_subimage2', #'v_products_bsubimage2', #'v_products_subimage3', #'v_products_bsubimage3', 'v_categories_id', 'v_products_price', 'v_products_quantity', 'v_products_weight', 'v_products_master', 'v_products_master_status', 'v_products_listing_status', 'v_date_avail', 'v_instock', 'v_tax_class_title', 'v_manufacturers_name', 'v_manufacturers_id', 'v_products_dim_type', 'v_products_length', 'v_products_width', 'v_products_height' ); //elari check default language_id from configuration table DEFAULT_LANGUAGE$epdlanguage_query = tep_db_query("select languages_id, name from " . TABLE_LANGUAGES . " where code = '" . DEFAULT_LANGUAGE . "'");if (tep_db_num_rows($epdlanguage_query)) { $epdlanguage = tep_db_fetch_array($epdlanguage_query); $epdlanguage_id = $epdlanguage['languages_id']; $epdlanguage_name = $epdlanguage['name'];} else { Echo 'Strange but there is no default language to work... That may not happen, just in case... ';} $langcode = ep_get_languages(); if ( $dltype != '' ){ // if dltype is set, then create the filelayout. Otherwise it gets read from the uploaded file ep_create_filelayout($dltype); // get the right filelayout for this download} //*******************************//*******************************// E N D// INITIALIZATION//*******************************//******************************* if ( $download == 'stream' or $download == 'tempfile' ){ //******************************* //******************************* // DOWNLOAD FILE //******************************* //******************************* $filestring = ""; // this holds the csv file we want to download $result = tep_db_query($filelayout_sql); $row = tep_db_fetch_array($result); // Here we need to allow for the mapping of internal field names to external field names // default to all headers named like the internal ones // the field mapping array only needs to cover those fields that need to have their name changed if ( count($fileheaders) != 0 ){ $filelayout_header = $fileheaders; // if they gave us fileheaders for the dl, then use them } else { $filelayout_header = $filelayout; // if no mapping was spec'd use the internal field names for header names } //We prepare the table heading with layout values foreach( $filelayout_header as $key => $value ){ $filestring .= $key . $separator; } // now lop off the trailing tab $filestring = substr($filestring, 0, strlen($filestring)-1); // set the type if ( $dltype == 'froogle' ){ $endofrow = "\n"; } else { // default to normal end of row $endofrow = $separator . 'EOREOR' . "\n"; } $filestring .= $endofrow; $num_of_langs = count($langcode); while ($row){ // if the filelayout says we need a products_name, get it // build the long full froogle image path $row['v_products_fullpath_image'] = $froogle_image_path . $row['v_products_image']; // Other froogle defaults go here for now $row['v_froogle_instock'] = 'Y'; $row['v_froogle_shipping'] = ''; $row['v_froogle_upc'] = ''; $row['v_froogle_color'] = ''; $row['v_froogle_size'] = ''; $row['v_froogle_quantitylevel'] = ''; $row['v_froogle_manufacturer_id'] = ''; $row['v_froogle_exp_date'] = ''; $row['v_froogle_product_type'] = 'OTHER'; $row['v_froogle_delete'] = ''; $row['v_froogle_currency'] = 'USD'; $row['v_froogle_offer_id'] = $row['v_products_model']; $row['v_froogle_product_id'] = $row['v_products_model']; // names and descriptions require that we loop thru all languages that are turned on in the store foreach ($langcode as $key => $lang){ $lid = $lang['id']; // for each language, get the description and set the vals $sql2 = "SELECT * FROM ".TABLE_PRODUCTS_DESCRIPTION." WHERE products_id = " . $row['v_products_id'] . " AND language_id = '" . $lid . "' "; $result2 = tep_db_query($sql2); $row2 = tep_db_fetch_array($result2); // I'm only doing this for the first language, since right now froogle is US only.. Fix later! // adding url for froogle, but it should be available no matter what if ($froogle_SEF_urls){ // if only one language if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = $froogle_product_info_path . '/products_id/' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = $froogle_product_info_path . '/products_id/' . $row['v_products_id'] . '/language/' . $lid; } } else { if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = $froogle_product_info_path . '?products_id=' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = $froogle_product_info_path . '?products_id=' . $row['v_products_id'] . '&language=' . $lid; } } $row['v_products_name_' . $lid] = $row2['products_name']; $row['v_products_description_' . $lid] = $row2['products_description']; $row['v_products_url_' . $lid] = $row2['products_url']; // froogle advanced format needs the quotes around the name and desc $row['v_froogle_products_name_' . $lid] = '"' . strip_tags(str_replace('"','""',$row2['products_name'])) . '"'; $row['v_froogle_products_description_' . $lid] = '"' . strip_tags(str_replace('"','""',$row2['products_description'])) . '"'; // support for Linda's Header Controller 2.0 here if(isset($filelayout['v_products_head_title_tag_' . $lid])){ $row['v_products_head_title_tag_' . $lid] = $row2['products_head_title_tag']; $row['v_products_head_desc_tag_' . $lid] = $row2['products_head_desc_tag']; $row['v_products_head_keywords_tag_' . $lid] = $row2['products_head_keywords_tag']; } // end support for Header Controller 2.0 } // for the categories, we need to keep looping until we find the root category // start with v_categories_id // Get the category description // set the appropriate variable name // if parent_id is not null, then follow it up. // we'll populate an aray first, then decide where it goes in the $thecategory_id = $row['v_categories_id']; $fullcategory = ''; // this will have the entire category stack for froogle for( $categorylevel=1; $categorylevel<$max_categories+1; $categorylevel++){ if ($thecategory_id){ $sql2 = "SELECT categories_name FROM ".TABLE_CATEGORIES_DESCRIPTION." WHERE categories_id = " . $thecategory_id . " AND language_id = " . $epdlanguage_id; $result2 = tep_db_query($sql2); $row2 = tep_db_fetch_array($result2); // only set it if we found something $temprow['v_categories_name_' . $categorylevel] = $row2['categories_name']; // now get the parent ID if there was one $sql3 = "SELECT parent_id FROM ".TABLE_CATEGORIES." WHERE categories_id = " . $thecategory_id; $result3 = tep_db_query($sql3); $row3 = tep_db_fetch_array($result3); $theparent_id = $row3['parent_id']; if ($theparent_id != ''){ // there was a parent ID, lets set thecategoryid to get the next level $thecategory_id = $theparent_id; } else { // we have found the top level category for this item, $thecategory_id = false; } //$fullcategory .= " > " . $row2['categories_name']; $fullcategory = $row2['categories_name'] . " > " . $fullcategory; } else { $temprow['v_categories_name_' . $categorylevel] = ''; } } // now trim off the last ">" from the category stack $row['v_category_fullpath'] = substr($fullcategory,0,strlen($fullcategory)-3); // temprow has the old style low to high level categories. $newlevel = 1; // let's turn them into high to low level categories for( $categorylevel=6; $categorylevel>0; $categorylevel--){ if ($temprow['v_categories_name_' . $categorylevel] != ''){ $row['v_categories_name_' . $newlevel++] = $temprow['v_categories_name_' . $categorylevel]; } } // if the filelayout says we need a manufacturers name, get it if (isset($filelayout['v_manufacturers_name'])){ if ($row['v_manufacturers_id'] != ''){ $sql2 = "SELECT manufacturers_name FROM ".TABLE_MANUFACTURERS." WHERE manufacturers_id = " . $row['v_manufacturers_id'] ; $result2 = tep_db_query($sql2); $row2 = tep_db_fetch_array($result2); $row['v_manufacturers_name'] = $row2['manufacturers_name']; } } // If you have other modules that need to be available, put them here // VJ product attribs begin if (isset($filelayout['v_attribute_options_id_1'])){ $languages = tep_get_languages(); $attribute_options_count = 1; foreach ($attribute_options_array as $attribute_options) { $row['v_attribute_options_id_' . $attribute_options_count] = $attribute_options['products_options_id']; for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $lid = $languages[$i]['id']; $attribute_options_languages_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options['products_options_id'] . "' and language_id = '" . (int)$lid . "'"; $attribute_options_languages_values = tep_db_query($attribute_options_languages_query); $attribute_options_languages = tep_db_fetch_array($attribute_options_languages_values); $row['v_attribute_options_name_' . $attribute_options_count . '_' . $lid] = $attribute_options_languages['products_options_name']; } $attribute_values_query = "select products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options['products_options_id'] . "' order by products_options_values_id"; $attribute_values_values = tep_db_query($attribute_values_query); $attribute_values_count = 1; while ($attribute_values = tep_db_fetch_array($attribute_values_values)) { $row['v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count] = $attribute_values['products_options_values_id']; $attribute_values_price_query = "select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$row['v_products_id'] . "' and options_id = '" . (int)$attribute_options['products_options_id'] . "' and options_values_id = '" . (int)$attribute_values['products_options_values_id'] . "'"; $attribute_values_price_values = tep_db_query($attribute_values_price_query); $attribute_values_price = tep_db_fetch_array($attribute_values_price_values); $row['v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count] = $attribute_values_price['price_prefix'] . $attribute_values_price['options_values_price']; for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $lid = $languages[$i]['id']; $attribute_values_languages_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$attribute_values['products_options_values_id'] . "' and language_id = '" . (int)$lid . "'"; $attribute_values_languages_values = tep_db_query($attribute_values_languages_query); $attribute_values_languages = tep_db_fetch_array($attribute_values_languages_values); $row['v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid] = $attribute_values_languages['products_options_values_name']; } $attribute_values_count++; } $attribute_options_count++; } } // VJ product attribs end // this is for the separate price per customer module if (isset($filelayout['v_customer_price_1'])){ $sql2 = "SELECT customers_group_price, customers_group_id FROM ".TABLE_PRODUCTS_GROUPS." WHERE products_id = " . $row['v_products_id'] . " ORDER BY customers_group_id" ; $result2 = tep_db_query($sql2); $ll = 1; $row2 = tep_db_fetch_array($result2); while( $row2 ){ $row['v_customer_group_id_' . $ll] = $row2['customers_group_id']; $row['v_customer_price_' . $ll] = $row2['customers_group_price']; $row2 = tep_db_fetch_array($result2); $ll++; } } if ($dltype == 'froogle'){ // For froogle, we check the specials prices for any applicable specials, and use that price // by grabbing the specials id descending, we always get the most recently added special price // I'm checking status because I think you can turn off specials $sql2 = "SELECT specials_new_products_price FROM ".TABLE_SPECIALS." WHERE products_id = " . $row['v_products_id'] . " and status = 1 and expires_date < CURRENT_TIMESTAMP ORDER BY specials_id DESC" ; $result2 = tep_db_query($sql2); $ll = 1; $row2 = tep_db_fetch_array($result2); if( $row2 ){ // reset the products price to our special price if there is one for this product $row['v_products_price'] = $row2['specials_new_products_price']; } } //elari - //We check the value of tax class and title instead of the id //Then we add the tax to price if $price_with_tax is set to 1 $row_tax_multiplier = tep_get_tax_class_rate($row['v_tax_class_id']); $row['v_tax_class_title'] = tep_get_tax_class_title($row['v_tax_class_id']); $row['v_products_price'] = round($row['v_products_price'] + ($price_with_tax * $row['v_products_price'] * $row_tax_multiplier / 100),2); // Now set the status to a word the user specd in the config vars if ( $row['v_status'] == '1' ){ $row['v_status'] = $active; } else { $row['v_status'] = $inactive; } // remove any bad things in the texts that could confuse EasyPopulate $therow = ''; foreach( $filelayout as $key => $value ){ //echo "The field was $key<br>"; $thetext = $row[$key]; // kill the carriage returns and tabs in the descriptions, they're killing me! $thetext = str_replace("\r",' ',$thetext); $thetext = str_replace("\n",' ',$thetext); $thetext = str_replace("\t",' ',$thetext); // and put the text into the output separated by tabs $therow .= $thetext . $separator; } // lop off the trailing tab, then append the end of row indicator $therow = substr($therow,0,strlen($therow)-1) . $endofrow; $filestring .= $therow; // grab the next row from the db $row = tep_db_fetch_array($result); } #$EXPORT_TIME=time(); $EXPORT_TIME = strftime('%Y%b%d-%H%I'); if ($dltype=="froogle"){ $EXPORT_TIME = "FroogleEP" . $EXPORT_TIME; } else { $EXPORT_TIME = "EP" . $EXPORT_TIME; } // now either stream it to them or put it in the temp directory if ($download == 'stream'){ //******************************* // STREAM FILE //******************************* header("Content-type: application/vnd.ms-excel"); header("Content-disposition: attachment; filename=$EXPORT_TIME.txt");// Changed if using SSL, helps prevent program delay/timeout (add to backup.php also) // header("Pragma: no-cache");if ($request_type== 'NONSSL'){header("Pragma: no-cache"); } else {header("Pragma: ");} header("Expires: 0"); echo $filestring; die(); } else { //******************************* // PUT FILE IN TEMP DIR //******************************* $tmpfname = DIR_FS_DOCUMENT_ROOT . $tempdir . "$EXPORT_TIME.txt"; //unlink($tmpfname); $fp = fopen( $tmpfname, "w+"); fwrite($fp, $filestring); fclose($fp); echo "You can get your file in the Tools/Files under " . $tempdir . "EP" . $EXPORT_TIME . ".txt"; die(); }} // *** END *** download section?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html <?php echo HTML_PARAMS; ?>><head><meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"><title><?php echo TITLE; ?></title><link rel="stylesheet" type="text/css" href="includes/stylesheet.css"></head><body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"><?php require(DIR_WS_INCLUDES . 'header.php'); ?> <table border="0" width="100%" cellspacing="2" cellpadding="2"><tr><td width="<?php echo BOX_WIDTH; ?>" valign="top" height="27"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"><?php require(DIR_WS_INCLUDES . 'column_left.php');?></table></td><td class="pageHeading" valign="top"><?phpecho "Easy Populate $curver - Default Language : " . $epdlanguage_name . '(' . $epdlanguage_id .')';?> <p class="smallText"> <?php if ($localfile or (is_uploaded_file($usrfl) && $split==0)) { //******************************* //******************************* // UPLOAD AND INSERT FILE //******************************* //******************************* if ($usrfl){ // move the file to where we can work with it $file = tep_get_uploaded_file('usrfl'); if (is_uploaded_file($file['tmp_name'])) { tep_copy_uploaded_file($file, DIR_FS_DOCUMENT_ROOT . $tempdir); } echo "<p class=smallText>"; echo "File uploaded. <br>"; echo "Temporary filename: " . $usrfl . "<br>"; echo "User filename: " . $usrfl_name . "<br>"; echo "Size: " . $usrfl_size . "<br>"; // get the entire file into an array $readed = file(DIR_FS_DOCUMENT_ROOT . $tempdir . $usrfl_name); } if ($localfile){ // move the file to where we can work with it $file = tep_get_uploaded_file('usrfl'); $attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " order by products_options_id"; $attribute_options_values = tep_db_query($attribute_options_query); $attribute_options_count = 1; //while ($attribute_options = tep_db_fetch_array($attribute_options_values)){ if (is_uploaded_file($file['tmp_name'])) { tep_copy_uploaded_file($file, DIR_FS_DOCUMENT_ROOT . $tempdir); } echo "<p class=smallText>"; echo "Filename: " . $localfile . "<br>"; // get the entire file into an array $readed = file(DIR_FS_DOCUMENT_ROOT . $tempdir . $localfile); } // now we string the entire thing together in case there were carriage returns in the data $newreaded = ""; foreach ($readed as $read){ $newreaded .= $read; } // now newreaded has the entire file together without the carriage returns. // if for some reason excel put qoutes around our EOREOR, remove them then split into rows $newreaded = str_replace('"EOREOR"', 'EOREOR', $newreaded); $readed = explode( $separator . 'EOREOR',$newreaded); // Now we'll populate the filelayout based on the header row. $theheaders_array = explode( $separator, $readed[0] ); // explode the first row, it will be our filelayout $lll = 0; $filelayout = array(); foreach( $theheaders_array as $header ){ $cleanheader = str_replace( '"', '', $header); // echo "Fileheader was $header<br><br><br>"; $filelayout[ $cleanheader ] = $lll++; // } unset($readed[0]); // we don't want to process the headers with the data // now we've got the array broken into parts by the expicit end-of-row marker.array_walk($readed, 'walk'); } if (is_uploaded_file($usrfl) && $split==1) { //******************************* &n Quote Link to comment Share on other sites More sharing options...
mark27uk3 Posted October 20, 2006 Share Posted October 20, 2006 (edited) Hi Guys, I was originally going to post about an error when importing my ep file, but I managed to see the error (mine as always) when I pasted the code into this reply :D So now my question is of a completely different nature. :thumbsup: Is it possible for easy populate to to recognise new products that are in the ep file and position them in automatically in the top level of admin categories/products. ie: I have say 5 categories Category 1 Category 2 Category 3 Category 4 Category 5 As I will update about 1500 products daily and existing products will be in the categories listed above I would like it if any new products appeared like this to make it easier to see new products that have been added. Category 1 Category 2 Category 3 Category 4 Category 5 New product 1 New product 2 New product 3 Does this work out of the box or is it something that would need adding/changing in the easypopulate.php file??? Your help and ideas would be appreciated. Thanks Mark Edited October 20, 2006 by mark27uk3 Quote Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
mark27uk3 Posted October 20, 2006 Share Posted October 20, 2006 My spreadsheet contains the following fields: v_products_model v_products_name_1 v_products_quantity v_status EOREOR Now presumbaly this should only update the products model, name, qty and status however on a test run it has updated existing products that contained prices, images etc and removed them, why?????? Surely if only those fields are specified in the feed then no other fields should be touched :blink: Thanks Mark Quote Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
steveorg Posted October 20, 2006 Share Posted October 20, 2006 I'm just starting out with OSC and it seems that Easy Populate will be an essential component of my installation. Instead of downloading and then uploading, I'll be using a frequently updated FTP feed from another system, which will then be inserted into the database. I'd appreciate input on these questions: Would it be possible to do the insertion through a chron job? File splits would also be required. I'd probably use a script that first checks to see if the feed has been updated since the last insertion. In light of this info, which OSC and Easy Populate versions woul be best to start with? I'll eventually want to add a multiple images contribution (suggestions welcome). Fantastico installed 2.2 MS2 (051113). Thanks in advance for all feedback. I forgot to mention that I'll also be using an SEO contrib. Okay,I slogged through the PHP to try to identify the code that's needed. It seems to me that I'm interested in all of the code starting at line 700. Here's the first few lines: if (is_uploaded_file($usrfl) && $split==1) { //******************************* //******************************* // UPLOAD AND SPLIT FILE //******************************* //******************************* // move the file to where we can work with it $file = tep_get_uploaded_file('usrfl'); //echo "Trying to move file..."; if (is_uploaded_file($file['tmp_name'])) { tep_copy_uploaded_file($file, DIR_FS_DOCUMENT_ROOT . $tempdir); } I don't know PHP, so this is 80% gibberish to me. It seems that I assign the data file name to a variable. Also, I may want to redirect screen output to a log file. Could anyone tell me if I'm on the right track? What are my other landmines? Thanks, Steve Quote Link to comment Share on other sites More sharing options...
SteveoSupremo Posted October 20, 2006 Share Posted October 20, 2006 so that I wont get flamed This might have been asked and answered a million times before but i'm not reading 300 pages and or not useing the right search terms. anyway how can i use EP to upload the Products Attributes as well as catalog info? anyhow if anyone could direct me that would be great or point me in a direction that I can find the answer that I am looking for. thanks Steve Quote Link to comment Share on other sites More sharing options...
Druid6900 Posted October 21, 2006 Share Posted October 21, 2006 Perhaps, because I'm not a programmer, I don't really understand the situation here, and there may be a hundred reasons why this couldn't be done, but, instead of having to re-arrange the array to match your product info or having to install several contributions that you might never use, shouldn't the first option for this product be "Analyze Product Information"? From looking at my sql database, it seems that everything that would be needed starts with the word "product_" and it may just be a matter of extracting the information and feeding it to the program so it KNOWS what data you have and need to have pulled out to remotely edit the data or to make your template for filling in and uploading. I'm sure some rules would need to be applied, but, isn't that what computers do for everything? Just a thought I had that would turn a damn useful program into something that is of universal use no matter what contribs you might have installed rather that having to try and cobble together stuff for various combinations of contributions. Seems a much more elegant solution, if it's possible. Quote No Good Deed EVER Goes Unpunished Link to comment Share on other sites More sharing options...
Guest Posted October 21, 2006 Share Posted October 21, 2006 so that I wont get flamed This might have been asked and answered a million times before but i'm not reading 300 pages and or not useing the right search terms. anyway how can i use EP to upload the Products Attributes as well as catalog info? anyhow if anyone could direct me that would be great or point me in a direction that I can find the answer that I am looking for. thanks Steve open your easypopulate file, depending on the version you have you will see in the configuration section a value to turn the attribute downoad on. in a version 2.8 and 2.9, it looks like: // change this if you want to download selected product options // this might be handy, if you have a lot of product options, and your output file exceeds 256 columns (which is the max. limit MS Excel is able to handle) global $attribute_options_select; //$attribute_options_select = array('Size', 'Model'); // uncomment and fill with product options name you wish to download // comment this line, if you wish to download all product options // VJ product attributes end in a version 3.0 it looks like: // VJ product attributes begin // **** Product Attributes **** // change this to false, if do not want to download product attributes global $products_with_attributes; $products_with_attributes = false; // change this to true, if you use QTYpro and want to set attributes stock with EP. global $products_attributes_stock; $products_attributes_stock = false; // change this if you want to download selected product options // this might be handy, if you have a lot of product options, and your output file exceeds 256 columns (which is the max. limit MS Excel is able to handle) global $attribute_options_select; // $attribute_options_select = array('Size', 'Model'); // uncomment and fill with product options name you wish to download // comment this line, if you wish to download all product options // VJ product attributes end Quote Link to comment Share on other sites More sharing options...
MOBASS Posted October 22, 2006 Share Posted October 22, 2006 Hi Guys I have just installed easypopulater 2.8 on a fresh 2.2 shop When I go to import catalog it changes all of my prices to '0' and I cant change them. No products_model field in record. This line was not imported is displayed at the bottom of the page. Which is strange because I have products_models??? The only other thing I have running is STSv4.2 Any help would be great Quote Link to comment Share on other sites More sharing options...
SteveoSupremo Posted October 23, 2006 Share Posted October 23, 2006 open your easypopulate file, depending on the version you have you will see in the configuration section a value to turn the attribute downoad on. in a version 2.8 and 2.9, it looks like: // change this if you want to download selected product options // this might be handy, if you have a lot of product options, and your output file exceeds 256 columns (which is the max. limit MS Excel is able to handle) global $attribute_options_select; //$attribute_options_select = array('Size', 'Model'); // uncomment and fill with product options name you wish to download // comment this line, if you wish to download all product options // VJ product attributes end in a version 3.0 it looks like: // VJ product attributes begin // **** Product Attributes **** // change this to false, if do not want to download product attributes global $products_with_attributes; $products_with_attributes = false; // change this to true, if you use QTYpro and want to set attributes stock with EP. global $products_attributes_stock; $products_attributes_stock = false; // change this if you want to download selected product options // this might be handy, if you have a lot of product options, and your output file exceeds 256 columns (which is the max. limit MS Excel is able to handle) global $attribute_options_select; // $attribute_options_select = array('Size', 'Model'); // uncomment and fill with product options name you wish to download // comment this line, if you wish to download all product options // VJ product attributes end ok so I'm not compleetly tracking here. I have 2.79 version so // comment this line, if you wish to download all product options this line says to me that if I want to download all product atributes I would leave it commented. otherwise but ether way I have tried both ways with the same results. maby I didnt fill it with the correct options? Are the options supposed to be the options used in the sql? thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted October 23, 2006 Share Posted October 23, 2006 ok so I'm not compleetly tracking here. I have 2.79 version so // comment this line, if you wish to download all product options this line says to me that if I want to download all product atributes I would leave it commented. otherwise but ether way I have tried both ways with the same results. maby I didnt fill it with the correct options? Are the options supposed to be the options used in the sql? thanks yes, these are the options used in mysql, that you defined in your "product attributes" section in the admin side Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.