Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

i want the values the customer inputs for Tax ID, Company Name, and what they answer for the above "drop down menu" question; to be displayed on the order (as it appears in admin->customers->orders).

 

how can i do this?

That is a big job because the value that is shown in the drop-down menu is not stored anywhere (you could have it emailed to yourself of course when the customer opens the account). And then for the order, if the customer already has an account there is no value for the drop-down menu.

Share this post


Link to post
Share on other sites
It is there, just a bit further than the rest of the code that needs adapting. Use the search function in your text editor for "DISPLAY_PRICE_WITH_TAX" and you will find it quickly.

 

So I finished the installation after 7-8 hours. I had couple of errors but all answers I found in the forum including advance_such_result.php So far everything works just perfect. This is an amazing contribution! Thank you so much all who worked so hard on this. I really appreciate it. Thank you.

Share this post


Link to post
Share on other sites

I keep getting this error, i get the error with my boxes/shopping_cart.php and my includes/shopping_cart.php

 

Fatal error: Call to undefined function: get_products() in /home/behrends/public_html/vtstorebeta/shopping_cart.php on line 75

 

Fatal error: Call to undefined function: get_products() in /home/behrends/public_html/vtstorebeta/includes/boxes/shopping_cart.php on line 25

 

I looked at my code did tons of cleaning n checking, i can't find the reason. I have 2 contribs together, in my file and they both work fine when by themselves. Everything else on the site works fine except displaying items WHEN I ADD TO CART! When it's empty it works fine.

 

My globals work fine

i installed 415

Downloaded OS yesterday, newest build

 

Here is my class file, i been working on this a lot, and i still can't figure why it's saying it can't see the function at all. There is no dubs of it anywhere, so i am guessing a error in the code of the function

shopping_cart.php class file

	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 . "'");
	if ($products = tep_db_fetch_array($products_query)) {
	  $prid = $products['products_id'];
	  $products_price = $products['products_price'];

// BOF Separate Pricing Per Customer
/*		  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
	  if (tep_db_num_rows($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  } */
  $specials_price = tep_get_products_special_price($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

	  $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'] : ''));
	}
  }

 

shopping_cart.php boxes file

<?php
/*
 $Id: shopping_cart.php,v 1.18 2003/02/10 22:31:06 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- shopping_cart //-->
	  <tr>
		<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);

 new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SHOPPING_CART));

 $cart_contents_string = '';
 if ($cart->count_contents() > 0) {
$cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';
$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  $cart_contents_string .= '<tr><td align="right" valign="top" class="infoBoxContents">';

  if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	$cart_contents_string .= '<span class="newItemInCart">';
  } else {
	$cart_contents_string .= '<span class="infoBoxContents">';
  }

  $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

  if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	$cart_contents_string .= '<span class="newItemInCart">';
  } else {
	$cart_contents_string .= '<span class="infoBoxContents">';
  }

  $cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';

  if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	tep_session_unregister('new_products_id_in_cart');
  }
}
$cart_contents_string .= '</table>';
 } else {
$cart_contents_string .= BOX_SHOPPING_CART_EMPTY;
 }

 $info_box_contents = array();
 $info_box_contents[] = array('text' => $cart_contents_string);

 if ($cart->count_contents() > 0) {
$info_box_contents[] = array('text' => tep_draw_separator());
$info_box_contents[] = array('align' => 'right',
							 'text' => $currencies->format($cart->show_total()));
 }
// ADDED FOR CCGV
 if (tep_session_is_registered('customer_id')) {
$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
$gv_result = tep_db_fetch_array($gv_query);
if ($gv_result['amount'] > 0 ) {
  $info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
  $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_BALANCE . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($gv_result['amount']) . '</td></tr></table>');
  $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext"><a href="'. tep_href_link(FILENAME_GV_SEND) . '">' . BOX_SEND_TO_FRIEND . '</a></td></tr></table>');
}
 }
 if (tep_session_is_registered('gv_id')) {
$gv_query = tep_db_query("select coupon_amount from " . TABLE_COUPONS . " where coupon_id = '" . $gv_id . "'");
$coupon = tep_db_fetch_array($gv_query);
$info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_REDEEMED . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($coupon['coupon_amount']) . '</td></tr></table>');

 }

// ADDED FOR CCGV END ADDITTION
 new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- shopping_cart_eof //-->

 

shopping_cart.php root file

<?php
/*
 $Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
 require("includes/application_top.php");

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_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 = '" . $products[$i]['id'] . "'
								   and pa.options_id = '" . $option . "'
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . $value . "'
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . $languages_id . "'
								   and poval.language_id = '" . $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
  }
}
?>
  <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
 } 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'); ?>

 

My e-mail is chris@behrendstech.com. I am new to oscommerce but not php, i am sure i am overlooking something or somethings screwing it up. I searched google and the forums already but i found no answers.

Share this post


Link to post
Share on other sites
A little further, the final_price is established as the products_price plus attributes price. Since the attributes price is zero the final_price cannot be lower than the products_price... (see code from includes/classes/shopping_cart.php, function get_products):

 

I have compared the code you gave me with my catalog/includes/classes/shopping_cart.php file and found no difference..

 

// BOF Separate Pricing Per Customer
/*		  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
	  if (tep_db_num_rows($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  } */
  $specials_price = tep_get_products_special_price($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
	  $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'] : ''));
	}
  }

 

