Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

it seems that for my "bug" this part of create_account.php doesn't works as expected:

 

tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");

 

it doesn't take the good values

customers_info_id is different from customer_id and the same for the other fields

 

After account created when i'm logged no info appear in account_edit.php

and in admin the same errors appears as my first message

 

very very strange


PL DTM

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

Sur un malentendu, ... ?a pourrait marcher

Share this post


Link to post
Share on other sites
It looks like you copied this piece of code from somewhere else, where the array with database results was called new_products. Try specials instead (and add the [$x], also with the Model ID#:

		<td bgcolor=#F2EEE5 width=250 valign=top align=center>
	 <table cellspacing=0 cellpadding=0 width=230>
	  <tr><td height=12></td></tr>
	  <tr>
	  <td width=78 valign=top><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials[$x]['products_image'], $specials[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>
	  <td width=10></td>
	   <td width=140 valign=top>
	   <table cellspacing=0 cellpadding=0 width=140>
				   <tr><td height=55 valign=middle><a class=ml5  href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials[$x]['products_id']) . '">' . $specials[$x]['products_name'] . '</a></td></tr>
		<tr><td class=ch8><a class=ch8  href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $specials[$x]['products_id']) . '">Model ID# ' . $specials[$x]['products_id'] . '</a></td></tr>
		<tr><td height=5></td></tr>
		<tr><td class=ch9 height=30 valign=middle><li><u>'.preg_replace('/\s\S*$/i', '', substr($specials[$x]['products_description'], 0, 45)).' ...</u></li></td></tr>

 

Well, eventhough description is still not showing.. I have realized about another amazing problem.. :huh:

 

When I logg in as a disccount user, no products are shown in specials.php. When I logoff, produts are shown.. :mellow:

Share this post


Link to post
Share on other sites

I have installed the register globals contribution, and have register long_arrays set on in .htaccess.

 

Merged the SPPC contribution with the register globals..

 

All is well (after attending to the broken search syntax for php 5.2 as per another contrib).. however now I find I cant sort the Customers on the Admin/Customers page....

 

The url looks ok, just never sorts as it used to...

http://......../catalog/admin/customers.php?listing=firstname-desc

 

Anyone have an clue to where to look for a broken sort ?

TIA

Share this post


Link to post
Share on other sites
I have installed the register globals contribution, and have register long_arrays set on in .htaccess.

 

Merged the SPPC contribution with the register globals..

 

All is well (after attending to the broken search syntax for php 5.2 as per another contrib).. however now I find I cant sort the Customers on the Admin/Customers page....

 

The url looks ok, just never sorts as it used to...

http://......../catalog/admin/customers.php?listing=firstname-desc

 

Anyone have an clue to where to look for a broken sort ?

TIA

 

 

To answer my own question.....

I looked at the customers.php page and found the $listing variable was not getting set to any value.. Perhaps due to the register globals patch but anyway, on about line 992 where the existing code was using the global variable $listing I added this line just before the switch ($listing) line :-

$listing=$_GET['listing'];

 

There may be a better fix, but this made the sort work!

 

 

So all is well....

Share this post


Link to post
Share on other sites

I just installed the upgrade to the PriceFormatter box, and it's fantastic... HOWEVER, now my "specials" pricing is not showing. It reflects in the cart if I add it, but it used to show the old price marked out in red and the new price next to it... I searched the forum and couldn't find this problem... any advice appreciated! Here's the site - if you click "deal of the day" it will take you to the dry erase message boards, which I have discounted to $9.50 - that will reflect in the cart but not on the product page.

Share this post


Link to post
Share on other sites
Not with SPPC as it can be found in the contribution section. The new code for that is ready though. I can send it to your email address if you like (PM me). I will put it in a new version of SPPC (promises, promises, promises).

That is an option but your stock will be out of whack that way.

Thank you for getting the attribute mod out there i have yet to tackle the install of it but i will soon.

 

Having 2 product one for retail one for wholesale would not mess with my inventory since i use Stone Edge order manager to control my inventory.

 

?witch would be simpler to control with products that have alot of drop downs like this? http://www.notubes.com/product_info.php/cP.../products_id/69

 

?I also use the mod Attribute Sorter and Copier v.6.0 has anyone used these 2 mods together?

Edited by notubes_pete

Share this post


Link to post
Share on other sites

I have a small question. my site under construction :

http://shop.skullman.nytka.org

 

I would like the graphic infoboxes to be in the same style as the rest of the shop. I mean remove the graphic borders and just keep the boxes and use the standard borders and colors.

 

