Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Any word on the step 8 of the Hide prod instructions?

 

What do you mean about the step 8 ? You talk about the file product_listing.php or the file product_listing_col.php ? I think you talk about the product_listing_col.php. Send your code, we will check because I don't see any problem. Do you Column Product Listing (for Separate Pricing Per Costomer v4.0) ?

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Mitch,

 

Ok, the problem you have made is at the beginning of line 91 :

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

You have erased the code for the Quantity price break. The contribution Show price list for SPPC 4.1 is not specific for Quantity price break, It's a stand alone. You have to ajust to work with Quantity Price break. I suggest you to restart without Show price list for SPPC 4.1 and after reinstall it but don't erase the code for quantity price break.

 

Here my code for this line , you can start from there :

 

	$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, NULL as specials_new_products_price, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Good luck

Edited by Jeep_ice

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

What do you mean about the step 8 ? You talk about the file product_listing.php or the file product_listing_col.php ? I think you talk about the product_listing_col.php. Send your code, we will check because I don't see any problem. Do you Column Product Listing (for Separate Pricing Per Costomer v4.0) ?

 

No problem! I actually had 2 problems!

1. After adding hide product for SPPC I no longer see my add to cart button on the product info page. This is the case when either someone is logged in or not. Also when qty is 0 or anything else!

Also, is there a way to have the price field displayed the stock osc way when no one is logged in and use the priceformatter format when someone is logged in?

2. I think it is product_listing_col.php that is now controlling my display because I did implement the Column Product Listing (for Separate Pricing Per Costomer v4.0) as suggested. It is working. I just get 2 prices.

 

Here is my product_listing_col.php code:

 

<?php

/*

original: $Id: product_listing.php,v 1.44 2003/06/09 22:49:43 hpdl Exp $

new: product_listing_col.php modified for SPPC 2005/03/10 Adam Bradley

corrected for proper HTML 2005/07/10 JanZ

*/

 

$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 

if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

<?php

}

 

$list_box_contents = array();

 

if ($listing_split->number_of_rows > 0) {

$row = 0;

$rows = 0;

$column = 0;

$listing_query = tep_db_query($listing_split->sql_query);

// BOF Separate Pricing per Customer

$no_of_listings = tep_db_num_rows($listing_query);

// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 

if(!tep_session_is_registered('sppc_customer_group_id')) {

$customer_group_id = '0';

} else {

$customer_group_id = $sppc_customer_group_id;

}

 

while ($_listing = tep_db_fetch_array($listing_query)) {

$listing[] = $_listing;

$list_of_prdct_ids[] = $_listing['products_id'];

}

// next part is a debug feature, when uncommented it will print the info that this module receives

/*

echo '<pre>';

print_r($listing);

echo '</pre>';

*/

$select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";

if ($no_of_listings > 1) {

for ($n = 1; $n < count($list_of_prdct_ids); $n++) {

$select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";

}

}

 

// get all product prices for products with the particular customer_group_id

// however not necessary for customer_group_id = 0

if ($customer_group_id != '0') {

$pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."' ");

// $no_of_pg_products = tep_db_num_rows($pg_query);

while ($pg_array = tep_db_fetch_array($pg_query)) {

$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '', 'final_price' => $pg_array['price']);

}

for ($x = 0; $x < $no_of_listings; $x++) {

// replace products prices with those from customers_group table

if(!empty($new_prices)) {

for ($i = 0; $i < count($new_prices); $i++) {

if( $listing[$x]['products_id'] == $new_prices[$i]['products_id'] ) {

$listing[$x]['products_price'] = $new_prices[$i]['products_price'];

$listing[$x]['specials_new_products_price'] = $new_prices[$i]['specials_new_products_price'];

$listing[$x]['final_price'] = $new_prices[$i]['final_price'];

}

}

} // end if(!empty($new_prices)

$listing[$x]['specials_new_products_price'] = ''; // makes sure that a retail specials price doesn't carry over to another customer group

$listing[$x]['final_price'] = $listing[$x]['products_price']; // final price should not be the retail special price

} // end for ($x = 0; $x < $no_of_listings; $x++)

} // end if ($customer_group_id != '0')

// an extra query is needed for all the specials

 

$specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "'");

while ($specials_array = tep_db_fetch_array($specials_query)) {

$new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']);

}

 

// add the correct specials_new_products_price and replace final_price

for ($x = 0; $x < $no_of_listings; $x++) {

 

if(!empty($new_s_prices)) {

for ($i = 0; $i < count($new_s_prices); $i++) {

if( $listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {

$listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price'];

$listing[$x]['final_price'] = $new_s_prices[$i]['final_price'];

}

}

} // end if(!empty($new_s_prices)

} // end for ($x = 0; $x < $no_of_listings; $x++)

 

// while ($listing = tep_db_fetch_array($listing_query)) { (was original code)

 

// WARNING the code assumes there are three products per row. To use a different number change the number

// at line 195: if ($column >= 3) and the code to fill up the table row below that accordingly

$counter = $row;

$class_for_buy_now = 'class="productListing-odd"';

$list_box_contents[$row] = array('params' => 'class="productListing-odd"');

for ($x = 0; $x < $no_of_listings; $x++) {

 

$rows++;

 

if (($rows/2) == floor($rows/2) && ($row > $counter)) {

$list_box_contents[$row] = array('params' => 'class="productListing-even"');

$class_for_buy_now = 'class="productListing-even"';

$counter = $row;

} else {

if ($row > $counter) {

$list_box_contents[$row] = array('params' => 'class="productListing-odd"');

$class_for_buy_now = 'class="productListing-odd"';

$counter = $row;

}

}

 

$product_contents = array();

 

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

$lc_align = '';

 

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_align = '';

$lc_text = ' ' . $listing[$x]['products_model'] . ' ';

break;

case 'PRODUCT_LIST_NAME':

$lc_align = '';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>';

} else {

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a> ';

}

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_align = '';

$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a> ';

break;

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

 

if (tep_not_null($listing[$x]['specials_new_products_price'])) {

$lc_text = ' <s>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> ';

} else {

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

// Original code below

// $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

$lc_text = ' ' . (($listing[$x]['products_price'] > 0) ? $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) : '') . ' ';

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

}

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

$lc_text = ' ' . $listing[$x]['products_quantity'] . ' ';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_align = 'right';

$lc_text = ' ' . $listing[$x]['products_weight'] . ' ';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_align = 'center';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

} else {

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

}

break; // EOF Separate Pricing per Customer

case 'PRODUCT_LIST_BUY_NOW':

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

// Original code below

// $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

$lc_text = ' ' . (($listing[$x]['products_price'] > 0) ? $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) : '') . ' ';

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

break;

}

$product_contents[] = $lc_text;

 

}

$lc_text = implode('<br>', $product_contents);

$list_box_contents[$row][$column] = array('align' => 'center',

'params' => 'class="productListing-data"',

'text' => $lc_text);

$column ++;

if ($x == ($no_of_listings -1)) {

// fill up the remainder of the table row with empty cells, assumes three products per row!

if ($column == '1') {

$list_box_contents[$row][$column + 1] = array('align' => 'center',

'params' => 'class="productListing-data"',

'text' => " ");

$column ++;

}

if ($column == '2') {

$list_box_contents[$row][$column + 1] = array('align' => 'center',

'params' => 'class="productListing-data"',

'text' => " ");

}

}

if ($column >= 3 || $x == ($no_of_listings -1) ) {

$row ++; // we start a new tr here with $list_box_contents

$list_box_contents[$row] = array('params' => $class_for_buy_now);

$column = 0;

// make sure three tables per row are filled

if (sizeof($buy_now_button_array) == 1) {

$buy_now_button_array[] = " ";

}

if (sizeof($buy_now_button_array) == 2) {

$buy_now_button_array[] = " ";

}

foreach ((array)$buy_now_button_array as $column1 => $lc_text1) {

$list_box_contents[$row][$column1] = array('align' => 'center',

'params' => 'class="productListing-data"',

'text' => $lc_text1);

}

unset($buy_now_button_array);

$column = 0;

$row ++; // $counter is now smaller than $row, a new $list_box_contents[] (table row) will be started

}

} // end for ($x = 0; $x < $no_of_listings; $x++)

 

