Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Hi!

 

I`m having a major problem here. Im trying to fix a new look on the product listing, but can`t figure out how. I`ve got so far that i get the new look up and running, but it repeats the 1 product in the categorie. For example, product nr. 3 in the categorie will show product nr. 1 Image, shortdescription, model ++. Same with product 2,3,4,5 and so on.

Picture of the problem:

problem.jpg

 

Can anyone help me figure out?

 

This is the coding of the work ive done so far:

<?php

/*

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

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

$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();

 

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

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_text = TABLE_HEADING_MODEL;

$lc_align = '';

break;

case 'PRODUCT_LIST_NAME':

$lc_text = TABLE_HEADING_PRODUCTS;

$lc_align = '';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_text = TABLE_HEADING_MANUFACTURER;

$lc_align = '';

break;

case 'PRODUCT_LIST_PRICE':

$lc_text = TABLE_HEADING_PRICE;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_text = TABLE_HEADING_QUANTITY;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_text = TABLE_HEADING_WEIGHT;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_text = TABLE_HEADING_IMAGE;

$lc_align = 'center';

break;

case 'PRODUCT_LIST_BUY_NOW':

$lc_text = TABLE_HEADING_BUY_NOW;

$lc_align = 'center';

break;

}

 

if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {

$lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);

}

 

$list_box_contents[0][] = array('align' => $lc_align,

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

'text' => ' ' . $lc_text . ' ');

}

 

if ($listing_split->number_of_rows > 0) {

 

$rows = 0;

$column = 0;

echo '

 

<table cellspacing=0 cellpadding=0 width=559>

<tr><td colspan=3 align=center>

<table cellspacing=0 cellpadding=0 width=534 align=center>

<tr><td height=8></td></tr>

<tr><td colspan=3 height=20> <span class=ch3>Categories /</span>   <span class=ch5>'.$breadcrumb->trail(' » ').'</span></td></tr>

<tr><td height=3></td></tr>

<tr><td colspan=3 bgcolor=#000000 height=3></td></tr>

<tr><td height=11></td></tr>

<tr>

 

 

';

 

$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 (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {

$customer_group_id = $_SESSION['sppc_customer_group_id'];

} else {

$customer_group_id = '0';

}

 

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);

$product_contents = array();

echo '</pre>';

*/

 

// 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 products_id in (" . implode(',', $list_of_prdct_ids) . ") and pg.customers_group_id = '" . $customer_group_id . "'");

 

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]['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 products_id in (" . implode(',', $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)

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

$rows++;

 

if (($rows/2) == floor($rows/2)) {

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

} else {

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

}

 

$cur_row = sizeof($list_box_contents) - 1;

 

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 class=ml7 href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '"><b>' . $listing[$x]['products_name'] . '</a></b><br>' . $listing[$x]['short_desc'] . '</b>';

} else {

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

 

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 = '<span class=ch8 style="padding-right:0px; color:#7F7F7F;font-size:11px"><s>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s></span><br><span class=ch8>' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span>';

} else {

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

}

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;

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

break;

}

 

$list_box_contents[$cur_row][] = array('align' => $lc_align,

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

'text' => $lc_text);

$product_contents[] = $lc_text;

}

 

 

$product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing[$x]['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

$product = tep_db_fetch_array($product_query);

$new_products['products_description'] = $product['products_description'];

// get products category

$categories_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$listing[$x]['products_id'] . "'");

if (tep_db_num_rows($categories_query) > 0) {

$categories = tep_db_fetch_array($categories_query);

$categories_query2 = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$categories['categories_id'] . "'");

$categories2 = tep_db_fetch_array($categories_query2);

$category_name = $categories2['categories_name'];

} else {

$category_name = '';

}

 

 

echo '

 

<td width=267 valign=top align=center>

<table cellspacing=0 cellpadding=0 width=225 align=center>

<tr><td height=2></td></tr>

<tr><td width=128 valign=top align=center>'. $product_contents[0] . '<br><b>' . $product_contents[2] . '</b>' .'</td>

<td width=98 valign=top>

<table cellspacing=0 cellpadding=0>

<tr><td height=45 align=center>'.$product_contents[1] .'</td></tr>

<tr><td height=2></td></tr>

<tr><td height=0></td></tr>

<tr><td align=center valign=bottom><br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_in_cart.gif') . '</a><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('small_view.gif') . '</a></td></tr>

</table>

</td></tr>

<tr><td height=11></td></tr>

</table>

</td>

 

';

$column ++;

if ($column >= 2) {

$rows ++;

$column = 0;

echo '

 

</tr>

<tr><td background=images/m18.gif colspan=3 height=1></td></tr>

<tr>

 

 

 

';

} else echo '

<td background=images/m17.gif width=1><table cellspacing=0 cellpadding=0 width=1><tr>

<td background=images/m17.gif width=1></td></tr></table>

';

 

 

 

}

 

echo '

 

</tr>

</table>

</td></tr>

</table>

 

 

 

 

';

 

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);

 

echo '<div class=PageHeading>Categories</div>';

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 height=2></td></tr>

<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

}

?>

 

Thanks,

Stian

Link to comment
Share on other sites

I have been working on getting a quantity box next to the "Buy Now" button on the product listings page.

 

I have tried several methods that have worked for stores without this contribution, but I haven't been able to get it to function with the contribution... Has anyone with the Separate Pricing per Customer contribution been able to get this to work?

 

I have the quantity boxes showing up and it adds to the cart, but it still adds only one product.

 

Thanks.

Edited by straitline
Link to comment
Share on other sites

I`m having a major problem here. Im trying to fix a new look on the product listing, but can`t figure out how. I`ve got so far that i get the new look up and running, but it repeats the 1 product in the categorie. For example, product nr. 3 in the categorie will show product nr. 1 Image, shortdescription, model ++. Same with product 2,3,4,5 and so on.

I think the problem is that the resetting of the array products_contents does no longer work because it was left somewhere inside the php comment tags here:

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);
$product_contents = array(); // inside the PHP comment tags
echo '</pre>';
*/

I think you need to move it to:

// while ($listing = tep_db_fetch_array($listing_query)) { (was original code)
for ($x = 0; $x < $no_of_listings; $x++) {
$product_contents = array(); // I think you need it here
$rows++;

Additionally, the $product_contents[1] and $product_contents[2] should probably filled with the products description and category name but it is missing in your code.

Link to comment
Share on other sites

I think the problem is that the resetting of the array products_contents does no longer work because it was left somewhere inside the php comment tags here:

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);
$product_contents = array(); // inside the PHP comment tags
echo '</pre>';
*/

I think you need to move it to:

// while ($listing = tep_db_fetch_array($listing_query)) { (was original code)
for ($x = 0; $x < $no_of_listings; $x++) {
$product_contents = array(); // I think you need it here
$rows++;

Additionally, the $product_contents[1] and $product_contents[2] should probably filled with the products description and category name but it is missing in your code.

 

Hi Jan!

 

Thanks for the reply. I Figured out where to put the $product_contents = array();, not where you say but might work, havent tried. I moved it to this location:

</td>

 

';

$product_contents = array();

$column ++;

if ($column >= 2) {

$rows ++;

$column = 0;

And works great now :)

Link to comment
Share on other sites

I'm having this same issue doing an advanced search in a price range. the store runs on php 5 and mysql 5. osc v2.2, rc 2, sppc v4.2.2. I've checked the code and don't see anything amiss. Any suggestions?

 

 

I can't replicate that error but I'm using MySQL5. Perhaps you use MySQL4?

 

Try to find that query and instead of

manufacturers m using(manufacturers_id) left join products_group_prices_cg_1 as tmp_pp using(products_id)

try

manufacturers m using(manufacturers_id) left join products_group_prices_cg_1 as tmp_pp on tmp_pp.products_id=p.products_id

There was something with MySQL4 and having "using()" in the query but I don't recall if it was that particular error.

Link to comment
Share on other sites

  • 3 weeks later...

Where did weight in product description go?

 

I added Separate Pricing Per Customer V4.2.2 and Quantity Price Breaks Per Product V2.00 about a week ago while developing a new OScommerce application. I have only one problem with the install and it took me a while to notice it, since I have been adding many add-ons. The weight field of the product is now missing while adding or editing a new product, in administration>catalog>products, therefore my shipping per calculated weight is all messed up. How can I add weight to a product using this contribution? Is there anywhere I should be looking to see if I made an error modifying the files? Note: non of the other add-ons I installed should have effected this other than this contribution.

 

Thanks

Link to comment
Share on other sites

Where did weight in product description go?

 

I added Separate Pricing Per Customer V4.2.2 and Quantity Price Breaks Per Product V2.00 about a week ago while developing a new OScommerce application. I have only one problem with the install and it took me a while to notice it, since I have been adding many add-ons. The weight field of the product is now missing while adding or editing a new product, in administration>catalog>products, therefore my shipping per calculated weight is all messed up. How can I add weight to a product using this contribution? Is there anywhere I should be looking to see if I made an error modifying the files? Note: non of the other add-ons I installed should have effected this other than this contribution.

Those two contributions add a lot of code in that file. My guess is something went wrong when adding them. Did you compare your file with the admin/categories.php file in QPBPP for SPPC (the weight part is just below the product description)?

Link to comment
Share on other sites

Those two contributions add a lot of code in that file. My guess is something went wrong when adding them. Did you compare your file with the admin/categories.php file in QPBPP for SPPC (the weight part is just below the product description)?

Thanks! I used diffmerge to compare the two files and found a couple of lines of code were missing and that did the trick. I wasn't sure which file to look at.

Link to comment
Share on other sites

Is there a way to include the TAX ID-number on the invoice?

I was sure it would be there as a standard option,

and now I can´t find a way to include it.

I have searched here and I´ve googled for an answer

but still no luck.

 

Could it be that it´s not supposed to be there?

Could it be that I have missed something in my

languages translations and the cut/past I had to do to have

it work on my online shop?

 

Otherwise it works like a charm. Exactly what I wanted

and needed. Thanks to the auther and everyone who has made

a contribution in this excellent SPPC.

 

Any answer, suggestion or information on my TAX ID/invoice-

problem will be very much appreciated.

Link to comment
Share on other sites

Is there a way to include the TAX ID-number on the invoice?

Sure. If you look at admin/includes/classes/order.php and see how customers_group_name is included you get an idea how to add entry_company_tax_id in the query etcetera and then as $order->customer['entry_company_tax_id'] in admin/invoice.php

Link to comment
Share on other sites

Sure. If you look at admin/includes/classes/order.php and see how customers_group_name is included you get an idea how to add entry_company_tax_id in the query etcetera and then as $order->customer['entry_company_tax_id'] in admin/invoice.php

Amazing! Absolutly perfect!

Thank you so much for pointing out this solution to me.

It was exactly what I wanted and needed.

Thanks again for your help!

Link to comment
Share on other sites

Hey guys,

 

I managed to install this contribution successfully. But i would like to ask if there is any way of achieving the following:

 

When a new member is registered then he should not be able to see any prices(by default it shows retail price) until the administrator assigns him to a group.

 

Is this possible? And how can i do it?

Link to comment
Share on other sites

Hello guys, please can you help me?

I have cycling products contribution but I am crazy of it because I can´t find solution how I can join there codes.

 

Here is cycling code

<?php
/*
  $Id: specials.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4 2007/06/22

 http://www.digitalsun.nl
 Copyright (c) 2009 DigitalSun.nl / Jan Dreef / zrxRaver
 Released under the GNU General Public License
*/

 $cycleImages = 10; // MAX_RANDOM_SELECT_SPECIALS;
 $imageDivHeight = 220;
 $offsetLeft = 5;
 $effect = 'fade';
 $params = ', speed:  200, pause:  5 ';

 $specials_qry = tep_db_query("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_SPECIALS . " s LEFT OUTER JOIN " . TABLE_PRODUCTS . " p ON (s.products_id=p.products_id) LEFT OUTER JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (s.products_id=pd.products_id) WHERE (p.products_status = '1') AND (pd.language_id = '" . (int)$languages_id . "') AND (s.status = '1') ORDER BY s.specials_date_added DESC LIMIT " . $cycleImages);
 while($specials_res = tep_db_fetch_array($specials_qry)) {
   $specials_array[] = $specials_res;
 }
 if(isset($specials_array)) {
   shuffle($specials_array);
   $maxRecs = sizeof($specials_array);
?>
<!-- specials //-->
         <tr>
           <td>
<?php
   $content = '  <div id="special123" style="position: relative; left:'.$offsetLeft.'px; height:'.$imageDivHeight.';">'."\n";
   for($i = 0; $i < $maxRecs; $i++ ) {
     $content .= '    <div><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials_array[$i]["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $specials_array[$i]['products_image'], $specials_array[$i]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials_array[$i]['products_id']) . '"><center>' . $specials_array[$i]['products_name'] . '</center></a><center><br><s>' . $currencies->display_price($specials_array[$i]['products_price'], tep_get_tax_rate($specials_array[$i]['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($specials_array[$i]['specials_new_products_price'], tep_get_tax_rate($specials_array[$i]['products_tax_class_id'])) . '</span></center></div>'."\n";
   }
   $content .= '  </div>'."\n";
   ob_start();
   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);
   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));
   $info_box_contents = array();
   $info_box_contents[] = array('params' => 'width="100%"',
                                  'text' => 'myAnchor');
   new infoBox($info_box_contents);
   $temp_box = ob_get_contents();
   ob_end_clean();
   echo str_replace('myAnchor', $content, $temp_box);
   echo '<script language="javascript">' . " $('#special123').cycle({ fx: '".$effect."'".$params."}); " . '</script>' . "\n";
?>
           </td>
         </tr>
