Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I installed Separate Pricing Per Customer and love it. I'm also a big open source person and I leave the OsCommerce banner in the footer of my website. However, since I installed Seperate priceing it now states OsCommerce next to my favicon.

 

Can someone tell me where I can change back to my wesite name. It was there before with the document name but somehow seperste priceing has overwritten it.

 

Thanks,

 

Ki

 

Never Mind I figured it out.

Link to comment
Share on other sites

Hello,

 

Anyone installed the Mail functions for SPPC 4.2.0 ?

 

I am trying this modification as I think it is really useful.....but it just gave me some errors in the admin/newsletter.php file

 

I am rechecking it again, just wondered if anyone else had tried it or not.

 

dca

Link to comment
Share on other sites

this is the error I get after 2 attempts at checking and editing.....anyone ?

 

1054 - Unknown column 'send_to_customer_groups' in 'field list'

 

select newsletters_id, title, length(content) as content_length, module, date_added, date_sent, status, locked, send_to_customer_groups from newsletters order by date_added desc limit 0, 20

 

[TEP STOP]

Link to comment
Share on other sites

Hello,

 

Anyone installed the Mail functions for SPPC 4.2.0 ?

 

I am trying this modification as I think it is really useful.....but it just gave me some errors in the admin/newsletter.php file

 

I am rechecking it again, just wondered if anyone else had tried it or not.

 

 

the error is :

1054 - Unknown column 'send_to_customer_groups' in 'field list'

 

select newsletters_id, title, length(content) as content_length, module, date_added, date_sent, status, locked, send_to_customer_groups from newsletters order by date_added desc limit 0, 20

 

[TEP STOP]

 

 

dca

Link to comment
Share on other sites

I have installed SPPC 4.15 with mod rev 1.

 

Now I want to install the following contrib

 

http://www.oscommerce.com/community/contri...ll/search,price

 

but.. it doesn´t work, and I don´t know why. I really need it for the german laws and I do not know, how I can handle it. Has anybody an Idea what I can do?? Or does someone know, how I can change my product_info?

 

Here is my Product_info

 

<?php
/*
 $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $
adapted for Separate Pricing Per Customer v4.2 2006/08/20

 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>
<?php
// BOF: Header Tag Controller v2.6.3
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
 <title><?php echo TITLE; ?></title>
<?php
}
// EOF: Header Tag Controller v2.6.3
?>
<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 FormatNumber(num)
  {
 if(isNaN(num)) { num = "0"; }
 sign = (num == (num = Math.abs(num)));
 num = Math.floor(num*100+0.50000000001);
 cents = num%100;
 num = Math.floor(num/100).toString();
 if(cents<10) { cents = "0" + cents; }
 for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
 {
   num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));
 }
 return (((sign)?'':'-') + num + '.' + cents);
  }
 function showPrice(form)
 {  
var myTotalPrice = 0;
var showUP = 0;
var myMathProblem = "";
myItemPrice = parseFloat(form.nuPrice.value);
for (var i = 0; i < form.elements.length; i++)
{
  var e = form.elements[i];
  if ( e.type == 'select-one' )
  {
	showUP = 1;
	Item = e.selectedIndex;
	myPrice = e.options[Item].text;
	myDollarSign = myPrice.indexOf("$",0)
	if ( myDollarSign != "-1" )
	{
	  myParSign = myPrice.indexOf(")", myDollarSign);
	  myAttributeString = myPrice.substring(myDollarSign+1, myParSign);
	  myAttributeString = myAttributeString.replace(/,/,"");
	  myAttributePrice = parseFloat(myAttributeString);
	  myMathProblem = myPrice.charAt(myDollarSign - 1);
	} else { myAttributePrice = 0; }
	  if (myMathProblem == "-")
	  {
		myTotalPrice = myTotalPrice - myAttributePrice;
	  } else {
		myTotalPrice = myTotalPrice + myAttributePrice;
	  }
  }
}  
if ( showUP )
{
	myTotalPrice = FormatNumber(myTotalPrice + myItemPrice);
	document.getElementById("productNEWprice").innerHTML = "Subtotal Price with Options $" + myTotalPrice;
}
 }  
//-->
</script>
<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" 
onload="showPrice(cart_quantity)">
<a name="<?php echo $tags_array['title']; ?>"></a>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
 if ($product_check['total'] < 1) {
?>
  <tr>
	<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 } else {
 //BOF UltraPics
//BOF Original
/*
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
*/
//EOF Original
$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_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, 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 . "'");
//EOF UltraPics