Can anyone please help me?

 

boxes.jpg

 

Thanks! //Bill

Share this post


Link to post
Share on other sites

Jan

dude I am trying to install your latest addition to SPPC the one that addresses attributes. I have a heavily modified cart and most of the SPPC attributes installed; or so I thought!

Your install instructions keep making references to Nov 2006 updates and to SPPC v4.2

Great. WHAT??? I can't any of these anywhere. Please tell me where they are.

Edited by HallMarc

Share this post


Link to post
Share on other sites
I have a old SPPC installed and would like some of my product only for customers and some only for dealers. Dose the new SPPC have this?

You need to add the Hide products from customer groups contribution

Share this post


Link to post
Share on other sites
I suggest something along these lines to keep things simple (you could make two different modules and enable/disable them in admin, that is not so simple). I haven't tried this, so backup etc.

 

Thanks Jan, sorry it took so long to get back to you - I was put onto another project for a bit. I did try the above quickly and ended up finding that for some reason the system doesn't keep you logged in when using that code - so I'm going to try it again after going through it with a fine tooth comb to see if maybe I missed something the first time through.

 

Another question though - I've found that when I'm logged in as a wholesale customer the product information page shows the retail price, but the shopping cart does show the correct wholesale price. I'm not sure yet what I missed in product_info - but I've pasted the code below for any of you who have both Master Products and SPPC installed to see if you know where the error is. I'm sure it has something to do with the merging of the two contributions :blush:

 

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

 Master Products - JOHNSON - 05/07/2003 matti@suomedia.com

 Copyright (c) 2003 Suomedia - Dynamic Content Management

 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

//added by admin  showing the master for slave products
 $master_query1 = tep_db_query("select products_id,products_master from " . TABLE_PRODUCTS . " where products_id =  '" . (int)$HTTP_GET_VARS['products_id'] . " '");
$results1 = tep_db_fetch_array($master_query1);
if (($results1['products_master'] != null) &&($results1['products_master'] != 0) ) {
		$HTTP_GET_VARS['products_id']=(int)$results1['products_master'];
}
//end of code added by admin  showing the master for slave products

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,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">
<!-- 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 //-->
<!-- Master Products //-->
<td width="100%" valign="top"><?php  echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">'; ?><table border="0" width="100%" cellspacing="0" cellpadding="0">	
<?php
// Master Products EOF
 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 {
//Master Products   	
$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_master_status, 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 . "'");
//Master Products EOF
$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>';
} 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']));
}

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>
		<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main">
<?php
if (tep_not_null($product_info['products_image'])) {
?>
	  <table border="0" cellspacing="0" cellpadding="2" align="right">
		<tr>
		  <td align="center" valign="top" class="smallText">

<script language="javascript"><!--
document.write('<?php echo ' ' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"'); ?>');
//--></script>
<noscript>
<?php echo ' ' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"'); ?>
</noscript>

		  </td>
		</tr>
	  </table>
<?php
}
?>
	  <p><?php echo embedded_href_replace($product_info['products_description']); ?></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"><?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 . "' 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_price($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_' . $HTTP_GET_VARS['products_id'] . '[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
		</tr>
<?php
  }
?>
	  </table>
<?php
}
//Master Products	
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
}	
?>
  </tr>
   <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>	 
<?php
if ($product_info['products_price']>0) {

$qty_array = array();

for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {

$qty_array[] = array('id' => $i, 'text' => $i); 
}
?>
  <tr>
	<td align="right" class="main"><?php if ($product_info['products_quantity'] > 0) {
  echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array); 
  } elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) {
	  $qty_array = array();
		for ($i=0; $ns = 20, $i <= $ns; $i++) {
		$qty_array[] = array('id' => $i, 'text' => $i); 
	}	 
  echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
  } else {
  echo TEXT_STOCK;
}
echo tep_draw_separator('pixel_trans.gif', '30', '10');
?>
	</td>
  </tr>
<?php
}
?>  
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></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 ($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>
<?php

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
$results = tep_db_fetch_array($master_query);
if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) { ?>

  <tr>
<td align="left" class="main"> <?php echo TEXT_SLAVE_PRODUCTS; ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr> 
  <tr>
<td><?php  include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS); ?></td>
  </tr>

<?php	
 } 
}
?>
  <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>
<?php  if ($reviews['count'] > 0) { ?>			   
			<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
}
?>				
			<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
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
?>
	</td>
  </tr>
</table></form></td>
<!-- Master Products EOF //-->   
<!-- 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'); ?>

 