<!-- specials_eof //-->
<?php
 }
?>

 

and here is whats next code:

<?php
/*
 $Id: whats_new.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2007/08/10

 http://www.digitalsun.nl
 Copyright (c) 2009 DigitalSun.nl / Jan Dreef / zrxRaver
 Released under the GNU General Public License
*/

 $cycleImages = 10; // MAX_RANDOM_SELECT_NEW;
 $imageDivHeight = 165;
 $offsetLeft = 5;
 $effect = 'fade';
 $params = ', speed:  200, pause:  5 ';

 $new_products_qry = tep_db_query("SELECT p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name, IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price FROM " . TABLE_PRODUCTS . " p LEFT OUTER JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (p.products_id=pd.products_id) LEFT OUTER JOIN " . TABLE_SPECIALS . " s ON (p.products_id=s.products_id) WHERE (products_status = '1') AND (pd.language_id = '" . (int)$languages_id . "') ORDER BY products_date_added DESC LIMIT " . $cycleImages);
 while($new_products_res = tep_db_fetch_array($new_products_qry)) {
   $new_products_array[] = $new_products_res;
 }
 if(isset($new_products_array)) {
   shuffle($new_products_array);
   $maxRecs = sizeof($new_products_array);
?>
<!-- whats_new //-->
         <tr>
           <td>
<?php
   $content = '  <div id="newproducts321" style="position: relative; left:'.$offsetLeft.'px; height:'.$imageDivHeight.'">'."\n";
   for($i = 0; $i < $maxRecs; $i++) {
     if (tep_not_null($new_products_array[$i]['specials_new_products_price'])) {
       $whats_new_price = '<s>' . $currencies->display_price($new_products_array[$i]['products_price'], tep_get_tax_rate($new_products_array[$i]['products_tax_class_id'])) . '</s><br>';
       $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($new_products_array[$i]['specials_new_products_price'], tep_get_tax_rate($new_products_array[$i]['products_tax_class_id'])) . '</span>';
     } else {
       $whats_new_price = $currencies->display_price($new_products_array[$i]['products_price'], tep_get_tax_rate($new_products_array[$i]['products_tax_class_id']));
     }
     $content .= '    <div><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products_array[$i]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products_array[$i]['products_image'], $new_products_array[$i]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><center><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products_array[$i]['products_id']) . '">' . $new_products_array[$i]['products_name'] . '</a><br>' . $whats_new_price . '</center></div>' . "\n";
   }
   $content .= '</div>' . "\n";
   ob_start();
   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);
   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW));
   $info_box_contents = array();
   $info_box_contents[] = array('params' => 'width="100%"',
                                  'text' => 'myAnchor');
   new infoBox($info_box_contents);
   $temp_box = ob_get_contents();
   ob_end_clean();
   echo str_replace('myAnchor', $content, $temp_box);
   echo '<script language="javascript">' . " $('#newproducts321').cycle({ fx: '".$effect."'".$params."}); " . '</script>' . "\n";
?>
           </td>
         </tr>
<!-- whats_new_eof //-->
<?php
 }
?>

 

PLEASE HELP ME, PLEASE

Link to comment
Share on other sites

When a new member is registered then he should not be able to see any prices(by default it shows retail price) until the administrator assigns him to a group.

 

Is this possible? And how can i do it?

What's the problem with showing prices that everybody could already see? Otherwise add new members to a group where all the prices are zero.

There is a contribution for not showing the price (and buy now button) when the price is 0.00.

Link to comment
Share on other sites

Does anybody have the Options as Images contribution installed with SPPC?

I installed Options as Images v1.7 and everything works fine except for one thing, for categories that are not displayed as images, the options prices +/- $ are not being displayed from the correct customer group.

The options_images.php file has the code to produce the dropdown list but it is replicated from the original product_info.php.

I have been unable to change the options_images.php code to incorporate the SPPC code to update the option prices to the appropriate group price.

Could anyone update the options_images.php file to incorporate the SPPC code???

Link to comment
Share on other sites

Hello

 

PLEASE HELP ME

 

I need to include this Hide products from customer for SPPC code catalog/includes/boxes/whats_new.php

 

    $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $random_product['products_id'] . "' and customers_group_id =  '" . $customer_group_id . "' and customers_group_price != null");

 

To my cycling products catalog/includes/boxes/whats_new.php code

 

$new_products_qry = tep_db_query("SELECT p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name, IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price FROM " . TABLE_PRODUCTS . " p LEFT OUTER JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (p.products_id=pd.products_id) LEFT OUTER JOIN " . TABLE_SPECIALS . " s ON (p.products_id=s.products_id) WHERE (products_status = '1') AND (pd.language_id = '" . (int)$languages_id . "') ORDER BY products_date_added DESC LIMIT " . $cycleImages);

 

 

And also for specials

 

I need to include this SPPC code catalog/includes/boxes/whats_new.php

 

// BOF Separate Pricing Per Customer