new productListingBox($list_box_contents);

} else {

$list_box_contents = array();

 

$list_box_contents[0] = array('params' => 'class="productListing-odd"');

$list_box_contents[0][] = array('params' => 'class="productListing-data"',

'text' => TEXT_NO_PRODUCTS);

 

new productListingBox($list_box_contents);

}

 

if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

<?php

}

?>

Link to comment
Share on other sites

Mitch,

 

Ok, the problem you have made is at the beginning of line 91 :

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

You have erased the code for the Quantity price break. The contribution Show price list for SPPC 4.1 is not specific for Quantity price break, It's a stand alone. You have to ajust to work with Quantity Price break. I suggest you to restart without Show price list for SPPC 4.1 and after reinstall it but don't erase the code for quantity price break.

 

Here my code for this line , you can start from there :

 

	$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, NULL as specials_new_products_price, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Good luck

 

OHH! :-"

I thought that once you all came out with a contribution that works with SPPC, that you all added them to you're own sites to make sure they work with all the SPPC conts. I am glad you told me this because I was going to add all the ones that I say that work with SPPC. You all do a good job with the code and instructions. I will go back and remove the show products. I am not really good enough to modify the SPPC code to work othe SPPC conts. Maybe one day!!!!

 

Thanks for the help! Do you think this will solve my add to carts button issue?

Link to comment
Share on other sites

Mitch,

 

Ok, the problem you have made is at the beginning of line 91 :

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

You have erased the code for the Quantity price break. The contribution Show price list for SPPC 4.1 is not specific for Quantity price break, It's a stand alone. You have to ajust to work with Quantity Price break. I suggest you to restart without Show price list for SPPC 4.1 and after reinstall it but don't erase the code for quantity price break.

 

Here my code for this line , you can start from there :

 

	$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, NULL as specials_new_products_price, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Good luck

 

I replaced the product_info.php code. The price is still showing up twice. I guess the issue is with the priceformatter.php because those and the language files are the only ones I changed for show price list. Are you using show price list, SPPC, price break, and hide products togehter?

 

