hongbiaoke Posted September 5, 2006 Posted September 5, 2006 Thanks again man, I got another problem... sorry When I downloaded my file, it does not show the V_categories_name_1.... Here's my code: <?php // Current EP Version$curver = '2.90'; /* $Id: easypopulate.php,v 2.90 2006/04/14 Davide Duca @ www.eurobigstore.com */ require('includes/application_top.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'); // WARNING: I'm not sure about this line - maybe this is why 'Upload EP File' doesn't work//link_post_variable('usrfl');// <<< END REGISTER_GLOABLS //**** 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.iniif (EP_SET_TIME_LIMIT == 'true') {set_time_limit(330);} //**** Size of products_model in products table ****// This is automatically set to the maximum defined size of products_model in the products table. We check to make sure all models are no longer than this value.global $modelsize;$table_definition_query=tep_db_query("describe " . TABLE_PRODUCTS);while ($product_definition=tep_db_fetch_array($table_definition_query)){ if ($product_definition[Field]=='products_model'){ if (substr($product_definition[Type],0,7)=='varchar'){ $modelsize=substr($product_definition[Type],8,strlen($product_definition[Type])); $modelsize=substr($modelsize,0,(strlen($modelsize)-1)); } }}//**** Price includes tax? ****global $price_with_tax;$price_with_tax = (EP_PRICE_INC_TAX =='true' ? 1 : 0); define(EP_TEMP_DIR,'/temp/');define(EP_DELIMITER,'\t');global $separator;if (EP_DELIMITER == '\t') { $separator = "\t"; // oscommerce stores escaped delimeters in mySQL as a string and not an actual tab.} else {$separator = EP_DELIMITER;} // 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 //*******************************// 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 (DIR_WS_FUNCTIONS . 'easypopulate_functions.php'); }//******************************* // VJ product attributes beginglobal $attribute_options_array;$attribute_options_array = array(); if (EP_PROD_ATTR == '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_dim_type', #'v_products_length', #'v_products_width', #'v_products_height', #'v_products_mimage', #'v_products_bimage', #'v_products_subimage1', #'v_products_bsubimage1', #'v_products_subimage2', #'v_products_bsubimage2', #'v_products_subimage3', 'v_categories_id', 'v_specials_price', 'v_specials_date_avail', 'v_specials_expires_date', 'v_products_price', 'products_price1', 'products_price2', 'products_price3', 'products_price4', 'products_price5', 'products_price6', 'products_price7', 'products_price8', 'products_price1_qty', 'products_price2_qty', 'products_price3_qty', 'products_price4_qty', 'products_price5_qty', 'products_price6_qty', 'products_price7_qty', 'products_price8_qty', 'products_qty_blocks', 'v_products_quantity', 'v_products_weight', '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//******************************* //*******************************// inactivated ALL PRODUCTS' STATUS// added function for those who dont have discontinue product list from supplier// by Tommy vo - [email protected]//*******************************if ( $inactivated == 1){ $result = ep_query('UPDATE products SET products_status=0;');} //*******************************// DOWNLOAD FILE//*******************************if ( $download == 'stream' or $download == 'tempfile' ){ $filestring = ""; // this holds the csv file we want to download $result = tep_db_query($filelayout_sql); $row = tep_db_fetch_array($result); //SETUP ATTRIBUTES ARRAY if (EP_USE_AO == 'true') { $attribute_values_sql = "select products_id, options_id, options_values_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " ORDER BY products_attributes_id"; $attributes_query= tep_db_query($attribute_values_sql); $attributes_array=array(); while($row_attributes= tep_db_fetch_array($attributes_query)){ $attributes_array[$row_attributes["products_id"]."_".$row_attributes["options_id"]."_".$row_attributes["options_values_id"]]=array("products_id"=>$row_attributes["products_id"], "options_id"=>$row_attributes["options_id"], "options_values_id"=>$row_attributes["options_values_id"], "options_values_price"=>$row_attributes["options_values_price"], "price_prefix"=>$row_attributes["price_prefix"] ); } $attributes_values_sql= "select products_options_values_id, products_options_values_name, language_id from " . TABLE_PRODUCTS_OPTIONS_VALUES; $attributes_values_query = tep_db_query($attributes_values_sql); $attributes_values_array=array(); while($row_attributes_values= tep_db_fetch_array($attributes_values_query)){ $attributes_values_array[$row_attributes_values["products_options_values_id"]."_".$row_attributes_values["language_id"]]=array("products_options_values_id"=>$row_attributes_values["products_options_values_id"],"products_options_values_name"=>$row_attributes_values["products_options_values_name"] ); } $attribute_options_lang_sql= "select products_options_id, products_options_name, language_id from " . TABLE_PRODUCTS_OPTIONS; $attribute_options_lang_query = tep_db_query($attribute_options_lang_sql); $attribute_options_lang_array=array(); while($row_attributes_lang= tep_db_fetch_array($attribute_options_lang_query)){ $attribute_options_lang_array[$row_attributes_lang["products_options_id"]."_".$row_attributes_lang["language_id"]]=array("products_options_id"=>$row_attributes_lang["products_options_id"],"products_options_name"=>$row_attributes_lang["products_options_name"] ); } } else { }// END SETUP ATTRIBUTES ARRAY // 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'] = EP_FROOGLE_IMG . $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 (EP_SEF_URLS == 'true'){ // if only one language if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '/products_id/' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '/products_id/' . $row['v_products_id'] . '/language/' . $lid; } } else { if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '?products_id=' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '?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<EP_MAX_CAT+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']; if (EP_USE_AO == 'true') { $attribute_options_languages=$attribute_options_lang_array[(int)$attribute_options['products_options_id']."_".(int)$lid]; } else { $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']; if (EP_USE_AO == 'true') { $attribute_values_price=$attributes_array[(int)$row['v_products_id']."_".(int)$attribute_options['products_options_id']."_".(int)$attribute_values['products_options_values_id']]; } else { $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']; //// attributes stock add start if (EP_CONTRIB_QTPRO == 'true') { $stock_attributes = $attribute_options['products_options_id'].'-'.$attribute_values['products_options_values_id']; $stock_quantity_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$row['v_products_id'] . "' and products_stock_attributes = '" . $stock_attributes . "'"); $stock_quantity = tep_db_fetch_array($stock_quantity_query); $row['v_attribute_values_stock_' . $attribute_options_count . '_' . $attribute_values_count] = $stock_quantity['products_stock_quantity']; } //// attributes stock add end for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $lid = $languages[$i]['id']; if (EP_USE_AO == 'true') { $attribute_values_languages=$attributes_values_array[(int)$attribute_values['products_options_values_id']."_".(int)$lid]; } else { $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//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // this is for the separate price per customer module if (EP_CONTRIB_SPPC == 'true Quote
everyth5 Posted September 6, 2006 Posted September 6, 2006 Ok, so I finally figured out what was wrong with CHMODing the Temp file and have it set to 777. Now I tried again to download editable txt file and Froogle tab delimited txt file and installing my file from my live site to the test site online but cannot. It seems to not do anything! Can someone help me on this one??? Thanks Kelvin Quote
everyth5 Posted September 6, 2006 Posted September 6, 2006 Ok, so I finally figured out what was wrong with CHMODing the Temp file and have it set to 777. Now I tried again to download editable txt file and Froogle tab delimited txt file and installing my file from my live site to the test site online but cannot. It seems to not do anything! Can someone help me on this one??? Thanks Kelvin Please someone, anyone......... I need to fix this before I can go further with testing. Quote
hongbiaoke Posted September 6, 2006 Posted September 6, 2006 Man, oh man...now when i upload, it does not upload the updated file, it says nothing on the bottom of the page in the admin's page... has anyone had this problem? <?php // Current EP Version$curver = '2.90'; /* $Id: easypopulate.php,v 2.90 2006/04/14 Davide Duca @ www.eurobigstore.com */ require('includes/application_top.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'); // WARNING: I'm not sure about this line - maybe this is why 'Upload EP File' doesn't work//link_post_variable('usrfl');// <<< END REGISTER_GLOABLS //**** 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.iniif (EP_SET_TIME_LIMIT == 'true') {set_time_limit(330);} //**** Size of products_model in products table ****// This is automatically set to the maximum defined size of products_model in the products table. We check to make sure all models are no longer than this value.global $modelsize;$table_definition_query=tep_db_query("describe " . TABLE_PRODUCTS);while ($product_definition=tep_db_fetch_array($table_definition_query)){ if ($product_definition[Field]=='products_model'){ if (substr($product_definition[Type],0,7)=='varchar'){ $modelsize=substr($product_definition[Type],8,strlen($product_definition[Type])); $modelsize=substr($modelsize,0,(strlen($modelsize)-1)); } }}//**** Price includes tax? ****global $price_with_tax;$price_with_tax = (EP_PRICE_INC_TAX =='true' ? 1 : 0); define(EP_TEMP_DIR,'/temp/');define(EP_DELIMITER,'\t');global $separator;if (EP_DELIMITER == '\t') { $separator = "\t"; // oscommerce stores escaped delimeters in mySQL as a string and not an actual tab.} else {$separator = EP_DELIMITER;} // 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 //*******************************// 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_fileif (!function_exists(tep_get_uploaded_file)){ include (DIR_WS_FUNCTIONS . 'easypopulate_functions.php');}//******************************* // VJ product attributes beginglobal $attribute_options_array;$attribute_options_array = array(); if (EP_PROD_ATTR == '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_dim_type', #'v_products_length', #'v_products_width', #'v_products_height', #'v_products_mimage', #'v_products_bimage', #'v_products_subimage1', #'v_products_bsubimage1', #'v_products_subimage2', #'v_products_bsubimage2', #'v_products_subimage3', 'v_categories_id', 'v_specials_price', 'v_specials_date_avail', 'v_specials_expires_date', 'v_products_price', 'products_price1', 'products_price2', 'products_price3', 'products_price4', 'products_price5', 'products_price6', 'products_price7', 'products_price8', 'products_price1_qty', 'products_price2_qty', 'products_price3_qty', 'products_price4_qty', 'products_price5_qty', 'products_price6_qty', 'products_price7_qty', 'products_price8_qty', 'products_qty_blocks', 'v_products_quantity', 'v_products_weight', '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//******************************* //*******************************// inactivated ALL PRODUCTS' STATUS// added function for those who dont have discontinue product list from supplier// by Tommy vo - [email protected]//*******************************if ( $inactivated == 1){ $result = ep_query('UPDATE products SET products_status=0;');} //*******************************// DOWNLOAD FILE//*******************************if ( $download == 'stream' or $download == 'tempfile' ){ $filestring = ""; // this holds the csv file we want to download $result = tep_db_query($filelayout_sql); $row = tep_db_fetch_array($result); //SETUP ATTRIBUTES ARRAY if (EP_USE_AO == 'true') { $attribute_values_sql = "select products_id, options_id, options_values_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " ORDER BY products_attributes_id"; $attributes_query= tep_db_query($attribute_values_sql); $attributes_array=array(); while($row_attributes= tep_db_fetch_array($attributes_query)){ $attributes_array[$row_attributes["products_id"]."_".$row_attributes["options_id"]."_".$row_attributes["options_values_id"]]=array("products_id"=>$row_attributes["products_id"], "options_id"=>$row_attributes["options_id"], "options_values_id"=>$row_attributes["options_values_id"], "options_values_price"=>$row_attributes["options_values_price"], "price_prefix"=>$row_attributes["price_prefix"] ); } $attributes_values_sql= "select products_options_values_id, products_options_values_name, language_id from " . TABLE_PRODUCTS_OPTIONS_VALUES; $attributes_values_query = tep_db_query($attributes_values_sql); $attributes_values_array=array(); while($row_attributes_values= tep_db_fetch_array($attributes_values_query)){ $attributes_values_array[$row_attributes_values["products_options_values_id"]."_".$row_attributes_values["language_id"]]=array("products_options_values_id"=>$row_attributes_values["products_options_values_id"],"products_options_values_name"=>$row_attributes_values["products_options_values_name"] ); } $attribute_options_lang_sql= "select products_options_id, products_options_name, language_id from " . TABLE_PRODUCTS_OPTIONS; $attribute_options_lang_query = tep_db_query($attribute_options_lang_sql); $attribute_options_lang_array=array(); while($row_attributes_lang= tep_db_fetch_array($attribute_options_lang_query)){ $attribute_options_lang_array[$row_attributes_lang["products_options_id"]."_".$row_attributes_lang["language_id"]]=array("products_options_id"=>$row_attributes_lang["products_options_id"],"products_options_name"=>$row_attributes_lang["products_options_name"] ); } } else { }// END SETUP ATTRIBUTES ARRAY // 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'] = EP_FROOGLE_IMG . $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 (EP_SEF_URLS == 'true'){ // if only one language if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '/products_id/' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '/products_id/' . $row['v_products_id'] . '/language/' . $lid; } } else { if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '?products_id=' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '?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<EP_MAX_CAT+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']; if (EP_USE_AO == 'true') { $attribute_options_languages=$attribute_options_lang_array[(int)$attribute_options['products_options_id']."_".(int)$lid]; } else { $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']; if (EP_USE_AO == 'true') { $attribute_values_price=$attributes_array[(int)$row['v_products_id']."_".(int)$attribute_options['products_options_id']."_".(int)$attribute_values['products_options_values_id']]; } else { $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']; //// attributes stock add start if (EP_CONTRIB_QTPRO == 'true') { $stock_attributes = $attribute_options['products_options_id'].'-'.$attribute_values['products_options_values_id']; $stock_quantity_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$row['v_products_id'] . "' and products_stock_attributes = '" . $stock_attributes . "'"); $stock_quantity = tep_db_fetch_array($stock_quantity_query); $row['v_attribute_values_stock_' . $attribute_options_count . '_' . $attribute_values_count] = $stock_quantity['products_stock_quantity']; } //// attributes stock add end for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $lid = $languages[$i]['id']; if (EP_USE_AO == 'true') { $attribute_values_languages=$attributes_values_array[(int)$attribute_values['products_options_values_id']."_".(int)$lid]; } else { $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// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // this is for the separate price per customer module if (EP_CONTRIB_SPPC == 'true Quote
hongbiaoke Posted September 6, 2006 Posted September 6, 2006 Man, oh man...now when i upload, it does not upload the updated file, it says nothing on the bottom of the page in the admin's page... has anyone had this problem? <?php // Current EP Version$curver = '2.90'; /* $Id: easypopulate.php,v 2.90 2006/04/14 Davide Duca @ www.eurobigstore.com */ require('includes/application_top.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'); // WARNING: I'm not sure about this line - maybe this is why 'Upload EP File' doesn't work//link_post_variable('usrfl');// <<< END REGISTER_GLOABLS //**** 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.iniif (EP_SET_TIME_LIMIT == 'true') {set_time_limit(330);} //**** Size of products_model in products table ****// This is automatically set to the maximum defined size of products_model in the products table. We check to make sure all models are no longer than this value.global $modelsize;$table_definition_query=tep_db_query("describe " . TABLE_PRODUCTS);while ($product_definition=tep_db_fetch_array($table_definition_query)){ if ($product_definition[Field]=='products_model'){ if (substr($product_definition[Type],0,7)=='varchar'){ $modelsize=substr($product_definition[Type],8,strlen($product_definition[Type])); $modelsize=substr($modelsize,0,(strlen($modelsize)-1)); } }}//**** Price includes tax? ****global $price_with_tax;$price_with_tax = (EP_PRICE_INC_TAX =='true' ? 1 : 0); define(EP_TEMP_DIR,'/temp/');define(EP_DELIMITER,'\t');global $separator;if (EP_DELIMITER == '\t') { $separator = "\t"; // oscommerce stores escaped delimeters in mySQL as a string and not an actual tab.} else {$separator = EP_DELIMITER;} // 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 //*******************************// 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_fileif (!function_exists(tep_get_uploaded_file)){ include (DIR_WS_FUNCTIONS . 'easypopulate_functions.php');}//******************************* // VJ product attributes beginglobal $attribute_options_array;$attribute_options_array = array(); if (EP_PROD_ATTR == '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_dim_type', #'v_products_length', #'v_products_width', #'v_products_height', #'v_products_mimage', #'v_products_bimage', #'v_products_subimage1', #'v_products_bsubimage1', #'v_products_subimage2', #'v_products_bsubimage2', #'v_products_subimage3', 'v_categories_id', 'v_specials_price', 'v_specials_date_avail', 'v_specials_expires_date', 'v_products_price', 'products_price1', 'products_price2', 'products_price3', 'products_price4', 'products_price5', 'products_price6', 'products_price7', 'products_price8', 'products_price1_qty', 'products_price2_qty', 'products_price3_qty', 'products_price4_qty', 'products_price5_qty', 'products_price6_qty', 'products_price7_qty', 'products_price8_qty', 'products_qty_blocks', 'v_products_quantity', 'v_products_weight', '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//******************************* //*******************************// inactivated ALL PRODUCTS' STATUS// added function for those who dont have discontinue product list from supplier// by Tommy vo - [email protected]//*******************************if ( $inactivated == 1){ $result = ep_query('UPDATE products SET products_status=0;');} //*******************************// DOWNLOAD FILE//*******************************if ( $download == 'stream' or $download == 'tempfile' ){ $filestring = ""; // this holds the csv file we want to download $result = tep_db_query($filelayout_sql); $row = tep_db_fetch_array($result); //SETUP ATTRIBUTES ARRAY if (EP_USE_AO == 'true') { $attribute_values_sql = "select products_id, options_id, options_values_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " ORDER BY products_attributes_id"; $attributes_query= tep_db_query($attribute_values_sql); $attributes_array=array(); while($row_attributes= tep_db_fetch_array($attributes_query)){ $attributes_array[$row_attributes["products_id"]."_".$row_attributes["options_id"]."_".$row_attributes["options_values_id"]]=array("products_id"=>$row_attributes["products_id"], "options_id"=>$row_attributes["options_id"], "options_values_id"=>$row_attributes["options_values_id"], "options_values_price"=>$row_attributes["options_values_price"], "price_prefix"=>$row_attributes["price_prefix"] ); } $attributes_values_sql= "select products_options_values_id, products_options_values_name, language_id from " . TABLE_PRODUCTS_OPTIONS_VALUES; $attributes_values_query = tep_db_query($attributes_values_sql); $attributes_values_array=array(); while($row_attributes_values= tep_db_fetch_array($attributes_values_query)){ $attributes_values_array[$row_attributes_values["products_options_values_id"]."_".$row_attributes_values["language_id"]]=array("products_options_values_id"=>$row_attributes_values["products_options_values_id"],"products_options_values_name"=>$row_attributes_values["products_options_values_name"] ); } $attribute_options_lang_sql= "select products_options_id, products_options_name, language_id from " . TABLE_PRODUCTS_OPTIONS; $attribute_options_lang_query = tep_db_query($attribute_options_lang_sql); $attribute_options_lang_array=array(); while($row_attributes_lang= tep_db_fetch_array($attribute_options_lang_query)){ $attribute_options_lang_array[$row_attributes_lang["products_options_id"]."_".$row_attributes_lang["language_id"]]=array("products_options_id"=>$row_attributes_lang["products_options_id"],"products_options_name"=>$row_attributes_lang["products_options_name"] ); } } else { }// END SETUP ATTRIBUTES ARRAY // 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'] = EP_FROOGLE_IMG . $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 (EP_SEF_URLS == 'true'){ // if only one language if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '/products_id/' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '/products_id/' . $row['v_products_id'] . '/language/' . $lid; } } else { if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '?products_id=' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '?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<EP_MAX_CAT+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']; if (EP_USE_AO == 'true') { $attribute_options_languages=$attribute_options_lang_array[(int)$attribute_options['products_options_id']."_".(int)$lid]; } else { $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']; if (EP_USE_AO == 'true') { $attribute_values_price=$attributes_array[(int)$row['v_products_id']."_".(int)$attribute_options['products_options_id']."_".(int)$attribute_values['products_options_values_id']]; } else { $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']; //// attributes stock add start if (EP_CONTRIB_QTPRO == 'true') { $stock_attributes = $attribute_options['products_options_id'].'-'.$attribute_values['products_options_values_id']; $stock_quantity_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$row['v_products_id'] . "' and products_stock_attributes = '" . $stock_attributes . "'"); $stock_quantity = tep_db_fetch_array($stock_quantity_query); $row['v_attribute_values_stock_' . $attribute_options_count . '_' . $attribute_values_count] = $stock_quantity['products_stock_quantity']; } //// attributes stock add end for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $lid = $languages[$i]['id']; if (EP_USE_AO == 'true') { $attribute_values_languages=$attributes_values_array[(int)$attribute_values['products_options_values_id']."_".(int)$lid]; } else { $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// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // this is for the separate price per customer module if (EP_CONTRIB_SPPC == 'true Quote
Guest Posted September 6, 2006 Posted September 6, 2006 I am having a problem with my Easy Populate. I can export my products just fine, but when I try to upload a sheet nothing happens. I actually get the following message: File uploaded.Temporary filename: /tmp/phpgt0of5 User filename: Import1-090506.txt SIZE_EP35634 It is on a test store but I do not know what the problem is. If someone is willing to look at it I can show you my store. Thank you in advance!! Rob Quote
everyth5 Posted September 7, 2006 Posted September 7, 2006 (edited) Please someone, anyone......... I need to fix this before I can go further with testing. Ok, so I finally figured out what was wrong with CHMODing the Temp file and have it set to 777. Now I tried again to download editable txt file and Froogle tab delimited txt file and installing my file from my live site to the test site online but cannot. It seems to not do anything! Can someone help me on this one??? Sorry bump; Edited September 7, 2006 by everyth5 Quote
hongbiaoke Posted September 7, 2006 Posted September 7, 2006 I've got another problem now... I can't upload, when I do it does not update the database, and there is no errors, it's like it just refreshed itself. I tried everything in the manual but nothing... Quote
Guest Posted September 7, 2006 Posted September 7, 2006 (edited) I've got another problem now... I can't upload, when I do it does not update the database, and there is no errors, it's like it just refreshed itself. I tried everything in the manual but nothing... This is the same problem I am having. Edited September 7, 2006 by offnetrob Quote
knacknuss Posted September 7, 2006 Posted September 7, 2006 Hi all I have a similar problem. I can upload the file and insert it inserts just one new row the database. Then it takes a while and I see the following on my screen: File uploaded. Temporary filename: /tmp/phpmvPQG9 User filename: EP2006Sep06-1909.txt Size: 95904 | 79318R | half_cube2 | Eagle Cree | Packtasche | | 15,00 | 0.00 | | 04.09.2006 | 200 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Zur Orient | | | | | 79339 | Reiseschir | Eagel Cree | Stabil und | | 39,00 | 0.00 | | 04.09.2006 | 200 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Zur Orient | | | | | 79452 | Geldgurt_G | Eagle Cree | 2 grosse H | | 20,00 | 0.00 | | 04.09.2006 | 200 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Zur Orient | | | | | 7781 | | Lekisport | Schutzkapp | | 9,80 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7465 | rettungsde | Rettungsde | Superleich | | 7,80 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7428 | seattle_so | Regenhut O | Regenhut O | | 99,00 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7435 | rockymount | Rocky Moun | Rocky Moun | | 39,00 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7400 | ponchoallg | W?fo Model | W?FO-Ponch | | 119,00 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7409 | PonchoTaue | W?fo Model | W?FO-Ponch | | 164,90 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7410 | Wdfo-Regen | W?fo-Regen | W?FO-Ponch | | 89,00 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4256 | RegenhoseW | Regen-?ber | Regen-?ber | | 199,00 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 79601 | Stretch-Gu | G?rtel str | G?rtel str | | 21,00 | | | 7711 | Recta_Komp | Recta-Komp | Sehr genau | | 49,00 | | | 7713 | Recta_Komp | Recta-Komp | Wie DP2, d | | 98,00 | | | 7727 | Detail-Lup | Mini-Fernr | Als kleins | | 95,00 | | | 7718 | falkenhors | Fernglas F | Ferngl?ser | | 329,00 | | | 7719 | falkenhors | Fernglas F | Ferngl?ser | | 342,00 | | | 7731 | Wandergril | Wandergril | Ideal zum | | 45,00 | | | 7733 | rucksackgr | Rucksack-G | Der Grillr | | 49,80 | | | 6137 | solardynam | Solar-Dyna | Solar-Dyna | | 48,00 | | | 6210 | ECOCharger | ECO-Charge | ECO-Charge | | 109,50 | | | 7279 | Travelshee | COCOON Tra | Travelshee | | 219,00 | | | 7377M | Huettenfin | LITHA-H?tt | Aus 2/3 Na | | 49,00 | | | 71475 | Stirnlampe | Stirnlampe | Stirnlampe | | 42,00 | | | 78290 | KatadynCan | Katadyn Bo | Katadyn Bo | | 95,00 | | | 78291 | | Ersatzfilt | Ersatzfilt | | 79,00 | | | 79329R | 40375_Half | Eagle Cree | Pack-it Ha | | 15,00 | | | 79316 | 40138_Quar | Eagle Cree | Pack-it Qu | | 12,50 | | | 79330 | Koala_schw | Eagel Cree | Reise-N?ce | | 28,00 | | | 79459 | Brustbeute | Eagle Cree | Die Sicher | | 14,00 | | | 7272 | seidenatur | COCOON Tra | Seide natu | | 119,00 | | | 7251 | baumwolleu | COCOON Rei | Leichte un | | 27,00 | | | 7303 | pyjama.jpg | Reise-Pyja | Reise-Pyja | | 119,90 | | | 7278 | ripstops.j | COCOON Tra | Ripstop-Se | | 139,00 | | | 7366H | Air-Revol_ | Meindl Air | Der Hochge | | 398,00 | | | 73808 | Revolution | Meindl ''R | Meindl ''R | | 29,90 | | | 73816 | AirRevoSoc | Meindl ''R | Meindl ''R | | 39,90 | | | 1 | 5025T-Saan | Landeskart | Bitte im B | | 13,50 | | | 7277 | cocoon_Ult | COCOON Tra | Seide ''Ul | | 129,00 | | | 7233 | LIGHTEC-70 | Ferrino-Sc | Mit Kunstf | | 129,00 | | | 77933 | SIGG_Sport | Sigg Sport | Sigg Sport | | 25,00 | | | 77091 | GPSKartenS | GPS Karten | GPS Karten | | 248,00 | | | .................................and so on .......4424 | DamenhoseM | Sch?ffel D | Damenhose | | 69,50 !New Product! If I go to the database always only the first row (product) get?s imported... What am I doing wrong? Quote
Guest Posted September 7, 2006 Posted September 7, 2006 Double check that you don't forget the the EOREOR values (that may sound stupid, but I did that several times before realizing I forgot to drag my cells down in excel to dupliacte these, too focused on the precious data Quote
knacknuss Posted September 7, 2006 Posted September 7, 2006 Double check that you don't forget the the EOREOR values (that may sound stupid, but I did that several times before realizing I forgot to drag my cells down in excel to dupliacte these, too focused on the precious data Thanks a lot you made my day :) Now it works :) Quote
Guest Posted September 7, 2006 Posted September 7, 2006 Thanks a lot you made my day :)Now it works :) I hope I made the other guy's day too. That was stupid, but I have been there just yesterday, pulling my hair, digging in EP's code, before realizing I was tired ;-) Quote
Guest Posted September 7, 2006 Posted September 7, 2006 (edited) I have that row on my .txt file but it still does not work. All I get is this: File uploaded.Temporary filename: /tmp/phpgahT7f User filename: Import1-090506.txt SIZE_EP34567 Anyone???? My store is not live right now, if someone can help I can give them a sample of the file I am trying to upload and they can try and see what happens. -Rob Edited September 7, 2006 by offnetrob Quote
Guest Posted September 7, 2006 Posted September 7, 2006 I have that row on my .txt file but it still does not work. All I get is this:Anyone???? My store is not live right now, if someone can help I can give them a sample of the file I am trying to upload and they can try and see what happens. -Rob I just figured it out. It had soemthing to do with a folder taht got moved!!!!!!!!!!!!! Quote
everyth5 Posted September 7, 2006 Posted September 7, 2006 I am trying to get EP working on my subdirectory site online and on my local site but have run into the same problem with both. I tried to download a Froogle tab-delimited txt file and a full txt file for editing as well as uploading a txt file from my live site and nothing happens. It seems like it just refreshes the window. There are no error messages or anything. I have the Temp file in the correct place and with the correct permissions. Hope someone can help me with this. Kelvin Quote
theornamentqueen Posted September 9, 2006 Posted September 9, 2006 Hello, I have installed EP 2.76 and it is great! I have got it working to upload lots of products... I have tried to go through the other versions of EP (and this forum) to see if there is a version that will help me. I need to be able to have products be in multiple "top level" categories. I already have them uploading into a top level category and sub categories. Anyone able to give me some advice or give me some direction on how to modify the files to achieve this goal? Thanks! Linda Wilson Quote
Guest Posted September 9, 2006 Posted September 9, 2006 Hello i have installed the EasyPopulate it works fine but it doesn' t upload the date Do you have an idea? It upload all the data except the date Could you please give me an idea. The manque of the date create a problem to the products_new.php page The products in the products_new.php page don't show up in the right order Quote
Guest Posted September 9, 2006 Posted September 9, 2006 Hello,I have installed EP 2.76 and it is great! I have got it working to upload lots of products... I have tried to go through the other versions of EP (and this forum) to see if there is a version that will help me. I need to be able to have products be in multiple "top level" categories. I already have them uploading into a top level category and sub categories. Anyone able to give me some advice or give me some direction on how to modify the files to achieve this goal? Thanks! Linda Wilson I would suggest you list "manually", via the OSC admin interface one of you products and copy it in another category (with either alias or duplicate, your choice) and then download the complete file via EP to see how this is managed. Then you just have to mimic what EP does. Quote
PHP-Newbie Posted September 9, 2006 Posted September 9, 2006 (edited) I have installed EP 2.76 on my computer and it seems fine. When I try to upload EP file I get the following msg: File uploaded. Temporary filename: C:\www\\tmp\phpBC.tmp User filename: EP2006Sep02-0012.txt Size: 730 That's fine. However when I tried to upload to my online server, I get the following error msg: Forbidden You don't have permission to access /catalog/admin/easypopulate.php on this server. I tested with stock OSC MS2.2 with EP mod installed only. Below is my setting of the admin/config define('HTTP_SERVER', 'http://www.mysite.com'); // eg, http://localhost - should not be empty for productive servers define('HTTP_CATALOG_SERVER', 'http://www.mysite.com'); define('HTTPS_CATALOG_SERVER', ''); define('ENABLE_SSL_CATALOG', 'false'); // secure webserver for catalog module define('DIR_FS_DOCUMENT_ROOT', '/var/www/html/); // where the pages are located on the server define('DIR_WS_ADMIN', '/catalog/admin/'); // absolute path required define('DIR_FS_ADMIN', '/var/www/html/catalog/admin/'); // absolute pate required define('DIR_WS_CATALOG', '/catalog/'); // absolute path required define('DIR_FS_CATALOG', '/var/www/html/catalog/'); // absolute path required and below is my setting of temp folder in easypopulate.php: $tempdir = "/eStore/temp/"; $tempdir2 = "/eStore/temp/"; Please help! Chris -------------------------------------------------------------------------------------------------------------------------- ok... This is really stupid, I just found out that it was not my problem and the fault was at the web host company smartyhost.. after 6 months of frustration... Stupid me!! I just tried to install OSC + EP on a FREE php/mysql server and it works flawlessly... Go for smartyhost if you dont want to use EP >.< Damn SmartyHost!!! Edited September 9, 2006 by PHP-Newbie Quote
theornamentqueen Posted September 9, 2006 Posted September 9, 2006 I would suggest you list "manually", via the OSC admin interface one of you products and copy it in another category (with either alias or duplicate, your choice) and then download the complete file via EP to see how this is managed. Then you just have to mimic what EP does. Thank you so much! I did just as you said, and when you copy and "link" the item in two categories it is in EP on two lines with the same model number and shows the two different categories. I wasn't able to discern a difference in the downloaded EP file, however, between when you "link" the item in two categories and when you "duplicate" it. The output looked identical to me. However, when I wanted to duplicate an item in EP, (show up as 2 separate items rather than just linked to two different categories), I added a code to the model number, and it worked out fine. Thanks again! :thumbsup: Linda Quote
aapinen Posted September 12, 2006 Posted September 12, 2006 My prices goes to dates in Excel, how can I change them right? eg. if I now put price to 8.3700 it goes as august 37. :| Quote
Guest Posted September 12, 2006 Posted September 12, 2006 My prices goes to dates in Excel, how can I change them right? eg. if I now put price to 8.3700 it goes as august 37. :| Your computer/excel settings for dates for Finland may have an impact on how a decimal number is interpreted. Try to switch your computer and excel prefs in US format to see if it improves Quote
Guest Posted September 12, 2006 Posted September 12, 2006 I'm having an issue with easypopulate. I can download just fine edit and upload, but when I upload it says : File uploaded. Temporary filename: C:\PHP\uploadtemp\php2254.tmp User filename: EP2006Sep08-1806fix2.xls Size: 1520128 This doesn't look like an error message, but I'm not even sure were that file is stored and when I check OS the products are not there. It seems like it's uploading but not inserting? :blink: I have double and triple checked my folder locations and permissions and even went so far as to force my server guy to make my entire server 100% writeable for a short time with still no luck. Then, I added echos throughout the function to try and see where the hold up is as I am not getting any errors. I made it all the way to the last echo but the data is still not being inserted. I'm even having trouble locating were in the code the insert is, I'm assuming that it is in the walk function. So it generally seems that everything is ok, there just is't anything being written to the database and no errors to tell me what's wrong. Anyone have anything on this?? at all?? I know I've seen others with the same problem but the ones that got fixed all seem to be folder related and I've eliminated this as a possibility, unless there is some hidden folder crazyness that I'm not thinking of. Quote
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.
Note: Your post will require moderator approval before it will be visible.