//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id

 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
   $customer_group_id = '0';
 }

 if ($customer_group_id == '0')  {
     $random_product = tep_random_select("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 p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id = '0' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS);
 } else { // $sppc_customer_group_id is in the session variables, so must be set
     $random_product = tep_random_select("select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as 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 LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using (products_id, customers_group_id) where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id= '".$customer_group_id."' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS);
   }

 if (tep_not_null($random_product)) {
// EOF Separate Pricing Per Customer

 

To my cycling products catalog/includes/boxes/whats_new.php code

 

$specials_qry = tep_db_query("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_SPECIALS . " s LEFT OUTER JOIN " . TABLE_PRODUCTS . " p ON (s.products_id=p.products_id) LEFT OUTER JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (s.products_id=pd.products_id) WHERE (p.products_status = '1') AND (pd.language_id = '" . (int)$languages_id . "') AND (s.status = '1') ORDER BY s.specials_date_added DESC LIMIT " . $cycleImages);
 while($specials_res = tep_db_fetch_array($specials_qry)) {
   $specials_array[] = $specials_res;
 }
 if(isset($specials_array)) {
   shuffle($specials_array);
   $maxRecs = sizeof($specials_array);

Link to comment
Share on other sites

New problem came up here.

 

When a customer is ordering something, customer gets nothing else than an blank screen at the checkout_success.php, and after enabling PHP error messages this came:

Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 909805 is not allowed to access /tmp owned by uid 0 in /customers/nonstopparty.no/nonstopparty.no/httpd.www/includes/functions/sessions.php on line 169

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /customers/nonstopparty.no/nonstopparty.no/httpd.www/includes/functions/sessions.php:169) in /customers/nonstopparty.no/nonstopparty.no/httpd.www/includes/functions/sessions.php on line 102

 

Fatal error: require() [function.require]: Failed opening required 'includes/footer-tracker.php' (include_path='.:/usr/share/php') in /customers/nonstopparty.no/nonstopparty.no/httpd.www/checkout_success.php on line 175

 

And, in admin, following error came(all pages, very like the shop error, just in admin):

Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 909805 is not allowed to access /tmp owned by uid 0 in /customers/nonstopparty.no/nonstopparty.no/httpd.www/admin/includes/functions/sessions.php on line 165

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /customers/nonstopparty.no/nonstopparty.no/httpd.www/admin/includes/functions/sessions.php:165) in /customers/nonstopparty.no/nonstopparty.no/httpd.www/admin/includes/functions/sessions.php on line 102

 

Warning: Cannot modify header information - headers already sent by (output started at /customers/nonstopparty.no/nonstopparty.no/httpd.www/admin/includes/functions/sessions.php:165) in /customers/nonstopparty.no/nonstopparty.no/httpd.www/admin/includes/functions/general.php on line 23

 

Anyone have a little clue whats wrong? As i understand, sessions.php is trying to access temp directory on the server but is rejected. Can i change the temp directory "address"? How?

 

Code at line 165 in sessions.php at admin:

function tep_session_save_path($path = '') {

if ($path != '') {

return session_save_path($path);

} else {

return session_save_path();

}

}

 

This might not have anything to do with SPPC, but the problem seems like it came after installing this. Worked on another shop at the same webhotell without sppc. Anyhow, also in Customers\Orders in admin area, no orders are displayed. And with the blank screen when last step at order confirmation is done, it still sends out email to customer, and registers in the sale logs in osc

 

Regards,

Stian

 

EDIT: SPPC 4.2.2 on RC2a

Edited by cod3g3n
Link to comment
Share on other sites

This might not have anything to do with SPPC, but the problem seems like it came after installing this.

Indeed, has totally nothing to do with SPPC. I have seen this a million times so a Google search of this error should come up with a solution. I think the problem is you either set your own temporary folder for your sessions or use the database for storing sessions.

Link to comment
Share on other sites

Indeed, has totally nothing to do with SPPC. I have seen this a million times so a Google search of this error should come up with a solution. I think the problem is you either set your own temporary folder for your sessions or use the database for storing sessions.

Okey, figured that out, and the blank page disappeard.

 

But, still nothing in Customers/Orders in Admin area, no orders showing, and no errors comming up..

Link to comment
Share on other sites

But, still nothing in Customers/Orders in Admin area, no orders showing, and no errors comming up..

Sure you are working with a recent version of osCommerce (2.2 RC2a) and not some ancient version that has all kinds of problems with register globals off?

 

I vaguely recall that the above issue is something that was addressed in one of the updates but I'm not sure.

Link to comment
Share on other sites

Sure you are working with a recent version of osCommerce (2.2 RC2a) and not some ancient version that has all kinds of problems with register globals off?

 

I vaguely recall that the above issue is something that was addressed in one of the updates but I'm not sure.

Not exactly RC2a, but RC2 upgraded to RC2a with the two bug fixes

 

10 Due to two bugs that were introduced with 2.2 RC2, it has been repackaged as

11 2.2 RC2a with the following changes:

12

13 * The Administration Tool -> Backup Manager -> Restoration routine failed on

14 PHP <5 servers due to the use of stripos(). A compatibility function has

15 been added to fix this.

16 [r1829]

17

18 * The reference of $_SESSION in the tep_session_is_registered() function

19 produces a PHP warning when the session has not been started (ie, for search

20 engine spiders). This has been fixed by checking if $_SESSION is set.

21 [r1830]

Link to comment
Share on other sites

Hi guys,

I have installed Quantity Price Breaks for Separate Pricing Per Customer V2.0.

When I have viewing a product at product_info.php, and change the quantity of product to add cart (I want "6" units of the product), and then click at add_cart_button, I go to shopping_cart.php. But the quantity of product in the shopping cart is "1".

I have revised catalog/product_info.php, catalog/shopping_cart.php and catalog/includes/classes/shopping_cart.php. But I haven't seen any differences between my pages and the pages in the package.

I need your help. Thanks for your attentions.

 

catalog/product_info.php

 

<?php
/*
 $Id: product_info.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2007/06/23, adapted for QPBPP for SPPC v2.0 2008/11/09

 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_PRODUCT_INFO);

 $product_check_query = tep_db_query("select count(*) as total 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 . "'");
 $product_check = tep_db_fetch_array($product_check_query);
 // BOF Separate Pricing per Customer
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
   $customer_group_id = '0';
 }
// EOF Separate Pricing per Customer
?>
<!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">
<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//--></script>
</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"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
 if ($product_check['total'] < 1) {
?>
     <tr>
       <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 } else {
   $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 . "'");
   $product_info = tep_db_fetch_array($product_info_query);

   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

   // BOF QPBPP for SPPC
   $pf->loadProduct((int)$_GET['products_id'], (int)$languages_id);
   $products_price = $pf->getPriceString();
// EOF QPBPP for SPPC

   if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];
   }
// BOF QPBPP for SPPC
 $min_order_qty = $pf->getMinOrderQty();
   if ($min_order_qty > 1) {
     $products_name .= '<br><span class="smallText">' . MINIMUM_ORDER_TEXT . $min_order_qty . '</span>';
   }
// EOF QPBPP for SPPC
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
           <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td class="main">
<?php
   if (tep_not_null($product_info['products_image'])) {
?>
         <table border="0" cellspacing="0" cellpadding="2" align="right">
           <tr>
             <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
             </td>
           </tr>
         </table>
<?php
   }
?>
         <p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
   // BOF SPPC Hide attributes from customer groups
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
         <table border="0" cellspacing="0" cellpadding="2">
           <tr>
             <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
           </tr>
<?php
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
       $products_options_array = array();
       $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
	$list_of_prdcts_attributes_id = '';
	$products_options = array(); // makes sure this array is empty again
       while ($_products_options = tep_db_fetch_array($products_options_query)) {
	$products_options[] = $_products_options;
	$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
}

     if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { 
        $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
 while ($pag_array = tep_db_fetch_array($pag_query)) {
	 $cg_attr_prices[] = $pag_array;
 }

 // substitute options_values_price and prefix for those for the customer group (if available)
 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
    for ($n = 0 ; $n < count($products_options); $n++) {
	 for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
		 if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
			$products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			$products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
		 }
	 } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
    }
       } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
     } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

  for ($n = 0 ; $n < count($products_options); $n++) {
         $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);
         if ($products_options[$n]['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         }
       }
// EOF SPPC attributes mod

       if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
           </tr>
<?php
     }
?>
         </table>
<?php
   }
?>
       </td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   $reviews = tep_db_fetch_array($reviews_query);
   if ($reviews['count'] > 0) {
?>
     <tr>
       <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   }

   if (tep_not_null($product_info['products_url'])) {
?>
     <tr>
       <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   }

   if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
     <tr>
       <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
     </tr>
<?php
   } else {
?>
     <tr>
       <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
     </tr>
<?php
   }
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
               <?php // BOF QPBPP for SPPC ?>
               <td class="main" align="right">
                 <table border="0" align="right">
                   <tr><td class="main" align="center">
                     <?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>
                   </td></tr>
                   <tr><td align="center">
                     <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>
                   </td></tr>
             </table>
               </td>
<?php // EOF QPBPP for SPPC ?>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td>
<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
 }
?>
       </td>
     </tr>
   </table></form></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'); ?>

 

catalog/shopping_cart.php

 

<?php
/*
 $Id: shopping_cart.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for QPBPP for SPPC v2.0 2008/11/01

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2007 osCommerce

 Released under the GNU General Public License
*/

 require("includes/application_top.php");

 if ($cart->count_contents() > 0) {
   include(DIR_WS_CLASSES . 'payment.php');
   $payment_modules = new payment;
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));
?>
<!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"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><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_cart.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
 if ($cart->count_contents() > 0) {
?>
     <tr>
       <td>
<?php
   $info_box_contents = array();
   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_REMOVE);

   $info_box_contents[0][] = array('params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_PRODUCTS);

   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_QUANTITY);

   $info_box_contents[0][] = array('align' => 'right',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_TOTAL);

   $any_out_of_stock = 0;
   $products = $cart->get_products();
   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
       while (list($option, $value) = each($products[$i]['attributes'])) {
         echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                     where pa.products_id = '" . (int)$products[$i]['id'] . "'
                                      and pa.options_id = '" . (int)$option . "'
                                      and pa.options_id = popt.products_options_id
                                      and pa.options_values_id = '" . (int)$value . "'
                                      and pa.options_values_id = poval.products_options_values_id
                                      and popt.language_id = '" . (int)$languages_id . "'
                                      and poval.language_id = '" . (int)$languages_id . "'");
         $attributes_values = tep_db_fetch_array($attributes);

         $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
         $products[$i][$option]['options_values_id'] = $value;
         $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
         $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
         $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
       }
     }
   }

   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
     if (($i/2) == floor($i/2)) {
       $info_box_contents[] = array('params' => 'class="productListing-even"');
     } else {
       $info_box_contents[] = array('params' => 'class="productListing-odd"');
     }

     $cur_row = sizeof($info_box_contents) - 1;

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

     $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
                      '  <tr>' .
                      '    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
                      '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';

     if (STOCK_CHECK == 'true') {
       $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
       if (tep_not_null($stock_check)) {
         $any_out_of_stock = 1;

         $products_name .= $stock_check;
       }
     }

     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
       reset($products[$i]['attributes']);
       while (list($option, $value) = each($products[$i]['attributes'])) {
         $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
       }
     }

     $products_name .= '    </td>' .
                       '  </tr>' .
                       '</table>';

     $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
                                            'text' => $products_name);

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

     $info_box_contents[$cur_row][] = array('align' => 'right',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
   }

   new productListingBox($info_box_contents);