That did fix my issue with the add to cart button. Not sure where to go from here. The code for the show price list cont. seems to only remove my add to cart button. :(

Link to comment
Share on other sites

I replaced the product_info.php code. The price is still showing up twice. I guess the issue is with the priceformatter.php because those and the language files are the only ones I changed for show price list. Are you using show price list, SPPC, price break, and hide products togehter?

 

That did fix my issue with the add to cart button. Not sure where to go from here. The code for the show price list cont. seems to only remove my add to cart button. :(

 

Yes, i'm using show price list, SPPC, price break, and hide products together ? It's hard to tell you where you got your error. Have you try the file priceformatter.php from show list price contribution ?

 

NB: The contribution show price list is making to work with SPPC 4.11 alone but if you use quantity price break for SPPC, you have to ajust a little the code.

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Jeep-Ice already has this coded. I think I'm the one responsible for holding up the upload of the new contribution. Perhaps he can email you what he has finished.

 

Hello, I have integrated the SPPC into the OSCommerce. It's a great contribution. And, yesterday when I installed the Hide products for cg sppc V103a, I have a problem of log-in. I was kept in the screen "login.php". Until when I restore my original backup of "application_top.php", I can log in and the products are, as expected, hidden from the specific group I preset in the admin section.

 

Now, I wonder if the change in the application_top.php is essential or not, because everything went okay and I didn't find any mistake so far.

 

Here below is my "changed" application_top.php:

 

<?php

/*

$Id: application_top.php,v 1.280 2003/07/12 09:38:07 hpdl Exp $

adapted for Separate Pricing Per Customer v4.1, Hide products from groups mod 2005/04/01

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

// start the timer for the page parse time log

define('PAGE_PARSE_START_TIME', microtime());

 

// set the level of error reporting

error_reporting(E_ALL & ~E_NOTICE);

 

// check if register_globals is enabled.

// since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.

if (function_exists('ini_get')) {

ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');

}

 

// Set the local configuration parameters - mainly for developers

if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

 

// +Country-State Selector

define ('DEFAULT_COUNTRY', '96');

// -Country-State Selector

 

// include server parameters

require('includes/configure.php');

 

if (strlen(DB_SERVER) < 1) {

if (is_dir('install')) {

header('Location: install/index.php');

}

}

 

// define the project version

define('PROJECT_VERSION', 'osCommerce 2.2-MS2');

 

// set the type of request (secure or not)

$request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

 

// set php_self in the local scope

if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];

 

if ($request_type == 'NONSSL') {

define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);

} else {

define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);

}

 

// include the list of project filenames

require(DIR_WS_INCLUDES . 'filenames.php');

 

// include the list of project database tables

require(DIR_WS_INCLUDES . 'database_tables.php');

 

// customization for the design layout

define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

 

// include the database functions

require(DIR_WS_FUNCTIONS . 'database.php');

 

// make a connection to the database... now

tep_db_connect() or die('Unable to connect to database server!');

 

// set the application parameters

$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);

while ($configuration = tep_db_fetch_array($configuration_query)) {

define($configuration['cfgKey'], $configuration['cfgValue']);

}

 

// if gzip_compression is enabled, start to buffer the output

if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) {

if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {

if (PHP_VERSION >= '4.0.4') {

ob_start('ob_gzhandler');

} else {

include(DIR_WS_FUNCTIONS . 'gzip_compression.php');

ob_start();

ob_implicit_flush();

}

} else {

ini_set('zlib.output_compression_level', GZIP_LEVEL);

}

}

 

// set the HTTP GET parameters manually if search_engine_friendly_urls is enabled

if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {

if (strlen(getenv('PATH_INFO')) > 1) {

$GET_array = array();

$PHP_SELF = str_replace(getenv('PATH_INFO'), '', $PHP_SELF);

$vars = explode('/', substr(getenv('PATH_INFO'), 1));

for ($i=0, $n=sizeof($vars); $i<$n; $i++) {

if (strpos($vars[$i], '[]')) {

$GET_array[substr($vars[$i], 0, -2)][] = $vars[$i+1];

} else {

$HTTP_GET_VARS[$vars[$i]] = $vars[$i+1];

}

$i++;

}

 

if (sizeof($GET_array) > 0) {

while (list($key, $value) = each($GET_array)) {

$HTTP_GET_VARS[$key] = $value;

}

}

}

}

 

// faqsdesk

define('DIR_WS_RSS', DIR_WS_INCLUDES . 'modules/faqdesk/rss/');

 

// define general functions used application-wide

require(DIR_WS_FUNCTIONS . 'general.php');

require(DIR_WS_FUNCTIONS . 'html_output.php');

 

// include calendar class

require(DIR_WS_CLASSES . 'calendar.php');

 

// set the cookie domain

$cookie_domain = (($request_type == 'NONSSL') ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN);

$cookie_path = (($request_type == 'NONSSL') ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH);

 

// include cache functions if enabled

if (USE_CACHE == 'true') include(DIR_WS_FUNCTIONS . 'cache.php');

 

// include shopping cart class

require(DIR_WS_CLASSES . 'shopping_cart.php');

 

// include navigation history class

require(DIR_WS_CLASSES . 'navigation_history.php');

 

// some code to solve compatibility issues

require(DIR_WS_FUNCTIONS . 'compatibility.php');

 

// check if sessions are supported, otherwise use the php3 compatible session class

if (!function_exists('session_start')) {

define('PHP_SESSION_NAME', 'osCsid');

define('PHP_SESSION_PATH', $cookie_path);

define('PHP_SESSION_DOMAIN', $cookie_domain);

define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);

 

include(DIR_WS_CLASSES . 'sessions.php');

}

 

// define how the session functions will be used

require(DIR_WS_FUNCTIONS . 'sessions.php');

 

// set the session name and save path

tep_session_name('osCsid');

tep_session_save_path(SESSION_WRITE_DIRECTORY);

 

// set the session cookie parameters

if (function_exists('session_set_cookie_params')) {

session_set_cookie_params(0, $cookie_path, $cookie_domain);

} elseif (function_exists('ini_set')) {

ini_set('session.cookie_lifetime', '0');

ini_set('session.cookie_path', $cookie_path);

ini_set('session.cookie_domain', $cookie_domain);

}

 

// set the session ID if it exists

if (isset($HTTP_POST_VARS[tep_session_name()])) {

tep_session_id($HTTP_POST_VARS[tep_session_name()]);

} elseif ( ($request_type == 'SSL') && isset($HTTP_GET_VARS[tep_session_name()]) ) {

tep_session_id($HTTP_GET_VARS[tep_session_name()]);

}

 

// start the session

$session_started = false;

if (SESSION_FORCE_COOKIE_USE == 'True') {

tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

 

if (isset($HTTP_COOKIE_VARS['cookie_test'])) {

tep_session_start();

$session_started = true;

}

} elseif (SESSION_BLOCK_SPIDERS == 'True') {

$user_agent = strtolower(getenv('HTTP_USER_AGENT'));

$spider_flag = false;

 

if (tep_not_null($user_agent)) {

$spiders = file(DIR_WS_INCLUDES . 'spiders.txt');

 

for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {

if (tep_not_null($spiders[$i])) {

if (is_integer(strpos($user_agent, trim($spiders[$i])))) {

$spider_flag = true;

break;

}

}

}

}

 

if ($spider_flag == false) {

tep_session_start();

$session_started = true;

}

} else {

tep_session_start();

$session_started = true;

}

 

// set SID once, even if empty

$SID = (defined('SID') ? SID : '');

 

// verify the ssl_session_id if the feature is enabled

if ( ($request_type == 'SSL') && (SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($session_started == true) ) {

$ssl_session_id = getenv('SSL_SESSION_ID');

if (!tep_session_is_registered('SSL_SESSION_ID')) {

$SESSION_SSL_ID = $ssl_session_id;

tep_session_register('SESSION_SSL_ID');

}

 

if ($SESSION_SSL_ID != $ssl_session_id) {

tep_session_destroy();

tep_redirect(tep_href_link(FILENAME_SSL_CHECK));

}

}

 

// verify the browser user agent if the feature is enabled

if (SESSION_CHECK_USER_AGENT == 'True') {

$http_user_agent = getenv('HTTP_USER_AGENT');

if (!tep_session_is_registered('SESSION_USER_AGENT')) {

$SESSION_USER_AGENT = $http_user_agent;

tep_session_register('SESSION_USER_AGENT');

}

 

if ($SESSION_USER_AGENT != $http_user_agent) {

tep_session_destroy();

tep_redirect(tep_href_link(FILENAME_LOGIN));

}

}

 

// verify the IP address if the feature is enabled

if (SESSION_CHECK_IP_ADDRESS == 'True') {

$ip_address = tep_get_ip_address();

if (!tep_session_is_registered('SESSION_IP_ADDRESS')) {

$SESSION_IP_ADDRESS = $ip_address;

tep_session_register('SESSION_IP_ADDRESS');

}

 

if ($SESSION_IP_ADDRESS != $ip_address) {

tep_session_destroy();

tep_redirect(tep_href_link(FILENAME_LOGIN));

}

}

 

// set the pollbooth parameters (can be modified through the administration tool)

$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from phesis_poll_config');

 

while ($configuration = tep_db_fetch_array($configuration_query)) {

define($configuration['cfgKey'], $configuration['cfgValue']);

}

// set the pollbooth parameters (can be modified through the administration tool)

 

// create the shopping cart & fix the cart if necesary

if (tep_session_is_registered('cart') && is_object($cart)) {

if (PHP_VERSION < 4) {

$broken_cart = $cart;

$cart = new shoppingCart;

$cart->unserialize($broken_cart);

}

} else {

tep_session_register('cart');

$cart = new shoppingCart;

}

 

// include currencies class and create an instance

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

// include balance_format class and create an instance

// Account Balance Modif

require(DIR_WS_CLASSES . 'balance_format.php');

$balance_format = new balance_format();

// End Account Balance Modif

 

// include the mail classes

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

 

// set the language

if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {

if (!tep_session_is_registered('language')) {

tep_session_register('language');

tep_session_register('languages_id');

}

 

include(DIR_WS_CLASSES . 'language.php');

$lng = new language();

 

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {

$lng->set_language($HTTP_GET_VARS['language']);

} else {

$lng->get_browser_language();

}

 

$language = $lng->language['directory'];

$languages_id = $lng->language['id'];

}

 

// include the language translations

require(DIR_WS_LANGUAGES . $language . '.php');

 

// currency

if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {

if (!tep_session_is_registered('currency')) tep_session_register('currency');

 

if (isset($HTTP_GET_VARS['currency'])) {

if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

} else {

$currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

}

}

 

// navigation history

if (tep_session_is_registered('navigation')) {

if (PHP_VERSION < 4) {

$broken_navigation = $navigation;

$navigation = new navigationHistory;

$navigation->unserialize($broken_navigation);

}

} else {

tep_session_register('navigation');

$navigation = new navigationHistory;

}

$navigation->add_current_page();

 

// BOF Separate Pricing Per Customer v4.1, Hide products from groups mod

 

if(!tep_session_is_registered('sppc_customer_group_id')) {

$customer_group_id = '0';

} else {

$customer_group_id = $sppc_customer_group_id;

}

 

$hide_product = false;

/* the shopping_cart page sends an array 'products_id'. Because with this code

it should not be possible to put a "forbidden" article in the cart we can

assume we can let this slide */

if (isset($HTTP_POST_VARS['products_id']) && !is_array($HTTP_POST_VARS['products_id'])) {

$pid_for_hide = (int)$HTTP_POST_VARS['products_id'];

} elseif (isset($HTTP_GET_VARS['products_id'])) {

$pid_for_hide = (int)$HTTP_GET_VARS['products_id'];

}

if (tep_not_null($pid_for_hide)) {

$hide_query = tep_db_query("select find_in_set('".$customer_group_id."', products_hide_from_groups) as hide_or_not from " . TABLE_PRODUCTS . " p where p.products_id = '" . $pid_for_hide . "'");

$hide_product_array = tep_db_fetch_array($hide_query);

if ( $hide_product_array['hide_or_not'] == '0') {

$hide_product = false;

} else {

$hide_product = true;

}

} // end if (tep_not_null($pid_for_hide))

// EOF Separate Pricing Per Customer v4.1, Hide products from groups mod

 

 

// Shopping cart actions

if (isset($HTTP_GET_VARS['action'])) {

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled

if ($session_started == false) {

tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));

}

 

// BOF Separate Pricing Per Customer v4.1, Hide products from groups mod

if (!$hide_product) { // product does not need to be hidden from the customer group

// EOF Separate Pricing Per Customer v4.1, Hide products from groups mod

 

if (DISPLAY_CART == 'true') {

$goto = FILENAME_SHOPPING_CART;

$parameters = array('action', 'cPath', 'products_id', 'pid');

} else {

$goto = basename($PHP_SELF);

if ($HTTP_GET_VARS['action'] == 'buy_now') {

$parameters = array('action', 'pid', 'products_id');

} else {

$parameters = array('action', 'pid');

}

}

switch ($HTTP_GET_VARS['action']) {

// customer wants to update the product quantity in their shopping cart

case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {

if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {

$cart->remove($HTTP_POST_VARS['products_id'][$i]);

} else {

if (PHP_VERSION < 4) {

// if PHP3, make correction for lack of multidimensional array.

reset($HTTP_POST_VARS);

while (list($key, $value) = each($HTTP_POST_VARS)) {

if (is_array($value)) {

while (list($key2, $value2) = each($value)) {

if (ereg ("(.*)\]\[(.*)", $key2, $var)) {

$id2[$var[1]][$var[2]] = $value2;

}

}

}

}

$attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';

} else {

$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';

}

$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

// customer adds a product from the products page

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

// performed by the 'buy now' button in product listings and review page

case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {

if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

} else {

$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

case 'notify' : if (tep_session_is_registered('customer_id')) {

if (isset($HTTP_GET_VARS['products_id'])) {

$notify = $HTTP_GET_VARS['products_id'];

} elseif (isset($HTTP_GET_VARS['notify'])) {

$notify = $HTTP_GET_VARS['notify'];

} elseif (isset($HTTP_POST_VARS['notify'])) {

$notify = $HTTP_POST_VARS['notify'];

} else {

tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

}

if (!is_array($notify)) $notify = array($notify);

for ($i=0, $n=sizeof($notify); $i<$n; $i++) {

$check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");

$check = tep_db_fetch_array($check_query);

if ($check['count'] < 1) {

tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");

}

}

tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

} else {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

break;

case 'notify_remove' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {

$check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

$check = tep_db_fetch_array($check_query);

if ($check['count'] > 0) {

tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

}

tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));

} else {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

break;

case 'cust_order' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {

if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));

} else {

$cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

}

}

 

//rmh referral start

// set the referral id

if (!tep_session_is_registered('referral_id') || isset($HTTP_GET_VARS['ref'])) {

if (!tep_session_is_registered('referral_id') && !tep_session_is_registered('customer_id')) {

tep_session_register('referral_id');

}

 

if (isset($HTTP_GET_VARS['ref']) && tep_not_null($HTTP_GET_VARS['ref'])) {

$referral_id = $HTTP_GET_VARS['ref'];

} else {

$referral_id = '';

} // end switch

// BOF Separate Pricing Per Customer v4.1, Hide products from groups mod

} else { // $hide_product is true

tep_redirect(tep_href_link(FILENAME_DEFAULT));

}

// EOF Separate Pricing Per Customer v4.1, Hide products from groups mod

} // if (isset($HTTP_GET_VARS['action']))

 

//rmh referral end

 

// include the who's online functions

 

if (basename($PHP_SELF) != FILENAME_EVENTS_CALENDAR_CONTENT){

require(DIR_WS_FUNCTIONS . 'whos_online.php');

tep_update_whos_online();

}

 

//events_calendar

define('FILENAME_EVENTS_CALENDAR', 'events_calendar.php');

define('FILENAME_EVENTS_CALENDAR_CONTENT', 'calendar_content.php');

define('FILENAME_EVENTS_MANAGER', 'events_manager.php');

 

//events_calendar

define('TABLE_EVENTS_CALENDAR', 'events_calendar');

 

// include the password crypto functions

require(DIR_WS_FUNCTIONS . 'password_funcs.php');

 

// include validation functions (right now only email address)

require(DIR_WS_FUNCTIONS . 'validations.php');

 

// split-page-results

require(DIR_WS_CLASSES . 'split_page_results.php');

 

// infobox

require(DIR_WS_CLASSES . 'boxes.php');

// Points/Rewards Module V1.60

require(DIR_WS_FUNCTIONS . 'redemptions.php');

 

// auto activate and expire banners

require(DIR_WS_FUNCTIONS . 'banner.php');

tep_activate_banners();

tep_expire_banners();

 

// auto expire special products

require(DIR_WS_FUNCTIONS . 'specials.php');

tep_expire_specials();

 

// calculate category path

if (isset($HTTP_GET_VARS['cPath'])) {

$cPath = $HTTP_GET_VARS['cPath'];

} elseif (isset($HTTP_GET_VARS['products_id']) && !isset($HTTP_GET_VARS['manufacturers_id'])) {

$cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);

} else {

$cPath = '';

}

 

if (tep_not_null($cPath)) {

$cPath_array = tep_parse_category_path($cPath);

$cPath = implode('_', $cPath_array);

$current_category_id = $cPath_array[(sizeof($cPath_array)-1)];

} else {

$current_category_id = 0;

}

 

// include the breadcrumb class and start the breadcrumb trail

require(DIR_WS_CLASSES . 'breadcrumb.php');

$breadcrumb = new breadcrumb;

 

$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

 

// add category names or the manufacturer name to the breadcrumb trail

if (isset($cPath_array)) {

for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {

$categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");

if (tep_db_num_rows($categories_query) > 0) {

$categories = tep_db_fetch_array($categories_query);

$breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));

} else {

break;

}

}

} elseif (isset($HTTP_GET_VARS['manufacturers_id'])) {

$manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

if (tep_db_num_rows($manufacturers_query)) {

$manufacturers = tep_db_fetch_array($manufacturers_query);

$breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));

}

}

 