and in the catalog/includes/classes/order.php , I found the shame code, but it doesn't have before the // EOF Separate Pricing Per Customer tag, it looks like

							 'format_id' => $billing_address['address_format_id']);

  $index = 0;
  $products = $cart->get_products();
  for ($i=0, $n=sizeof($products); $i<$n; $i++) {
	$this->products[$index] = array('qty' => $products[$i]['quantity'],
									'name' => $products[$i]['name'],
									'model' => $products[$i]['model'],
									'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
									'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
									'price' => $products[$i]['price'],
									'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),
									'weight' => $products[$i]['weight'],
									'id' => $products[$i]['id']);
// BOF Separate Pricing Per Customer
 if(!tep_session_is_registered('sppc_customer_group_id')) {

 

I have delete my site, install new Oscommerce files and over them the SPPC v 413 in order to have a clean version (keeping the old SQL BD), and when I install the SPPC files the problem beguins :'(

 

Thanks for your help Janz!

Edited by Mookie_Jam

Share this post


Link to post
Share on other sites
I have delete my site, install new Oscommerce files and over them the SPPC v 413 in order to have a clean version (keeping the old SQL BD), and when I install the SPPC files the problem beguins.
I know it is not much of a comfort, but I have found at least one topic where several people mention this problem (without a fix...).

 

I wonder, can you change this piece in includes/classes/order.php:

// BOF Separate Pricing Per Customer
 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
 if ($customer_group_id != '0'){
 $orders_customers_price = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '". $customer_group_id . "' and products_id = '" . $products[$i]['id'] . "'");
 $orders_customers = tep_db_fetch_array($orders_customers_price);
if ($orders_customers = tep_db_fetch_array($orders_customers_price)) {
$this->products[$index] = array('price' => $orders_customers['customers_group_price'],
									'final_price' => $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id']));
}
 }
// EOF Separate Pricing Per Customer

to:

// BOF Separate Pricing Per Customer
 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
 if ($customer_group_id != '0'){
 $orders_customers_price = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '". $customer_group_id . "' and products_id = '" . $products[$i]['id'] . "'");
 $orders_customers = tep_db_fetch_array($orders_customers_price);
if ($orders_customers = tep_db_fetch_array($orders_customers_price)) {
$this->products[$index]['price'] = $orders_customers['customers_group_price'];
$this->products[$index]['final_price'] = $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id'];
}
 }
// EOF Separate Pricing Per Customer

and see if that helps?

Share this post


Link to post
Share on other sites
and see if that helps?

returns me this error

 

Parse error: parse error, unexpected ';' in /home/www/xxx/www/catalog/includes/classes/order.php on line 251

 

the line is

	$this->products[$index]['final_price'] = $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id'];

 

:huh:

Edited by Mookie_Jam

Share this post


Link to post
Share on other sites

I have a question/request regarding SPPC...

 

I have a site that needs to have seperate pricing per country, i.e. the first thing the user does when they get to the site is to select the country they are in and based on this selection display products with thier country pricing.

 

So can this be done (or has this been done already) so that each product has a country price, i.e.

 

France $10

Germany $12

UK $23

 

Cheers, Jason

Share this post


Link to post
Share on other sites
That is a big job because the value that is shown in the drop-down menu is not stored anywhere (you could have it emailed to yourself of course when the customer opens the account). And then for the order, if the customer already has an account there is no value for the drop-down menu.

ok, thats alright... it wont let them attain wholesale status if they answer "no" to the question anyway...

(and their group type (wholesale or retail) is already displayed on the orders).

 

also i need to add Tax ID's to the orders... could i use the instructions you provided at Post #2545??

i could not find where the Tax ID is stored in the SQL database...


Did you get rid of the voices in your head? Do you now miss them and the things that they said?

-David Gilmour

Share this post


Link to post
Share on other sites
returns me this error

 

Parse error: parse error, unexpected ';' in /home/www/xxx/www/catalog/includes/classes/order.php on line 251

 

the line is

	$this->products[$index]['final_price'] = $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id'];

 

:huh:

See the open ( at the end of the statement? Surprised the error report didn't mention that it was expecting it.

Share this post


Link to post
Share on other sites
returns me this error

 

Parse error: parse error, unexpected ';' in /home/www/xxx/www/catalog/includes/classes/order.php on line 251

 

the line is

	$this->products[$index]['final_price'] = $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id'];

 

:huh:

 

Hi,

 

I believe you don't set your tax correctly in the admin panel (Locations / Taxes), it's all there. You have to set all these tax correctly. It's the key. I don't have any problem with the tax and I use SPPC 4.11 since 1 years and 6 months...


John

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

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites
I have a site that needs to have seperate pricing per country, i.e. the first thing the user does when they get to the site is to select the country they are in and based on this selection display products with thier country pricing.

 

So can this be done (or has this been done already) so that each product has a country price, i.e.

 

France $10

Germany $12

UK $23

Tricky... the separate pricing is done by way of the customer group which is set as a session variable on login. I guess you could code it such that by choosing the country this session variable is set but when the customer opens an account and then changes country things get interesting.

 

I guess you were not looking for fixed prices for different currencies contribution.

Share this post


Link to post
Share on other sites
also i need to add Tax ID's to the orders... could i use the instructions you provided at Post #2545??

i could not find where the Tax ID is stored in the SQL database...

The tax id is stored in the table address_book (in hindsight not a good move, should have been customers but there were already contributions using it there... there are instructions from texmaxx a number of pages back how to move that to the table customers). You might need an extra query based on customer_id and customers_default_address_id to pick that tax id up in the table address book if you leave the tax id where it is now.

Share this post


Link to post
Share on other sites
Sorry just needed another 5 minutes got it working, if anybody has similiar then I commented out line 181 in advance_search_results.php

 

$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 

Thanks. This worked to solve my advanced search error "1066"


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

Share this post


Link to post
Share on other sites

I'm using Featured Products v1.5.6. Thanks to JanZ's code on page 112 for the Featured Products, (and the Hide SPPC for Best Sellers Mod and new_products.php) I was able to get the Featured Products on index.php to hide the Wholesale products as before it was showing all products. (Then obviously show products for Wholesalers when logged in.) (catalog/includes/modules/featured.php)

 

While it appears to be working, I'm no expert, these are the only changes that have been made using the more elaborate code on page 112:

 

$featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, NULL as specstat, NULL as specials_new_products_price, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_FEATURED . " f using(products_id) left join " . TABLE_PRODUCTS_DESCRIPTION . " pd using(products_id) where p.products_status = '1' and f.status = '1' and find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 and pd.language_id = '" . (int)$languages_id . "' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
} else {
$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name));
$featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, NULL as specstat, NULL as specials_new_products_price, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_FEATURED . " f using(products_id) left join " . TABLE_PRODUCTS_DESCRIPTION . " pd using(products_id), " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
}

 

I'm hoping that this is correct. (If so, perhaps it can be added as a Contrib like the Best Sellers Content Box for SPPC with Hide Products.)

Share this post


Link to post
Share on other sites

does anyone know how can i keep them from adding certain items to their cart, but still let them see the items and info. (kinda like a gallery).


Did you get rid of the voices in your head? Do you now miss them and the things that they said?

-David Gilmour

Share this post


Link to post
Share on other sites
The tax id is stored in the table address_book (in hindsight not a good move, should have been customers but there were already contributions using it there... there are instructions from texmaxx a number of pages back how to move that to the table customers). You might need an extra query based on customer_id and customers_default_address_id to pick that tax id up in the table address book if you leave the tax id where it is now.

ok JanZ, i got my tax_id field moved from the address_book table to customers table now... now can you tell me what code to add to make the tax_id show up on all the orders that each wholesale customer submits??

 

thanks btw

Edited by herot

Did you get rid of the voices in your head? Do you now miss them and the things that they said?

-David Gilmour

Share this post


Link to post
Share on other sites
Tricky... the separate pricing is done by way of the customer group which is set as a session variable on login. I guess you could code it such that by choosing the country this session variable is set but when the customer opens an account and then changes country things get interesting.

 

I guess you were not looking for fixed prices for different currencies contribution.

 

Thank you that contribution is perfect, I'll just set up currencies for each country and use the currency as the country selector

Share this post


Link to post
Share on other sites
Dave,

The before and after you posted are not from the post of mine you refer you. I suggest you use the "original" 4.11 version and then apply the changes mentioned in that post for both index.php and advanced_search_results.php. MySQL 5 is more strict than MySQL4 so there is no reason for sql that works on MySQL5 to not work on MySQL4.

 

The latest SPPC versions are becoming a bit of a mess with some of the new coding not working at all (the advanced_search_results.php in particular) or not totally in order. All well meant of course by the contributors.

 

I'm working on version 4.20 at the moment that will be "clean" again. It will incorporate a number of features that were ready for a long time but not documented (specific taxes for customers/customer groups, mail and newsletters for customer groups, attribute prices for groups). The attribute prices for groups was lacking the admin part, almost finalized that, but in the mean time I added another feature: hiding attributes for groups for which the catalog side is not finished :rolleyes:

 

It will probably take a couple of weeks to finish the coding, testing, and documenting the new version...

 

Installed SPPC with virtually no problems and it is working well! Thanks for this great contrib!

 

I've tried to incorporate EZier New Fields and that is working well, except with the new products and product listing pages. Both of these contribs make changes to some of the same code, so it's hard for a non-php guru to put them together on those pages.

 

Given the value of those two contrib feature sets along with Quantity Price Break, is there any chance that with SPPC 4.2, there can be a full package of SPPC stand alone, and then a separate package for SPPC with Quantity Price Break, and heck, perhaps even a package with all three integrated together? I think this would be a hugely popular "total pricing solution."

 

Anyway, I'm going to try to include Quantity Price Break, but wanted to read through all of this forum before I start to make sure I know of any challenges before hand. . .


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

Share this post


Link to post
Share on other sites
I hope you found the Quantity Price Breaks for Separate Pricing Per Customer contribution by now :-"

 

yes, I did thanks. I started late yesterday but it ended up being too complicated at the time for a non-php reader, because I have EZier fields installed already and some of the code between the two was beyond my skill. I may have to follow the suggestion here to to sppc, then overwrite QPBfSPPC files and then try to do Ezier last.

 

If anybody has all three on their system in working order, I would sure love to just get a copy of the files :-)


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

