Zoltan Posted October 29, 2006 Posted October 29, 2006 To the community: I am coming from the German board to find any help here because was nt able to fix this: Have intalled the sppc 4.1.4. into my existing shop. Everything seems to work exept the following: Once activated the account for a wholesaler, the prices only are change in net, but are not showing the prices added for this group. I really would appreciate to get some help ore information where to receive this. Thanks very much. Best whishes Robin Can see the shop here: http://www.belladonna.de Quote
Jan Zonjee Posted October 29, 2006 Posted October 29, 2006 I am coming from the German board to find any help here because was nt able to fix this: Couldn't find your topic there, to see if you gave more information about the problem there. This is not much to go on.Everything seems to work exept the following: Once activated the account for a wholesaler, the prices only are change in net, but are not showing the prices added for this group. You didn't assign wholesale customers to the group with id 0 did you (id=0 is reserved for retail customers)? Another possibility is that the session variable for the customer group id is not set when logging in. You can check that by adding somewhere on the bottom of the page (preferably where you only see it in the HTML source of the page once printed): echo '<pre>'; print_r($_SESSION); Quote
Zoltan Posted October 29, 2006 Author Posted October 29, 2006 Dear JanZ, thanks very much for you suggestions. The first point - check the customer group id- is cleared. At this time customer group O is the default or retail group, 1 is for wholesale, and 2 is for a third group. So far, in my opinion, this is OK. The secon point. I have included the code you gave me. Thi is the output: Before login: Array ( [cart] => shoppingcart Object ( [contents] => Array ( ) [total] => 0 [weight] => 0 [cartID] => [content_type] => ) [language] => german [languages_id] => 2 [currency] => EUR [navigation] => navigationhistory Object ( [path] => Array ( [0] => Array ( => index.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( ) ) [1] => Array ( => shopping_cart.php [mode] => NONSSL [get] => Array ( [osCsid] => f27ab8788ba4f4d7d549ec26f5bf6f41 ) [post] => Array ( ) ) [2] => Array ( => account.php [mode] => NONSSL [get] => Array ( [osCsid] => f27ab8788ba4f4d7d549ec26f5bf6f41 ) [post] => Array ( ) ) [3] => Array ( => login.php [mode] => NONSSL [get] => Array ( [osCsid] => f27ab8788ba4f4d7d549ec26f5bf6f41 ) [post] => Array ( ) ) ) [snapshot] => Array ( => account.php [mode] => NONSSL [get] => Array ( [osCsid] => f27ab8788ba4f4d7d549ec26f5bf6f41 ) [post] => Array ( ) ) ) [affiliate_ref] => [affiliate_clickthroughs_id] => [jukebox] => -1 ) after login to wholesale account: Array ( [cart] => shoppingcart Object ( [contents] => Array ( [1759{3}25{1}34] => Array ( [qty] => 1 [attributes] => Array ( [3] => 25 [1] => 34 ) ) ) [total] => 103.28 [weight] => 0 [cartID] => [content_type] => ) [language] => german [languages_id] => 2 [currency] => EUR [navigation] => navigationhistory Object ( [path] => Array ( [0] => Array ( => index.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( ) ) [1] => Array ( => shopping_cart.php [mode] => NONSSL [get] => Array ( [osCsid] => f27ab8788ba4f4d7d549ec26f5bf6f41 ) [post] => Array ( ) ) [2] => Array ( => account.php [mode] => NONSSL [get] => Array ( [osCsid] => f27ab8788ba4f4d7d549ec26f5bf6f41 ) [post] => Array ( ) ) ) [snapshot] => Array ( ) ) [affiliate_ref] => [affiliate_clickthroughs_id] => [jukebox] => -1 [customer_id] => 4135 [customer_default_address_id] => 4362 [customer_first_name] => Robin [sppc_customer_group_id] => 1 [sppc_customer_group_show_tax] => 0 [sppc_customer_group_tax_exempt] => 0 [customer_country_id] => 81 [customer_zone_id] => 0 ) What now does thia show to me ? Again, after loging into the wholesale account, the prices are shown in net, but based from the retail prices (not wholesale prices). Thanks very much hearing from you again. Robin Quote
Jan Zonjee Posted October 29, 2006 Posted October 29, 2006 The first point - check the customer group id- is cleared. At this time customer group O is the default or retail group, 1 is for wholesale, and 2 is for a third group. So far, in my opinion, this is OK. Yes, that looks fine. [sppc_customer_group_id] => 1 [sppc_customer_group_show_tax] => 0 [sppc_customer_group_tax_exempt] => 0 What now does thia show to me ? It shows that this is in order. The session variables are set OK.Again, after loging into the wholesale account, the prices are shown in net, but based from the retail prices (not wholesale prices) Do I understand correctly that the prices everywhere are still retail? Not just on one page, but when you go from index.php to product_info.php to shopping_cart.php to checkout the price stays retail? On product_info.php you could do a echo $customer_group_id; to see if the session variable which is set correctly translates correctly to customer_group_id = 1. Then also make sure your wholesale prices went into the database (table products_groups, customers_group_id =1). You could/should check that with phpMyAdmin or whatever tool is available to check the database directly. Quote
Zoltan Posted October 29, 2006 Author Posted October 29, 2006 Hi JanZ, yes the prices remains retail wherever I navigate, but calculated in net. This is the output on product info toc check the customer group: Array ( [cart] => shoppingcart Object ( [contents] => Array ( ) [total] => 103.28 [weight] => 0 [cartID] => 62872 [content_type] => ) [language] => german [languages_id] => 2 [currency] => EUR [navigation] => navigationhistory Object ( [path] => Array ( [0] => Array ( => index.php [mode] => NONSSL [get] => Array ( [osCsid] => bf6073e615e32b1d173ea2f12f32074e ) [post] => Array ( ) ) [1] => Array ( => account.php [mode] => NONSSL [get] => Array ( [osCsid] => bf6073e615e32b1d173ea2f12f32074e ) [post] => Array ( ) ) [2] => Array ( => shopping_cart.php [mode] => NONSSL [get] => Array ( [osCsid] => bf6073e615e32b1d173ea2f12f32074e ) [post] => Array ( ) ) [3] => Array ( => index.php [mode] => NONSSL [get] => Array ( [cPath] => 342_889 [osCsid] => bf6073e615e32b1d173ea2f12f32074e ) [post] => Array ( ) ) [4] => Array ( => product_info.php [mode] => NONSSL [get] => Array ( [products_id] => 43230 [osCsid] => bf6073e615e32b1d173ea2f12f32074e ) [post] => Array ( ) ) ) [snapshot] => Array ( ) ) [affiliate_ref] => [affiliate_clickthroughs_id] => [jukebox] => -1 [recently_viewed] => 43230; [customer_id] => 4135 [customer_default_address_id] => 4362 [customer_first_name] => Robin [sppc_customer_group_id] => 1 [sppc_customer_group_show_tax] => 0 [sppc_customer_group_tax_exempt] => 0 [customer_country_id] => 81 [customer_zone_id] => 0 ) It seems to be set correctly to customer group id 1. I als checked the database. Customer group id for the tested products is 1, and there is a wholsale price inserted, which differs from the default retail price. Also there I cannot find any mistake. This are some products which I used for testing: customers_group_id customers_group_price products_id 1 3.5000 20656 1 54.9500 1760 1 4.9500 2230 1 32.9500 1759 1 50.0000 43144 1 4.4500 2027 1 19.9000 43229 Thaks very much, Robin Quote
Jan Zonjee Posted October 29, 2006 Posted October 29, 2006 This is the output on product info toc check the customer group: OK, I wasn't very clear on this. I meant echo $customer_group_id like for example in product_info.php: // BOF Separate Price per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // EOF Separate Price per Customer ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta nonsense=<?php echo $customer_group_id; ?>> Quote
Zoltan Posted October 29, 2006 Author Posted October 29, 2006 Yes I have added this to product_info.php, which is part of the code of sppc except: <meta nonsense=<?php echo $customer_group_id; ?>> Unfortunately, I have no changing in prices. It is still the same. Robin This is the current product_info.php: <?php/* $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $ adapted for Separate Pricing Per Customer v4 2005/03/06 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 Price per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // EOF Separate Price per Customer?><!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html <?php echo HTML_PARAMS; ?>><head><meta nonsense=<?php echo $customer_group_id; ?>><meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"><?php// BOF: WebMakers.com Changed: Header Tag Controller v1.0// Replaced by header_tags.phpif ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) { require(DIR_WS_INCLUDES . 'header_tags.php');} else {?> <title><?php echo TITLE ?></title><?php}// EOF: WebMakers.com Changed: Header Tag Controller v1.0?><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> <?php // the requested product could not be found. But we do not give up. // Check if it was disabled and get the category id of that product $product_check_query = tep_db_query("select pc.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc where p.products_status != '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.products_id = pc.products_id and pd.language_id = '" . (int)$languages_id . "'"); if ($product_check = tep_db_fetch_array($product_check_query)) { // product exists but disabled // then we do a query of the other products in the same category // and we display them below using the product_listing module $listing_sql = "select p.products_model, pd.products_name, p.products_image, p.products_quantity, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.categories_id = " . $product_check['categories_id'] . " and pd.language_id = '" . (int)$languages_id . "'"; } else { // no, the product is totally absent, we are running out of options, so lets do a query anyway with a variation on the product id. $wrong_id = $HTTP_GET_VARS['products_id']; $size = strlen($wrong_id)-2; $wrong_id = substr($wrong_id, 1,$size); $listing_sql = "select p.products_model, pd.products_name, p.products_image, p.products_quantity, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p.products_id like '%" . $wrong_id . "%' and pd.language_id = '" . (int)$languages_id . "'"; }?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></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 { if (!tep_session_is_registered('recently_viewed')) { tep_session_register('recently_viewed'); $recently_viewed = $HTTP_GET_VARS['products_id'] . ';'; //$recently_viewed = ""; }$check_not_duplicate = $HTTP_GET_VARS['products_id'];$temp_recent = $recently_viewed;if (!ereg($check_not_duplicate, $temp_recent ) ) $recently_viewed = $HTTP_GET_VARS['products_id'] . ';' . $recently_viewed; $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, p.products_groesse, p.products_groesse_text1, p.products_groesse_text2, p.products_groesse_text3, p.products_hersteller, p.products_hersteller_text1, p.products_hersteller_text2, p.products_hersteller_text3, p.products_autor, p.products_autor_text1, p.products_autor_text2, p.products_autor_text3, p.products_zusatz, p.products_zusatz_text1, p.products_zusatz_text2, p.products_zusatz_text3, 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 . "'"); //Base Price Delete if ($new_price = tep_get_products_special_price($product_info['products_id'])) {// BOF Separate Price per Customer $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { $product_info['products_price']= $scustomer_group_price['customers_group_price']; }// EOF Separate Price per Customer $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else {// BOF Separate Price per Customer $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { $product_info['products_price']= $scustomer_group_price['customers_group_price']; }// EOF Separate Price per Customer $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); }//Base Price End 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']; }?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading" valign="top"><?php echo $products_name; ?> </td><!-- //Base Price Change //--> <td class="pageHeading" align="right" valign="top"><?php echo tep_get_products_display_price($product_info['products_id']) . tep_get_products_display_price($product_info['products_id'], true); ?></td><!-- //Base Price Ende //--> </tr> </table></td> </tr> <tr> <td> <div align="left"> <?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></div> </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="java script: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" class="rahmen"') . '<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> <tr> <td align="right" class="smallText"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td><img src="<?php echo DIR_WS_ICONS; ?>icon_print.gif" style="cursor:hand" onclick="window.open('<?php echo tep_href_link(FILENAME_PRINT_PRODUCT_INFO,'products_id='.$product_info['products_id']); ?>', 'popup', 'toolbar=0, width=640, height=600')"></td> <td width="2"></td> <td><?php echo '<a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info['products_id']) .'" target="_blank">' . tep_image('pdf/pdf.gif') .'</a>'; ?></td> </tr> </table> </td> </tr> <tr> <td align="right" class="smallText"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td></td> <td width="2"></td> <td></td> </tr> </table> </td> </tr> <tr> <td align="right" class="smallText"><?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> <?php }?> <p style="margin-top: 0; margin-bottom: 0"></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_zusatz']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_description']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><br> <b><?php echo stripslashes($product_info['products_groesse']); ?></b></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_groesse_text1']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_groesse_text2']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_groesse_text3']); ?></p> <p style="margin-top: 0; margin-bottom: 0"> </p> <p style="margin-top: 0; margin-bottom: 0"><b><?php echo stripslashes($product_info['products_autor']); ?> </b><?php echo stripslashes($product_info['products_autor_text1']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_autor_text2']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_autor_text3']); ?></p> <p style="margin-top: 0; margin-bottom: 0"></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_hersteller']); ?><?php echo stripslashes($product_info['products_hersteller_text1']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_hersteller_text2']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_hersteller_text3']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><br> </p> <p style="margin-top: 0; margin-bottom: 0"><?php echo stripslashes($product_info['products_zusatz_text1']); ?></p> <p style="margin-top: 0; margin-bottom: 0"><font color="green"><b><?php echo stripslashes($product_info['products_zusatz_text2']); ?></b></font></p> <p style="margin-top: 0; margin-bottom: 0"> </p> <p style="margin-top: 0; margin-bottom: 0"><font color="gray" size="-2"><?php echo stripslashes($product_info['products_zusatz_text3']); ?></font></p> <p style="margin-top: 0; margin-bottom: 0"></p> <?php $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 . "'"); $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"><b><?php echo TEXT_PRODUCT_OPTIONS; ?></b></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 . "' 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 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 . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price2($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } 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 }?> <h1><?php echo stripslashes($product_info['products_name']); ?></h1> <div align="right"> <h1></h1> </div> <h1><?php include (DIR_WS_INCLUDES . 'products_next_previous.php');?></h1> </td> </tr> <!-- bof Product Special Expire Date --> <tr> <td class="smallText" align="right" valign="top" colspan="2"><?php $special_exp_date = tep_get_products_special_expire($product_info['products_id']); if ($special_exp_date != ''){echo '<span class="inputRequirement">Spezialpreis g?ltig bis ' . tep_date_long($special_exp_date) . ' </span>';} ?></td> </tr><!-- eof Product Special Expire Date --> <tr> <td></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 $products_price; ?></td> </tr> <tr> &n Quote
Jan Zonjee Posted October 29, 2006 Posted October 29, 2006 Yes I have added this to product_info.php, which is part of the code of sppc except: <meta nonsense=<?php echo $customer_group_id; ?>> Unfortunately, I have no changing in prices. It is still the same. OK, but what is echo'ed there if you are logged-in as wholesale? As retail I saw it is zero. Quote
Jan Zonjee Posted October 29, 2006 Posted October 29, 2006 Actually, it looks like your price is made here: <!-- //Base Price Change //--> <td class="pageHeading" align="right" valign="top"><?php echo tep_get_products_display_price($product_info['products_id']) . tep_get_products_display_price($product_info['products_id'], true); ?></td> <!-- //Base Price Ende //--> That is not a standard osC function. Probably it can be modified for SPPC, but I have never seen this one before. Quote
Zoltan Posted October 30, 2006 Author Posted October 30, 2006 OK, but what is echo'ed there if you are logged-in as wholesale? As retail I saw it is zero. By logging in it changes to 1, so far this works. Quote
Zoltan Posted October 30, 2006 Author Posted October 30, 2006 Actually, it looks like your price is made here: <!-- //Base Price Change //--> <td class="pageHeading" align="right" valign="top"><?php echo tep_get_products_display_price($product_info['products_id']) . tep_get_products_display_price($product_info['products_id'], true); ?></td> <!-- //Base Price Ende //--> That is not a standard osC function. Probably it can be modified for SPPC, but I have never seen this one before. Ok, this is a modification which ads functionality for base price, i.e. 50 g costs 3,50, price per 100 g is 7,00 (its part of German law). Do you think, that this could be a problem with SPPC ? It is installed before SPPC. Quote
Jan Zonjee Posted October 30, 2006 Posted October 30, 2006 Do you think, that this could be a problem with SPPC ? It is installed before SPPC. Pretty likely in my view. Can you find it back (probably in includes/general.php?) and post it? I think it looks up the price again... Quote
Zoltan Posted October 30, 2006 Author Posted October 30, 2006 Pretty likely in my view. Can you find it back (probably in includes/general.php?) and post it? I think it looks up the price again... This is my general.php <?php/* $Id: general.php,v 1.231 2003/07/09 01:15:48 hpdl Exp $ adapted for Separate Pricing Per Customer v4.0 2005/02/08 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License*/ //// // Return a product's description // TABLES: products description function tep_get_products_description($product_id) { global $languages_id; $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $product_id . "' and language_id = '" . $languages_id . "'"); $product_description = tep_db_fetch_array($product_query); return $product_description['products_description']; } ////// Stop from parsing any further PHP code function tep_exit() { tep_session_close(); exit(); } ////// Redirect to another page or site function tep_redirect($url) { if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL } } header('Location: ' . $url); tep_exit(); } ////// Parse the data used in the html tags to ensure the tags will not break function tep_parse_input_field_data($data, $parse) { return strtr(trim($data), $parse); } function tep_output_string($string, $translate = false, $protected = false) { if ($protected == true) { return htmlspecialchars($string); } else { if ($translate == false) { return tep_parse_input_field_data($string, array('"' => '"')); } else { return tep_parse_input_field_data($string, $translate); } } } function tep_output_string_protected($string) { return tep_output_string($string, false, true); } function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); } ////// Return a random row from a database query function tep_random_select($query) { $random_product = ''; $random_query = tep_db_query($query); $num_rows = tep_db_num_rows($random_query); if ($num_rows > 0) { $random_row = tep_rand(0, ($num_rows - 1)); tep_db_data_seek($random_query, $random_row); $random_product = tep_db_fetch_array($random_query); } return $random_product; } ////// Return a product's name// TABLES: products function tep_get_products_name($product_id, $language = '') { global $languages_id; if (empty($language)) $language = $languages_id; $product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'"); $product = tep_db_fetch_array($product_query); return $product['products_name']; } ////// Return a product's special price (returns nothing if there is no offer)// TABLES: products function tep_get_products_special_price($product_id) { $product_query = tep_db_query("select products_price, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $product_id . "'"); if (tep_db_num_rows($product_query)) { $product = tep_db_fetch_array($product_query); $product_price = $product['products_price']; } else { return false; } // BOF Separate Pricing Per Customer global $sppc_customer_group_id; if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status and customers_group_id = '" . (int)$customer_group_id . "'");// EOF Separate_Pricing Per Customer if (tep_db_num_rows($specials_query)) { $special = tep_db_fetch_array($specials_query); $special_price = $special['specials_new_products_price']; } else { $special_price = false; } if(substr($product['products_model'], 0, 4) == 'GIFT') { //Never apply a salededuction to Ian Wilson's Giftvouchers return $special_price; } $product_to_categories_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $product_id . "'"); $product_to_categories = tep_db_fetch_array($product_to_categories_query); $category = $product_to_categories['categories_id']; $sale_query = tep_db_query("select sale_specials_condition, sale_deduction_value, sale_deduction_type from " . TABLE_SALEMAKER_SALES . " where sale_categories_all like '%," . $category . ",%' and sale_status = '1' and (sale_date_start <= now() or sale_date_start = '0000-00-00') and (sale_date_end >= now() or sale_date_end = '0000-00-00') and (sale_pricerange_from <= '" . $product_price . "' or sale_pricerange_from = '0') and (sale_pricerange_to >= '" . $product_price . "' or sale_pricerange_to = '0')"); if (tep_db_num_rows($sale_query)) { $sale = tep_db_fetch_array($sale_query); } else { return $special_price; } if (!$special_price) { $tmp_special_price = $product_price; } else { $tmp_special_price = $special_price; } switch ($sale['sale_deduction_type']) { case 0: $sale_product_price = $product_price - $sale['sale_deduction_value']; $sale_special_price = $tmp_special_price - $sale['sale_deduction_value']; break; case 1: $sale_product_price = $product_price - (($product_price * $sale['sale_deduction_value']) / 100); $sale_special_price = $tmp_special_price - (($tmp_special_price * $sale['sale_deduction_value']) / 100); break; case 2: $sale_product_price = $sale['sale_deduction_value']; $sale_special_price = $sale['sale_deduction_value']; break; default: return $special_price; } if ($sale_product_price < 0) { $sale_product_price = 0; } if ($sale_special_price < 0) { $sale_special_price = 0; } if (!$special_price) { return number_format($sale_product_price, 4, '.', ''); } else { switch($sale['sale_specials_condition']){ case 0: return number_format($sale_product_price, 4, '.', ''); break; case 1: return number_format($special_price, 4, '.', ''); break; case 2: return number_format($sale_special_price, 4, '.', ''); break; default: return number_format($special_price, 4, '.', ''); } } } ////// Return a product's stock// TABLES: products function tep_get_products_stock($products_id) { $products_id = tep_get_prid($products_id); $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $stock_values = tep_db_fetch_array($stock_query); return $stock_values['products_quantity']; } ////// Check if the required stock is available// If insufficent stock is available return an out of stock message function tep_check_stock($products_id, $products_quantity) { $stock_left = tep_get_products_stock($products_id) - $products_quantity; $out_of_stock = ''; if ($stock_left < 0) { $out_of_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>'; } return $out_of_stock; } ////// Break a word in a string if it is longer than a specified length ($len) function tep_break_string($string, $len, $break_char = '-') { $l = 0; $output = ''; for ($i=0, $n=strlen($string); $i<$n; $i++) { $char = substr($string, $i, 1); if ($char != ' ') { $l++; } else { $l = 0; } if ($l > $len) { $l = 1; $output .= $break_char; } $output .= $char; } return $output; } ////// Return all HTTP GET variables, except those passed as a parameter function tep_get_all_get_params($exclude_array = '') { global $HTTP_GET_VARS; if (!is_array($exclude_array)) $exclude_array = array(); $get_url = ''; if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) { reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) { $get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&'; } } } return $get_url; } ////// Returns an array with countries// TABLES: countries function tep_get_countries($countries_id = '', $with_iso_codes = false) { global $languages_id; $countries_array = array(); if (tep_not_null($countries_id)) { if ($with_iso_codes == true) { $countries = tep_db_query("SELECT cn.countries_name, c.countries_iso_code_2, c.countries_iso_code_3 from " . TABLE_COUNTRIES . " c, " . TABLE_COUNTRIES_NAMES . " cn WHERE c.countries_id = '" . (int)$countries_id . "' AND c.countries_id = cn.countries_id AND cn.language_id = '" . $languages_id . "' ORDER BY countries_name"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name'], 'countries_iso_code_2' => $countries_values['countries_iso_code_2'], 'countries_iso_code_3' => $countries_values['countries_iso_code_3']); } else { $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES_NAMES . " where countries_id = '" . (int)$countries_id . "'AND language_id = '" . $languages_id . "' ORDER BY countries_name"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name']); } } else { $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES_NAMES . " WHERE language_id = '" . $languages_id . "' ORDER By countries_name"); while ($countries_values = tep_db_fetch_array($countries)) { $countries_array[] = array('countries_id' => $countries_values['countries_id'], 'countries_name' => $countries_values['countries_name']); } } return $countries_array; } ////// Alias function to tep_get_countries, which also returns the countries iso codes function tep_get_countries_with_iso_codes($countries_id) { return tep_get_countries($countries_id, true); } ////// Generate a path to categories function tep_get_path($current_category_id = '') { global $cPath_array; if (tep_not_null($current_category_id)) { $cp_size = sizeof($cPath_array); if ($cp_size == 0) { $cPath_new = $current_category_id; } else { $cPath_new = ''; $last_category_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$cPath_array[($cp_size-1)] . "'"); $last_category = tep_db_fetch_array($last_category_query); $current_category_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'"); $current_category = tep_db_fetch_array($current_category_query); if ($last_category['parent_id'] == $current_category['parent_id']) { for ($i=0; $i<($cp_size-1); $i++) { $cPath_new .= '_' . $cPath_array[$i]; } } else { for ($i=0; $i<$cp_size; $i++) { $cPath_new .= '_' . $cPath_array[$i]; } } $cPath_new .= '_' . $current_category_id; if (substr($cPath_new, 0, 1) == '_') { $cPath_new = substr($cPath_new, 1); } } } else { $cPath_new = implode('_', $cPath_array); } return 'cPath=' . $cPath_new; } ////// Returns the clients browser function tep_browser_detect($component) { global $HTTP_USER_AGENT; return stristr($HTTP_USER_AGENT, $component); } ////// Alias function to tep_get_countries() function tep_get_country_name($country_id) { $country_array = tep_get_countries($country_id); return $country_array['countries_name']; } ////// Returns the zone (State/Province) name// TABLES: zones function tep_get_zone_name($country_id, $zone_id, $default_zone) { $zone_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country_id . "' and zone_id = '" . (int)$zone_id . "'"); if (tep_db_num_rows($zone_query)) { $zone = tep_db_fetch_array($zone_query); return $zone['zone_name']; } else { return $default_zone; } } ////// Returns the zone (State/Province) code// TABLES: zones function tep_get_zone_code($country_id, $zone_id, $default_zone) { $zone_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country_id . "' and zone_id = '" . (int)$zone_id . "'"); if (tep_db_num_rows($zone_query)) { $zone = tep_db_fetch_array($zone_query); return $zone['zone_code']; } else { return $default_zone; } } ////// Wrapper function for round() function tep_round($number, $precision) { if (strpos($number, '.') && (strlen(substr($number, strpos($number, '.')+1)) > $precision)) { $number = substr($number, 0, strpos($number, '.') + 1 + $precision + 1); if (substr($number, -1) >= 5) { if ($precision > 1) { $number = substr($number, 0, -1) + ('0.' . str_repeat(0, $precision-1) . '1'); } elseif ($precision == 1) { $number = substr($number, 0, -1) + 0.1; } else { $number = substr($number, 0, -1) + 1; } } else { $number = substr($number, 0, -1); } } return $number; } ////// Returns the tax rate for a zone / class// TABLES: tax_rates, zones_to_geo_zones function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) { // BOF Separate Pricing Per Customer, tax exempt modification global $customer_zone_id, $customer_country_id, $sppc_customer_group_tax_exempt; if(!tep_session_is_registered('sppc_customer_group_tax_exempt')) { $customer_group_tax_exempt = '0'; } else { $customer_group_tax_exempt = $sppc_customer_group_tax_exempt; } if ($customer_group_tax_exempt == '1') { return 0; }// EOF Separate Pricing Per Customer, tax exempt modification if ( ($country_id == -1) && ($zone_id == -1) ) { if (!tep_session_is_registered('customer_id')) { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $customer_country_id; $zone_id = $customer_zone_id; } } $tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' group by tr.tax_priority"); if (tep_db_num_rows($tax_query)) { $tax_multiplier = 1.0; while ($tax = tep_db_fetch_array($tax_query)) { $tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100); } return ($tax_multiplier - 1.0) * 100; } else { return 0; } } ////// Return the tax description for a zone / class// TABLES: tax_rates; function tep_get_tax_description($class_id, $country_id, $zone_id) { $tax_query = tep_db_query("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' order by tr.tax_priority"); if (tep_db_num_rows($tax_query)) { $tax_description = ''; while ($tax = tep_db_fetch_array($tax_query)) { $tax_description .= $tax['tax_description'] . ' + '; } $tax_description = substr($tax_description, 0, -3); return $tax_description; } else { return TEXT_UNKNOWN_TAX_RATE; } } // BOF AAP V1.2.1// actual attribute price adjustment (used with no price prefix only) function tep_adjust_price($attribute, $price) { global $currencies; $adjustment = ($attribute-$price); return $adjustment; }//EOF AAP V1.2.1 ////// Add tax to a products price function tep_add_tax($price, $tax) { global $currencies; // BOF Separate Pricing Per Customer, show_tax modification// next line was original code// if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) { global $sppc_customer_group_show_tax; global $sppc_customer_group_tax_exempt; if(!tep_session_is_registered('sppc_customer_group_show_tax')) { $customer_group_show_tax = '1'; } else { $customer_group_show_tax = $sppc_customer_group_show_tax; } // echo '<br>cg_tax_exempt: '; // echo $sppc_customer_group_tax_exempt; if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) && ($customer_group_show_tax == '1')) {// EOF Separate Pricing Per Customer, show_tax modification return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_calculate_tax($price, $tax); } else { return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); } } // Calculates Tax rounding the result function tep_calculate_tax($price, $tax) { global $currencies; return tep_round($price * $tax / 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); } ////// Return the number of products in a category// TABLES: products, products_to_categories, categories function tep_count_products_in_category($category_id, $include_inactive = false) { $products_count = 0; if ($include_inactive == true) { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$category_id . "'"); } else { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$category_id . "'"); } $products = tep_db_fetch_array($products_query); $products_count += $products['total']; $child_categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$category_id . "'"); if (tep_db_num_rows($child_categories_query)) { while ($child_categories = tep_db_fetch_array($child_categories_query)) { $products_count += tep_count_products_in_category($child_categories['categories_id'], $include_inactive); } } return $products_count; } ////// Return true if the category has subcategories// TABLES: categories function tep_has_category_subcategories($category_id) { $child_category_query = tep_db_query("select count(*) as count from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$category_id . "'"); $child_category = tep_db_fetch_array($child_category_query); if ($child_category['count'] > 0) { return true; } else { return false; } } ////// Returns the address_format_id for the given country// TABLES: countries; function tep_get_address_format_id($country_id) { $address_format_query = tep_db_query("select address_format_id as format_id from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$country_id . "'"); if (tep_db_num_rows($address_format_query)) { $address_format = tep_db_fetch_array($address_format_query); return $address_format['format_id']; } else { return '1'; } } ////// Return a formatted address// TABLES: address_format function tep_address_format($address_format_id, $address, $html, $boln, $eoln) { $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'"); $address_format = tep_db_fetch_array($address_format_query); $company = tep_output_string_protected($address['company']); if (isset($address['firstname']) && tep_not_null($address['firstname'])) { $firstname = tep_output_string_protected($address['firstname']); $lastname = tep_output_string_protected($address['lastname']); } elseif (isset($address['name']) && tep_not_null($address['name'])) { $firstname = tep_output_string_protected($address['name']); $lastname = ''; } else { $firstname = ''; $lastname = ''; } $street = tep_output_string_protected($address['street_address']); $suburb = tep_output_string_protected($address['suburb']); $city = tep_output_string_protected($address['city']); $state = tep_output_string_protected($address['state']); if (isset($address['country_id']) && tep_not_null($address['country_id'])) { $country = tep_get_country_name($address['country_id']); if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) { $state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state); } } elseif (isset($address['country']) && tep_not_null($address['country'])) { $country = tep_output_string_protected($address['country']); } else { $country = ''; } $postcode = tep_output_string_protected($address['postcode']); $zip = $postcode; if ($html) {// HTML Mode $HR = '<hr>'; $hr = '<hr>'; if ( ($boln == '') && ($eoln == "\n") ) { // Values not specified, use rational defaults $CR = '<br>'; $cr = '<br>'; $eoln = $cr; } else { // Use values supplied $CR = $eoln . $boln; $cr = $CR; } } else {// Text Mode $CR = $eoln; $cr = $CR; $HR = '----------------------------------------'; $hr = '----------------------------------------'; } $statecomma = ''; $streets = $street; if ($suburb != '') $streets = $street . $cr . $suburb; if ($country == '') $country = tep_output_string_protected($address['country']); if ($state != '') $statecomma = $state . ', '; $fmt = $address_format['format']; eval("\$address = \"$fmt\";"); if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) { $address = $company . $cr . $address; } return $address; } ////// Return a formatted address// TABLES: customers, address_book function tep_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = "\n") { $address_query = tep_db_query("select entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$address_id . "'"); $address = tep_db_fetch_array($address_query); $format_id = tep_get_address_format_id($address['country_id']); return tep_address_format($format_id, $address, $html, $boln, $eoln); } function tep_row_number_format($number) { if ( ($number < 10) && (substr($number, 0, 1) != '0') ) $number = '0' . $number; return $number; } function tep_get_categories($categories_array = '', $parent_id = '0', $indent = '') { global $languages_id; if (!is_array($categories_array)) $categories_array = array(); $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $categories_array[] = array('id' => $categories['categories_id'], 'text' => $indent . $categories['categories_name']); if ($categories['categories_id'] != $parent_id) { $categories_array = tep_get_categories($categories_array, $categories['categories_id'], $indent . '??'); } } return $categories_array; } function tep_get_manufacturers($manufacturers_array = '') { if (!is_array($manufacturers_array)) $manufacturers_array = array(); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } return $manufacturers_array; } ////// Return all subcategory IDs// TABLES: categories function tep_get_subcategories(&$subcategories_array, $parent_id = 0) { $subcategories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$parent_id . "'"); while ($subcategories = tep_db_fetch_array($subcategories_query)) { $subcategories_array[sizeof($subcategories_array)] = $subcategories['categories_id']; if ($subcategories['categories_id'] != $parent_id) { tep_get_subcategories($subcategories_array, $subcategories['categories_id']); } } } // Output a raw date string in the selected locale date format// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS function tep_date_long($raw_date) { if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false; $year = (int)substr($raw_date, 0, 4); $month = (int)substr($raw_date, 5, 2); $day = (int)substr($raw_date, 8, 2); $hour = (int)substr($raw_date, 11, 2); $minute = (int)substr($raw_date, 14, 2); $second = (int)substr($raw_date, 17, 2); return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$month,$day,$year)); } ////// Output a raw date string in the selected locale date format// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS// NOTE: Includes a workaround for dates before 01/01/1970 that fail on windows servers function tep_date_short($raw_date) { if ( ($raw_date == '0000-00-00 00:00:00') || empty($raw_date) ) return false; $year = substr($raw_date, 0, 4); $month = (int)substr($raw_date, 5, 2); $day = (int)substr($raw_date, 8, 2); $hour = (int)substr($raw_date, 11, 2); $minute = (int)substr($raw_date, 14, 2); $second = (int)substr($raw_date, 17, 2); if (@date('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) { return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year)); } else { return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037))); } } ////// Parse search string into indivual objects function tep_parse_search_string($search_str = '', &$objects) { $search_str = trim(strtolower($search_str)); // Break up $search_str on whitespace; quoted string will be reconstructed later $pieces = split('[[:space:]]+', $search_str); $objects = array(); $tmpstring = ''; $flag = ''; for ($k=0; $k<count($pieces); $k++) { while (substr($pieces[$k], 0, 1) == '(') { $objects[] = '('; if (strlen($pieces[$k]) > 1) { $pieces[$k] = substr($pieces[$k], 1); } else { $pieces[$k] = ''; } } $post_objects = array(); while (substr($pieces[$k], -1) == ')') { $post_objects[] = ')'; if (strlen($pieces[$k]) > 1) { $pieces[$k] = substr($pieces[$k], 0, -1); } else { $pieces[$k] = ''; } } // Check individual words if ( (substr($pieces[$k], -1) != '"') && (substr($pieces[$k], 0, 1) != '"') ) { $objects[] = trim($pieces[$k]); for ($j=0; $j<count($post_objects); $j++) { $objects[] = $post_objects[$j]; } } else {/* This means that the $piece is either the beginning or the end of a string. So, we'll slurp up the $pieces and stick them together until we get to the end of the string or run out of pieces.*/ // Add this word to the $tmpstring, starting the $tmpstring $tmpstring = trim(ereg_replace('"', ' ', $pieces[$k])); // Check for one possible exception to the rule. That there is a single quoted word. if (substr($pieces[$k], -1 ) == '"') {// Turn the flag off for future iterations $flag = 'off'; $objects[] = trim($pieces[$k]); for ($j=0; $j<count($post_objects); $j++) { $objects[] = $post_objects[$j]; } unset($tmpstring); // Stop looking for the end of the string and move onto the next word. continue; } // Otherwise, turn on the flag to indicate no quotes have been found attached to this word in the string. $flag = 'on'; // Move on to the next word $k++; // Keep reading until the end of the string as long as the $flag is on while ( ($flag == 'on') && ($k < count($pieces)) ) { while (substr($pieces[$k], -1) == ')') { $post_objects[] = ')'; if (strlen($pieces[$k]) > 1) { $pieces[$k] = substr($pieces[$k], 0, -1); } else { $pieces[$k] = ''; } } // If the word doesn't end in double quotes, append it to the $tmpstring. if (substr($pieces[$k], -1) != '"') {// Tack this word onto the current string entity $tmpstring .= ' ' . $pieces[$k]; // Move on to the next word $k++; continue; } else {/* If the $piece ends in double quotes, strip the double quotes, tack the $piece onto the tail of the string, push the $tmpstring onto the $haves, kill the $tmpstring, turn the $flag "off", and return.*/ $tmpstring .= ' ' . trim(ereg_replace('"', ' ', $pieces[$k])); // Push the $tmpstring onto the array of stuff to search for $objects[] = trim($tmpstring); for ($j=0; $j<count($post_objects); $j++) { $objects[] = $post_objects[$j]; } unset($tmpstring); // Turn off the flag to exit the loop $flag = 'off'; } } } } // add default logical operators if needed $temp = array(); for($i=0; $i<(count($objects)-1); $i++) { $temp[] = $objects[$i]; if ( ($objects[$i] != 'and') && ($objects[$i] != 'or') && ($objects[$i] != '(') && ($objects[$i+1] != 'and') && ($objects[$i+1] != 'or') && ($objects[$i+1] != ')') ) { & Quote
Jan Zonjee Posted October 30, 2006 Posted October 30, 2006 This is my general.php No, it is not there. Perhaps in one of the files that get included? Quote
Zoltan Posted October 31, 2006 Author Posted October 31, 2006 No, it is not there. Perhaps in one of the files that get included? Can you clear up, for what you are looking ? I am just not sure what should search now.... Quote
Jan Zonjee Posted October 31, 2006 Posted October 31, 2006 Can you clear up, for what you are looking ? I am just not sure what should search now.... If you find the function tep_get_products_display_price (perhaps your text editor can search in all your files for this) then I might be able to say if it needs any and how to change it to work with SPPC. Quote
Zoltan Posted October 31, 2006 Author Posted October 31, 2006 If you find the function tep_get_products_display_price (perhaps your text editor can search in all your files for this) then I might be able to say if it needs any and how to change it to work with SPPC. Hi this would take some time, cause there are about 40 files to check...... Quote
Zoltan Posted November 11, 2006 Author Posted November 11, 2006 Hi finally I am back, YES IT IS IN THE GENERAL.PHP. Unfortunately it just pasted not the complete fie in here. Would it be possible to email it to you ??? Robin Quote
Zoltan Posted November 16, 2006 Author Posted November 16, 2006 Hi JanZ, finally I managed to find the bug. In general.php there was one step not included (dividing customer group). This now is working and I am very happy. BUT: As soon as i.e. a wholesale customer with group 1 add some items to the basked there, the items are shown in default custumer group value 0. I was revising the whole documents but not found already... Do you have nany idea ? Zoltan Quote
Jan Zonjee Posted November 16, 2006 Posted November 16, 2006 Do you have nany idea ? The page shopping_cart.php gets it prices from the file includes/classes/shopping_cart.php. Perhaps you should try to echo the object $cart with print_r($cart) on the bottom of that page (start with echo '<pre>';) and check if $this->cg_id is 1. Quote
Zoltan Posted November 16, 2006 Author Posted November 16, 2006 The page shopping_cart.php gets it prices from the file includes/classes/shopping_cart.php. Perhaps you should try to echo the object $cart with print_r($cart) on the bottom of that page (start with echo '<pre>';) and check if $this->cg_id is 1. Dear JanZ yes thanks, I already tried this: the output is correct: [cg_id] => 1. Robin Quote
Jan Zonjee Posted November 17, 2006 Posted November 17, 2006 I already tried this: the output is correct: [cg_id] => 1. OK, but the question is now, are the prices in the object (as outputted) the correct prices? If so, there is code in includes/modules/shopping_cart.php that gets it prices in a non-standard way that does not account for the customer group id. If not then start with the class shopping_cart.php to fix it so that it shows the correct price. Quote
Zoltan Posted January 14, 2007 Author Posted January 14, 2007 Dear JanZ, its me again, whish you happy New Year 2007 first. I am still working on SPPC which does not transfer the prices correctly to the shopping cart. Your question from below: If you ask about the prices outputted in the shopping cart: no they are not correctly, it shows the default prices without tax. What do you mean with: "includes/modules/shopping_cart.php" ß Do not know where o find this... Would be very happy to hear from you again. Robin OK, but the question is now, are the prices in the object (as outputted) the correct prices? If so, there is code in includes/modules/shopping_cart.php that gets it prices in a non-standard way that does not account for the customer group id. If not then start with the class shopping_cart.php to fix it so that it shows the correct price. Quote
Jan Zonjee Posted January 14, 2007 Posted January 14, 2007 Robin, whish you happy New Year 2007 first. Thank you, best wishes for 2007 too.What do you mean with: "includes/modules/shopping_cart.php" Do not know where o find this... It is a path to a file but you won't find it there because it is in "includes/classes/". Quote
Zoltan Posted January 14, 2007 Author Posted January 14, 2007 Dear JanZ, thanks for your information. This is our includes/classes/shopping_cart.php file: <?php /* $Id: shopping_cart.php,v 1.35 2003/06/25 21:14:33 hpdl Exp $ adapted for Separate Pricing Per Customer v4.0 2005/01/27 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 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; if (!tep_session_is_registered('customer_id')) return false; // insert current cart contents in database if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; // BOF Separate Pricing Per Customer // global variable (session) $sppc_customer_group_id -> class variable cg_id global $sppc_customer_group_id; if(!tep_session_is_registered('sppc_customer_group_id')) { $this->cg_id = '0'; } else { $this->cg_id = $sppc_customer_group_id; } // EOF Separate Pricing Per Customer $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) . "', '" . $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 = '" . $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); $products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " 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']); // 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; $products_id = tep_get_uprid($products_id, $attributes); if ($notify == true) { $new_products_id_in_cart = $products_id; tep_session_register('new_products_id_in_cart'); } if ($this->in_cart($products_id)) { $this->update_quantity($products_id, $qty, $attributes); } else { $this->contents[] = array($products_id); $this->contents[$products_id] = array('qty' => $qty); // 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) . "', '" . $qty . "', '" . date('Ymd') . "')"); if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id]['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) . "', '" . (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(); } function update_quantity($products_id, $quantity = '', $attributes = '') { global $customer_id; if (empty($quantity)) return true; // nothing needs to be updated if theres no quantity, so we return true.. $this->contents[$products_id] = array('qty' => $quantity); // update database if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'"); if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id]['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) . "' 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() { $this->total = 0; $this->weight = 0; if (!is_array($this->contents)) return 0; reset($this->contents); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); if ($product = tep_db_fetch_array($product_query)) { $prid = $product['products_id']; $products_tax = tep_get_tax_rate($product['products_tax_class_id']); $products_price = $product['products_price']; $products_weight = $product['products_weight']; $special_price = tep_get_products_special_price($prid); if ($special_price) { $products_price = $special_price; } ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // BOF - AAP V1.2.1 - updated to account for no price prefix to equal actual price // attributes price if (!isset($this->contents[$products_id]['attributes'])) { $this->total += tep_add_tax($products_price, $products_tax) * $qty; } $this->weight += ($qty * $products_weight); } if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); $price_prefix = $attribute_price['price_prefix']; $option_price = $attribute_price['options_values_price']; $products_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); $products_price = $products_stuff['products_price']; if ($price_prefix == '+') { $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } if ($price_prefix == '-') { $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } if ($price_prefix == '') { if ($attribute_price['options_values_price'] == '0') $this->total += tep_add_tax($products_price, $products_tax) * $qty; } if ($attribute_price['options_values_price'] > '0') { if ($price_prefix == '') { if (ceil($option_price) != ceil($products_price)) { $this->total += tep_add_tax($attribute_price['options_values_price'], $products_tax) * $qty; //echo '<br><bR>TOTLA: '.($qty * tep_add_tax($attribute_price['options_values_price'], $products_tax)).'<br><br>'; } else { $this->total += tep_add_tax($products_price, $products_tax) * $qty; $this->total += tep_add_tax(tep_adjust_price($option_price, $products_price), $product_tax) * $qty; } } } } } } } // subtotal function for attributes price function attributes_price($products_id) { $attributes_price = 0; if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); $price_prefix = $attribute_price['price_prefix']; $option_price = $attribute_price['options_values_price']; $products_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); $products_price = $products_stuff['products_price']; if ($price_prefix == '+') { $attributes_price += $option_price; } if ($price_prefix == '-') { $attributes_price -= $option_price; } if (($price_prefix == '') and ($option_price > 0)) $attributes_price += tep_adjust_price($option_price,$products_price); else $attributes_price+= $option_price; } } return $attributes_price; } // EOF - AAP V1.2.1 ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// function get_products() { global $languages_id; // BOF Separate Pricing Per Customer // global variable (session) $sppc_customer_group_id -> class variable cg_id global $sppc_customer_group_id; if(!tep_session_is_registered('sppc_customer_group_id')) { $this->cg_id = '0'; } else { $this->cg_id = $sppc_customer_group_id; } // EOF Separate Pricing Per Customer if (!is_array($this->contents)) return false; $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and ((pd.language_id = '" . (int)$languages_id . "')or p.products_bundle_status='1')"); if ($products = tep_db_fetch_array($products_query)) { $prid = $products['products_id']; $products_price = $products['products_price']; $special_price = tep_get_products_special_price($prid); if ($special_price) { $products_price = $special_price; } $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], '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']; } } } ?> The add for sppc is already included. Where could be a mistake ? Robin Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.