// add the products model to the breadcrumb trail

// BOF Separate Pricing Per Customer, Hide products from groups mod

if (isset($HTTP_GET_VARS['products_id'])) {

$model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0");

// EOF Separate Pricing Per Customer, Hide products from groups mod

if (tep_db_num_rows($model_query)) {

$model = tep_db_fetch_array($model_query);

$breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));

}

}

 

// include the articles functions

require(DIR_WS_FUNCTIONS . 'articles.php');

require(DIR_WS_FUNCTIONS . 'article_header_tags.php');

 

// calculate topic path

if (isset($HTTP_GET_VARS['tPath'])) {

$tPath = $HTTP_GET_VARS['tPath'];

} elseif (isset($HTTP_GET_VARS['articles_id']) && !isset($HTTP_GET_VARS['authors_id'])) {

$tPath = tep_get_article_path($HTTP_GET_VARS['articles_id']);

} else {

$tPath = '';

}

 

if (tep_not_null($tPath)) {

$tPath_array = tep_parse_topic_path($tPath);

$tPath = implode('_', $tPath_array);

$current_topic_id = $tPath_array[(sizeof($tPath_array)-1)];

} else {

$current_topic_id = 0;

}

 

// add topic names or the author name to the breadcrumb trail

if (isset($tPath_array)) {

for ($i=0, $n=sizeof($tPath_array); $i<$n; $i++) {

$topics_query = tep_db_query("select topics_name from " . TABLE_TOPICS_DESCRIPTION . " where topics_id = '" . (int)$tPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");

if (tep_db_num_rows($topics_query) > 0) {

$topics = tep_db_fetch_array($topics_query);

$breadcrumb->add($topics['topics_name'], tep_href_link(FILENAME_ARTICLES, 'tPath=' . implode('_', array_slice($tPath_array, 0, ($i+1)))));

} else {

break;

}

}

} elseif (isset($HTTP_GET_VARS['authors_id'])) {

$authors_query = tep_db_query("select authors_name from " . TABLE_AUTHORS . " where authors_id = '" . (int)$HTTP_GET_VARS['authors_id'] . "'");

if (tep_db_num_rows($authors_query)) {

$authors = tep_db_fetch_array($authors_query);

$breadcrumb->add('Articles by ' . $authors['authors_name'], tep_href_link(FILENAME_ARTICLES, 'authors_id=' . $HTTP_GET_VARS['authors_id']));

}

}

 

// add the articles name to the breadcrumb trail

if (isset($HTTP_GET_VARS['articles_id'])) {

$article_query = tep_db_query("select articles_name from " . TABLE_ARTICLES_DESCRIPTION . " where articles_id = '" . (int)$HTTP_GET_VARS['articles_id'] . "'");

if (tep_db_num_rows($article_query)) {

$article = tep_db_fetch_array($article_query);

if (isset($HTTP_GET_VARS['authors_id'])) {

$breadcrumb->add($article['articles_name'], tep_href_link(FILENAME_ARTICLE_INFO, 'authors_id=' . $HTTP_GET_VARS['authors_id'] . '&articles_id=' . $HTTP_GET_VARS['articles_id']));

} else {

$breadcrumb->add($article['articles_name'], tep_href_link(FILENAME_ARTICLE_INFO, 'tPath=' . $tPath . '&articles_id=' . $HTTP_GET_VARS['articles_id']));

}

}

}

 

// add only if Header Tags not already installed

require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');

 

// initialize the message stack for output messages

require(DIR_WS_CLASSES . 'message_stack.php');

$messageStack = new messageStack;

 

// set which precautions should be checked

define('WARN_INSTALL_EXISTENCE', 'true');

define('WARN_CONFIG_WRITEABLE', 'true');

define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true');

define('WARN_SESSION_AUTO_START', 'true');

define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');

 

include('includes/application_top_support.php');

?>

 

It would be a great help if I can really "completed" the installation and continue to work on the site.

Thanks for your attention.

 

James

from Hong Kong

Link to comment
Share on other sites

Yes, i'm using show price list, SPPC, price break, and hide products together ? It's hard to tell you where you got your error. Have you try the file priceformatter.php from show list price contribution ?

 

NB: The contribution show price list is making to work with SPPC 4.11 alone but if you use quantity price break for SPPC, you have to ajust a little the code.

 

Whew! After spending the last 5 hours with my eyes glued to the screen, I have found where I have an issue. I am definitly going to need some help with this one.

OK! Here we go!

I understand that the Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" contribution is suppose to:

1. hide the product price from desired groups and

2. disable the buy now and add to cart buttons.

 

This is good! But,

 

in the instructions in step 8 you say:

 

 

***** ATTENTION *****

 

 

But if you use the contribution "Column Product Listing for SPPC v4.1", Modify the product_listing_col.php instead the product_listing.php and do the following :

 

catalog/includes/modules/product_listing_col.php

 

around line 150 replace the following line:

 

$lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

 

with:

 

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

// Original code below

// $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

$lc_text = ' ' . (($listing[$x]['products_price'] > 0) ? $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) : '') . ' ';

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

 

 