Thanks again!


~Tracy
 

Share this post


Link to post
Share on other sites
I suggest something along these lines to keep things simple (you could make two different modules and enable/disable them in admin, that is not so simple). I haven't tried this, so backup etc.

 

 

Hmmm - well, I copied and pasted what you posted into the files and uploaded them (rather than trying to merge) and now at least I'm not getting logged out during the checkout process - but it still isn't recognizing the difference between retail and wholesale customers for the free shipping. The contrib. I'm using is here:

Free Shipping w/Minimum Amount (in case it would be helpful for you to see all of the files invovled to make sure I'm not missing one that would need editing).

 

I am also going to email the creator of the contrib. to see if they have already been asked how to get it to work properly with SPPC :)


~Tracy
 

Share this post


Link to post
Share on other sites
Well, eventhough description is still not showing..
Perhaps the query that gets the information is not changed to also include products description?
When I logg in as a disccount user, no products are shown in specials.php. When I logoff, produts are shown..
Perhaps there are no specials defined for the discount user?

Share this post


Link to post
Share on other sites
I just installed the upgrade to the PriceFormatter box
Upgrade? Looking at the site you linked to it looks like you use some HTML of your own. Did you add:

// BOF Separate Pricing per Customer, Price Break 1.11.3 mod
  $pf->loadProductSppc((int)$HTTP_GET_VARS['products_id'], (int)$languages_id, $product_info);
  $products_price = $pf->getPriceString();
// EOF Separate Pricing per Customer, Price Break 1.11.3 mod

and then later on use echo products_price;?

Share this post


Link to post
Share on other sites

Marc,

I am trying to install your latest addition to SPPC the one that addresses attributes. I have a heavily modified cart and most of the SPPC attributes installed; or so I thought!

Your install instructions keep making references to Nov 2006 updates and to SPPC v4.2

Great. WHAT??? I can't any of these anywhere. Please tell me where they are.

November 2006 updates? I couldn't find that scanning the install.txt (although I mention revision 1, November 14 for the "upgrade to the upgrade" in which I added code to order.php). I could find mentions of the August 2006 update (which I need/expanded on somewhere in the shopping cart code). SPPC 4.2 is a work in (slow) progress. I refer to it in the comments because it will be included in that new version (the stuff in the contribution section is part of the install instructions for that).

Share this post


Link to post
Share on other sites
I've found that when I'm logged in as a wholesale customer the product information page shows the retail price, but the shopping cart does show the correct wholesale price. I'm not sure yet what I missed in product_info - but I've pasted the code below for any of you who have both Master Products and SPPC installed to see if you know where the error is. I'm sure it has something to do with the merging of the two contributions
Can't see anything wrong with it really. Perhaps a register globals problem? In that case try:

// BOF Separate Price per Customer
 if ( !isset($_SESSION['sppc_customer_group_id']) ) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $_SESSION['sppc_customer_group_id'];
 }
  // EOF Separate Price per Customer

instead of:

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

Share this post


Link to post
Share on other sites
Marc,

November 2006 updates? I couldn't find that scanning the install.txt (although I mention revision 1, November 14 for the "upgrade to the upgrade" in which I added code to order.php). I could find mentions of the August 2006 update (which I need/expanded on somewhere in the shopping cart code). SPPC 4.2 is a work in (slow) progress. I refer to it in the comments because it will be included in that new version (the stuff in the contribution section is part of the install instructions for that).

Jan, It was late and I got those two confused. My apologies.