$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 . "'");

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>';
  $nuPrice = $currencies->display_price($new_price, tep_get_tax_rate($product_info_values['products_tax_class_id']));
} 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']));
  $nuPrice = $products_price;
}
$nuPrice = str_replace(",", "", $nuPrice);	### Add this line!
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 valign="top"><h1><?php echo $products_name; ?></h1></td>
		<td align="right" valign="top"><h1><?php echo $products_price; ?></h1></td>
		<input type="hidden" name="nuPrice" value="<?php echo str_replace("$","",$nuPrice); ?>">
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main">
<?php
if (tep_not_null($product_info['products_image'])) {
?>
	  <table border="0" cellspacing="0" cellpadding="2" align="right">
		<tr>
		  <td align="center" class="smallText">
		  <!--BOF UltraPics-->
<?php
if ($product_info['products_image_med']!='') {
	$new_image = $product_info['products_image_med'];
	$image_width = MEDIUM_IMAGE_WIDTH;
	$image_height = MEDIUM_IMAGE_HEIGHT;
} else {
	$new_image = $product_info['products_image'];
	$image_width = SMALL_IMAGE_WIDTH;
	$image_height = SMALL_IMAGE_HEIGHT;
}

?>
<!--EOF UltraPics-->
<script language="javascript"><!--
//BOF UltraPics
//BOF Original
/*
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"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
*/
//EOF Original
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'] . 'ℑ=0') . '\\\')">' . tep_image(DIR_WS_IMAGES . $new_image, addslashes($product_info['products_name']), $image_width, $image_height, 'hspace="5" vspace="5"') . '<br>' . tep_image_button('image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</a>'; ?>');
//EOF UltraPics


//--></script>
<noscript>
<!--BOF UltraPics-->
<!--BOF Original--><!--
<?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>'; ?>
--><!--EOF Original-->
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image_med']) . '">' . tep_image(DIR_WS_IMAGES . $new_image . 'ℑ=0', addslashes($product_info['products_name']), $image_width, $image_height, 'hspace="5" vspace="5"') . '<br>' . tep_image_button('image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</a>'; ?>
<!--EOF UltraPics-->

</noscript>
		  </td>
		</tr>
	  </table>
<?php
}
?>
	  <p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
// BOF SPPC Hide attributes from customer groups
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
?>
	  <table border="0" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
		</tr>
<?php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
	$products_options_array = array();
	$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
	$list_of_prdcts_attributes_id = '';
	$products_options = array(); // makes sure this array is empty again
	while ($_products_options = tep_db_fetch_array($products_options_query)) {
	$products_options[] = $_products_options;
	$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
}

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

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

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

	  }
	}
// EOF SPPC attributes mod

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

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

if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
  </tr>
<?php
} else {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
  </tr>
<?php
}
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
			<?php // #################### START Qauntity images and text unlimited ############# ?>
			<td class="main" align="center"><?php echo TEXT_STOCKINFO; ?><br><?php echo $lc_text = '' . picto_qty($product_info['products_quantity']) . ''; ?></font></td></p>
			<?php // #################### END Qauntity images and text unlimited ############# ?>
			<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
 }
?>
	</td>
  </tr>
		<tr>
   <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
   <td class="smallText" align="center"><?php echo TEXT_VIEWING; ?> 
   <?php echo '<a title="' . $tags_array['title'] . '" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id'], 'NONSSL') . '"/# ' . $tags_array['title'] . '">' . $tags_array['title']; ?></a></td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Hope someone can help me...

Link to comment
Share on other sites

this is the error I get after 2 attempts at checking and editing.....anyone ?

 

1054 - Unknown column 'send_to_customer_groups' in 'field list'

 

select newsletters_id, title, length(content) as content_length, module, date_added, date_sent, status, locked, send_to_customer_groups from newsletters order by date_added desc limit 0, 20

 

[TEP STOP]

Sorry, my fault. It has been so long ago I coded this I forgot to include a crucial sql command in the instructions:

 

ALTER TABLE `newsletters`
ADD send_to_customer_groups VARCHAR(32) DEFAULT NULL;

I'll do my best to update the instructions today and upload a fresh file.

Link to comment
Share on other sites

Hi to all

Just want to say it is a great contribution, really good work, thank you.

I installed it, and i have a problem with the admin panel, to be more precise i cannot submit changes in the customers (where you assign customers to new group). I don't have a submit button:) so i can't save changes. Any idea what i might do wrong. If you could tell me which php file is responsible for changing customers details.

Thank you in advance

Hubert

Link to comment
Share on other sites

Sorry, my fault. It has been so long ago I coded this I forgot to include a crucial sql command in the instructions:

 