and around line 176 replace the following line:

 

$buy_now_button_array[] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a> ';

$lc_text = ''; // otherwise the price will be shown twice

 

with:

 

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

// Original code below

// $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

$lc_text = ' ' . (($listing[$x]['products_price'] > 0) ? $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) : '') . ' ';

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

 

The highlighted code is the buy now button. For me (i am not sure if anyone else is having this problem) if this is not there, I do not show a buy now button any time for any product. Also, in the highlighted code, the price which I believe to be $lc_text = " will display a price if filled in. In the instructions it says to replace the highlighted section with what is following. The replacement text adds a price field back in.

 

If I comment out the entire replacement code, I do not get a second price field. I also did not replace the $buy now array code but rather added the replacement code below it. This looks like what I should be getting but when I am trying to hide the price/buy button, the buy button is still there. :(

 

The good thing is that it is disabled though.

 

So, any ideas of how I can take the buy now button away from just the products that have a hidden price (for the customers that should not see it only). :huh:

Link to comment
Share on other sites

Whew! After spending the last 5 hours with my eyes glued to the screen, I have found where I have an issue. I am definitly going to need some help with this one.

OK! Here we go!

I understand that the Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" contribution is suppose to:

1. hide the product price from desired groups and

2. disable the buy now and add to cart buttons.

 

This is good! But,

 

in the instructions in step 8 you say:

***** ATTENTION *****

 

 

But if you use the contribution "Column Product Listing for SPPC v4.1", Modify the product_listing_col.php instead the product_listing.php and do the following :

 

catalog/includes/modules/product_listing_col.php

 

around line 150 replace the following line:

 

$lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

 

with:

 

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

// Original code below

// $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

$lc_text = ' ' . (($listing[$x]['products_price'] > 0) ? $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) : '') . ' ';

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

and around line 176 replace the following line:

 

$buy_now_button_array[] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a> ';

$lc_text = ''; // otherwise the price will be shown twice

 

with:

 

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

// Original code below

// $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

$lc_text = ' ' . (($listing[$x]['products_price'] > 0) ? $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) : '') . ' ';

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

 

The highlighted code is the buy now button. For me (i am not sure if anyone else is having this problem) if this is not there, I do not show a buy now button any time for any product. Also, in the highlighted code, the price which I believe to be $lc_text = " will display a price if filled in. In the instructions it says to replace the highlighted section with what is following. The replacement text adds a price field back in.

 

If I comment out the entire replacement code, I do not get a second price field. I also did not replace the $buy now array code but rather added the replacement code below it. This looks like what I should be getting but when I am trying to hide the price/buy button, the buy button is still there. :(

 

The good thing is that it is disabled though.

 

So, any ideas of how I can take the buy now button away from just the products that have a hidden price (for the customers that should not see it only). :huh:

 

Mitch,

 

It's tough to say where you mixed up because if you miss some code in a file, it's will be the mess. Can you send your code for priceformatter.php ? Maybe the answer is there. :-"

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Andy,

 

You have to modify EasyPopulate for working with the group price you have, here what you have to do, just folows the instructions and you gonna have fun with EasyPopulate :

 

Open admin/easypopulate.php and search the following lines :

 

// 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_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++,

 

These line will be commented out. For each customer group you have, uncomment one of the lines... If you have normal prices, and two another price like me, uncomment group id #1 and #2 and #3.

 

After that, a little lower, you can find the text file about sql data. It looks like this :

 

// 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 .'
)'
);
}
if ($v_customer_price_2 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_2 . ',
' . $v_customer_price_2 . ',
' . $v_products_id . ',
' . $v_products_price . '
)'
);
}
if ($v_customer_price_3 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_3 . ',
' . $v_customer_price_3 . ',
' . $v_products_id . ',
' . $v_products_price . '
)'
);
}
if ($v_customer_price_4 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_4 . ',
' . $v_customer_price_4 . ',
' . $v_products_id . ',
' . $v_products_price . '
)'
);
}

}

 

The line ' . $v_products_price . ' is not needed. Erase that whole line. I don't know why commenting the line won't work...but it won't.

 

Anyway, the line above the one you just erased has a comma at the end of it. Erase the comma so that sql knows to start another line.

 

That's it.

Just upload your excel file in admin panel via Easy Populate.

 

I've loaded the easypopulate.php file from the "Easy Populate for SPPC and Hide Products from Customer Groups" Contribution, but when I export the txt file to edit it in excel it doesn't show any of the information for groups or group prices. I've looked through the file and it looks like all the changes that were mentioned above have already been made. I also tried the newest version of Easy Populate with the same modications made and still didn't have any luck. I've Any ideas why it might not be working?

Other Contributions I have installed include SPPC 4.11, Hide products for SPPC, Order Editor 1.75, Image subdirictories, Additional table rate, Admin specials by Categories for SPPC, and STS. I don't think that any of these would effect Easypopulate but still I'm learning PHP and but maybe one of them is...

Any help would be much appreciated. Thanks.

 

Gabe

Link to comment
Share on other sites

I've loaded the easypopulate.php file from the "Easy Populate for SPPC and Hide Products from Customer Groups" Contribution, but when I export the txt file to edit it in excel it doesn't show any of the information for groups or group prices. I've looked through the file and it looks like all the changes that were mentioned above have already been made. I also tried the newest version of Easy Populate with the same modications made and still didn't have any luck. I've Any ideas why it might not be working?

Other Contributions I have installed include SPPC 4.11, Hide products for SPPC, Order Editor 1.75, Image subdirictories, Additional table rate, Admin specials by Categories for SPPC, and STS. I don't think that any of these would effect Easypopulate but still I'm learning PHP and but maybe one of them is...

Any help would be much appreciated. Thanks.

 

Gabe

 

Gabe,

 

It supposed to work, I gave this to four person here in this forum and everybody got it to work. When you export the file from the admin panel in Category in easypopulate sub menu, do you choose "Download Complete tab-delimited .txt file to edit" ? Do you have created Group ?

Edited by Jeep_ice

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Mitch,

 

It's tough to say where you mixed up because if you miss some code in a file, it's will be the mess. Can you send your code for priceformatter.php ? Maybe the answer is there. :-"

 

Ok! Here it is!

 

<?php

/*

$Id: PriceFormatter.php,v 1.6 2003/06/25 08:29:26 petri Exp $

adapted for Separate Pricing Per Customer v4 2005/03/20

including an optimization to avoid double queries for the same info

adapted for Separate Pricing Per Customer v4.1, Hide products from groups mod 2005/03/28

adapted for SPPC v4 to show price list 2005/09/19

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

/*

PriceFormatter.php - module to support quantity pricing

 

Created 2003, Beezle Software based on some code mods by WasaLab Oy (Thanks!)

*/

 