This section of code (I'm trying to integrate this with Product Attributes - Option Type Feature and Options as Images for MS2) has got me scratching my head. Right now, it adds the item to the shopping cart yet the value for any textbox option is missing. Also, I can't add another item with a different value to the cart. It just overwrites the previous value and adds 1 to the qty. Take a look:

 

	function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
  // BOF Separate Pricing Per Customer, Price Break 1.11.3 modification
  global $new_products_id_in_cart, $customer_id, $sppc_customer_group_id, $languages_id;
  if(!hmw_session_is_registered('sppc_customer_group_id')) { 
	$this->cg_id = '0';
	  } else {
	$this->cg_id = $sppc_customer_group_id;
 }
// EOF Separate Pricing Per Customer

  $pf = new PriceFormatter;
  $pf->loadProduct($products_id, $languages_id);
  $qty = $pf->adjustQty($qty);
  $products_id_string = hmw_get_uprid($products_id, $attributes);
  $products_id = hmw_get_prid($products_id_string);

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


  if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) {
// BOF SPPC attribute hide check, original query expanded to include attributes
	$check_product_query = hmw_db_query("select products_status, options_id, options_values_id, attributes_hide_from_groups, '0' as hide_attr_status from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where p.products_id = '" . (int)$products_id . "'");
	while ($_check_product = hmw_db_fetch_array($check_product_query)) {
		   $attr_hide_array = array(); // empty array in case it is still around and filled
		   $attr_hide_array = explode(",", $_check_product['attributes_hide_from_groups']);
		   if (in_array($this->cg_id, $attr_hide_array)) {
			   $_check_product['hide_attr_status'] = '1';
		   }
		   $check_product[] = $_check_product;
	} // end while ($_check_product = hmw_db_fetch_array($check_product_query))
	$no_of_check_product = count($check_product);

	if (is_array($attributes)) {
	   foreach($attributes as $attr_option => $attr_option_value) {
				$valid_option = '0';
				for ($x = 0; $x < $no_of_check_product; $x++) {
					 if ($attr_option == $check_product[$x]['options_id'] && $attr_option_value == $check_product[$x]['options_values_id']) {
						 $valid_option = '1';
						 if ($check_product[$x]['hide_attr_status'] == '1') {
						// delete hidden attributes from array attributes
							 unset($attributes[$attr_option]);
						 }
					} // end if ($attr_option == $check_product[$x]['options_id']....
				} // end for ($x = 0; $x < $no_of_check_product; $x++)
						if ($valid_option == '0') {
								  while (list($option, $value) = each($attributes)) {
									$attr_value = NULL;
									$blank_value = FALSE;
									if (strstr($option, TEXT_PREFIX)) {
									  if (trim($value) == NULL) {
										$blank_value = TRUE;
										unset($attributes[$attr_option]);
					// after having gone through the options for this product and not having found a matching one
					// we can conclude that apparently this is not a valid option for this product so remove it
										}
									  } else {
										$option = substr($option, strlen(TEXT_PREFIX));
										$attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
										$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;
										$this->contents[$products_id_string]['attributes'][$option] = $value;
									  }
									}
								   }
			} // end foreach($attributes as $attr_option => $attr_option_value)
} // end if (is_array($attributes))
// now attributes have been checked and hidden and invalid ones deleted make the $products_id_string again
	$products_id_string = hmw_get_uprid($products_id, $attributes);

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

	  if ($this->in_cart($products_id_string)) {
		$this->update_quantity($products_id_string, (int)$qty, $attributes);
	  } else {
		$this->contents[$products_id_string] = array('qty' => $qty);
// insert into database
		if (hmw_session_is_registered('customer_id')) hmw_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . hmw_db_input($products_id_string) . "', '" . $qty . "', '" . date('Ymd') . "')");

  if (is_array($attributes)) {
	  reset($attributes);
	  while (list($option, $value) = each($attributes)) {
		$attr_value = NULL;
		$blank_value = FALSE;
		if (strstr($option, TEXT_PREFIX)) {
		  if (trim($value) == NULL)
		  {
			$blank_value = TRUE;
		  } else {
			$option = substr($option, strlen(TEXT_PREFIX));
			$attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
			$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;
			$this->contents[$products_id_string]['attributes'][$option] = $value;
		  }
		}

		if (!$blank_value) {
		  $this->contents[$products_id_string]['attributes'][$option] = $value;
// insert into database
			if (hmw_session_is_registered('customer_id')) hmw_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) values ('" . (int)$customer_id . "', '" . hmw_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "', '" . hmw_db_input($attr_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();
	  } 
	}
  }
} // end function

Edited by HallMarc

Share this post


Link to post
Share on other sites

Marc,

This section of code (I'm trying to integrate this with Product Attributes - Option Type Feature and Options as Images for MS2) has got me scratching my head. Right now, it adds the item to the shopping cart yet the value for any textbox option is missing. Also, I can't add another item with a different value to the cart. It just overwrites the previous value and adds 1 to the qty.
I'm not familiar with the Option Type Feature but I understand the customer can add text to the product and the option ends up as not being a valid option since it isn't listed in the products_attributes table?

 

If so I think the easiest would be to just check for the option being a option type and let it pass there:

							if ($valid_option == '0' && !strstr($attr_option, TEXT_PREFIX)) {
					// after having gone through the options for this product and not having found a matching one
					// we can conclude that apparently this is not a valid option for this product so remove it
					unset($attributes[$attr_option]);
								   } // end if ($valid_option == '0')
			} // end foreach($attributes as $attr_option => $attr_option_value)
} // end if (is_array($attributes))
// now attributes have been checked and hidden and invalid ones deleted make the $products_id_string again
	$products_id_string = hmw_get_uprid($products_id, $attributes);

