Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

npereira

Members
  • Content count

    87
  • Joined

  • Last visited

Everything posted by npereira

  1. npereira

    NEW! Complete Order Editing Tool!

    HELLLLLLLLOOOOOO ! ! ! ! Anyone here? is this contrib dead or what? anyother solutions to edit orders?
  2. npereira

    NEW! Complete Order Editing Tool!

    is there anyone still working on this contrib or is this dead? Is there an alternative contrib that works ?
  3. npereira

    Easy Populate not import

    what is the error your getting?
  4. npereira

    NEW! Complete Order Editing Tool!

    Not sure, but I think I get the same thing. I have the latest order Editor 1.61b I make a test order: 1 x product @ 1149.99$ Table Rate (Best Way (Based on Order Amount, see Shipping & Returns)): 50.00$ 7% GST + 7.5% PST Quebec: 172.79$ 7% GST (Shipping) + 7.5% PST Quebec (Shipping): 7.51$ Total : 1,380.29$ Then if I go in and edit ANYTHING ! (was editing the shipping cost from 50 to 100$) Then I get this: 1 x product @ 1149.99$ Table Rate (Best Way (Based on Order Amount, see Shipping & Returns)): 100.00$ 7% GST + 7.5% PST Quebec: 187.81$ TOTALY WRONG ! should not have changed as the item price did not change. 7% GST (Shipping) + 7.5% PST Quebec (Shipping): 187.81$ TOTALY WRONG ! this should be 15.03$ Total: 1,625.61$ TOTALY WRONG !this should be 1437.81$ anyone know why this is happening? and is there a fix for this? using OSC 2.2 MS2 with the only mod is individual price per customer.
  5. Can anyone give me a hand in figuring this out? This is the only thing left before going into production.... Thanks
  6. Hello, Have question about error getting when trying to import EP file. Error: File uploaded. Temporary filename: /tmp/phpbYiwx7 User filename: LIVE_data.txt Size: 213771 | 51-760100 | adaracing/ | Tube - 2.5 | 10 inch in | | 9.99 | 8 | 1 | 0 | | 0000-00-00 | 10 | ADA Racing | Dirt Bike | Performanc | | | | GST/HST/PS | Active Updated 1136 - Column count doesn't match value count at row 1 INSERT INTO products_groups VALUES ( 1, 8, 28, 9.99 ) [TEP STOP] This is installed on OSC MS 2.2 and lastest EP file, no other mods installed. I cannot figureout where I need to change for the easypopulate.php file to fix this issue.
  7. npereira

    PDF Catalog v.1.5

    Is there anyone still supporting this or os there an alternative contrib that will do the same?
  8. npereira

    PDF Catalog v.1.5

    Im getting the same thing... now, all of a sudden i start to get : Fatal error: Call to undefined function: tep_get_languages_directory() in /home2/shopott/public_html/admin/pdf_catalogue.php on line 541 Does anyone have this running and can submit the lastest FIXED files?
  9. Hi all, Bee running OSCommerce for about 1 year now. I have added several mods, including individual shipping and per item shipping. My problem is that on some items, if the user only purchases that single item, I end up paying for the difference in shipping. When some order multiple items, the shipping ends up being WAY to expenssive and I loose orders. I would like to know what Canadian Store owners use for shipping. How do you setup each item's weight for shipping via either Purolator or Canada Post as theses are my 2 shippers. Can someone explain to me how they are making OSC calculate shipping cost that would be reasonable to both me and my customer. Please provide feedback and/or the modules used and who they perform to you. Thanks
  10. Ok, Went home last night and it works fine there... I can see the buttons. I tried from 2 different PC's at work and they dont work. What part of IE would prevent this? Im using IE 6 with SP4 on a WIN2000 PRo
  11. Hello, added this contrib ver 1.7 to a working OS2.2.2 All settings apperear in the admin and are all enabled but I dont see the HTML AREA buttons anywhere, just the standard text boxes. What Am I missing? I re-read the installation docs and everything is fine.... Anyone get this? thanks for your reply.
  12. npereira

    Seperate Pricing Per Customer v3.5

    Is there anyone that is supporting this application? I get : 1062 - Duplicate entry '1' for key 1 insert into products_groups (products_id, products_price, customers_group_id, customers_group_price) values ('877', '799.9900', '1', '450.00') [TEP STOP] When trying to add a Dealer Price to a product..... !
  13. It is not in auto-increment. Again, see the table setup in the DB: -- -- Table structure for table `products_groups` -- CREATE TABLE `products_groups` ( `customers_group_id` int(11) NOT NULL default '0', `customers_group_price` decimal(15,4) NOT NULL default '0.0000', `products_id` int(11) NOT NULL default '0', `products_price` decimal(15,4) NOT NULL default '0.0000', PRIMARY KEY (`customers_group_id`) ) TYPE=MyISAM; -- -- Dumping data for table `products_groups` -- INSERT INTO `products_groups` VALUES (1, 799.0000, 823, 899.9900); Can you see how to modify the code to have it delete the line and re-add it instead of updating? That would fix the problem in it's entety but I dont know how to acheive or build that code and where to put it.
  14. 1062 - Duplicate entry '1' for key 1 INSERT INTO products_groups VALUES ( 1, 16, 895, 19.99 ) This is the error I get after downloading the EP file, adding price to the v_customer_price_1 column and adding group ID # to v_customer_group_id_1 column which in my case, there is only 1 added group which is Dealer and the DB says it's Group ID # 1 so this is what I add to that column and upload the file back to the DB via EP. This is where is fails ! When downloading, it brings the columns for the individual pricing but that's where it crashes ! PLEASE ! Can't anyone help me on this? This is the only thing that does not work, and updating every single 1500+ items individualy would take me a few weeks! Please someone help a desprate man ! This is where ... I THINK .... is screwed up but this is the original code and has not been modified. So was easypopulate actualy tested with the individual pricing MOD? if (isset($v_customer_price_1)){ if (($v_customer_group_id_1 == '') AND ($v_customer_price_1 != '')) { echo "<font color=red>ERROR - v_customer_group_id and v_customer_price must occur in pairs</font>"; die(); } // they spec'd some prices, so clear all existing entries $result = tep_db_query(' DELETE FROM '.TABLE_PRODUCTS_GROUPS.' WHERE products_id = ' . $v_products_id ); // and insert the new record if ($v_customer_price_1 != ''){ $result = tep_db_query(' INSERT INTO '.TABLE_PRODUCTS_GROUPS.' VALUES ( ' . $v_customer_group_id_1 . ', ' . $v_customer_price_1 . ', ' . $v_products_id . ', ' . $v_products_price .' )' ); }
  15. They are in the file ! They may not be at the correct location but thats what i need to know.
  16. Ok, but from my posted easypopulate.php file, can you tell me what is missing? or wrong? I can't for the love of god figure out what is screwed up... Thanks
  17. Can anyone privide any feedback on this? I need to get this resolve before implamenting as a production server. Thanks
  18. Here is another example: When executing the "Download Model/Price/Qty tab-delimited .txt file to edit " in the Easy Populate (which runs the priceqty dltype function), I get the pricing for the different groups. Where the problem relies is when I try to update the DB using Easy Populate "Upload EP File". The screen comes back and gives me File uploaded. Temporary filename: /tmp/phpgM0x1y User filename: priceqty.txt Size: 1079 | MG200MMS | 299.99 | 32 | 185 | 1 Updated 1062 - Duplicate entry '1' for key 1 INSERT INTO products_groups VALUES ( 1, 185, 1, 299.99 ) [TEP STOP] What does this realy mean? From what I can understand, and I am far from being a PHP wiz, is that there should be some kind of function running during an upload that looks at the "table_products_groups" and looks to see if there is an entry at "v_customer_price_1 and v_customer_group_id_1" and if there is, it should delete it from the table and insert the info in the uploaded file to the table. Am I far away from the actual issue?
  19. Hmmm... Not sure .... here is the DB for the products_groups -- -- Table structure for table `products_groups` -- CREATE TABLE `products_groups` ( `customers_group_id` int(11) NOT NULL default '0', `customers_group_price` decimal(15,4) NOT NULL default '0.0000', `products_id` int(11) NOT NULL default '0', `products_price` decimal(15,4) NOT NULL default '0.0000', PRIMARY KEY (`customers_group_id`) ) TYPE=MyISAM; -- -- Dumping data for table `products_groups` -- INSERT INTO `products_groups` VALUES (1, 185.0000, 31, 299.0654); INSERT INTO `products_groups` VALUES (2, 99.9900, 31, 100.0000); INSERT INTO `products_groups` VALUES (3, 49.9900, 31, 100.0000);
  20. Continued... for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $l_id = $languages[$i]['id']; $key2 = 'v_attribute_options_name_' . $attribute_options_count . '_' . $l_id; $header_array[$key2] = $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)) { $key3 = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count; $header_array[$key3] = $iii++; $key4 = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count; $header_array[$key4] = $iii++; for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $l_id = $languages[$i]['id']; $key5 = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $l_id; $header_array[$key5] = $iii++; } $attribute_values_count++; } $attribute_options_count++; } $header_array['v_manufacturers_name'] = $iii++; $header_array['v_products_ship_price'] = $iii++; $header_array['v_products_ship_price_two'] = $iii++; $filelayout = array_merge($filelayout, $header_array); // VJ product attribs end // build the categories name section of the array based on the number of categores the user wants to have for($i=1;$i<$max_categories+1;$i++){ $filelayout = array_merge($filelayout, array('v_categories_name_' . $i => $iii++)); } $filelayout = array_merge($filelayout, array( 'v_tax_class_title' => $iii++, '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, /* p.products_bimage as v_products_bimage, */ p.products_price as v_products_price, /* p.products_price1 as v_products_price1, */ /* p.products_price2 as v_products_price2, */ /* p.products_price3 as v_products_price3, */ /* p.products_price4 as v_products_price4, */ /* p.products_price1_qty as v_products_price1_qty, */ /* p.products_price2_qty as v_products_price2_qty, */ /* p.products_price3_qty as v_products_price3_qty, */ /* p.products_price4_qty as v_products_price4_qty, */ /* p.products_qty_blocks as v_products_qty_blocks, */ 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, p.products_ship_price as v_products_ship_price, p.products_ship_price_two as v_products_ship_price_two, 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 "; break; case 'priceqty': $iii = 0; // uncomment the customer_price and customer_group to support multi-price per product contrib $filelayout = array( 'v_products_model' => $iii++, 'v_products_price' => $iii++, // 'v_products_price1' => $iii++, // 'v_products_price2' => $iii++, // 'v_products_price3' => $iii++, // 'v_products_price4' => $iii++, // 'v_products_price1_qty' => $iii++, // 'v_products_price2_qty' => $iii++, // 'v_products_price3_qty' => $iii++, // 'v_products_price4_qty' => $iii++, // 'v_products_qty_blocks' => $iii++, 'v_products_quantity' => $iii++, 'v_customer_price_1' => $iii++, 'v_customer_group_id_1' => $iii++, // 'v_customer_price_2' => $iii++, // 'v_customer_group_id_2' => $iii++, #'v_customer_price_3' => $iii++, #'v_customer_group_id_3' => $iii++, #'v_customer_price_4' => $iii++, #'v_customer_group_id_4' => $iii++, ); $filelayout_sql = "SELECT p.products_id as v_products_id, p.products_model as v_products_model, p.products_price as v_products_price, p.products_tax_class_id as v_tax_class_id, p.products_quantity as v_products_quantity FROM ".TABLE_PRODUCTS." as p "; break; } $filelayout_count = count($filelayout); } function walk( $item1 ) { global $filelayout, $filelayout_count, $modelsize; global $active, $inactive, $langcode, $default_these, $deleteit, $zero_qty_inactive; global $epdlanguage_id, $price_with_tax, $replace_quotes; global $default_images, $default_image_manufacturer, $default_image_product, $default_image_category; global $separator, $max_categories; // first we clean up the row of data // chop blanks from each end $item1 = ltrim(rtrim($item1)); // blow it into an array, splitting on the tabs $items = explode($separator, $item1); // make sure all non-set things are set to ''; // and strip the quotes from the start and end of the stings. // escape any special chars for the database. foreach( $filelayout as $key=> $value){ $i = $filelayout[$key]; if (isset($items[$i]) == false) { $items[$i]=''; } else { // Check to see if either of the magic_quotes are turned on or off; // And apply filtering accordingly. if (function_exists('ini_get')) { //echo "Getting ready to check magic quotes<br>"; if (ini_get('magic_quotes_runtime') == 1){ // The magic_quotes_runtime are on, so lets account for them // check if the last character is a quote; // if it is, chop off the quotes. if (substr($items[$i],-1) == '"'){ $items[$i] = substr($items[$i],2,strlen($items[$i])-4); } // now any remaining doubled double quotes should be converted to one doublequote $items[$i] = str_replace('\"\"',""",$items[$i]); if ($replace_quotes){ $items[$i] = str_replace('\"',""",$items[$i]); $items[$i] = str_replace("\'","'",$items[$i]); } } else { // no magic_quotes are on // check if the last character is a quote; // if it is, chop off the 1st and last character of the string. if (substr($items[$i],-1) == '"'){ $items[$i] = substr($items[$i],1,strlen($items[$i])-2); } // now any remaining doubled double quotes should be converted to one doublequote $items[$i] = str_replace('""',""",$items[$i]); if ($replace_quotes){ $items[$i] = str_replace('"',""",$items[$i]); $items[$i] = str_replace("'","'",$items[$i]); } } } } } /* if ( $items['v_status'] == $deleteit ){ // they want to delete this product. echo "Deleting product " . $items['v_products_model'] . " from the database<br>"; // Get the ID // kill in the products_to_categories // Kill in the products table return; // we're done deleteing! } */ // now do a query to get the record's current contents $sql = "SELECT p.products_id as v_products_id, p.products_model as v_products_model, p.products_image as v_products_image, /* p.products_bimage as v_products_bimage, */ p.products_price as v_products_price, /* p.products_price1 as v_products_price1, */ /* p.products_price2 as v_products_price2, */ /* p.products_price3 as v_products_price3, */ /* p.products_price4 as v_products_price4, */ /* p.products_price1_qty as v_products_price1_qty, */ /* p.products_price2_qty as v_products_price2_qty, */ /* p.products_price3_qty as v_products_price3_qty, */ /* p.products_price4_qty as v_products_price4_qty, */ /* p.products_qty_blocks as v_products_qty_blocks, */ p.products_weight as v_products_weight, p.products_date_added as v_date_avail, p.products_tax_class_id as v_tax_class_id, p.products_quantity as v_products_quantity, p.manufacturers_id as v_manufacturers_id, p.products_ship_price as v_products_ship_price, p.products_ship_price_two as v_products_ship_price_two, subc.categories_id as v_categories_id FROM ".TABLE_PRODUCTS." as p, ".TABLE_CATEGORIES." as subc, ".TABLE_PRODUCTS_TO_CATEGORIES." as ptoc WHERE p.products_id = ptoc.products_id AND p.products_model = '" . $items[$filelayout['v_products_model']] . "' AND ptoc.categories_id = subc.categories_id "; $result = tep_db_query($sql); $row = tep_db_fetch_array($result); while ($row){ // OK, since we got a row, the item already exists. // Let's get all the data we need and fill in all the fields that need to be defaulted to the current values // for each language, get the description and set the vals foreach ($langcode as $key => $lang){ //echo "Inside defaulting loop"; //echo "key is $key<br>"; //echo "langid is " . $lang['id'] . "<br>"; // $sql2 = "SELECT products_name, products_description // FROM ".TABLE_PRODUCTS_DESCRIPTION." // WHERE // products_id = " . $row['v_products_id'] . " AND // language_id = '" . $lang['id'] . "' // "; $sql2 = "SELECT * FROM ".TABLE_PRODUCTS_DESCRIPTION." WHERE products_id = " . $row['v_products_id'] . " AND language_id = '" . $lang['id'] . "' "; $result2 = tep_db_query($sql2); $row2 = tep_db_fetch_array($result2); // Need to report from ......_name_1 not ..._name_0 $row['v_products_name_' . $lang['id']] = $row2['products_name']; $row['v_products_description_' . $lang['id']] = $row2['products_description']; $row['v_products_url_' . $lang['id']] = $row2['products_url']; // support for Linda's Header Controller 2.0 here if(isset($filelayout['v_products_head_title_tag_' . $lang['id'] ])){ $row['v_products_head_title_tag_' . $lang['id']] = $row2['products_head_title_tag']; $row['v_products_head_desc_tag_' . $lang['id']] = $row2['products_head_desc_tag']; $row['v_products_head_keywords_tag_' . $lang['id']] = $row2['products_head_keywords_tag']; } // end support for Header Controller 2.0 } // start with v_categories_id // Get the category description // set the appropriate variable name // if parent_id is not null, then follow it up. $thecategory_id = $row['v_categories_id']; for( $categorylevel=1; $categorylevel<$max_categories+1; $categorylevel++){ if ($thecategory_id){ $sql2 = "SELECT categories_name FROM ".TABLE_CATEGORIES_DESCRIPTION." WHERE categories_id = " . $thecategory_id . " AND language_id = " . $epdlanguage_id; $result2 = tep_db_query($sql2); $row2 = tep_db_fetch_array($result2); // only set it if we found something $temprow['v_categories_name_' . $categorylevel] = $row2['categories_name']; // now get the parent ID if there was one $sql3 = "SELECT parent_id FROM ".TABLE_CATEGORIES." WHERE categories_id = " . $thecategory_id; $result3 = tep_db_query($sql3); $row3 = tep_db_fetch_array($result3); $theparent_id = $row3['parent_id']; if ($theparent_id != ''){ // there was a parent ID, lets set thecategoryid to get the next level $thecategory_id = $theparent_id; } else { // we have found the top level category for this item, $thecategory_id = false; } } else { $temprow['v_categories_name_' . $categorylevel] = ''; } } // temprow has the old style low to high level categories. $newlevel = 1; // let's turn them into high to low level categories for( $categorylevel=$max_categories+1; $categorylevel>0; $categorylevel--){ if ($temprow['v_categories_name_' . $categorylevel] != ''){ $row['v_categories_name_' . $newlevel++] = $temprow['v_categories_name_' . $categorylevel]; } } 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']; } //elari - //We check the value of tax class and title instead of the id //Then we add the tax to price if $price_with_tax is set to 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']); if ($price_with_tax){ $row['v_products_price'] = round($row['v_products_price'] + ($row['v_products_price'] * $row_tax_multiplier / 100),2); // $row['v_products_price1'] = round($row['v_products_price1'] + ($row['v_products_price1'] * $row_tax_multiplier / 100),2); // $row['v_products_price2'] = round($row['v_products_price2'] + ($row['v_products_price2'] * $row_tax_multiplier / 100),2); // $row['v_products_price3'] = round($row['v_products_price3'] + ($row['v_products_price3'] * $row_tax_multiplier / 100),2); // $row['v_products_price4'] = round($row['v_products_price4'] + ($row['v_products_price4'] * $row_tax_multiplier / 100),2); } // now create the internal variables that will be used // the $$thisvar is on purpose: it creates a variable named what ever was in $thisvar and sets the value foreach ($default_these as $thisvar){ $$thisvar = $row[$thisvar]; } $row = tep_db_fetch_array($result); } // this is an important loop. What it does is go thru all the fields in the incoming file and set the internal vars. // Internal vars not set here are either set in the loop above for existing records, or not set at all (null values) // the array values are handled separatly, although they will set variables in this loop, we won't use them. foreach( $filelayout as $key => $value ){ $$key = $items[ $value ]; } // so how to handle these? we shouldn't built the array unless it's been giving to us. // The assumption is that if you give us names and descriptions, then you give us name and description for all applicable languages foreach ($langcode as $lang){ //echo "Langid is " . $lang['id'] . "<br>"; $l_id = $lang['id']; if (isset($filelayout['v_products_name_' . $l_id ])){ //we set dynamically the language values $v_products_name[$l_id] = $items[$filelayout['v_products_name_' . $l_id]]; $v_products_description[$l_id] = $items[$filelayout['v_products_description_' . $l_id ]]; $v_products_url[$l_id] = $items[$filelayout['v_products_url_' . $l_id ]]; // support for Linda's Header Controller 2.0 here if(isset($filelayout['v_products_head_title_tag_' . $l_id])){ $v_products_head_title_tag[$l_id] = $items[$filelayout['v_products_head_title_tag_' . $l_id]]; $v_products_head_desc_tag[$l_id] = $items[$filelayout['v_products_head_desc_tag_' . $l_id]]; $v_products_head_keywords_tag[$l_id] = $items[$filelayout['v_products_head_keywords_tag_' . $l_id]]; } // end support for Header Controller 2.0 } } //elari... we get the tax_clas_id from the tax_title //on screen will still be displayed the tax_class_title instead of the id.... if ( isset( $v_tax_class_title) ){ $v_tax_class_id = tep_get_tax_title_class_id($v_tax_class_title); } //we check the tax rate of this tax_class_id $row_tax_multiplier = tep_get_tax_class_rate($v_tax_class_id); //And we recalculate price without the included tax... //Since it seems display is made before, the displayed price will still include tax //This is same problem for the tax_clas_id that display tax_class_title if ($price_with_tax){ $v_products_price = round( $v_products_price / (1 + ( $row_tax_multiplier * $price_with_tax/100) ), 4); // $v_products_price1 = round( $v_products_price1 / (1 + ( $row_tax_multiplier * $price_with_tax/100) ), 4); // $v_products_price2 = round( $v_products_price2 / (1 + ( $row_tax_multiplier * $price_with_tax/100) ), 4); // $v_products_price3 = round( $v_products_price3 / (1 + ( $row_tax_multiplier * $price_with_tax/100) ), 4); // $v_products_price4 = round( $v_products_price4 / (1 + ( $row_tax_multiplier * $price_with_tax/100) ), 4); } // if they give us one category, they give us all 6 categories unset ($v_categories_name); // default to not set. if ( isset( $filelayout['v_categories_name_1'] ) ){ $newlevel = 1; for( $categorylevel=6; $categorylevel>0; $categorylevel--){ if ( $items[$filelayout['v_categories_name_' . $categorylevel]] != ''){ $v_categories_name[$newlevel++] = $items[$filelayout['v_categories_name_' . $categorylevel]]; } } while( $newlevel < $max_categories+1){ $v_categories_name[$newlevel++] = ''; // default the remaining items to nothing } } if (ltrim(rtrim($v_products_quantity)) == '') { $v_products_quantity = 1; } if ($v_date_avail == '') { // $v_date_avail = "CURRENT_TIMESTAMP"; $v_date_avail = "NULL"; } else { // we put the quotes around it here because we can't put them into the query, because sometimes // we will use the "current_timestamp", which can't have quotes around it. $v_date_avail = '"' . $v_date_avail . '"'; } if ($v_date_added == '') { $v_date_added = "CURRENT_TIMESTAMP"; } else { // we put the quotes around it here because we can't put them into the query, because sometimes // we will use the "current_timestamp", which can't have quotes around it. $v_date_added = '"' . $v_date_added . '"'; } // default the stock if they spec'd it or if it's blank $v_db_status = '1'; // default to active if ($v_status == $inactive){ // they told us to deactivate this item $v_db_status = '0'; } if ($zero_qty_inactive && $v_products_quantity == 0) { // if they said that zero qty products should be deactivated, let's deactivate if the qty is zero $v_db_status = '0'; } if ($v_manufacturer_id==''){ $v_manufacturer_id="NULL"; } if ($v_products_ship_price==''){ $v_products_ship_price = '0.00'; } else { $v_products_ship_price = '' . $v_products_ship_price . ''; } if ($v_products_ship_price_two==''){ $v_products_ship_price_two = '0.00'; } else { $v_products_ship_price_two = '' . $v_products_ship_price_two . ''; } if (trim($v_products_image)==''){ $v_products_image = $default_image_product; } if (strlen($v_products_model) > $modelsize ){ echo "<font color='red'>" . strlen($v_products_model) . $v_products_model . "... ERROR! - Too many characters in the model number.<br> 12 is the maximum on a standard OSC install.<br> Your maximum product_model length is set to $modelsize<br> You can either shorten your model numbers or increase the size of the field in the database.</font>"; die(); } // OK, we need to convert the manufacturer's name into id's for the database if ( isset($v_manufacturers_name) && $v_manufacturers_name != '' ){ $sql = "SELECT man.manufacturers_id FROM ".TABLE_MANUFACTURERS." as man WHERE man.manufacturers_name = '" . $v_manufacturers_name . "'"; $result = tep_db_query($sql); $row = tep_db_fetch_array($result); if ( $row != '' ){ foreach( $row as $item ){ $v_manufacturer_id = $item; } } else { // to add, we need to put stuff in categories and categories_description $sql = "SELECT MAX( manufacturers_id) max FROM ".TABLE_MANUFACTURERS; $result = tep_db_query($sql); $row = tep_db_fetch_array($result); $max_mfg_id = $row['max']+1; // default the id if there are no manufacturers yet if (!is_numeric($max_mfg_id) ){ $max_mfg_id=1; } // Uncomment this query if you have an older 2.2 codebase /* $sql = "INSERT INTO ".TABLE_MANUFACTURERS."( manufacturers_id, manufacturers_name, manufacturers_image ) VALUES ( $max_mfg_id, '$v_manufacturers_name', '$default_image_manufacturer' )"; */ // Comment this query out if you have an older 2.2 codebase $sql = "INSERT INTO ".TABLE_MANUFACTURERS."( manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified ) VALUES ( $max_mfg_id, '$v_manufacturers_name', '$default_image_manufacturer', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP )"; $result = tep_db_query($sql); $v_manufacturer_id = $max_mfg_id; } } // if the categories names are set then try to update them if ( isset($v_categories_name_1)){ // start from the highest possible category and work our way down from the parent $v_ca
  21. need help with seperate price per customer contrid, uploading to EP. I have installed EP and moded the file to download the fields customer_price_1 and customer_group_id_1 On downloading the DB Complete puts the values in correctly and all is good. The problem happens when I want to update. The screen shows all items updated but the last item wich is the one with the customer pricing difference, says : 1062 - Duplicate entry '1' for key 1 INSERT INTO products_groups VALUES ( 1, 185, 29, 100 ) 1 is the group IDfor #1, 185 is the price for #1 and I have no idea what 29 and 100 are. Here is the item from the tab deliniated file: testing2 testing2 100 185 1 99.99 2 0 10/28/2004 0:00 10/20/2004 20:29 9 10 5 Hardware CDROM Drives --none-- Active EOREOR Here is the code from my EP. Can someone help me get this litle issue resolved? I'm not very good with php but I can get around. Now there seems to be something screwy but I cannot figure out what... <?php // Current EP Version $curver = '2.74-MS2'; // With Price Break, removed local paths from 7 Aug version, these are now correct. /* $Id: easypopulate.php,v 2.74 2004/05/03 VJ Exp $ */ // //******************************* //******************************* // C O N F I G U R A T I O N // V A R I A B L E S //******************************* //******************************* // **** Temp directory **** // if you changed your directory structure from stock and do not have /catalog/temp/, then you'll need to change this accordingly. // $tempdir = "temp/"; $tempdir2 = "temp/"; //**** File Splitting Configuration **** // we attempt to set the timeout limit longer for this script to avoid having to split the files // NOTE: If your server is running in safe mode, this setting cannot override the timeout set in php.ini // uncomment this if you are not on a safe mode server and you are getting timeouts // set_time_limit(330); // if you are splitting files, this will set the maximum number of records to put in each file. // if you set your php.ini to a long time, you can make this number bigger global $maxrecs; $maxrecs = 300; // default, seems to work for most people. Reduce if you hit timeouts //$maxrecs = 4; // for testing //**** Image Defaulting **** global $default_images, $default_image_manufacturer, $default_image_product, $default_image_category; // set them to your own default "We don't have any picture" gif $default_image_manufacturer = 'blank.gif'; $default_image_product = 'no_pic.gif'; $default_image_category = 'blank.gif'; // or let them get set to nothing //$default_image_manufacturer = ''; //$default_image_product = ''; //$default_image_category = ''; //**** Status Field Setting **** // Set the v_status field to "Inactive" if you want the status=0 in the system // Set the v_status field to "Delete" if you want to remove the item from the system <- THIS IS NOT WORKING YET! // If zero_qty_inactive is true, then items with zero qty will automatically be inactive in the store. global $active, $inactive, $zero_qty_inactive, $deleteit; $active = 'Active'; $inactive = 'Inactive'; //$deleteit = 'Delete'; // not functional yet $zero_qty_inactive = true; //**** Size of products_model in products table **** // set this to the size of your model number field in the db. We check to make sure all models are no longer than this value. // this prevents the database from getting fubared. Just making this number bigger won't help your database! They must match! global $modelsize; $modelsize = 50; //**** Price includes tax? **** // Set the v_price_with_tax to // 0 if you want the price without the tax included // 1 if you want the price to be defined for import & export including tax. global $price_with_tax; $price_with_tax =0; // **** Quote -> Escape character conversion **** // If you have extensive html in your descriptions and it's getting mangled on upload, turn this off // set to 1 = replace quotes with escape characters // set to 0 = no quote replacement global $replace_quotes; $replace_quotes = true; // **** Field Separator **** // change this if you can't use the default of tabs // Tab is the default, comma and semicolon are commonly supported by various progs // Remember, if your descriptions contain this character, you will confuse EP! global $separator; $separator = "\t"; // tab is default //$separator = ","; // comma //$separator = ";"; // semi-colon //$separator = "~"; // tilde //$separator = "-"; // dash //$separator = "*"; // splat // **** Max Category Levels **** // change this if you need more or fewer categories global $max_categories; $max_categories = 5; // 7 is default // VJ product attributes begin // **** Product Attributes **** // change this to false, if do not want to download product attributes global $products_with_attributes; $products_with_attributes = false; // change this if you want to download selected product options // this might be handy, if you have a lot of product options, and your output file exceeds 256 columns (which is the max. limit MS Excel is able to handle) global $attribute_options_select; //$attribute_options_select = array('Size', 'Model'); // uncomment and fill with product options name you wish to download // comment this line, if you wish to download all product options // VJ product attributes end // **************************************** // Froogle configuration variables // -- YOU MUST CONFIGURE THIS! IT WON'T WORK OUT OF THE BOX! // **************************************** // **** Froogle product info page path **** // We can't use the tep functions to create the link, because the links will point to the admin, since that's where we're at. // So put the entire path to your product_info.php page here global $froogle_product_info_path; $froogle_product_info_path = "http://shop.ott-motorcycles.ca/product_info.php"; // **** Froogle product image path **** // Set this to the path to your images directory global $froogle_image_path; $froogle_image_path = "http://shop.ott-motorcycles.ca/images/"; // **** Froogle - search engine friendly setting // if your store has SEARCH ENGINE FRIENDLY URLS set, then turn this to true // I did it this way because I'm having trouble with the code seeing the constants // that are defined in other places. global $froogle_SEF_urls; $froogle_SEF_urls = false; // **************************************** // End Froogle configuration variables // **************************************** //******************************* //******************************* // E N D // C O N F I G U R A T I O N // V A R I A B L E S //******************************* //******************************* //******************************* //******************************* // S T A R T // INITIALIZATION //******************************* //******************************* require('includes/application_top.php'); require('includes/database_tables.php'); //******************************* // If you are running a pre-Nov1-2002 snapshot of OSC, then we need this include line to avoid // errors like: // undefined function tep_get_uploaded_file if (!function_exists(tep_get_uploaded_file)){ include ('easypopulate_functions.php'); } //******************************* // VJ product attributes begin global $attribute_options_array; $attribute_options_array = array(); if ($products_with_attributes == true) { if (is_array($attribute_options_select) && (count($attribute_options_select) > 0)) { foreach ($attribute_options_select as $value) { $attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " where products_options_name = '" . $value . "'"; $attribute_options_values = tep_db_query($attribute_options_query); if ($attribute_options = tep_db_fetch_array($attribute_options_values)){ $attribute_options_array[] = array('products_options_id' => $attribute_options['products_options_id']); } } } else { $attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " order by products_options_id"; $attribute_options_values = tep_db_query($attribute_options_query); while ($attribute_options = tep_db_fetch_array($attribute_options_values)){ $attribute_options_array[] = array('products_options_id' => $attribute_options['products_options_id']); } } } // VJ product attributes end global $filelayout, $filelayout_count, $filelayout_sql, $langcode, $fileheaders; // these are the fields that will be defaulted to the current values in the database if they are not found in the incoming file global $default_these; $default_these = array( 'v_products_image', // 'v_products_mimage', // 'v_products_bimage', // 'v_products_subimage1', // 'v_products_bsubimage1', // 'v_products_subimage2', // 'v_products_bsubimage2', // 'v_products_subimage3', // 'v_products_bsubimage3', 'v_categories_id', 'v_products_price', // 'v_products_price1', // 'v_products_price2', // 'v_products_price3', // 'v_products_price4', // 'v_products_price1_qty', // 'v_products_price2_qty', // 'v_products_price3_qty', // 'v_products_price4_qty', // 'v_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 //******************************* //******************************* if ( $download == 'stream' or $download == 'tempfile' ){ //******************************* //******************************* // DOWNLOAD FILE //******************************* //******************************* $filestring = ""; // this holds the csv file we want to download if ( $dltype=='froogle' ){ // set the things froogle wants at the top of the file $filestring .= "# html_escaped=YES\n"; $filestring .= "# updates_only=NO\n"; $filestring .= "# product_type=OTHER\n"; $filestring .= "# quoted=YES\n"; } $result = tep_db_query($filelayout_sql); $row = tep_db_fetch_array($result); // Here we need to allow for the mapping of internal field names to external field names // default to all headers named like the internal ones // the field mapping array only needs to cover those fields that need to have their name changed if ( count($fileheaders) != 0 ){ $filelayout_header = $fileheaders; // if they gave us fileheaders for the dl, then use them } else { $filelayout_header = $filelayout; // if no mapping was spec'd use the internal field names for header names } //We prepare the table heading with layout values foreach( $filelayout_header as $key => $value ){ $filestring .= $key . $separator; } // now lop off the trailing tab $filestring = substr($filestring, 0, strlen($filestring)-1); // set the type if ( $dltype == 'froogle' ){ $endofrow = "\n"; } else { // default to normal end of row $endofrow = $separator . 'EOREOR' . "\n"; } $filestring .= $endofrow; $num_of_langs = count($langcode); while ($row){ // if the filelayout says we need a products_name, get it // build the long full froogle image path $row['v_products_fullpath_image'] = $froogle_image_path . $row['v_products_image']; // Other froogle defaults go here for now $row['v_froogle_instock'] = 'Y'; $row['v_froogle_shipping'] = ''; $row['v_froogle_upc'] = ''; $row['v_froogle_color'] = ''; $row['v_froogle_size'] = ''; $row['v_froogle_quantitylevel'] = ''; $row['v_froogle_manufacturer_id'] = ''; $row['v_froogle_exp_date'] = ''; $row['v_froogle_product_type'] = 'OTHER'; $row['v_froogle_delete'] = ''; $row['v_froogle_currency'] = 'USD'; $row['v_froogle_offer_id'] = $row['v_products_model']; $row['v_froogle_product_id'] = $row['v_products_model']; // names and descriptions require that we loop thru all languages that are turned on in the store foreach ($langcode as $key => $lang){ $lid = $lang['id']; // for each language, get the description and set the vals $sql2 = "SELECT * FROM ".TABLE_PRODUCTS_DESCRIPTION." WHERE products_id = " . $row['v_products_id'] . " AND language_id = '" . $lid . "' "; $result2 = tep_db_query($sql2); $row2 = tep_db_fetch_array($result2); // I'm only doing this for the first language, since right now froogle is US only.. Fix later! // adding url for froogle, but it should be available no matter what if ($froogle_SEF_urls){ // if only one language if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = $froogle_product_info_path . '/products_id/' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = $froogle_product_info_path . '/products_id/' . $row['v_products_id'] . '/language/' . $lid; } } else { if ($num_of_langs == 1){ $row['v_froogle_products_url_' . $lid] = $froogle_product_info_path . '?products_id=' . $row['v_products_id']; } else { $row['v_froogle_products_url_' . $lid] = $froogle_product_info_path . '?products_id=' . $row['v_products_id'] . '&language=' . $lid; } } $row['v_products_name_' . $lid] = $row2['products_name']; $row['v_products_description_' . $lid] = $row2['products_description']; $row['v_products_url_' . $lid] = $row2['products_url']; // froogle advanced format needs the quotes around the name and desc $row['v_froogle_products_name_' . $lid] = '"' . strip_tags(str_replace('"','""',$row2['products_name'])) . '"'; $row['v_froogle_products_description_' . $lid] = '"' . strip_tags(str_replace('"','""',$row2['products_description'])) . '"'; // support for Linda's Header Controller 2.0 here if(isset($filelayout['v_products_head_title_tag_' . $lid])){ $row['v_products_head_title_tag_' . $lid] = $row2['products_head_title_tag']; $row['v_products_head_desc_tag_' . $lid] = $row2['products_head_desc_tag']; $row['v_products_head_keywords_tag_' . $lid] = $row2['products_head_keywords_tag']; } // end support for Header Controller 2.0 } // for the categories, we need to keep looping until we find the root category // start with v_categories_id // Get the category description // set the appropriate variable name // if parent_id is not null, then follow it up. // we'll populate an aray first, then decide where it goes in the $thecategory_id = $row['v_categories_id']; $fullcategory = ''; // this will have the entire category stack for froogle for( $categorylevel=1; $categorylevel<$max_categories+1; $categorylevel++){ if ($thecategory_id){ $sql2 = "SELECT categories_name FROM ".TABLE_CATEGORIES_DESCRIPTION." WHERE categories_id = " . $thecategory_id . " AND language_id = " . $epdlanguage_id; $result2 = tep_db_query($sql2); $row2 = tep_db_fetch_array($result2); // only set it if we found something $temprow['v_categories_name_' . $categorylevel] = $row2['categories_name']; // now get the parent ID if there was one $sql3 = "SELECT parent_id FROM ".TABLE_CATEGORIES." WHERE categories_id = " . $thecategory_id; $result3 = tep_db_query($sql3); $row3 = tep_db_fetch_array($result3); $theparent_id = $row3['parent_id']; if ($theparent_id != ''){ // there was a parent ID, lets set thecategoryid to get the next level $thecategory_id = $theparent_id; } else { // we have found the top level category for this item, $thecategory_id = false; } //$fullcategory .= " > " . $row2['categories_name']; $fullcategory = $row2['categories_name'] . " > " . $fullcategory; } else { $temprow['v_categories_name_' . $categorylevel] = ''; } } // now trim off the last ">" from the category stack $row['v_category_fullpath'] = substr($fullcategory,0,strlen($fullcategory)-3); // temprow has the old style low to high level categories. $newlevel = 1; // let's turn them into high to low level categories for( $categorylevel=6; $categorylevel>0; $categorylevel--){ if ($temprow['v_categories_name_' . $categorylevel] != ''){ $row['v_categories_name_' . $newlevel++] = $temprow['v_categories_name_' . $categorylevel]; } } // if the filelayout says we need a manufacturers name, get it if (isset($filelayout['v_manufacturers_name'])){ if ($row['v_manufacturers_id'] != ''){ $sql2 = "SELECT manufacturers_name FROM ".TABLE_MANUFACTURERS." WHERE manufacturers_id = " . $row['v_manufacturers_id'] ; $result2 = tep_db_query($sql2); $row2 = tep_db_fetch_array($result2); $row['v_manufacturers_name'] = $row2['manufacturers_name']; } } // If you have other modules that need to be available, put them here // VJ product attribs begin if (isset($filelayout['v_attribute_options_id_1'])){ $languages = tep_get_languages(); $attribute_options_count = 1; foreach ($attribute_options_array as $attribute_options) { $row['v_attribute_options_id_' . $attribute_options_count] = $attribute_options['products_options_id']; for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $lid = $languages[$i]['id']; $attribute_options_languages_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options['products_options_id'] . "' and language_id = '" . (int)$lid . "'"; $attribute_options_languages_values = tep_db_query($attribute_options_languages_query); $attribute_options_languages = tep_db_fetch_array($attribute_options_languages_values); $row['v_attribute_options_name_' . $attribute_options_count . '_' . $lid] = $attribute_options_languages['products_options_name']; } $attribute_values_query = "select products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options['products_options_id'] . "' order by products_options_values_id"; $attribute_values_values = tep_db_query($attribute_values_query); $attribute_values_count = 1; while ($attribute_values = tep_db_fetch_array($attribute_values_values)) { $row['v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count] = $attribute_values['products_options_values_id']; $attribute_values_price_query = "select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$row['v_products_id'] . "' and options_id = '" . (int)$attribute_options['products_options_id'] . "' and options_values_id = '" . (int)$attribute_values['products_options_values_id'] . "'"; $attribute_values_price_values = tep_db_query($attribute_values_price_query); $attribute_values_price = tep_db_fetch_array($attribute_values_price_values); $row['v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count] = $attribute_values_price['price_prefix'] . $attribute_values_price['options_values_price']; for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $lid = $languages[$i]['id']; $attribute_values_languages_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$attribute_values['products_options_values_id'] . "' and language_id = '" . (int)$lid . "'"; $attribute_values_languages_values = tep_db_query($attribute_values_languages_query); $attribute_values_languages = tep_db_fetch_array($attribute_values_languages_values); $row['v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid] = $attribute_values_languages['products_options_values_name']; } $attribute_values_count++; } $attribute_options_count++; } } // VJ product attribs end // this is for the separate price per customer module if (isset($filelayout['v_customer_price_1'])){ $sql2 = "SELECT customers_group_price, customers_group_id FROM ".TABLE_PRODUCTS_GROUPS." WHERE products_id = " . $row['v_products_id'] . " ORDER BY customers_group_id" ; $result2 = tep_db_query($sql2); $ll = 1; $row2 = tep_db_fetch_array($result2); while( $row2 ){ $row['v_customer_group_id_' . $ll] = $row2['customers_group_id']; $row['v_customer_price_' . $ll] = $row2['customers_group_price']; $row2 = tep_db_fetch_array($result2); $ll++; } } if ($dltype == 'froogle'){ // For froogle, we check the specials prices for any applicable specials, and use that price // by grabbing the specials id descending, we always get the most recently added special price // I'm checking status because I think you can turn off specials $sql2 = "SELECT specials_new_products_price FROM ".TABLE_SPECIALS." WHERE products_id = " . $row['v_products_id'] . " and status = 1 and expires_date < CURRENT_TIMESTAMP ORDER BY specials_id DESC" ; $result2 = tep_db_query($sql2); $ll = 1; $row2 = tep_db_fetch_array($result2); if( $row2 ){ // reset the products price to our special price if there is one for this product $row['v_products_price'] = $row2['specials_new_products_price']; } } //elari - //We check the value of tax class and title instead of the id //Then we add the tax to price if $price_with_tax is set to 1 $row_tax_multiplier = tep_get_tax_class_rate($row['v_tax_class_id']); $row['v_tax_class_title'] = tep_get_tax_class_title($row['v_tax_class_id']); $row['v_products_price'] = round($row['v_products_price'] + ($price_with_tax * $row['v_products_price'] * $row_tax_multiplier / 100),2); // $row['v_products_price1'] = round($row['v_products_price1'] + // ($price_with_tax * $row['v_products_price1'] * $row_tax_multiplier / 100),2); // $row['v_products_price2'] = round($row['v_products_price2'] + // ($price_with_tax * $row['v_products_price2'] * $row_tax_multiplier / 100),2); // $row['v_products_price3'] = round($row['v_products_price3'] + // ($price_with_tax * $row['v_products_price3'] * $row_tax_multiplier / 100),2); // $row['v_products_price4'] = round($row['v_products_price4'] + // ($price_with_tax * $row['v_products_price4'] * $row_tax_multiplier / 100),2); // Now set the status to a word the user specd in the config vars if ( $row['v_status'] == '1' ){ $row['v_status'] = $active; } else { $row['v_status'] = $inactive; } // remove any bad things in the texts that could confuse EasyPopulate $therow = ''; foreach( $filelayout as $key => $value ){ //echo "The field was $key<br>"; $thetext = $row[$key]; // kill the carriage returns and tabs in the descriptions, they're killing me! $thetext = str_replace("\r",' ',$thetext); $thetext = str_replace("\n",' ',$thetext); $thetext = str_replace("\t",' ',$thetext); // and put the text into the output separated by tabs $therow .= $thetext . $separator; } // lop off the trailing tab, then append the end of row indicator $therow = substr($therow,0,strlen($therow)-1) . $endofrow; $filestring .= $therow; // grab the next row from the db $row = tep_db_fetch_array($result); } #$EXPORT_TIME=time(); $EXPORT_TIME = strftime('%Y%b%d-%H%I'); if ($dltype=="froogle"){ $EXPORT_TIME = "FroogleEP" . $EXPORT_TIME; } else { $EXPORT_TIME = "EP" . $EXPORT_TIME; } // now either stream it to them or put it in the temp directory if ($download == 'stream'){ //******************************* // STREAM FILE //******************************* header("Content-type: application/vnd.ms-excel"); header("Content-disposition: attachment; filename=$EXPORT_TIME.txt"); // Changed if using SSL, helps prevent program delay/timeout (add to backup.php also) // header("Pragma: no-cache"); if ($request_type== 'NONSSL'){ header("Pragma: no-cache"); } else { header("Pragma: "); } header("Expires: 0"); echo $filestring; die(); } else { //******************************* // PUT FILE IN TEMP DIR //******************************* $tmpfname = DIR_FS_DOCUMENT_ROOT . $tempdir . "$EXPORT_TIME.txt"; //unlink($tmpfname); $fp = fopen( $tmpfname, "w+"); fwrite($fp, $filestring); fclose($fp); echo "You can get your file in the Tools/Files under " . $tempdir . "EP" . $EXPORT_TIME . ".txt"; die(); } } // *** END *** download section ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top" height="27"> <table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <?php require(DIR_WS_INCLUDES . 'column_left.php');?> </table></td> <td class="pageHeading" valign="top"><?php echo "Easy Populate $curver - Default Language : " . $epdlanguage_name . '(' . $epdlanguage_id .')'; ?> <p class="smallText"> <?php if ($localfile or (is_uploaded_file($usrfl) && $split==0)) {
  22. npereira

    Seperate Pricing Per Customer v3.5

    Ok, Here are both my specials.php files for catalog and catalog/admin that are working! /catalog/specials.php <?php /* $Id: specials.php,v 1.49 2003/06/09 22:35:33 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SPECIALS); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SPECIALS)); ?> <!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> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php // BOF Seperate Customer Pricing // Next line was original code // $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC"; $customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'"); $customer_group = tep_db_fetch_array($customer_group_query); $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id = ". (int)$customer_group['customers_group_id']." order by s.specials_date_added DESC"; // EOF Seperate Customer Pricing $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS); if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <?php $row = 0; $specials_query = tep_db_query($specials_split->sql_query); while ($specials = tep_db_fetch_array($specials_query)) { $row++; // BOF Seperate Customer Pricing $customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'"); $customer_group = tep_db_fetch_array($customer_group_query); $row = 0; $specials_query = tep_db_query($specials_split->sql_query); while ($specials = tep_db_fetch_array($specials_query)) { $row++; $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $specials['products_id'] . "' and customers_group_id = '" . $customer_group['customers_group_id'] . "'"); if ( $customer_group['customers_group_id'] != 0) if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) $specials['products_price']= $customer_group_price['customers_group_price']; // EOF Seperate Customer Pricing echo ' <td align="center" width="33%" class="smallText"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a><br><s>' . $currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($specials['specials_new_products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</span></td>' . "\n"; } if ((($row / 3) == floor($row / 3))) { ?> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <?php } } ?> </tr> </table></td> </tr> <?php if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?> <tr> <td><br><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table></td> </tr> <?php } ?> </table></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Here is the /catalog/admin/specials.php <?php /* $Id: specials.php,v 1.41 2003/06/29 22:50:52 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); if (tep_not_null($action)) { switch ($action) { case 'setflag': tep_set_specials_status($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag']); tep_redirect(tep_href_link(FILENAME_SPECIALS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'sID=' . $HTTP_GET_VARS['id'], 'NONSSL')); break; case 'insert': $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']); $products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']); $specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']); $day = tep_db_prepare_input($HTTP_POST_VARS['day']); $month = tep_db_prepare_input($HTTP_POST_VARS['month']); $year = tep_db_prepare_input($HTTP_POST_VARS['year']); // BOF Seperate Customer Pricing $customers_group=tep_db_prepare_input($HTTP_POST_VARS['customers_group']); $price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS. " WHERE products_id = ".(int)$products_id . " AND customers_group_id = ".(int)$customers_group); while ($gprices = tep_db_fetch_array($price_query)) { $products_price=$gprices['customers_group_price']; } // EOF Seperate Customer Pricing if (substr($specials_price, -1) == '%') { $new_special_insert_query = tep_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $new_special_insert = tep_db_fetch_array($new_special_insert_query); $products_price = $new_special_insert['products_price']; $specials_price = ($products_price - (($specials_price / 100) * $products_price)); } $expires_date = ''; if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) { $expires_date = $year; $expires_date .= (strlen($month) == 1) ? '0' . $month : $month; $expires_date .= (strlen($day) == 1) ? '0' . $day : $day; } // BOF Seperate Customer Pricing // tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), '" . tep_db_input($expires_date) . "', '1')"); tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status, customers_group_id) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), '" . tep_db_input($expires_date) . "', '1', ".(int)$customers_group.")"); // BOF Seperate Customer Pricing tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'])); break; case 'update': $specials_id = tep_db_prepare_input($HTTP_POST_VARS['specials_id']); $products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']); $specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']); $day = tep_db_prepare_input($HTTP_POST_VARS['day']); $month = tep_db_prepare_input($HTTP_POST_VARS['month']); $year = tep_db_prepare_input($HTTP_POST_VARS['year']); if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price)); $expires_date = ''; if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) { $expires_date = $year; $expires_date .= (strlen($month) == 1) ? '0' . $month : $month; $expires_date .= (strlen($day) == 1) ? '0' . $day : $day; } tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', specials_last_modified = now(), expires_date = '" . tep_db_input($expires_date) . "' where specials_id = '" . (int)$specials_id . "'"); tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials_id)); break; case 'deleteconfirm': $specials_id = tep_db_prepare_input($HTTP_GET_VARS['sID']); tep_db_query("delete from " . TABLE_SPECIALS . " where specials_id = '" . (int)$specials_id . "'"); tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'])); break; } } ?> <!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"> <script language="javascript" src="includes/general.js"></script> <?php if ( ($action == 'new') || ($action == 'edit') ) { ?> <link rel="stylesheet" type="text/css" href="includes/javascript/calendar.css"> <script language="JavaScript" src="includes/javascript/calendarcode.js"></script> <?php } ?> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> <div id="popupcalendar" class="text"></div> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <?php if ( ($action == 'new') || ($action == 'edit') ) { $form_action = 'insert'; if ( ($action == 'edit') && isset($HTTP_GET_VARS['sID']) ) { $form_action = 'update'; $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price, s.expires_date from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id and s.specials_id = '" . (int)$HTTP_GET_VARS['sID'] . "'"); $product = tep_db_fetch_array($product_query); $sInfo = new objectInfo($product); } else { $sInfo = new objectInfo(array()); // create an array of products on special, which will be excluded from the pull down menu of products // (when creating a new product on special) // BOF Seperate customer pricing // $specials_array = array(); // $specials_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where s.products_id = p.products_id"); // while ($specials = tep_db_fetch_array($specials_query)) { // $specials_array[] = $specials['products_id']; // } // } $specials_array = array(); $specials_query = tep_db_query("select p.products_id, s.customers_group_id from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where s.products_id = p.products_id"); while ($specials = tep_db_fetch_array($specials_query)) { $specials_array[] = (int)$specials['products_id'].":".(int)$specials['customers_group_id']; } $customers_groups_query = tep_db_query("select distinct customers_group_name, customers_group_id from " . TABLE_CUSTOMERS . " order by customers_group_id "); $input_groups=array(); $all_groups=array(); while ($existing_groups = tep_db_fetch_array($customers_groups_query)) { $input_groups[$sde++]=array("id"=>$existing_groups['customers_group_id'], "text"=> $existing_groups['customers_group_name']); $all_groups[$existing_groups['customers_group_id']]=$existing_groups['customers_group_name']; } if(isset($HTTP_GET_VARS['sID']) && $sInfo->customers_group_id!=0){ $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $sInfo->products_id . "' and customers_group_id = '" . $sInfo->customers_group_id . "'"); if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) { $sInfo->products_price = $customer_group_price['customers_group_price']; } } } // EOF Seperate customer pricing ?> <tr><form name="new_special" <?php echo 'action="' . tep_href_link(FILENAME_SPECIALS, tep_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('specials_id', $HTTP_GET_VARS['sID']); ?> <td><br><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo TEXT_SPECIALS_PRODUCT; ?> </td> <td class="main"><?php echo (isset($sInfo->products_name)) ? $sInfo->products_name . ' <small>(' . $currencies->format($sInfo->products_price) . ')</small>' : tep_draw_products_pull_down('products_id', 'style="font-size:10px"', $specials_array); echo tep_draw_hidden_field('products_price', (isset($sInfo->products_price) ? $sInfo->products_price : '')); ?></td> </tr> <!-- BOF Seperate customer pricing --> <tr> <td class="main"><?php echo TEXT_SPECIALS_GROUPS; ?> </td> <td class="main"><?php echo tep_draw_pull_down_menu('customers_group', $input_groups, (isset($sInfo->customers_group_id)?$sInfo->customers_group_id:''));?> </td> </tr> <!-- EOF Seperate customer pricing --> <tr> <td class="main"><?php echo TEXT_SPECIALS_SPECIAL_PRICE; ?> </td> <td class="main"><?php echo tep_draw_input_field('specials_price', (isset($sInfo->specials_new_products_price) ? $sInfo->specials_new_products_price : '')); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?> </td> <td class="main"><?php echo tep_draw_input_field('day', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="javascript:calClick();return false;" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><br><?php echo TEXT_SPECIALS_PRICE_TIP; ?></td> <td class="main" align="right" valign="top"><br><?php echo (($form_action == 'insert') ? tep_image_submit('button_insert.gif', IMAGE_INSERT) : tep_image_submit('button_update.gif', IMAGE_UPDATE)). ' <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . (isset($HTTP_GET_VARS['sID']) ? '&sID=' . $HTTP_GET_VARS['sID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td> </tr> </table></td> </form></tr> <?php } else { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRODUCTS_PRICE; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> </tr> <?php // BOF Seperate Customer Pricing // $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id order by pd.products_name"; $all_groups=array(); $customers_groups_query = tep_db_query("select distinct customers_group_name, customers_group_id from " . TABLE_CUSTOMERS . " order by customers_group_id "); while ($existing_groups = tep_db_fetch_array($customers_groups_query)) { $all_groups[$existing_groups['customers_group_id']]=$existing_groups['customers_group_name']; } $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, s.specials_id, s.customers_group_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id order by pd.products_name"; // EOF Seperate Customer Pricing $specials_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $specials_query_raw, $specials_query_numrows); $specials_query = tep_db_query($specials_query_raw); while ($specials = tep_db_fetch_array($specials_query)) { if ((!isset($HTTP_GET_VARS['sID']) || (isset($HTTP_GET_VARS['sID']) && ($HTTP_GET_VARS['sID'] == $specials['specials_id']))) && !isset($sInfo)) { $products_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$specials['products_id'] . "'"); $products = tep_db_fetch_array($products_query); $sInfo_array = array_merge($specials, $products); $sInfo = new objectInfo($sInfo_array); } if (isset($sInfo) && is_object($sInfo) && ($specials['specials_id'] == $sInfo->specials_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials['specials_id']) . '\'">' . "\n"; } // BOF Seperate Customer Pricing $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $specials['products_id']. "' and customers_group_id = '" . $sInfo->customers_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) $sInfo->products_price=$specials['products_price']=$scustomer_group_price['customers_group_price']; // EOF Seperate Customer Pricing ?> <td class="dataTableContent"><?php echo $specials['products_name']; ?></td> <!-- BOF Seperate Customer Pricing //--> <!-- <td class="dataTableContent" align="right"><span class="oldPrice"><?php echo $currencies->format($specials['products_price']); ?></span> <span class="specialPrice"><?php echo $currencies->format($specials['specials_new_products_price']); ?></span></td> //--> <td class="dataTableContent" align="right"><span class="oldPrice"><?php echo $currencies->format($specials['products_price']); ?></span> <span class="specialPrice"><?php echo $currencies->format($specials['specials_new_products_price'])." (".$all_groups[$specials['customers_group_id']].")"; ?></span></td> <!-- EOF Seperate Customer Pricing //--> <td class="dataTableContent" align="right"> <?php if ($specials['status'] == '1') { echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . ' <a href="' . tep_href_link(FILENAME_SPECIALS, 'action=setflag&flag=0&id=' . $specials['specials_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>'; } else { echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'action=setflag&flag=1&id=' . $specials['specials_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a> ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10); } ?></td> <td class="dataTableContent" align="right"><?php if (isset($sInfo) && is_object($sInfo) && ($specials['specials_id'] == $sInfo->specials_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials['specials_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> </tr> <?php } ?> <tr> <td colspan="4"><table border="0" width="100%" cellpadding="0"cellspacing="2"> <tr> <td class="smallText" valign="top"><?php echo $specials_split->display_count($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td> <td class="smallText" align="right"><?php echo $specials_split->display_links($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td> </tr> <?php if (empty($action)) { ?> <tr> <td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?></td> </tr> <?php } ?> </table></td> </tr> </table></td> <?php $heading = array(); $contents = array(); switch ($action) { case 'delete': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SPECIALS . '</b>'); $contents = array('form' => tep_draw_form('specials', FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '<br><b>' . $sInfo->products_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if (is_object($sInfo)) { $heading[] = array('text' => '<b>' . $sInfo->products_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($sInfo->specials_date_added)); $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($sInfo->specials_last_modified)); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_info_image($sInfo->products_image, $sInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)); $contents[] = array('text' => '<br>' . TEXT_INFO_ORIGINAL_PRICE . ' ' . $currencies->format($sInfo->products_price)); $contents[] = array('text' => '' . TEXT_INFO_NEW_PRICE . ' ' . $currencies->format($sInfo->specials_new_products_price)); $contents[] = array('text' => '' . TEXT_INFO_PERCENTAGE . ' ' . number_format(100 - (($sInfo->specials_new_products_price / $sInfo->products_price) * 100)) . '%'); $contents[] = array('text' => '<br>' . TEXT_INFO_EXPIRES_DATE . ' <b>' . tep_date_short($sInfo->expires_date) . '</b>'); $contents[] = array('text' => '' . TEXT_INFO_STATUS_CHANGE . ' ' . tep_date_short($sInfo->date_status_change)); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } } ?> </tr> </table></td> </tr> </table></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Hope this helps!
  23. npereira

    Seperate Pricing Per Customer v3.5

    Somehow, the install instructions are not correct for this MOD as I setup a NEW FRESH OSC install, and copied all the files over the original ones, and the specials is still having issues. Is there a new Version of this mod?
  24. npereira

    Seperate Pricing Per Customer v3.5

    Hello, I installed the latest version of this contrib and everyth9ing seems to be working fine... although the specials.phph file is not working. When trying to access it is days: Parse error: parse error, unexpected $ in /home2/shopott/public_html/specials.php on line 138 The problem is there is no line 138 There is no blank lines after the ?> and no spaces. What could be the problem? Thanks
  25. npereira

    [Contribution]Paypal IPN - Devosc

    Finaly got this working after tickling the app sideways ! LOL I had to delete both currencies, then add the CAD then the USD then set the CAD as default and change the line DEFAULT_LANGUAGE_CURRENCY from USD to CAD and everything come up. My store items are showing the correct pricing and when going to paypal, it is sending the correct amount to paypal also. Thanks all... This was the groosome week I ever had trying to fix this. There should be something in the KB about this potential problem with paypal. Thanks again. Now I have to clean up my files fro some Mods I dont want anymore.... Here we go again, and YES I WILL BACKUP EVERYTHING BEFOREHAND ! LOL Thanks! You Gotta love this software and I will donate to it ! Nelson Pereira Shop.Ott-Motorcycles.ca
×