class PriceFormatter {

var $hiPrice;

var $lowPrice;

var $quantity;

var $hasQuantityPrice;

 

function PriceFormatter($prices=NULL) {

$this->productsID = -1;

 

$this->hasQuantityPrice=false;

$this->hasSpecialPrice=false;

 

$this->hiPrice=-1;

$this->lowPrice=-1;

 

for ($i=1; $i<=8; $i++){

$this->quantity[$i] = -1;

$this->prices[$i] = -1;

}

$this->thePrice = -1;

$this->specialPrice = -1;

$this->qtyBlocks = 1;

 

// BOF add customer_group_id/list price

// add list price:

$this->listPrice = '';

$this->cg_id = '0'; // customer_group_id

// EOF add customer_group_id/list price

 

if($prices)

$this->parse($prices);

}

 

function encode() {

$str = $this->productsID . ":"

. (($this->hasQuantityPrice == true) ? "1" : "0") . ":"

. (($this->hasSpecialPrice == true) ? "1" : "0") . ":"

. $this->quantity[1] . ":"

. $this->quantity[2] . ":"

. $this->quantity[3] . ":"

. $this->quantity[4] . ":"

. $this->quantity[5] . ":"

. $this->quantity[6] . ":"

. $this->quantity[7] . ":"

. $this->quantity[8] . ":"

. $this->price[1] . ":"

. $this->price[2] . ":"

. $this->price[3] . ":"

. $this->price[4] . ":"

. $this->price[5] . ":"

. $this->price[6] . ":"

. $this->price[7] . ":"

. $this->price[8] . ":"

. $this->thePrice . ":"

. $this->specialPrice . ":"

. $this->qtyBlocks . ":"

. $this->taxClass;

return $str;

}

 

function decode($str) {

list($this->productsID,

$this->hasQuantityPrice,

$this->hasSpecialPrice,

$this->quantity[1],

$this->quantity[2],

$this->quantity[3],

$this->quantity[4],

$this->quantity[5],

$this->quantity[6],

$this->quantity[7],

$this->quantity[8],

$this->price[1],

$this->price[2],

$this->price[3],

$this->price[4],

$this->price[5],

$this->price[6],

$this->price[7],

$this->price[8],

$this->thePrice,

$this->specialPrice,

$this->qtyBlocks,

$this->taxClass) = explode(":", $str);

 

$this->hasQuantityPrice = (($this->hasQuantityPrice == 1) ? true : false);

$this->hasSpecialPrice = (($this->hasSpecialPrice == 1) ? true : false);

}

 

function parse($prices) {

$this->productsID = $prices['products_id'];

$this->hasQuantityPrice=false;

$this->hasSpecialPrice=false;

 

$this->quantity[1]=$prices['products_price1_qty'];

$this->quantity[2]=$prices['products_price2_qty'];

$this->quantity[3]=$prices['products_price3_qty'];

$this->quantity[4]=$prices['products_price4_qty'];

$this->quantity[5]=$prices['products_price5_qty'];

$this->quantity[6]=$prices['products_price6_qty'];

$this->quantity[7]=$prices['products_price7_qty'];

$this->quantity[8]=$prices['products_price8_qty'];

 

$this->thePrice=$prices['products_price'];

$this->specialPrice=$prices['specials_new_products_price'];

$this->hasSpecialPrice=tep_not_null($this->specialPrice);

 

$this->price[1]=$prices['products_price1'];

$this->price[2]=$prices['products_price2'];

$this->price[3]=$prices['products_price3'];

$this->price[4]=$prices['products_price4'];

$this->price[5]=$prices['products_price5'];

$this->price[6]=$prices['products_price6'];

$this->price[7]=$prices['products_price7'];

$this->price[8]=$prices['products_price8'];

 

 

/*

Change support special prices

If any price level has a price greater than the special

price lower it to the special price

*/

if ($this->hasSpecialPrice == true) {

for($i=1; $i<=8; $i++) {

if ($this->price[$i] > $this->specialPrice)

$this->price[$i] = $this->specialPrice;

}

}

//end changes to support special prices

 

$this->qtyBlocks=$prices['products_qty_blocks'];

 

$this->taxClass=$prices['products_tax_class_id'];

 

if ($this->quantity[1] > 0) {

$this->hasQuantityPrice = true;

$this->hiPrice = $this->thePrice;

$this->lowPrice = $this->thePrice;

 

for($i=1; $i<=8; $i++) {

if($this->quantity[$i] > 0) {

if ($this->price[$i] > $this->hiPrice) {

$this->hiPrice = $this->price[$i];

}

if ($this->price[$i] < $this->lowPrice) {

$this->lowPrice = $this->price[$i];

}

}

}

}

// BOF add customer_group_id/list price

global $sppc_customer_group_id;

if(!tep_session_is_registered('sppc_customer_group_id')) {

$this->cg_id = '0';

} else {

$this->cg_id = $sppc_customer_group_id;

}

$this->listPrice = $prices['list_price'];

// EOF add customer_group_id/list price

}

// function loadProductSppc is Separate Pricing Per Customer only

function loadProductSppc($product_id, $language_id=1, $product_info)

{

 

global $sppc_customer_group_id;

if(!tep_session_is_registered('sppc_customer_group_id')) {

$customer_group_id = '0';

} else {

$customer_group_id = $sppc_customer_group_id;

}

// BOF add List Price (retail price) to the product_info array

$product_info['list_price'] = $product_info['products_price'];

// EOF add List Price

if ($customer_group_id != '0') {

$customer_group_price_query = tep_db_query("select customers_group_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$product_id. "' and customers_group_id = '" . $customer_group_id . "'");

 

if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {

$product_info['products_price']= $customer_group_price['customers_group_price'];

for ($i = 1 ; $i < 9 ; $i++) {

$product_info['products_price'.$i.''] = $customer_group_price['products_price'.$i.''];

$product_info['products_price'.$i.'_qty'] = $customer_group_price['products_price'.$i.'_qty'];

} // end if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))

$product_info['products_qty_blocks'] = $customer_group_price['products_qty_blocks'];

} else { // there is no price for the item in products_groups: retail price breaks need to nulled

for ($i = 1 ; $i < 9 ; $i++) {

$product_info['products_price'.$i.''] = '0.0000';

$product_info['products_price'.$i.'_qty'] = '0';

} // end if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))

$product_info['products_qty_blocks'] = '1';

}

} // end if ($customer_group_id != '0')

// now get the specials price for this customer_group and add it to product_info array

$special_price_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = " . (int)$product_id . " and status ='1' and customers_group_id = '" . $customer_group_id . "'");

if ($specials_price = tep_db_fetch_array($special_price_query)) {

$product_info['specials_new_products_price'] = $specials_price['specials_new_products_price'];

}

 

$this->parse($product_info);

return $product_info;

}

 

function loadProduct($product_id, $language_id=1)

{

global $sppc_customer_group_id;

if(!tep_session_is_registered('sppc_customer_group_id')) {

$customer_group_id = '0';

} else {

$customer_group_id = $sppc_customer_group_id;

}

 

$sql = "select pd.products_name, p.products_model, p.products_image, p.products_id," .

" p.products_price, p.products_weight," .

" p.products_price1,p.products_price2,p.products_price3,p.products_price4, p.products_price5,p.products_price6,p.products_price7,p.products_price8," .

" p.products_price1_qty,p.products_price2_qty,p.products_price3_qty,p.products_pri

ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri

ce8_qty," .

" p.products_qty_blocks," .

" p.products_tax_class_id," .

" NULL as specials_new_products_price" .

" from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .

" " . TABLE_PRODUCTS . " p" .

" where p.products_status = '1'" .

" and p.products_id = '" . (int)$product_id . "'" .

" and pd.products_id = '" . (int)$product_id . "'" .

" and pd.language_id = '". (int)$language_id ."'";

 

$product_info_query = tep_db_query($sql);

$product_info = tep_db_fetch_array($product_info_query);

// BOF add List Price (retail price) to the product_info array

$product_info['list_price'] = $product_info['products_price'];

// EOF add List Price

 

if ($customer_group_id != '0') {

$customer_group_price_query = tep_db_query("select customers_group_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$product_id. "' and customers_group_id = '" . $customer_group_id . "'");

 

if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {

$product_info['products_price']= $customer_group_price['customers_group_price'];

for ($i = 1 ; $i < 9 ; $i++) {

$product_info['products_price'.$i.''] = $customer_group_price['products_price'.$i.''];

$product_info['products_price'.$i.'_qty'] = $customer_group_price['products_price'.$i.'_qty'];

} // end if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))

$product_info['products_qty_blocks'] = $customer_group_price['products_qty_blocks'];

} else { // there is no price for the item in products_groups: retail price breaks need to nulled

for ($i = 1 ; $i < 9 ; $i++) {

$product_info['products_price'.$i.''] = '0.0000';

$product_info['products_price'.$i.'_qty'] = '0';

} // end if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))

$product_info['products_qty_blocks'] = '1';

}

} // end if ($customer_group_id != '0')

// now get the specials price for this customer_group and add it to product_info array

$special_price_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = " . (int)$product_id . " and status ='1' and customers_group_id = '" . $customer_group_id . "'");

if ($specials_price = tep_db_fetch_array($special_price_query)) {

$product_info['specials_new_products_price'] = $specials_price['specials_new_products_price'];

}

 

$this->parse($product_info);

return $product_info;

}

 

function computePrice($qty)

{

$qty = $this->adjustQty($qty);

 

// Compute base price, taking into account the possibility of a special

$price = ($this->hasSpecialPrice === TRUE) ? $this->specialPrice : $this->thePrice;

 

for ($i=1; $i<=8; $i++)

if (($this->quantity[$i] > 0) && ($qty >= $this->quantity[$i]))

$price = $this->price[$i];

 

return $price;

}

 

function adjustQty($qty) {

// Force QTY_BLOCKS granularity

$qb = $this->getQtyBlocks();

if ($qty < 1)

$qty = 1;

 

if ($qb >= 1)

{

if ($qty < $qb)

$qty = $qb;

 

if (($qty % $qb) != 0)

$qty += ($qb - ($qty % $qb));

}

return $qty;

}

 

function getQtyBlocks() {

return $this->qtyBlocks;

}

 

function getPrice() {

return $this->thePrice;

}

 

function getLowPrice() {

return $this->lowPrice;

}

 

function getHiPrice() {

return $this->hiPrice;

}

 

function hasSpecialPrice() {

return $this->hasSpecialPrice;

}

 

function hasQuantityPrice() {

return $this->hasQuantityPrice;

}

 

function getPriceString($style='productPriceInBox') {

global $currencies;

 

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

if ($this->thePrice > 0 ) {

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

if ($this->hasSpecialPrice == true) {

$lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';

// BOF add list price NOTE: since only the special price for the customer group

// is queried, the retail special price is not known

if ($this->cg_id > 0) {

$lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">' . SHOW_PRICE_LIST

. $currencies->display_price($this->listPrice,

tep_get_tax_rate($this->taxClass))

. '</td></tr>';

} // end if ($this->cg_id > 0)

$lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">';

$lc_text .= ' <s>'

. $currencies->display_price($this->thePrice,

tep_get_tax_rate($this->taxClass))

. '</s>  <span class="productSpecialPrice">'

. $currencies->display_price($this->specialPrice,

tep_get_tax_rate($this->taxClass))

. '</span> '

.'</td></tr>';

}

else

{

$lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';

// BOF add list price

if ($this->cg_id > 0) {

$lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">' . SHOW_PRICE_LIST

. $currencies->display_price($this->listPrice,

tep_get_tax_rate($this->taxClass))

. '</td></tr>';

} // end if ($this->cg_id > 0)

$lc_text .= '<tr><td align="left" class=' . $style. ' colspan="2">';

if ($this->cg_id > 0) {

$lc_text .= SHOW_YOUR_PRICE;

}

$lc_text .= $currencies->display_price($this->thePrice,

tep_get_tax_rate($this->taxClass))

. '</td></tr>';

// EOF add list price

}

// If you want to change the format of the price/quantity table

// displayed on the product information page, here is where you do it.

 

if($this->hasQuantityPrice == true) {

for($i=1; $i<=8; $i++) {

if($this->quantity[$i] > 0) {

$lc_text .= '<tr><td class='.$style.'>'

. $this->quantity[$i]

.'+ </td><td class='.$style.'>'

. $currencies->display_price($this->price[$i],

tep_get_tax_rate($this->taxClass))

.'</td></tr>';

}

}

 

$lc_text .= '</table>';

 

}

else {

if ($this->hasSpecialPrice == true) {

// BOF add list price

$lc_text = '';

if ($this->cg_id > 0) {

$lc_text .= '<span class="smallText">' . SHOW_PRICE_LIST;

$lc_text .= $currencies->display_price($this->listPrice,

tep_get_tax_rate($this->taxClass));

$lc_text .= '</span><br />' . SHOW_PRICE_LIST;

} // end if ($this->cg_id > 0)

$lc_text .= ' <s>'

// EOF add list price

. $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass))

. '</s>  <span class="productSpecialPrice">'

. $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass))

. '</span> ';

}

else {

// BOF add list price

$lc_text = '';

if ($this->cg_id > 0) {

$lc_text .= '<span class="smallText">' . SHOW_PRICE_LIST;

$lc_text .= $currencies->display_price($this->listPrice,

tep_get_tax_rate($this->taxClass));

$lc_text .= '</span><br />' . SHOW_YOUR_PRICE;

} // end if ($this->cg_id > 0)

$lc_text .= ' '

// EOF add list price

. $currencies->display_price($this->thePrice,

tep_get_tax_rate($this->taxClass))

. ' ';

}

}

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

} else {

$lc_text = HIDE_PRICE_INFO ;

}

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

