Jump to content

candyelephant

Members
  • Content count

    3
  • Joined

  • Last visited

  1. candyelephant

    Seperate Pricing Per Customer v3.5

    Hi Jan, Whooosh! Did you see that flying pig go straight over my head lol Unfortunately I dont have the option of writing it from scratch, I get by but not that experienced :( Candy
  2. candyelephant

    Seperate Pricing Per Customer v3.5

    Hi Tracy, Thank you for taking the time to advise me. The question is which query or all queries, does it also need to be added to the attributes queries as well??? Candy
  3. candyelephant

    Seperate Pricing Per Customer v3.5

    Hi, I hope that some of the kind people on this board will be able to assist me. :blush: I was set the task of modifying easy populate to work with SPPC under the store front rather than the admin to allow the download of a csv file for our wholesale customers. I have managed to get EP to work lovely (after spending time stripping out all of the import stuff and froogle stuff so I was left with just the bare bones csv download incorporating SPPC. I am now a little stuck on the last couple of issues which are: 1. Incorporate the code for 'Hide products from customer groups for SPPC' 2. Changing the way the v_customers_price_1 is output so that the column header is the regular 'v_products_price' This is my stripped out EP file and I would appreciate the help in finishing off these last couple of tasks. <?php /* $Id: easypopulate.php,v 2.76f 2007/01/20 22:50:52 surfalot Exp $ Designed for osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2007 Todd Holforty mtholforty(at)surfalot(dot)com Released under the GNU General Public License */ // Current EP Version define ('EP_CURRENT_VERSION', '2.76f-MS2'); require('includes/application_top.php'); require_once('includes/database_tables.php'); require('easypopulate_functions.php'); // //******************************* //******************************* // C O N F I G U R A T I O N // V A R I A B L E S //******************************* //******************************* // or let them get set to nothing define ('EP_DEFAULT_IMAGE_MANUFACTURER', ''); define ('EP_DEFAULT_IMAGE_PRODUCT', ''); define ('EP_DEFAULT_IMAGE_CATEGORY', ''); //**** Status Field Setting **** // Set the v_status field to "Inactive" if you want the status=0 in the system define ('EP_TEXT_ACTIVE', 'Active'); define ('EP_TEXT_INACTIVE', 'Inactive'); //**** 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! // If you increase the Model Number size, you must increase the size of the field // in the database. Use a SQL tool like phpMyAdmin (see your host) and change the // "products_model" field of the "products" table in your osCommerce Database. define ('EP_MODEL_NUMBER_SIZE', 12); // default is 12 //**** Price includes tax? **** // Set the EP_PRICE_WITH_TAX to // false if you want the price that is exported to be the same value as stored in the database (no tax added). // true if you want the tax to be added to the export price and subtracted from the import price. define ('EP_PRICE_WITH_TAX', false); // default is false //**** Price calculation precision **** // US Currency uses 2 digits behind the decimal place, so for the US this should be 2 // NOTE: when entering into the database all prices will be converted to 4 decimal places. define ('EP_PRECISION', 2); // default is 2 // **** Quote -> Escape character conversion **** // If you have extensive html in your descriptions and it's getting mangled on upload, turn this off // set to true = replace quotes with escape characters // set to false = no quote replacement define ('EP_REPLACE_QUOTES', false); // default is false // **** 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! // if EP_EXCEL_SAFE_OUTPUT if false (below) you must make EP_PRESERVE_TABS_CR_LF false also. $ep_separator = "\t"; // tab is default //$ep_separator = ','; // comma //$ep_separator = ';'; // semi-colon //$ep_separator = '~'; // tilde //$ep_separator = '*'; // splat // define ('EP_SEPARATOR', ); // *** Excel safe output *** // this setting will supersede the previous $ep_separator setting and create a file // that excel will import without spanning cells from embedded commas or tabs in your products. // if EP_EXCEL_SAFE_OUTPUT if false (below) you must make EP_PRESERVE_TABS_CR_LF false also. define ('EP_EXCEL_SAFE_OUTPUT', true); // default is: true if (EP_EXCEL_SAFE_OUTPUT == true) { if ($language == 'english') { $ep_separator = ','; // comma } elseif ($language == 'german') { $ep_separator = ';'; // semi-colon } else { $ep_separator = ','; // comma // default for all others. } } // *** Preserve Tabs, Carriage returns and Line feeds *** // this setting will preserve the special chars that can cause problems in // a text based output. When used with EP_EXCEL_SAFE_OUTPUT, it will safely // preserve these elements in the export and import. define ('EP_PRESERVE_TABS_CR_LF', false); // default is: false // **** Max Category Levels **** // change this if you need more or fewer categories. // set this to the maximum depth of your categories. define ('EP_MAX_CATEGORIES', 7); // default is 7 // VJ product attributes begin // **** Product Attributes **** // change this to false, if do not want to download product attributes define ('EP_PRODUCTS_WITH_ATTRIBUTES', true); // default is true // change this to true, if you use QTYpro and want to set attributes stock with EP. define ('EP_PRODUCTS_ATTRIBUTES_STOCK', false); // default is false // change this if you want to download only selected product options (attributes). // 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, then load-up this array with // attributes to skip when generating the export. $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 // Separate Pricing Per Customer (SPPC) define ('EP_SPPC_SUPPORT', true); // default is false //******************************* //******************************* // 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 //******************************* //******************************* // modify tableBlock for use here. class epbox extends tableBlock { // constructor function epbox($contents, $direct_ouput = true) { $this->table_width = ''; if (!empty($contents) && $direct_ouput == true) { echo $this->tableBlock($contents); } } // only member function function output($contents) { return $this->tableBlock($contents); } } if (!empty($languages_id) && !empty($language)) { define ('EP_DEFAULT_LANGUAGE_ID', $languages_id); define ('EP_DEFAULT_LANGUAGE_NAME', $language); } else { //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) > 0) { $epdlanguage = tep_db_fetch_array($epdlanguage_query); define ('EP_DEFAULT_LANGUAGE_ID', $epdlanguage['languages_id']); define ('EP_DEFAULT_LANGUAGE_NAME', $epdlanguage['name']); } else { echo 'Strange but there is no default language to work... That may not happen, just in case... '; } } $languages = tep_get_languages(); // VJ product attributes begin $attribute_options_array = array(); if (EP_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 // these are the fields that will be defaulted to the current values in // the database if they are not found in the incoming file $default_these = array(); foreach ($languages as $key => $lang){ $default_these[] = 'v_products_name_' . $lang['id']; $default_these[] = 'v_products_description_' . $lang['id']; $default_these[] = 'v_products_url_' . $lang['id']; if (EP_HTC_SUPPORT == true) { $default_these[] = 'v_products_head_title_tag_' . $lang['id']; $default_these[] = 'v_products_head_desc_tag_' . $lang['id']; $default_these[] = 'v_products_head_keywords_tag_' . $lang['id']; } } $default_these[] = 'v_products_image'; $default_these[] = 'v_categories_id'; $default_these[] = 'v_products_price'; $default_these[] = 'v_products_quantity'; $default_these[] = 'v_products_weight'; $default_these[] = 'v_status_current'; $default_these[] = 'v_date_avail'; $default_these[] = 'v_date_added'; $default_these[] = 'v_tax_class_title'; $default_these[] = 'v_manufacturers_name'; $default_these[] = 'v_manufacturers_id'; $filelayout = ''; $filelayout_count = ''; $filelayout_sql = ''; $fileheaders = ''; if ( !empty($dltype) ){ // if dltype is set, then create the filelayout. Otherwise it gets read from the uploaded file list($filelayout, $filelayout_count, $filelayout_sql, $fileheaders) = ep_create_filelayout($dltype, $attribute_options_array, $languages); // get the right filelayout for this download } //******************************* //******************************* // E N D // INITIALIZATION //******************************* //******************************* //******************************* //******************************* // DOWNLOAD FILE (EXPORT) //******************************* //******************************* if ( !empty($_GET['download']) && ($_GET['download'] == 'stream' or $_GET['download'] == 'activestream' or $_GET['download'] == 'tempfile') ){ $filestring = ""; // this holds the csv file we want to download $result = tep_db_query($filelayout_sql); $row = tep_db_fetch_array($result); // $EXPORT_TIME=time(); // start export time when export is started. //$EXPORT_TIME = strftime('%Y%b%d-%H%I'); $EXPORT_TIME = "puzzledrop_csv"; // 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 . $ep_separator; } // now lop off the trailing tab $filestring = substr($filestring, 0, strlen($filestring)-1); // default to normal end of row $endofrow = $ep_separator . 'EOREOR' . "\n"; $filestring .= $endofrow; if ($download == 'activestream'){ header("Content-type: application/vnd.ms-excel"); header("Content-disposition: attachment; filename=$EXPORT_TIME" . ((EP_EXCEL_SAFE_OUTPUT == true)?".csv":".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; } $num_of_langs = count($languages); while ($row){ // names and descriptions require that we loop thru all languages that are turned on in the store foreach ($languages 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); $row['v_products_name_' . $lid] = $row2['products_name']; $row['v_products_description_' . $lid] = $row2['products_description']; $row['v_products_url_' . $lid] = $row2['products_url']; // 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_CATEGORIES; $categorylevel++){ if ($thecategory_id){ $sql2 = "SELECT categories_name FROM ".TABLE_CATEGORIES_DESCRIPTION." WHERE categories_id = " . $thecategory_id . " AND language_id = " . EP_DEFAULT_LANGUAGE_ID; $result2 = tep_db_query($sql2); $row2 = tep_db_fetch_array($result2); $sql2 = "SELECT categories_image FROM ".TABLE_CATEGORIES." WHERE categories_id = " . $thecategory_id . ''; $result2 = tep_db_query($sql2); $row2 = array_merge($row2, tep_db_fetch_array($result2)); // only set it if we found something $temprow['v_categories_name_' . $categorylevel] = $row2['categories_name']; $temprow['v_categories_image_' . $categorylevel] = $row2['categories_image']; // 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] = ''; $temprow['v_categories_image_' . $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=EP_MAX_CATEGORIES; $categorylevel>0; $categorylevel--){ if ($temprow['v_categories_name_' . $categorylevel] != ''){ $row['v_categories_name_' . $newlevel] = $temprow['v_categories_name_' . $categorylevel]; $row['v_categories_image_' . $newlevel] = $temprow['v_categories_image_' . $categorylevel]; $newlevel++; } } // 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'])){ $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']; //// attributes stock add start if ( EP_PRODUCTS_ATTRIBUTES_STOCK == 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']; $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++; } } //elari - //We check the value of tax class and title instead of the id //Then we add the tax to price if EP_PRICE_WITH_TAX is set to true $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'] = $row['v_products_price'] + (EP_PRICE_WITH_TAX == true ? round( ($row['v_products_price'] * $row_tax_multiplier / 100), EP_PRECISION) : 0); // Now set the status to a word the user specd in the config vars if ( $row['v_status'] == '1' ){ $row['v_status'] = EP_TEXT_ACTIVE; } else { $row['v_status'] = EP_TEXT_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! if (EP_PRESERVE_TABS_CR_LF == false) { $thetext = str_replace("\r",' ',$thetext); $thetext = str_replace("\n",' ',$thetext); $thetext = str_replace("\t",' ',$thetext); } if (EP_EXCEL_SAFE_OUTPUT == true) { // use quoted values and escape the embedded quotes for excel safe output. $therow .= '"'.str_replace('"','""',$thetext).'"' . $ep_separator; } else { // and put the text into the output separated by $ep_separator defined above $therow .= $thetext . $ep_separator; } } // lop off the trailing separator, then append the end of row indicator $therow = substr($therow,0,strlen($therow)-1) . $endofrow; if ($download == 'activestream'){ echo $therow; } else { $filestring .= $therow; } // grab the next row from the db $row = tep_db_fetch_array($result); } // now either stream it to them or put it in the temp directory if ($download == 'activestream'){ die(); } elseif ($download == 'stream'){ //******************************* // STREAM FILE //******************************* header("Content-type: application/vnd.ms-excel"); header("Content-disposition: attachment; filename=$EXPORT_TIME" . ((EP_EXCEL_SAFE_OUTPUT == true)?".csv":".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(); } } //******************************* //******************************* // S T A R T // PAGE DELIVERY //******************************* //******************************* ?> <!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"> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td class="pageHeading" valign="top"> <table width="<?php if (EP_SHOW_EP_SETTINGS == true) { echo '95'; } else { echo '75'; } ?>%" border="0"> <tr> <td width="75%" class="main"> <table width="100%" border="0" cellpadding="3" cellspacing="3"> <tr> <td width="50%" valign="top"><a class="main" href="easypopulate.php?download=stream&dltype=full">Download Products CSV file</a></td> </tr> </table> </td> </td> </tr> </table> </body> </html> <?php /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// // // ep_create_filelayout() // /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// function ep_create_filelayout($dltype, $attribute_options_array, $languages){ // depending on the type of the download the user wanted, create a file layout for it. $fieldmap = array(); // default to no mapping to change internal field names to external. // build filters $sql_filter = ''; if (!empty($_GET['epcust_category_filter'])) { $sub_categories = array(); $categories_query_addition = 'ptoc.categories_id = ' . (int)$_GET['epcust_category_filter'] . ''; tep_get_sub_categories($sub_categories, $_GET['epcust_category_filter']); foreach ($sub_categories AS $ckey => $category ) { $categories_query_addition .= ' or ptoc.categories_id = ' . (int)$category . ''; } $sql_filter .= ' and (' . $categories_query_addition . ')'; } if ($_GET['epcust_manufacturer_filter']!='') { $sql_filter .= ' and p.manufacturers_id = ' . (int)$_GET['epcust_manufacturer_filter']; } if ($_GET['epcust_status_filter']!='') { $sql_filter .= ' and p.products_status = ' . (int)$_GET['epcust_status_filter']; } // ///////////////////////////////////////////////////////////////////// // // Start: Support for other contributions // // ///////////////////////////////////////////////////////////////////// $ep_additional_layout_product = ''; $ep_additional_layout_product_select = ''; $ep_additional_layout_product_description = ''; $ep_additional_layout_pricing = ''; if (EP_SPPC_SUPPORT == true) { $ep_additional_layout_pricing .= '$filelayout[\'v_customer_price_1\'] = $iii++; '; } // ///////////////////////////////////////////////////////////////////// // End: Support for other contributions // ///////////////////////////////////////////////////////////////////// switch( $dltype ){ case 'full': // The file layout is dynamically made depending on the number of languages $iii = 0; $filelayout = array(); $filelayout['v_products_model'] = $iii++; foreach ($languages as $key => $lang){ $filelayout['v_products_name_'.$lang['id']] = $iii++; $filelayout['v_products_description_'.$lang['id']] = $iii++; $filelayout['v_products_url_'.$lang['id']] = $iii++; if (!empty($ep_additional_layout_product_description)) { eval($ep_additional_layout_product_description); } } $filelayout['v_products_image'] = $iii++; if (!empty($ep_additional_layout_product)) { eval($ep_additional_layout_product); } //$filelayout['v_products_price'] = $iii++; if (!empty($ep_additional_layout_pricing)) { eval($ep_additional_layout_pricing); } //$filelayout['v_products_quantity'] = $iii++; $filelayout['v_products_weight'] = $iii++; $filelayout['v_date_avail'] = $iii++; $filelayout['v_date_added'] = $iii++; // VJ product attribs begin $attribute_options_count = 1; foreach ($attribute_options_array as $tkey => $attribute_options_values) { $filelayout['v_attribute_options_id_'.$attribute_options_count] = $iii++; foreach ($languages as $tkey => $lang ) { $filelayout['v_attribute_options_name_'.$attribute_options_count.'_'.$lang['id']] = $iii++; } $attribute_values_query = "select products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options_values['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)) { $filelayout['v_attribute_values_id_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++; foreach ($languages as $tkey => $lang ) { $filelayout['v_attribute_values_name_'.$attribute_options_count.'_'.$attribute_values_count.'_'.$lang['id']] = $iii++; } $filelayout['v_attribute_values_price_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++; //// attributes stock add start if ( EP_PRODUCTS_ATTRIBUTES_STOCK == true ) { $filelayout['v_attribute_values_stock_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++; } //// attributes stock add end $attribute_values_count++; } $attribute_options_count++; } // VJ product attribs end $filelayout['v_manufacturers_name'] = $iii++; // build the categories name section of the array based on the number of categores the user wants to have for($i=1; $i<EP_MAX_CATEGORIES+1; $i++){ $filelayout['v_categories_name_'.$i] = $iii++; $filelayout['v_categories_image_'.$i] = $iii++; } $filelayout['v_tax_class_title'] = $iii++; $filelayout['v_status'] = $iii++; $filelayout_sql = "SELECT p.products_id as v_products_id, p.products_model as v_products_model, p.products_image as v_products_image, $ep_additional_layout_product_select p.products_price as v_products_price, p.products_weight as v_products_weight, p.products_date_available as v_date_avail, p.products_date_added as v_date_added, p.products_tax_class_id as v_tax_class_id, p.products_quantity as v_products_quantity, p.manufacturers_id as v_manufacturers_id, subc.categories_id as v_categories_id, p.products_status as v_status FROM ".TABLE_PRODUCTS." as p, ".TABLE_CATEGORIES." as subc, ".TABLE_PRODUCTS_TO_CATEGORIES." as ptoc WHERE p.products_id = ptoc.products_id AND ptoc.categories_id = subc.categories_id " . $sql_filter; break; } $filelayout_count = count($filelayout); return array($filelayout, $filelayout_count, $filelayout_sql, $fileheaders); } ?> I look forward to your responses and thanks in advance for the help (sorry for posting so much code as I know it is sometimes frowned upon on some forums) Regards Candy
×