?>
       </td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>
     </tr>
<?php
   if ($any_out_of_stock == 1) {
     if (STOCK_ALLOW_CHECKOUT == 'true') {
?>
     <tr>
       <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>
     </tr>
<?php
     } else {
?>
     <tr>
       <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>
     </tr>
<?php
     }
   }
// BOF QPBPP for SPPC
   if ($messageStack->size('cart_notice') > 0) {
?>
     <tr>
       <td style="padding-top: 10px"><?php echo $messageStack->output('cart_notice'); ?></td>
     </tr>
<?php
     }
// EOF QPBPP for SPPC
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>
<?php
   $back = sizeof($navigation->path)-2;
   if (isset($navigation->path[$back])) {
?>
               <td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>
<?php
   }
?>
               <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
   $initialize_checkout_methods = $payment_modules->checkout_initialization_method();

   if (!empty($initialize_checkout_methods)) {
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td align="right" class="main" style="padding-right: 50px;"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></td>
     </tr>
<?php
     reset($initialize_checkout_methods);
     while (list(, $value) = each($initialize_checkout_methods)) {
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td align="right" class="main"><?php echo $value; ?></td>
     </tr>
<?php
     }
   }
 } else {
?>
     <tr>
       <td align="center" class="main"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 }
?>
   </table></form></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'); ?>

catalog/includes/classes/shopping_cart.php

 