ALTER TABLE `newsletters`
ADD send_to_customer_groups VARCHAR(32) DEFAULT NULL;

I'll do my best to update the instructions today and upload a fresh file.

 

Hello JanZ,

 

Thanks. Looks good.

 

dca

Link to comment
Share on other sites

After 2 late nights, I finally was able to get this mod working. It was fairly easy, but to incorporate my qty<0 and produt sort gave my a slight hic-up. It was the fatigue mostly.

 

Thanks to all for making this work.

 

Anyhow my question is..

 

I wish to have a tier pricing structure.

 

Basiclly anyone who purhases over 1000$ is level 1 over $2000 is level 2 and over $5000 is level 3. Is there an easy way to due this?

 

If not, is there an easy way to mass update my entire cust list's customers_group_id so anyone logged in has seperate prcing than posted. Straight SQL is fine.

 

Those darn MAP :)

Edited by graysonhobby
Link to comment
Share on other sites

Well...I was able to answer my own question about the SQL to mass update the Cust_group_id

 

Now..how do I incorporate a where clause in my PHPAdmine from the cust_stat file...

 

UPDATE `customers` SET `customers_group_id` = '1' where sum(op.products_quantity * op.final_price) as ordersum from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o where c.customers_id = o.customers_id and o.orders_id = op.orders_id group by c.customers_firstname, c.customers_lastname order by ordersum DESC";

Link to comment
Share on other sites

Now..how do I incorporate a where clause in my PHPAdmine from the cust_stat file...

 

UPDATE `customers` SET `customers_group_id` = '1' where sum(op.products_quantity * op.final_price) as ordersum from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o where c.customers_id = o.customers_id and o.orders_id = op.orders_id group by c.customers_firstname, c.customers_lastname order by ordersum DESC";

Personally, I don't understand what you want to do but you do seem to have the first where before even mentioning the from clause so that won't work.

Link to comment
Share on other sites

Personally, I don't understand what you want to do but you do seem to have the first where before even mentioning the from clause so that won't work.

 

 

That last post was missing a space.

 

My 1st question was how do I update all the customers grouping id

 

SQL Code is here

 

UPDATE `customers` SET `customers_group_id` = '1'

 

Now I just need help with a SQL statement that will search for Customer Purchase totals > 1000 and set the Customer_group_Id = 2

Link to comment
Share on other sites

Now I just need help with a SQL statement that will search for Customer Purchase totals > 1000 and set the Customer_group_Id = 2

I tried that, but even selecting with an ordersum larger than this or that throws an error. The best I can come up with is:

select c.customers_id, c.customers_group_id, sum(op.products_quantity * op.final_price) as ordersum from customers c, orders_products op, orders o where c.customers_id = o.customers_id and o.orders_id = op.orders_id group by c.customers_id order by ordersum desc;

If you start with the highest order volume and later add "and c.customers_group_id < #" you might prune the number of customers_id you need to write down.

 

Updating like update customer set customer_group_id = # where customers_id in (3, 14, 15, 17, 33, 89); should work. 3, 14, 15, 17, 33, 89 are the customers_id of which you made a note of course.

Link to comment
Share on other sites

I will like to set the new customers automatically into their group if they place in the right code, i dont want to place them myself and check them into their groups.

 

I have for example 3 differents groups , each one has a code (gp1_0001,gp2_0001,gp3_0001) , as they register and introduce the right code , and after they successfully complete their summission , i want them to directly be in the group that has the code they introduce. without me having to check them manually into their groups from the admin panel. I need this cause i will be handeling groups of 4000 or more people and is too much time to check them all.

 

does anyone know about any contrib that makes this? I have v4.16 and the hide products and categories addon to this contribtion.

Edited by sultanos

If you are not part of the solution, you are part of the problem

Link to comment
Share on other sites

I will like to set the new customers automatically into their group if they place in the right code, i dont want to place them myself and check them into their groups.

 

I have for example 3 differents groups , each one has a code (gp1_0001,gp2_0001,gp3_0001) , as they register and introduce the right code , and after they successfully complete their summission , i want them to directly be in the group that has the code they introduce. without me having to check them manually into their groups from the admin panel. I need this cause i will be handeling groups of 4000 or more people and is too much time to check them all.

 

does anyone know about any contrib that makes this?

There is none, but it is not hard to add that to create_account.php. I would suggest adding an input field (model it after the one for company_tax_id). Then in the top of the file (like around line 37 where the stuff regarding company_tax_id is) you add code for evaluating the post variable. Kind of like:

if ($_POST['name_of_your_input_field'] == 'gp1_0001') {
$customer_group_id = '1'; //or whatever it should be
} elseif ($_POST['name_of_your_input_field'] == 'gp2_0001') {
$customer_group_id = '2'; //or whatever it should be
} elseif ($_POST['name_of_your_input_field'] == 'gp3_0001') {
$customer_group_id = '3'; //or whatever it should be
} else {
$customer_group_id = '0'; // have a default to fall back on in case a customer types in no code or a wrong one
}

Then further on, for example around line 212 you add the customer_group_id to the $sql_data_array:

$sql_data_array['customer_group_id'] = $customer_group_id;

That should do it.

Link to comment
Share on other sites

Hi Jan,

 

I have been receiving some phone calls from customers having problems, and until today I hadn't been able to duplicate it. I finally had a customer who called while the error was on their screen :thumbsup:

 

It turns out to be something happening between Discount Coupon Codes (v3) and SPPC. If a new customer browses the site, puts items in their cart, clicks on checkout, and then sets up their account. If they try to use a discount code during checkout they get an error that looks to me like the customer group id is not being passed:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND coupons_id="MM0707"' at line 4

SELECT dc2cg.customers_group_id FROM discount_coupons_to_customer_groups dc2cg WHERE customers_group_id= AND coupons_id="MM0707"

 

If the customer logs in before shopping, or if an existing customer logs in after clicking on "checkout" - everything works correctly. It only seems to occur when a new customer sets up their account after clicking "checkout" and wants to use a discount coupon.

 

This is the bit of code in the file that is referenced in the error:

//customer_group_exclusions
			$check_user_query = tep_db_query($sql = 'SELECT dc2cg.customers_group_id
																								FROM '.TABLE_DISCOUNT_COUPONS_TO_CUSTOMER_GROUPS.' dc2cg
																								WHERE customers_group_id='.$sppc_customer_group_id.'
																									AND coupons_id="'.tep_db_input( $code ).'"' );
			if( tep_db_num_rows( $check_user_query ) > 0 ) {
				$this->message( ENTRY_DISCOUNT_COUPON_ERROR ); //display the error message

 

This bit of code appears in the file before the referenced code above:

//EOF SPPC to get customers group id
		global $customer_id; //needed for customer_exclusions	
		global $sppc_customer_group_id; //needed for customer group exclusions

 

Any thoughts on what can be done to cause the customer group id to properly be passed along when a new customer sets up their account when they click on "checkout" and then they click on "continue" to go back to the checkout process?

 

Thanks!! :blush:

~Tracy
 

Link to comment
Share on other sites

If the customer logs in before shopping, or if an existing customer logs in after clicking on "checkout" - everything works correctly. It only seems to occur when a new customer sets up their account after clicking "checkout" and wants to use a discount coupon.

 

Any thoughts on what can be done to cause the customer group id to properly be passed along when a new customer sets up their account when they click on "checkout" and then they click on "continue" to go back to the checkout process?

Yes, sorry, knew about that a long time. Should be fixed in the new version.

In create_account.php around line 232 and further change:

	  if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }

  $customer_first_name = $firstname;
  $customer_default_address_id = $address_id;
  $customer_country_id = $country;
  $customer_zone_id = $zone_id;
  tep_session_register('customer_id');
  tep_session_register('customer_first_name');
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_country_id');
  tep_session_register('customer_zone_id');

// restore cart contents
  $cart->restore_contents();

To (above is some additional code shown that is not changed, just for reference):

	  if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }
// BOF Separate Pricing Per Customer
// register SPPC session variables for the new customer
// if there is code above that puts new customers directly into another customer group (default is retail)
// then the below code need not be changed, it uses the newly inserted customer group
  $check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customer_id . "'");
  $customer_group_info = tep_db_fetch_array($check_customer_group_info);
  $sppc_customer_group_id = $customer_group_info['customers_group_id'];
  $sppc_customer_group_show_tax = (int)$customer_group_info['customers_group_show_tax'];
  $sppc_customer_group_tax_exempt = (int)$customer_group_info['customers_group_tax_exempt'];
// EOF Separate Pricing Per Customer
  $customer_first_name = $firstname;
  $customer_default_address_id = $address_id;
  $customer_country_id = $country;
  $customer_zone_id = $zone_id;
  tep_session_register('customer_id');
  tep_session_register('customer_first_name');
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_country_id');
  tep_session_register('customer_zone_id');
		// BOF Separate Pricing Per Customer
  tep_session_register('sppc_customer_group_id');
  tep_session_register('sppc_customer_group_show_tax');
  tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing Per Customer

// restore cart contents
  $cart->restore_contents();

Link to comment
Share on other sites