Part of the problem you experienced must surely be the double looping of the array with attributes and not having it reset before the while statement in that part (which will likely give interesting results here so that is not a good idea).

 

Hopefully, this will do the trick...

Share this post


Link to post
Share on other sites

Can't see anything wrong with it really. Perhaps a register globals problem? In that case try:

// BOF Separate Price per Customer
 if ( !isset($_SESSION['sppc_customer_group_id']) ) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $_SESSION['sppc_customer_group_id'];
 }
  // EOF Separate Price per Customer

 

Ok - I have tried the above in index.php, product_info.php and advanced_search_result.php (still going through all of the files in the site doing a search for this block of code so anywhere else it appears I can update it).

 

While doing this I came across something that very likely is my problem (as so far the above change hasn't fixed the problem). I am using STS and there is another product_info.php page in the sts_inc folder and I see that I had to update it for Master Products but I'm not sure how to incorporate the SPPC code into it as well. Any ideas? (I think once this is all working I should see if I can incorporate it into a downloadable contrib. for those trying to get Master Products and SPPC working together - provided my other contrib's haven't changed the same pages :huh: )

	$products_id=intval($_GET['products_id']);
// Create variables for product ID, added in v4.0.6	
$template['productid'] = $products_id;
$template['productsid'] = $products_id; // Just for consistende with osC names

// Start the "Add to Cart" form
$template_pinfo['startform'] = tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_slave'));
// Add the hidden form variable for the Product_ID
$template_pinfo['startform'] .= tep_draw_hidden_field('products_id', $products_id);
$template_pinfo['endform'] = "</form>";

// Get product information from products_id parameter
$product_info_query = tep_db_query("select p.products_master_status, 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 = '" . $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);

// START Master Products
$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master =  '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   $results = tep_db_fetch_array($master_query);

if ($product_info['products_price']>0) {
  $qty_array = array();
  for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {
	$qty_array[] = array('id' => $i, 'text' => $i); 
  }
  if (($product_info['products_quantity'] > 0) || (STOCK_CHECK == 'false')) {
	$template_pinfo['qtyproducts']= TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
  } else {
	  $template_pinfo['qtyproducts']= TEXT_STOCK;
					  }
}				

$template_pinfo['slaveproducts']='';
if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) {
  $sts->start_capture();
	  echo ' ';
  include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS);
	  echo ' ';
  $sts->stop_capture ('slaveproducts', 'box');
  $template_pinfo['slaveproducts']= $sts->template['slaveproducts'];
	}
// END Master Products

$template_pinfo['regularprice'] = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $template_pinfo['regularpricestrike'] = "<s>" . $template_pinfo['regularprice'] . "</s>";
  $template_pinfo['specialprice'] = $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
} else {
  $template_pinfo['specialprice'] = '';
  $template_pinfo['regularpricestrike'] = $template_pinfo['regularprice'];
}

$template_pinfo['productname'] = $product_info['products_name'];
$template_pinfo['productmodel'] =  $product_info['products_model'];

if (tep_not_null($product_info['products_image'])) {
 $template_pinfo['imagesmall'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"');
 $template_pinfo['imagelarge'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), '','','');
 $template_pinfo['product_popup']= '<script language="javascript"><!--'."\n".
							   'document.write(\'<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . (int)$products_id) . '\\\')">' . $template_pinfo['imagesmall'] . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>\');'."\n".
							   '//--></script>'."\n".
							   '<noscript>'."\n".
							   '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">'.$template_pinfo['imagesmall'] . '<br>' . TEXT_CLICK_TO_ENLARGE .'</a>'."\n".
							   '</noscript>'."\n";
} else {
 $template_pinfo['imagesmall'] ='';
 $template_pinfo['imagelarge'] ='';
 $template_pinfo['product_popup']='';	
}

$template_pinfo['productdesc'] = stripslashes($product_info['products_description']); 

// Get the number of product attributes (the select list options)
$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 there are attributes (options), then...
if ($products_attributes['total'] > 0) {
 // Print the options header
 $template_pinfo['optionheader'] = TEXT_PRODUCT_OPTIONS;

 // Select the list of attribute (option) names
 $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 . "'");

// For each option name, get the individual attribute (option) choices
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 the attribute (option) has a price modifier, include it
  if ($products_options['options_values_price'] != '0') {
	$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
  }

}