<?php
/*
 $Id: shopping_cart.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2008/03/07, QPBPP for SPPC v2.0 2008/11/08

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class shoppingCart {
   var $contents, $total, $weight, $cartID, $content_type;

   function shoppingCart() {
     $this->reset();
   }

   function restore_contents() {
     global $customer_id, $languages_id; // languages_id needed for PriceFormatter - QPBPP

     if (!tep_session_is_registered('customer_id')) return false;

// insert current cart contents in database
     if (is_array($this->contents)) {
       reset($this->contents);
	// BOF SPPC attribute hide/invalid check: loop through the shopping cart and check the attributes if they
// are hidden for the now logged-in customer
     $this->cg_id = $this->get_customer_group_id();
       while (list($products_id, ) = each($this->contents)) {
				// only check attributes if they are set for the product in the cart
			   if (isset($this->contents[$products_id]['attributes'])) {
			$check_attributes_query = tep_db_query("select options_id, options_values_id, IF(find_in_set('" . $this->cg_id . "', attributes_hide_from_groups) = 0, '0', '1') as hide_attr_status from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . tep_get_prid($products_id) . "'");
			while ($_check_attributes = tep_db_fetch_array($check_attributes_query)) {
				$check_attributes[] = $_check_attributes;
			} // end while ($_check_attributes = tep_db_fetch_array($check_attributes_query))
			$no_of_check_attributes = count($check_attributes);
			$change_products_id = '0';

			foreach($this->contents[$products_id]['attributes'] as $attr_option => $attr_option_value) {
				$valid_option = '0';
				for ($x = 0; $x < $no_of_check_attributes ; $x++) {
					if ($attr_option == $check_attributes[$x]['options_id'] && $attr_option_value == $check_attributes[$x]['options_values_id']) {
						$valid_option = '1';
						if ($check_attributes[$x]['hide_attr_status'] == '1') {
						// delete hidden attributes from array attributes, change products_id accordingly later
						$change_products_id = '1';
						unset($this->contents[$products_id]['attributes'][$attr_option]);
						}
					} // end if ($attr_option == $check_attributes[$x]['options_id']....
				} // end for ($x = 0; $x < $no_of_check_attributes ; $x++)
				if ($valid_option == '0') {
					// after having gone through the options for this product and not having found a matching one
					// we can conclude that apparently this is not a valid option for this product so remove it
					unset($this->contents[$products_id]['attributes'][$attr_option]);
					// change products_id accordingly later
					$change_products_id = '1';
				}
			} // end foreach($this->contents[$products_id]['attributes'] as $attr_option => $attr_option_value)

         if ($change_products_id == '1') {
           $original_products_id = $products_id;
           $products_id = tep_get_prid($original_products_id);
           $products_id = tep_get_uprid($products_id, $this->contents[$original_products_id]['attributes']);
					 // add the product without the hidden attributes to the cart
           $this->contents[$products_id] = $this->contents[$original_products_id];
			     // delete the originally added product with the hidden attributes
           unset($this->contents[$original_products_id]);
           }
			  } // end if (isset($this->contents[$products_id]['attributes']))
			} // end while (list($products_id, ) = each($this->contents))
      reset($this->contents); // reset the array otherwise the cart will be emptied
// EOF SPPC attribute hide/invalid check
       while (list($products_id, ) = each($this->contents)) {
         $qty = $this->contents[$products_id]['qty'];
	  // BOF QPBPP for SPPC adjust quantity blocks and min_order_qty for this customer group
// warnings about this are raised in PriceFormatter
     $pf = new PriceFormatter;
     $pf->loadProduct(tep_get_prid($products_id), $languages_id);
     $qty = $pf->adjustQty($qty);
// EOF QPBPP for SPPC
         $product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
         if (!tep_db_num_rows($product_query)) {
           tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . tep_db_input($qty) . "', '" . date('Ymd') . "')");
           if (isset($this->contents[$products_id]['attributes'])) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
               tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
             }
           }
         } else {
           tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . tep_db_input($qty) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
         }
       }
     }

// reset per-session cart contents, but not the database contents
     $this->reset(false);

     // BOF QPBPP for SPPC
     $products_query = tep_db_query("select cb.products_id, ptdc.discount_categories_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " cb left join (select products_id, discount_categories_id from " . TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES . " where customers_group_id = '" . $this->cg_id . "') as ptdc on cb.products_id = ptdc.products_id where customers_id = '" . (int)$customer_id . "'");
     while ($products = tep_db_fetch_array($products_query)) {
       $this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity'], 'discount_categories_id' => $products['discount_categories_id']);
// EOF QPBPP for SPPC
// attributes
       $attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");
       while ($attributes = tep_db_fetch_array($attributes_query)) {
         $this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
       }
     }

     $this->cleanup();
   }

   function reset($reset_database = false) {
     global $customer_id;

     $this->contents = array();
     $this->total = 0;
     $this->weight = 0;
     $this->content_type = false;

     if (tep_session_is_registered('customer_id') && ($reset_database == true)) {
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");
     }

     unset($this->cartID);
     if (tep_session_is_registered('cartID')) tep_session_unregister('cartID');
   }

   function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
     global $new_products_id_in_cart, $customer_id;
  // BOF Separate Pricing Per Customer 
     $this->cg_id = $this->get_customer_group_id();
// EOF Separate Pricing Per Customer

     $products_id_string = tep_get_uprid($products_id, $attributes);
     $products_id = tep_get_prid($products_id_string);

     if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$qty > MAX_QTY_IN_CART)) {
       $qty = MAX_QTY_IN_CART;
     }
  // BOF QPBPP for SPPC
     $pf = new PriceFormatter;
     $pf->loadProduct($products_id);
     $qty = $pf->adjustQty($qty);
     $discount_category = $pf->get_discount_category();
// EOF QPBPP for SPPC

     $attributes_pass_check = true;

     if (is_array($attributes)) {
       reset($attributes);
       while (list($option, $value) = each($attributes)) {
         if (!is_numeric($option) || !is_numeric($value)) {
           $attributes_pass_check = false;
           break;
         }
       }
     }

     if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) {
       // BOF SPPC attribute hide check, original query expanded to include attributes
			$check_product_query = tep_db_query("select p.products_status, options_id, options_values_id, IF(find_in_set('" . $this->cg_id . "', attributes_hide_from_groups) = 0, '0', '1') as hide_attr_status from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where p.products_id = '" . (int)$products_id . "'");
			while ($_check_product = tep_db_fetch_array($check_product_query)) {
				$check_product[] = $_check_product;
			} // end while ($_check_product = tep_db_fetch_array($check_product_query))
			$no_of_check_product = count($check_product);

 if (is_array($attributes)) {
			foreach($attributes as $attr_option => $attr_option_value) {
				$valid_option = '0';
				for ($x = 0; $x < $no_of_check_product ; $x++) {
					if ($attr_option == $check_product[$x]['options_id'] && $attr_option_value == $check_product[$x]['options_values_id']) {
						$valid_option = '1';
						if ($check_product[$x]['hide_attr_status'] == '1') {
						// delete hidden attributes from array attributes
						unset($attributes[$attr_option]);
						}
					} // end if ($attr_option == $check_product[$x]['options_id']....
				} // end for ($x = 0; $x < $no_of_check_product ; $x++)
				if ($valid_option == '0') {
					// after having gone through the options for this product and not having found a matching one
					// we can conclude that apparently this is not a valid option for this product so remove it
					unset($attributes[$attr_option]);
				}
			} // end foreach($attributes as $attr_option => $attr_option_value)
} // end if (is_array($attributes))
// now attributes have been checked and hidden and invalid ones deleted make the $products_id_string again
			$products_id_string = tep_get_uprid($products_id, $attributes);

       if ((isset($check_product) && tep_not_null($check_product)) && ($check_product[0]['products_status'] == '1')) {
// EOF SPPC attribute hide check
         if ($notify == true) {
           $new_products_id_in_cart = $products_id;
           tep_session_register('new_products_id_in_cart');
         }

         // BOF QPBPP for SPPC
         if ($this->in_cart($products_id_string)) {
           $this->update_quantity($products_id_string, $qty, $attributes, $discount_category);
         } else {
           $this->contents[$products_id_string] = array('qty' => (int)$qty, 'discount_categories_id' => $discount_category);
// EOF QPBPP for SPPC
// insert into database
           if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')");

           if (is_array($attributes)) {
             reset($attributes);
             while (list($option, $value) = each($attributes)) {
               $this->contents[$products_id_string]['attributes'][$option] = $value;
// insert into database
               if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");
             }
           }
         }

         $this->cleanup();

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
         $this->cartID = $this->generate_cart_id();
       }
     }
   }

   // BOF QPBPP for SPPC
   function update_quantity($products_id, $quantity = '', $attributes = '', $discount_categories_id = NULL) {
// EOF QPBPP for SPPC
     global $customer_id;

     $products_id_string = tep_get_uprid($products_id, $attributes);
     $products_id = tep_get_prid($products_id_string);

     if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$quantity > MAX_QTY_IN_CART)) {
       $quantity = MAX_QTY_IN_CART;
     }

     $attributes_pass_check = true;

     if (is_array($attributes)) {
       reset($attributes);
       while (list($option, $value) = each($attributes)) {
         if (!is_numeric($option) || !is_numeric($value)) {
           $attributes_pass_check = false;
           break;
         }
       }
     }

     if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity) && ($attributes_pass_check == true)) {
       // BOF QPBPP for SPPC
       $this->contents[$products_id_string] = array('qty' => (int)$quantity, 'discount_categories_id' => $discount_categories_id);
// EOF QPBPP for SPPC
// update database
       if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int)$quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "'");

       if (is_array($attributes)) {
         reset($attributes);
         while (list($option, $value) = each($attributes)) {
           $this->contents[$products_id_string]['attributes'][$option] = $value;
// update database
           if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "'");
         }
       }
     }
   }

   function cleanup() {
     global $customer_id;

     reset($this->contents);
     while (list($key,) = each($this->contents)) {
       if ($this->contents[$key]['qty'] < 1) {
         unset($this->contents[$key]);
// remove from database
         if (tep_session_is_registered('customer_id')) {
           tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
           tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
         }
       }
     }
   }

   function count_contents() {  // get total number of items in cart 
     $total_items = 0;
     if (is_array($this->contents)) {
       reset($this->contents);
       while (list($products_id, ) = each($this->contents)) {
         $total_items += $this->get_quantity($products_id);
       }
     }

     return $total_items;
   }

   function get_quantity($products_id) {
     if (isset($this->contents[$products_id])) {
       return $this->contents[$products_id]['qty'];
     } else {
       return 0;
     }
   }

   function in_cart($products_id) {
     if (isset($this->contents[$products_id])) {
       return true;
     } else {
       return false;
     }
   }

   function remove($products_id) {
     global $customer_id;

     unset($this->contents[$products_id]);
// remove from database
     if (tep_session_is_registered('customer_id')) {
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
     }

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
     $this->cartID = $this->generate_cart_id();
   }

   function remove_all() {
     $this->reset();
   }

   function get_product_id_list() {
     $product_id_list = '';
     if (is_array($this->contents)) {
       reset($this->contents);
       while (list($products_id, ) = each($this->contents)) {
         $product_id_list .= ', ' . $products_id;
       }
     }

     return substr($product_id_list, 2);
   }

   function calculate() {
     global $currencies, $languages_id, $pfs; // for QPBPP added: $languages_id, $pfs

     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) return 0;
  // BOF Separate Pricing Per Customer
// global variable (session) $sppc_customer_group_id -> class variable cg_id
     $this->cg_id = $this->get_customer_group_id();
// EOF Separate Pricing Per Customer
// BOF QPBPP for SPPC
       $discount_category_quantity = array(); // calculates no of items per discount category in shopping basket
     foreach ($this->contents as $products_id => $contents_array) {
         if(tep_not_null($contents_array['discount_categories_id'])) {
           if (!isset($discount_category_quantity[$contents_array['discount_categories_id']])) {
               $discount_category_quantity[$contents_array['discount_categories_id']] = $contents_array['qty'];
           } else {
               $discount_category_quantity[$contents_array['discount_categories_id']] += $contents_array['qty'];
           }
         }
     } // end foreach

  $pf = new PriceFormatter;
// EOF QPBPP for SPPC

     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
       $qty = $this->contents[$products_id]['qty'];
	// BOF QPBPP for SPPC       
     if (tep_not_null($this->contents[$products_id]['discount_categories_id'])) {
       $nof_items_in_cart_same_cat = $discount_category_quantity[$this->contents[$products_id]['discount_categories_id']];
       $nof_other_items_in_cart_same_cat = $nof_items_in_cart_same_cat - $qty;
     } else {
         $nof_other_items_in_cart_same_cat = 0;
     }
// EOF QPBPP for SPPC

// products price
       // BOF QPBPP for SPPC
      $pf->loadProduct($products_id, $languages_id);
       if ($product = $pfs->getPriceFormatterData($products_id)) {
         $prid = $product['products_id'];
         $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
         $products_price = $pf->computePrice($qty, $nof_other_items_in_cart_same_cat);
// EOF QPBPP for SPPC

         $products_weight = $product['products_weight'];

// BOF Separate Pricing Per Customer
/*   $specials_price = tep_get_products_special_price((int)$prid);
     if (tep_not_null($specials_price)) {
    $products_price = $specials_price;
     } elseif ($this->cg_id != 0){
       $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$prid . "' and customers_group_id =  '" . $this->cg_id . "'");
       if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
       $products_price = $customer_group_price['customers_group_price'];
       }
         } */