Is it possible to put a new customer into a "member" group if he/she simply signs up for our newsletter. ie checks the newsletter box.

 

im thinking something like this

 

if (NEWSLETTER == 'TRUE') {

$sql_data_array['customers_group_ra'] = '2';

}

 

this is doing nothing for me..

Link to comment
Share on other sites

There is none, but it is not hard to add that to create_account.php. I would suggest adding an input field (model it after the one for company_tax_id). Then in the top of the file (like around line 37 where the stuff regarding company_tax_id is) you add code for evaluating the post variable. Kind of like:

if ($_POST['name_of_your_input_field'] == 'gp1_0001') {
$customer_group_id = '1'; //or whatever it should be
} elseif ($_POST['name_of_your_input_field'] == 'gp2_0001') {
$customer_group_id = '2'; //or whatever it should be
} elseif ($_POST['name_of_your_input_field'] == 'gp3_0001') {
$customer_group_id = '3'; //or whatever it should be
} else {
$customer_group_id = '0'; // have a default to fall back on in case a customer types in no code or a wrong one
}

Then further on, for example around line 212 you add the customer_group_id to the $sql_data_array:

$sql_data_array['customer_group_id'] = $customer_group_id;

That should do it.

 

Ok let´s do it.

 

Where and how do i insert this´my input field´.

One more question , how does the database insert those values?. i just need to put the code you gave me?

If you are not part of the solution, you are part of the problem

Link to comment
Share on other sites

But this might work:

	if (NEWSLETTER == 'TRUE') {
$sql_data_array['customers_group_id'] = '2';
}

 

 

Yea I saw that after I posted, I swtiched it still does not work. I went into the DB and swapped Retail Group ID = 1 and Member Pricing = 0. That seemed to fix it.

Link to comment
Share on other sites

Yes, sorry, knew about that a long time. Should be fixed in the new version.

In create_account.php around line 232 and further change:

	  if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }

  $customer_first_name = $firstname;
  $customer_default_address_id = $address_id;
  $customer_country_id = $country;
  $customer_zone_id = $zone_id;
  tep_session_register('customer_id');
  tep_session_register('customer_first_name');
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_country_id');
  tep_session_register('customer_zone_id');

// restore cart contents
  $cart->restore_contents();

To (above is some additional code shown that is not changed, just for reference):

	  if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }
// BOF Separate Pricing Per Customer
// register SPPC session variables for the new customer
// if there is code above that puts new customers directly into another customer group (default is retail)
// then the below code need not be changed, it uses the newly inserted customer group
  $check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customer_id . "'");
  $customer_group_info = tep_db_fetch_array($check_customer_group_info);
  $sppc_customer_group_id = $customer_group_info['customers_group_id'];
  $sppc_customer_group_show_tax = (int)$customer_group_info['customers_group_show_tax'];
  $sppc_customer_group_tax_exempt = (int)$customer_group_info['customers_group_tax_exempt'];
// EOF Separate Pricing Per Customer
  $customer_first_name = $firstname;
  $customer_default_address_id = $address_id;
  $customer_country_id = $country;
  $customer_zone_id = $zone_id;
  tep_session_register('customer_id');
  tep_session_register('customer_first_name');
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_country_id');
  tep_session_register('customer_zone_id');
		// BOF Separate Pricing Per Customer
  tep_session_register('sppc_customer_group_id');
  tep_session_register('sppc_customer_group_show_tax');
  tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing Per Customer

// restore cart contents
  $cart->restore_contents();

 

WOOHOO!! It worked!! Thank you very very very much!! :thumbsup:

~Tracy
 

Link to comment
Share on other sites

Yea I saw that after I posted, I swtiched it still does not work. I went into the DB and swapped Retail Group ID = 1 and Member Pricing = 0. That seemed to fix it.

Then visitors who are not logged in will get to see the member pricing...

 

Of course the code should be like:

	if ($newsletter == 1 ) {
$sql_data_array['customers_group_id'] = '2';
}

Link to comment
Share on other sites

Hello all. I've got a webstore that sells to both retail and wholesale customers. I've got a little problem though and I seem to be the only one with this problem because I can't find anyone else posting about it.

 

If a retail item's price is $54.00 for the small, 56 for the med and 59 for the large lets say and the wholesale pricing is 21, 22 and 22.50 lets say, there would appear to be no way to do that without using seperate entries for each size of product since the product attributes only allow me to add a general increase in price that applies to both retail and wholesale which this is getting rather messy on some items that have lots of sizes like pants. Is there some work around, a different contrib or some easy fix that anyone can think of?

 

Thanks...

Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...