return $lc_text;

}

 

function getPriceStringShort() {

global $currencies;

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

if ($this->thePrice > 0 ) {

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

 

if ($this->hasSpecialPrice == true) {

$lc_text = ' <s>'

. $currencies->display_price($this->thePrice,

tep_get_tax_rate($this->taxClass))

. '</s>  <span class="productSpecialPrice">'

. $currencies->display_price($this->specialPrice,

tep_get_tax_rate($this->taxClass))

. '</span> ';

}

else {

if($this->hasQuantityPrice == true) {

$lc_text = ' '

. $currencies->display_price($this->lowPrice,

tep_get_tax_rate($this->taxClass))

. ' - '

. $currencies->display_price($this->hiPrice,

tep_get_tax_rate($this->taxClass))

. ' ';

}

else {

$lc_text = ' '

. $currencies->display_price($this->thePrice,

tep_get_tax_rate($this->taxClass))

. ' ';

}

}

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

} else {

$lc_text = HIDE_PRICE_INFO ;

}

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

return $lc_text;

}

}

 

?>

Link to comment
Share on other sites

This is good! But,

 

in the instructions in step 8 you say:

***** ATTENTION *****

 

But if you use the contribution "Column Product Listing for SPPC v4.1", Modify the product_listing_col.php instead the product_listing.php and do the following :

 

catalog/includes/modules/product_listing_col.php

 

around line 150 replace the following line:

 

$lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

 

with:

 

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

// Original code below

// $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

$lc_text = ' ' . (($listing[$x]['products_price'] > 0) ? $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) : '') . ' ';

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

and around line 176 replace the following line:

 

$buy_now_button_array[] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a> ';

$lc_text = ''; // otherwise the price will be shown twice

 

with:

 

// BOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

// Original code below

// $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';

$lc_text = ' ' . (($listing[$x]['products_price'] > 0) ? $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) : '') . ' ';

// EOF "Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" modification

 

The highlighted code is the buy now button. For me (i am not sure if anyone else is having this problem) if this is not there, I do not show a buy now button any time for any product. Also, in the highlighted code, the price which I believe to be $lc_text = " will display a price if filled in. In the instructions it says to replace the highlighted section with what is following. The replacement text adds a price field back in.

 