// EOF Separate Pricing Per Customer

         $this->total += $currencies->calculate_price($products_price, $products_tax, $qty);
         $this->weight += ($qty * $products_weight);
       }

// attributes price
// BOF SPPC attributes mod
       if (isset($this->contents[$products_id]['attributes'])) {
         reset($this->contents[$products_id]['attributes']);
      $where = " AND ((";
       while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
        $where .= "options_id = '" . (int)$option . "' AND options_values_id = '" . (int)$value . "') OR (";
      }
      $where=substr($where, 0, -5) . ')';

      $attribute_price_query = tep_db_query("SELECT products_attributes_id, options_values_price, price_prefix FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . (int)$products_id . "'" . $where ."");

      if (tep_db_num_rows($attribute_price_query)) { 
       $list_of_prdcts_attributes_id = '';
			 // empty array $attribute_price
			 $attribute_price = array();
       while ($attributes_price_array = tep_db_fetch_array($attribute_price_query)) { 
	   $attribute_price[] =  $attributes_price_array;
	   $list_of_prdcts_attributes_id .= $attributes_price_array['products_attributes_id'].",";
           }
       if (tep_not_null($list_of_prdcts_attributes_id) && $this->cg_id != '0') { 
        $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $this->cg_id . "'");
 while ($pag_array = tep_db_fetch_array($pag_query)) {
	 $cg_attr_prices[] = $pag_array;
 }

 // substitute options_values_price and prefix for those for the customer group (if available)
 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
    for ($n = 0 ; $n < count($attribute_price); $n++) {
	 for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
		 if ($cg_attr_prices[$i]['products_attributes_id'] == $attribute_price[$n]['products_attributes_id']) {
			$attribute_price[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			$attribute_price[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
		 }
	 } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
         }
       } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
     } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')
// now loop through array $attribute_price to add up/substract attribute prices

  for ($n = 0 ; $n < count($attribute_price); $n++) {
           if ($attribute_price[$n]['price_prefix'] == '+') {
             $this->total += $currencies->calculate_price($attribute_price[$n]['options_values_price'], $products_tax, $qty);
           } else {
             $this->total -= $currencies->calculate_price($attribute_price[$n]['options_values_price'], $products_tax, $qty);
       }
  } // end for ($n = 0 ; $n < count($attribute_price); $n++)
         } // end if (tep_db_num_rows($attribute_price_query))
       } // end if (isset($this->contents[$products_id]['attributes'])) 
     }
   }
// EOF SPPC attributes mod

   // function attributes_price changed partially according to FalseDawn's post