Share this post


Link to post
Share on other sites

Hi Philip, and Everyone,

 

I need your help. I using OSCmax which has separate pricing installed as well as CATEGORIES DESCRIPTION. I went on further to install "Hide products from customer groups for SPPC", but i'am facing problems with admin/categories.php

 

Philip, i followed your codes below, and i can see the checkboxes appearing on the edit cateogories page, but it doesnt seem to reflect in database. When i checked the checkboxes, the categories are still in the frontend website.

 

Can you / anyone advise please?

 

 

Many thanks!

 

 

 

 

Hi JanZ,

 

This is the code I have:

		<tr>
	  <td colspan="2" class="main" ><?php echo TEXT_HIDE_CATEGORIES_FROM_GROUPS; ?></td>
	</tr>
	<?php  
  $hide_categories_customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id");
  $hide_categories_from_groups_array = explode(',',$cInfo->categories_hide_from_groups);
  $hide_categories_from_groups_array = array_slice($hide_categories_from_groups_array, 1); // remove "@" from the array
  while ($hide_categories_customers_group = tep_db_fetch_array($hide_categories_customers_group_query)) {
?>
	<tr bgcolor="#ebebff">
	  <td class="main" colspan="2"><?php
  if (isset($cInfo->categories)) {
   echo tep_draw_checkbox_field('hide_cat[' . $hide_categories_customers_group['customers_group_id'] . ']',  $hide_categories_customers_group['customers_group_id'] , (isset($cInfo->categories[ $hide_categories_customers_group['customers_group_id']])) ? 1: 0);
  } else {
  echo tep_draw_checkbox_field('hide_cat[' . $hide_categories_customers_group['customers_group_id'] . ']',  $hide_categories_customers_group['customers_group_id'] , (in_array($hide_categories_customers_group['customers_group_id'], $hide_categories_from_groups_array)) ? 1: 0);
  } ?>
 <?php echo $hide_categories_customers_group['customers_group_name']; ?></td>
	</tr>
	<tr bgcolor="#ebebff">
	  <td class="main" colspan="2"><?php
	}
	 for ($i = 0; $i < count($customers_groups); $i++) {
   $category_hide_string .= '  <td class="main">' . tep_draw_checkbox_field('hide_cat[' . $customers_groups[$i]['id'] . ']',  $customers_groups[$i]['id'] , 0) . '  ' . $customers_groups[$i]['text']. '</td>' . "\n";
	  }
	$category_hide_string .= '</tr>'. "\n";
	 echo $category_hide_string;
// EOF SPPC hide products and categories from groups

// end while ($hide_categories_customers_group = tep_db_fetch_array($hide_categories_customers_group_query))
?> </td>
	</tr>
	<tr>
	  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	</tr>
	<!-- EOF Separate Pricing Per Customer -->

 

It shows - but then when I choose the groups it does not put them in the database.

 

Thanks,

Philip

Share this post


Link to post
Share on other sites

i have a problem where if i edit the customers info the customergroup always goes back to retail. so basically i want the dropdown to already select the current setting not just select retail everytime so if i edit a customer of a diff group i have to remeber to put them back in the right group everytime.


Check out my fully customized oscommerce site by viewing my profile.

Share this post


Link to post
Share on other sites

i also notice in my account info. you have tax ids applied to each address in an address book.

and in my admin where you edit account info there is a field for tax id and its always blank. it seems to control the tax id on the primary address because if i update my account info the tax id dissapeers (looking in address book from customer side of cart)

.. is there a way to have this field pull the primary address tax id and fill this field. 1. so i can see it and actually be able to look it up and verify it, and 2. so when i update the customers account it doesnt delete his tax id (if he has one)


Check out my fully customized oscommerce site by viewing my profile.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×