// If we should select a default attribute (option), do it here
if (isset($cart->contents[$_GET['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;
}

$template_pinfo['optionnames'] .= $products_options_name['products_options_name'] . ':<br>'; 
$template_pinfo['optionchoices'] .=  tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . "<br>"; 
 }
} else {
 // No options, blank out the template variables for them
 $template_pinfo['optionheader'] = '';
 $template_pinfo['optionnames'] = '';
 $template_pinfo['optionchoices'] = '';
}

// See if there are any reviews
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$_GET['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
 $template_pinfo['reviews'] = TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; 
} else {
 $template_pinfo['reviews'] = '';
}

// See if there is a product URL
if (tep_not_null($product_info['products_url'])) {
 $template_pinfo['moreinfolabel'] = TEXT_MORE_INFORMATION;
 $template_pinfo['moreinfourl'] = tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false); 
} else {
 $template_pinfo['moreinfolabel'] = '';
 $template_pinfo['moreinfourl'] = '';
}

$template_pinfo['moreinfolabel'] = str_replace('%s', $template_pinfo['moreinfourl'], $template_pinfo['moreinfolabel']);

// See if product is not yet available
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
 $template_pinfo['productdatelabel'] = TEXT_DATE_AVAILABLE;
 $template_pinfo['productdate'] = tep_date_long($product_info['products_date_available']);
} else {
 $template_pinfo['productdatelabel'] = TEXT_DATE_ADDED;
 $template_pinfo['productdate'] = tep_date_long($product_info['products_date_added']); 
}

// Strip out %s values
$template_pinfo['productdatelabel'] = str_replace('%s.', '', $template['productdatelabel']);

// See if any product reviews
$template_pinfo['reviewsurl'] = tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params());
$template_pinfo['reviewsbutton'] = tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS);
$template_pinfo['addtocartbutton'] = tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);

// See if any "Also Purchased" items. Feature added in v4.0.6
$sts->start_capture();
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
$sts->stop_capture ('alsopurchased'); // Get the result to the main array
$template_pinfo['alsopurchased']= $sts->template['alsopurchased']; // Put it in the product info


~Tracy
 

Share this post


Link to post
Share on other sites
While doing this I came across something that very likely is my problem (as so far the above change hasn't fixed the problem). I am using STS and there is another product_info.php page in the sts_inc folder and I see that I had to update it for Master Products but I'm not sure how to incorporate the SPPC code into it as well. Any ideas? (I think once this is all working I should see if I can incorporate it into a downloadable contrib. for those trying to get Master Products and SPPC working together - provided my other contrib's haven't changed the same pages huh.gif )

 

Ok - I believe I've found all pages that have the code you recommended I change, and I changed it - no luck. So I've been playing with the sts_inc product_info.php file and I've made the below changes - still not working though - but it's got to be one of these two pages I would think. Is the shopping cart working correctly because it calls 'final_price' rather than 'product_price' ?

(changes are in red)

<?php
/*
 $Id: product_info.php,v 4.1 2006/01/25 23:55:58 rigadin Exp $

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

 Copyright (c) 2006 osCommerce

 Released under the GNU General Public License
Based on: Simple Template System (STS) - Copyright (c) 2004 Brian Gallagher - brian@diamondsea.com
STS v4.1 by Rigadin (rigadin@osc-help.net)
*/

$products_id=intval($_GET['products_id']);
// Create variables for product ID, added in v4.0.6	
$template['productid'] = $products_id;
$template['productsid'] = $products_id; // Just for consistende with osC names

// Start the "Add to Cart" form
$template_pinfo['startform'] = tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_slave'));
// Add the hidden form variable for the Product_ID
$template_pinfo['startform'] .= tep_draw_hidden_field('products_id', $products_id);
$template_pinfo['endform'] = "</form>";

[color=#CC0000]// BOF Separate Price per Customer
 if ( !isset($_SESSION['sppc_customer_group_id']) ) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $_SESSION['sppc_customer_group_id'];
 }
// EOF Separate Price per Customer[/color]

// Get product information from products_id parameter
$product_info_query = tep_db_query("select p.products_master_status, 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 = '" . $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);

// START Master Products
$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master =  '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   $results = tep_db_fetch_array($master_query);

[color=#CC0000]// BOF Separate Price per Customer

	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $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 = '" . $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']));
}[/color]

if ($product_info['products_price']>0) {
  $qty_array = array();
  for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {
	$qty_array[] = array('id' => $i, 'text' => $i); 
  }
  if (($product_info['products_quantity'] > 0) || (STOCK_CHECK == 'false')) {
	$template_pinfo['qtyproducts']= TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
  } else {
	  $template_pinfo['qtyproducts']= TEXT_STOCK;
					  }
}				