// http://www.oscommerce.com/forums/index.php?showtopic=139587
// changed completely for Separate Pricing Per Customer, attributes mod
   function attributes_price($products_id) {
// global variable (session) $sppc_customer_group_id -> class variable cg_id
   $this->cg_id = $this->get_customer_group_id();

     if (isset($this->contents[$products_id]['attributes'])) {
       reset($this->contents[$products_id]['attributes']);
      $where = " AND ((";
       while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
        $where .= "options_id = '" . (int)$option . "' AND options_values_id = '" . (int)$value . "') OR (";
      }
      $where=substr($where, 0, -5) . ')';

      $attribute_price_query = tep_db_query("SELECT products_attributes_id, options_values_price, price_prefix FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . (int)$products_id . "'" . $where ."");

     if (tep_db_num_rows($attribute_price_query)) {
       $list_of_prdcts_attributes_id = '';
       while ($attributes_price_array = tep_db_fetch_array($attribute_price_query)) { 
	   $attribute_price[] =  $attributes_price_array;
	   $list_of_prdcts_attributes_id .= $attributes_price_array['products_attributes_id'].",";
         }

       if (tep_not_null($list_of_prdcts_attributes_id) && $this->cg_id != '0') { 
        $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $this->cg_id . "'");
 while ($pag_array = tep_db_fetch_array($pag_query)) {
	 $cg_attr_prices[] = $pag_array;
 }

 // substitute options_values_price and prefix for those for the customer group (if available)
 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
    for ($n = 0 ; $n < count($attribute_price); $n++) {
	 for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
		 if ($cg_attr_prices[$i]['products_attributes_id'] == $attribute_price[$n]['products_attributes_id']) {
			$attribute_price[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			$attribute_price[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
       }
	 } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
     }
       } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
     } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')
// now loop through array $attribute_price to add up/substract attribute prices

  for ($n = 0 ; $n < count($attribute_price); $n++) {
           if ($attribute_price[$n]['price_prefix'] == '+') {
             $attributes_price += $attribute_price[$n]['options_values_price'];
           } else {
             $attributes_price -= $attribute_price[$n]['options_values_price'];
           }
  } // end for ($n = 0 ; $n < count($attribute_price); $n++)
     return $attributes_price;
      } else { // end if (tep_db_num_rows($attribute_price_query))
        return 0;
      } 
    }  else { // end if (isset($this->contents[$products_id]['attributes']))
      return 0;
   }
  } // end of function attributes_price, modified for SPPC with attributes

   function get_products() {
     global $languages_id, $pfs; // PriceFormatterStore added
  // BOF Separate Pricing Per Customer
 $this->cg_id = $this->get_customer_group_id();
// EOF Separate Pricing Per Customer

     if (!is_array($this->contents)) return false;
  // BOF QPBPP for SPPC
     $discount_category_quantity = array();
     foreach ($this->contents as $products_id => $contents_array) {
         if(tep_not_null($contents_array['discount_categories_id'])) {
           if (!isset($discount_category_quantity[$contents_array['discount_categories_id']])) {
               $discount_category_quantity[$contents_array['discount_categories_id']] = $contents_array['qty'];
           } else {
               $discount_category_quantity[$contents_array['discount_categories_id']] += $contents_array['qty'];
           }
         }
     } // end foreach

     $pf = new PriceFormatter;
// EOF QPBPP for SPPC

     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
       // BOF QPBPP for SPPC
     $pf->loadProduct($products_id, $languages_id); // does query if necessary and adds to 
     // PriceFormatterStore or gets info from it next
     if ($products = $pfs->getPriceFormatterData($products_id)) {
      if (tep_not_null($this->contents[$products_id]['discount_categories_id'])) {
         $nof_items_in_cart_same_cat =  $discount_category_quantity[$this->contents[$products_id]['discount_categories_id']];
         $nof_other_items_in_cart_same_cat = $nof_items_in_cart_same_cat - $this->contents[$products_id]['qty'];
       } else {
         $nof_other_items_in_cart_same_cat = 0;
       }
         $products_price = $pf->computePrice($this->contents[$products_id]['qty'], $nof_other_items_in_cart_same_cat);
// EOF QPBPP for SPPC

         $products_array[] = array('id' => $products_id,
                                   'name' => $products['products_name'],
                                   'model' => $products['products_model'],
                                   'image' => $products['products_image'],
								// BOF QPBPP for SPPC
                                   'discount_categories_id' => $this->contents[$products_id]['discount_categories_id'],
// EOF QPBPP for SPPC
                                   'price' => $products_price,
                                   'quantity' => $this->contents[$products_id]['qty'],
                                   'weight' => $products['products_weight'],
                                   'final_price' => ($products_price + $this->attributes_price($products_id)),
                                   'tax_class_id' => $products['products_tax_class_id'],
                                   'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''));
       }
     }

     return $products_array;
   }

   function show_total() {
     $this->calculate();

     return $this->total;
   }

   function show_weight() {
     $this->calculate();

     return $this->weight;
   }

   function generate_cart_id($length = 5) {
     return tep_create_random_value($length, 'digits');
   }

   function get_content_type() {
     $this->content_type = false;

     if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) {
       reset($this->contents);
       while (list($products_id, ) = each($this->contents)) {
         if (isset($this->contents[$products_id]['attributes'])) {
           reset($this->contents[$products_id]['attributes']);
           while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
             $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id");
             $virtual_check = tep_db_fetch_array($virtual_check_query);

             if ($virtual_check['total'] > 0) {
               switch ($this->content_type) {
                 case 'physical':
                   $this->content_type = 'mixed';

                   return $this->content_type;
                   break;
                 default:
                   $this->content_type = 'virtual';
                   break;
               }
             } else {
               switch ($this->content_type) {
                 case 'virtual':
                   $this->content_type = 'mixed';

                   return $this->content_type;
                   break;
                 default:
                   $this->content_type = 'physical';
                   break;
               }
             }
           }
         } else {
           switch ($this->content_type) {
             case 'virtual':
               $this->content_type = 'mixed';

               return $this->content_type;
               break;
             default:
               $this->content_type = 'physical';
               break;
           }
         }
       }
     } else {
       $this->content_type = 'physical';
     }

     return $this->content_type;
   }

   function unserialize($broken) {
     for(reset($broken);$kv=each($broken);) {
       $key=$kv['key'];
       if (gettype($this->$key)!="user function")
       $this->$key=$kv['value'];
     }
   }

// added for Separate Pricing Per Customer, returns customer_group_id
   function get_customer_group_id() {
     if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
       $_cg_id = $_SESSION['sppc_customer_group_id'];
     } else {
        $_cg_id = 0;
     }
     return $_cg_id;
   }

 }
?>

Edited by dajorla
Link to comment
Share on other sites

Hi guys,

I have installed Quantity Price Breaks for Separate Pricing Per Customer V2.0.

When I have viewing a product at product_info.php, and change the quantity of product to add cart (I want "6" units of the product), and then click at add_cart_button, I go to shopping_cart.php. But the quantity of product in the shopping cart is "1".

I have revised catalog/product_info.php, catalog/shopping_cart.php and catalog/includes/classes/shopping_cart.php. But I haven't seen any differences between my pages and the pages in the package.

That part is handled in includes/appication_top.php after (around line 338 and further)

switch ($HTTP_GET_VARS['action']) {

 

and then

 

// 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'])) {

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...