If I comment out the entire replacement code, I do not get a second price field. I also did not replace the $buy now array code but rather added the replacement code below it. This looks like what I should be getting but when I am trying to hide the price/buy button, the buy button is still there. :(

 

The good thing is that it is disabled though.

 

So, any ideas of how I can take the buy now button away from just the products that have a hidden price (for the customers that should not see it only). :huh:

 

Mitch,

 

Very sorry. I just decide to check my file instruct and have see that I've made an error in the instruction file in Step 8. I have made waste your time, I should have looked at all the first time that you said it to me. It's a stupid error of Copy and Paste of my side. Shame on me. :blush:

 

Here the fix for the second part of the file catalog/includes/modules/product_listing_col.php :

 

and around line 176 replace the following line:

 

$buy_now_button_array[] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a> ';

$lc_text = ''; // otherwise the price will be shown twice

 

with:

 

// BOF "Hide Price if $0 for SPPC 4.1.1"

// Original code below

// $buy_now_button_array[] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a> ';

// $lc_text = ''; // otherwise the price will be shown twice

$buy_now_button_array[] = (($listing[$x]['products_price'] > 0) ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a>' : '<B>'. HIDE_PRICE_INFO .'</B>');

$lc_text = ''; // otherwise the price will be shown twice

// EOF "Hide Price if $0 for SPPC 4.1.1"

 

I have uploaded the fix in the contribution file and give you credit to find this bug. Excuse me again. :-"

Edited by Jeep_ice

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Hi....

 

You don't supposed to see "your price " if you not logged. Please send your code of your product_info.php here and we will check what is the problem.

 

Ok, And now to fix your bug about "Show Price list for SPPC 4.1" to be compatible with "Quantity Price Breaks for SPPC 4.1.1" and "Hide Price if 0$ for Quantity Price Breaks for SPPC 4.1" do the following :

 

Don't edit the file catalog/product_info.php like it say in "Show Price list for SPPC 4.1" instruction because all is controlled in the file PriceFormatter.php. Just copy the file PriceFormatter.php included in this package and overwrite the file in catalog/includes/classes. That's it, you all set. If you want to use "Hide price if 0$ for SPPC 4.1.1" with "Show Price List for SPPC 4.1.1" for "Quantity Price break for 4.11". Edit the file PriceFormatter.php and follow the instruction in the contribution "Hide Price if 0$ for Quantity Price Breaks for SPPC 4.1". It's the good order to let all the file to be compatible between them. Ouf. Capish !!!! I will update the contribution "Show Price list for SPPC 4.1" for supported all these contribution.

 

NB: With all these edit, you not going to see your price if not login.

 

Have fun. :thumbsup:

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

All, I uploaded a new version of Seperate Pricing Per Customer.

Some bug fixes I found when installing on my new copy of 2.2MS2 and a MAJOR OPTIONAL improvement -- I needed the functionality of having special prices for each group.

I think all the code is good -- I have spent the day testing. If you find something doesn't work on your install, or perhaps I missed something, let me know. (email: scott AT everson D0T ws)

Here are the notes:

Updated by Scott Everson (scott AT everson DOT ws), 08/02/2003

Bug fixes:

-Added in mod to products_new.php (so correct price displayed in new products list)

-Adjusted location of mod in modules/product_listing.php

-Changed $product_info_values[] to $product_info[] in product_info.php mod. My 2.2MS2 used the $product_info[] array.

Improvements:

-Added option mod to support special prices per group. This means that you can create a special price for your 'Retail' group and only customers in that group will see the special price. Create a special price for your 'Wholesale' group and only customers in that group will see the special price. Special prices will not default.. meaning if there is no special price for 'Wholesale' but there is one for 'Retail' your wholesale customer will NOT BE SHOWN the retail special price.

More info: When you add special prices, you will see the prices for each group next to the product title. It a price/group is missing, it is because a special price for that prodcut/group already exists. If the product is missing, it is because there is already a special price for all groups.

I am willing to offer support for this MOD and version 2.2MS2.

Link to comment
Share on other sites

SPPC states

 

 

If you don't use ACA (contribution 2611), you don't need this module. You can also start using ACA:

 

 

Does this mean that ACA 2611 is required?

 

Or merely that is you were using 2611 then 716 will be even better?

 

Can I simply install 716 as is and not bother 2611?

 

Or is 2611 needed in order to provide the sub-classes of level for clients to see the difference prices?

My Contributions

 

Henry Smith

Link to comment
Share on other sites

Mitch,

 

Very sorry. I just decide to check my file instruct and have see that I've made an error in the instruction file in Step 8. I have made waste your time, I should have looked at all the first time that you said it to me. It's a stupid error of Copy and Paste of my side. Shame on me. :blush:

 

Here the fix for the second part of the file catalog/includes/modules/product_listing_col.php :

 

and around line 176 replace the following line:

 

$buy_now_button_array[] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a> ';

$lc_text = ''; // otherwise the price will be shown twice

 

with:

 

// BOF "Hide Price if $0 for SPPC 4.1.1"

// Original code below

// $buy_now_button_array[] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a> ';

// $lc_text = ''; // otherwise the price will be shown twice

$buy_now_button_array[] = (($listing[$x]['products_price'] > 0) ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a>' : '<B>'. HIDE_PRICE_INFO .'</B>');

$lc_text = ''; // otherwise the price will be shown twice

// EOF "Hide Price if $0 for SPPC 4.1.1"

 

I have uploaded the fix in the contribution file and give you credit to find this bug. Excuse me again. :-"

 

No Problem! Like I said this contribution is very useful to me. I appreciate you putting it out there and helping me get it working for me.

 

It is working perfectly!!! :D

Link to comment
Share on other sites

Ok, And now to fix your bug about "Show Price list for SPPC 4.1" to be compatible with "Quantity Price Breaks for SPPC 4.1.1" and "Hide Price if 0$ for Quantity Price Breaks for SPPC 4.1" do the following :

 

Don't edit the file catalog/product_info.php like it say in "Show Price list for SPPC 4.1" instruction because all is controlled in the file PriceFormatter.php. Just copy the file PriceFormatter.php included in this package and overwrite the file in catalog/includes/classes. That's it, you all set. If you want to use "Hide price if 0$ for SPPC 4.1.1" with "Show Price List for SPPC 4.1.1" for "Quantity Price break for 4.11". Edit the file PriceFormatter.php and follow the instruction in the contribution "Hide Price if 0$ for Quantity Price Breaks for SPPC 4.1". It's the good order to let all the file to be compatible between them. Ouf. Capish !!!! I will update the contribution "Show Price list for SPPC 4.1" for supported all these contribution.

 

NB: With all these edit, you not going to see your price if not login.

 

Have fun. :thumbsup:

 

I Modified the priceformatter.php. It seems to work like a charm now!

Again, thanks for all you help!

Link to comment
Share on other sites

Hi,

 

I am having trouble with the customers page with the contrib. The problem is say I go to edit a customers detail and insert a company tax id. This doesnt seem to be inserting into the database.

 

Also does anyone know how to make this work with the order editor contrib.

 

Any help is much appreciated

 

thanks

kris

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Link to comment
Share on other sites

Hi,

 

I am having trouble with the customers page with the contrib. The problem is say I go to edit a customers detail and insert a company tax id. This doesnt seem to be inserting into the database.

 

Also does anyone know how to make this work with the order editor contrib.

 

Any help is much appreciated

 

thanks

kris

 

I once had a similar problem with categories.php not saving updated prices. It was because I had not modified the page properly.

 

Odds are there is some error with your customers.php file. Did you upload a raw file that came with the contribution or did you modify the file by hand?

 

Also, there is no version of Order Editor that incorporates SPPC that I know of. I personally would like a version that works with SPPC and MVS, but, as Mick would say, you can't always get what you want.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Any idea on when SPPC will be updated for the latest release of osC? I'm sorry to be a PITA, but I still have not been able to fix my problem mentioned HERE. I've tried to figure out the query statements myself, but they're just too complex for my brain. Please help.

Happiness does not come from doing easy work but from the afterglow of satisfaction that comes after the achievement of a difficult task that demanded our best. --Anonymous

Link to comment
Share on other sites

Any idea on when SPPC will be updated for the latest release of osC? I'm sorry to be a PITA, but I still have not been able to fix my problem mentioned HERE. I've tried to figure out the query statements myself, but they're just too complex for my brain. Please help.

 

It looks like the sections you're having trouble with are the parts that update for MySQL 5.0. Does your webhost currently use MySQL 5.0? If not I would think you could avoid these difficulties, at least for the time being, by not applying this portion of the update.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

SPPC states: If you don't use ACA (contribution 2611), you don't need this module. You can also start using ACA. Does this mean that ACA 2611 is required?

answer: no, it is not required for SPPC

Or merely that is you were using 2611 then 716 will be even better?

answer: no, if you use ACA2 [2611] then the ACA2 module for SPPC [716; 10/1/06 zip] will make installation of SPPC [716; 20/3/05 zip minus the admin/categories.php] a lot easier.

Can I simply install 716 as is and not bother 2611?

answer: yes, you can install SPPC [716; 20/3/05 zip] w/o 'bothering' with ACA2 [2611] and the SPPC ACA2 module [716; 10/1/06 zip]

Or is 2611 needed in order to provide the sub-classes of level for clients to see the difference prices?

Answer: No, it's not that complicated, it's supposed to make your life easier.

 

 

Please read Rigadin's instructions of ACA2 [2611] and SPPC ACA2 module [716; 10/1/06 zip] and the reason for using ACA2 for SPPC and many other contributions should become clearer to you.

 

My advice is this:

 

Scenario A - Your shop is unmodified or admin/categories.php is (relatively) untouched.

Start by installling ACA2! Unpack ACA2 [2611], read instructions and install. Then install SPPC [716; 20/3/05 zip minus the admin/categories.php], followed by the ACA2 module for SPPC [716; 10/1/06 zip] and activation of SPPC from the panel in admin and Bob's your uncle!

 

Scenario B - Your shop is heavily modified already w/o ACA or ACA2

 

In this case you're a pro and should start straight away with installing SPPC [716; 20/3/05 zip]

 

Good luck,

Skylla

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...