$template_pinfo['slaveproducts']='';
if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) {
  $sts->start_capture();
	  echo ' ';
  include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS);
	  echo ' ';
  $sts->stop_capture ('slaveproducts', 'box');
  $template_pinfo['slaveproducts']= $sts->template['slaveproducts'];
	}
// END Master Products

$template_pinfo['regularprice'] = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $template_pinfo['regularpricestrike'] = "<s>" . $template_pinfo['regularprice'] . "</s>";
  $template_pinfo['specialprice'] = $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
} else {
  $template_pinfo['specialprice'] = '';
  $template_pinfo['regularpricestrike'] = $template_pinfo['regularprice'];
}

$template_pinfo['productname'] = $product_info['products_name'];
$template_pinfo['productmodel'] =  $product_info['products_model'];

if (tep_not_null($product_info['products_image'])) {
 $template_pinfo['imagesmall'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"');
 $template_pinfo['imagelarge'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), '','','');
 $template_pinfo['product_popup']= '<script language="javascript"><!--'."\n".
							   'document.write(\'<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . (int)$products_id) . '\\\')">' . $template_pinfo['imagesmall'] . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>\');'."\n".
							   '//--></script>'."\n".
							   '<noscript>'."\n".
							   '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">'.$template_pinfo['imagesmall'] . '<br>' . TEXT_CLICK_TO_ENLARGE .'</a>'."\n".
							   '</noscript>'."\n";
} else {
 $template_pinfo['imagesmall'] ='';
 $template_pinfo['imagelarge'] ='';
 $template_pinfo['product_popup']='';	
}

$template_pinfo['productdesc'] = stripslashes($product_info['products_description']); 

// Get the number of product attributes (the select list options)
$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 there are attributes (options), then...
if ($products_attributes['total'] > 0) {
 // Print the options header
 $template_pinfo['optionheader'] = TEXT_PRODUCT_OPTIONS;

 // Select the list of attribute (option) names
 $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 . "'");

// For each option name, get the individual attribute (option) choices
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 the attribute (option) has a price modifier, include it
  if ($products_options['options_values_price'] != '0') {
	$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
  }

}

// If we should select a default attribute (option), do it here
if (isset($cart->contents[$_GET['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;
}

$template_pinfo['optionnames'] .= $products_options_name['products_options_name'] . ':<br>'; 
$template_pinfo['optionchoices'] .=  tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . "<br>"; 
 }
} else {
 // No options, blank out the template variables for them
 $template_pinfo['optionheader'] = '';
 $template_pinfo['optionnames'] = '';
 $template_pinfo['optionchoices'] = '';
}

// See if there are any reviews
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$_GET['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
 $template_pinfo['reviews'] = TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; 
} else {
 $template_pinfo['reviews'] = '';
}

// See if there is a product URL
if (tep_not_null($product_info['products_url'])) {
 $template_pinfo['moreinfolabel'] = TEXT_MORE_INFORMATION;
 $template_pinfo['moreinfourl'] = tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false); 
} else {
 $template_pinfo['moreinfolabel'] = '';
 $template_pinfo['moreinfourl'] = '';
}

$template_pinfo['moreinfolabel'] = str_replace('%s', $template_pinfo['moreinfourl'], $template_pinfo['moreinfolabel']);

// See if product is not yet available
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
 $template_pinfo['productdatelabel'] = TEXT_DATE_AVAILABLE;
 $template_pinfo['productdate'] = tep_date_long($product_info['products_date_available']);
} else {
 $template_pinfo['productdatelabel'] = TEXT_DATE_ADDED;
 $template_pinfo['productdate'] = tep_date_long($product_info['products_date_added']); 
}

// Strip out %s values
$template_pinfo['productdatelabel'] = str_replace('%s.', '', $template['productdatelabel']);

// See if any product reviews
$template_pinfo['reviewsurl'] = tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params());
$template_pinfo['reviewsbutton'] = tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS);
$template_pinfo['addtocartbutton'] = tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);

// See if any "Also Purchased" items. Feature added in v4.0.6
$sts->start_capture();
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
$sts->stop_capture ('alsopurchased'); // Get the result to the main array
$template_pinfo['alsopurchased']= $sts->template['alsopurchased']; // Put it in the product info

?>

 

I am just stumped :huh: Hopefully someone here will see where I'm going wrong :blush:


~Tracy
 

Share this post


Link to post
Share on other sites
Ok - I believe I've found all pages that have the code you recommended I change, and I changed it - no luck. So I've been playing with the sts_inc product_info.php file and I've made the below changes - still not working though - but it's got to be one of these two pages I would think. Is the shopping cart working correctly because it calls 'final_price' rather than 'product_price' ?

(changes are in red)

 

:blush: I forgot that color doesn't work in the code tags - so apparently my changes are in between the tags :blush:

 

Sorry 'bout that :(


~Tracy
 

Share this post


Link to post
Share on other sites

Okay, I want to apologize in advance for even asking but....

 

I am setting up my Mom's website (www.unbeweavablefashions.com/shop). What she would like to do is separate the income generated on the site by the manufacturer. For instance, if one of her scarves sells, the money goes to her paypal, and if my aunt earrings sell it goes to her account, etc.

This was the closest contribution I could find to address that problem. Is there a contribution that is out there that could facilitate that sort of payment splitting or is this something that Paypal would have to come up with?

 

Just point me in the right direction.

 

Thanks.

Share this post


Link to post
Share on other sites

***FOLLOW UP***

 

I was looking at simplifying the process somewhat. It turns out that Paypal has a Mass Pay capability which requires a text file formatted like so:

 

(From Paypal's site)

"In the first column, enter your recipients’ email addresses. In the second column, enter the payment amounts for each recipient. In the third column, input the three-letter currency code for the currency of the payment."

 

In my case the Currency code would be USD.

 

I have found a report in the contributions section that might help. I am going to test this out. What I would need is a report that spits out the relevant info in a tab-delimited format. I will play with it some more. If someone already has this, if you could share that would be awesome. If I figure out how to rig the report to give me the data, I will post as a contrib.

 

Thanks again...

Share this post


Link to post
Share on other sites
***FOLLOW UP***

 

I was looking at simplifying the process somewhat. It turns out that Paypal has a Mass Pay capability which requires a text file formatted like so:

 

(From Paypal's site)

"In the first column, enter your recipients’ email addresses. In the second column, enter the payment amounts for each recipient. In the third column, input the three-letter currency code for the currency of the payment."

 

In my case the Currency code would be USD.

 

I have found a report in the contributions section that might help. I am going to test this out. What I would need is a report that spits out the relevant info in a tab-delimited format. I will play with it some more. If someone already has this, if you could share that would be awesome. If I figure out how to rig the report to give me the data, I will post as a contrib.

 

Thanks again...

I would suggest adding this to the MVS contribution and moving this part of the thread to that area.

Share this post


Link to post
Share on other sites

Ok, now my code reads as follows. It will add the product to the cart with the option name and the value is empty until I go back and add a second one! Then it adds the value correctly. It also sets the default attribute value to '0' until the item is deleted from the cart. See this for yourself at http://www.hallmarcwebsites.com/osdemo/

 

 function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
  // BOF Separate Pricing Per Customer, Price Break 1.11.3 modification
  global $new_products_id_in_cart, $customer_id, $sppc_customer_group_id, $languages_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

  $pf = new PriceFormatter;
  $pf->loadProduct($products_id, $languages_id);
  $qty = $pf->adjustQty($qty);
  $products_id_string = tep_get_uprid($products_id, $attributes);
  $products_id = tep_get_prid($products_id_string);

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


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

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

// now attributes have been checked and hidden and invalid ones deleted make the $products_id_string again
	$products_id_string = tep_get_uprid($products_id, $attributes);

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

	  if ($this->in_cart($products_id_string)) {
		$this->update_quantity($products_id_string, (int)$qty, $attributes);
	  } else {
		$this->contents[] = array($products_id_string);
		$this->contents[$products_id_string] = 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_string) . "', '" . $qty . "', '" . date('Ymd') . "')");

  if (is_array($attributes)) {
	  reset($attributes);
	  while (list($option, $value) = each($attributes)) {
		$attr_value = NULL;
		$blank_value = FALSE;
		if (strstr($option, TEXT_PREFIX)) {
		  if (trim($value) == NULL)
		  {
			$blank_value = TRUE;
		  } else {
			$option = substr($option, strlen(TEXT_PREFIX));
			$attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
			$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;
			$this->contents[$products_id_string]['attributes'][$option] = $value;
		  }
		}

		if (!$blank_value) {
		  $this->contents[$products_id_string]['attributes'][$option] = $value;
// insert into database
			if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "', '" . tep_db_input($attr_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();
	  } 
	}
  }
} // end function

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

×