Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I am having some difficulties to apply changes of SPPC to new_products.php. This file is not like the default osc file.

 

I've tried to change it ..but it changes the original look.

The part that SPPC changes (from if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { to while ($new_products = tep_db_fetch_array($new_products_query)) {) is exactly the same for your new_products.php as the standard module.

 

After that you only need to take care that every instance of $new_products['a_field_name'] is changed to $new_products[$x]['a_field_name'] because the while ($new_products = tep_db_fetch_array($new_products_query)) { is changed to for ($x = 0; $x < $no_of_new_products; $x++) { and you should be fine.

 

Strange enough that template code does a query for the products_description, but I don't see it used (am I overlooking something?).

Link to comment
Share on other sites

Hi!

 

I noticed that the button Add to Wish List is not able to move over text attributes which by a customer has been written in a text field, there is a row created for it but no text. The text appears in shoppingcart when Add to Cart is clicked in wishlist.php though.

 

My shopping_cart.php has the code already in it I believe; I posted this file on page 120 in this topic. I think my wishlist.php also nedd to have this code in order to show this particular attribute. Now my wishlist.php looks as follows (provided I posted the right snippet needed here):

 

/*******************************************************************
******** THIS IS THE WISHLIST CODE FOR PRODUCT ATTRIBUTES  *********
*******************************************************************/

			  $attributes_addon_price = 0;

			  // Now get and populate product attributes
				$att_name = "";
				if (isset($wishList->wishID[$wishlist_id]['attributes'])) {
					while (list($option, $value) = each($wishList->wishID[$wishlist_id]['attributes'])) {
						  echo tep_draw_hidden_field('id[' . $wishlist_id . '][' . $option . ']', $value);

	 					$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
								  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
								  where pa.products_id = '" . $wishlist_id . "'
								   and pa.options_id = '" . $option . "'
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . $value . "'
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . $languages_id . "'
								   and poval.language_id = '" . $languages_id . "'");
						$attributes_values = tep_db_fetch_array($attributes);


						$att_name .= " (" . $attributes_values['products_options_name'] . ": " . $attributes_values['products_options_values_name'] . ") ";
				   		echo '<br /><small><i> ' . $attributes_values['products_options_name'] . ': ' . $attributes_values['products_options_values_name'] . '</i></small>';
					} // end while attributes for product

				}

				echo '<input type="hidden" name="prod_att[]" value="' . $att_name . '" />';

			   	if (tep_not_null($products['specials_new_products_price'])) {
			   		$products_price = '<s>' . $currencies->display_price($products['products_price']+$attributes_addon_price, tep_get_tax_rate($products['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products['specials_new_products_price']+$attributes_addon_price, tep_get_tax_rate($products['products_tax_class_id'])) . '</span>';
			   	} else {
				   	$products_price = $currencies->display_price($products['products_price']+$attributes_addon_price, tep_get_tax_rate($products['products_tax_class_id']));
				}

/*******************************************************************
******* CHECK TO SEE IF PRODUCT HAS BEEN ADDED TO THEIR CART *******
*******************************************************************/

		if($cart->in_cart($wishlist_id)) {
			echo '<br /><font color="#FF0000"><b>' . TEXT_ITEM_IN_CART . '</b></font>';
		}

Link to comment
Share on other sites

The part that SPPC changes (from if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { to while ($new_products = tep_db_fetch_array($new_products_query)) {) is exactly the same for your new_products.php as the standard module.

 

After that you only need to take care that every instance of $new_products['a_field_name'] is changed to $new_products[$x]['a_field_name'] because the while ($new_products = tep_db_fetch_array($new_products_query)) { is changed to for ($x = 0; $x < $no_of_new_products; $x++) { and you should be fine.

 

Strange enough that template code does a query for the products_description, but I don't see it used (am I overlooking something?).

 

Hi Janz! Thx a lot. You were right..it works fine now :thumbsup: . Regarding the query for product description, it indeed seems useless, i'm having an error with it anyway, so i commented it out. By the way do u know of any nice display code for the new products. The one on my template are not giving the desired results (sorry to be off topic :blush: )

 

 

Best Regards

Link to comment
Share on other sites

I noticed that the button Add to Wish List is not able to move over text attributes which by a customer has been written in a text field, there is a row created for it but no text. The text appears in shoppingcart when Add to Cart is clicked in wishlist.php though.

 

My shopping_cart.php has the code already in it I believe; I posted this file on page 120 in this topic.

I guess you did, but the thread is about Separate Pricing Per Customer (at least mainly). This seems to be about merging code for two other contributions.

 

Personally, I have never used either one of them. I think you would be really lucky if someone checking this thread would know something about solving your problem. Isn't there a thread for either the Wish List or text attributes mod?

Link to comment
Share on other sites

You were right..it works fine now.
Good to hear.
By the way do u know of any nice display code for the new products. The one on my template are not giving the desired results
No clue, sorry.
Link to comment
Share on other sites

Yes I know the thread is primarily for SPPC. The reason I asked was that you made it possible to use My WhishList contribution with SPPC, which I have gratefully used. So the two contibutions I have merged here together with SPPC are My WhishList and Product Attributes - Option Type Feature.

 

The code in shoppingcart.php looked similar to the code in whishlist.php, at least to me. I thought maybe if whishlist were tweaked a bit more with regard to if a text attribute is assigned then it would work with OTF as well. The code I refer to in shoppingcart.php is:

 

// Push all attributes information in an array
  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
	while (list($option, $value) = each($products[$i]['attributes'])) {
	  //clr 030714 move hidden field to if statement below
	  //echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
								  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
								  where pa.products_id = '" . $products[$i]['id'] . "'
								   and pa.options_id = '" . $option . "'
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . $value . "'
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . $languages_id . "'
								   and poval.language_id = '" . $languages_id . "'");
	  $attributes_values = tep_db_fetch_array($attributes);

	  //clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily
	  if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
		echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']',  $products[$i]['attributes_values'][$option]);
		$attr_value = $products[$i]['attributes_values'][$option];
	  } else {
		echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
		$attr_value = $attributes_values['products_options_values_name'];
	  }

 

Thanks for answering my questions before! It was a great help for me, now everything with regards to SPPC works. :)

 

Sorry if I'm going off topic with this one, won't happen again.

Link to comment
Share on other sites

Sorry to get off topic here. My new products are not displaying correctly. The box shows up but there are no images or titles, simply $0.00. I swear I've seen this talked about before but can't find it now...I double checked products_new and it matches the version from 4.1.4, I'm probably missing something stupid again...

 

<?php
/*
 $Id: products_new.php,v 1.27 2003/06/09 22:35:33 hpdl Exp $
 adapted for Separate Pricing Per Customer v3.6 2005/02/09


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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

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

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_products_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 $products_new_array = array();

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";
 $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 if ($products_new_split->number_of_rows > 0) {
// BOF Separate Price Per Customer
//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id

 if(!tep_session_is_registered('sppc_customer_group_id')) { 
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }

$products_new_query = tep_db_query($products_new_split->sql_query);
$no_of_products_new = tep_db_num_rows($products_new_query);
while ($_products_new = tep_db_fetch_array($products_new_query)) {
  $products_new[] = $_products_new;
$list_of_prdct_ids[] = $_products_new['products_id'];  
}

 $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
  if ($no_of_products_new > 1) {
  for ($n = 1; $n < count($list_of_prdct_ids); $n++) {
  $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";   
  }
  }

// get all customers_group_prices for products with the particular customer_group_id
// however not necessary for customer_group_id
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."'");
while ($pg_array = tep_db_fetch_array($pg_query)) {
$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '');
}

  for ($x = 0; $x < $no_of_products_new; $x++) {
// replace products prices with those from customers_group table
// originally they would be obtained with an extra query for every new product:
//   if ($new_price = tep_get_products_special_price($products_new['products_id'])) {

	if(!empty($new_prices)) {
	for ($i = 0; $i < count($new_prices); $i++) {
		if( $products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
		$products_new[$x]['products_price'] = $new_prices[$i]['products_price'];
		}
	}
} // end if(!empty($new_prices)
  } // end for ($x = 0; $x < $no_of_products_new; $x++)
} // end if ($customer_group_id != '0')

// an extra query is needed for all the specials

$specials_query = tep_db_query("select s.products_id, specials_new_products_price from " . TABLE_SPECIALS . " s  where (".$select_list_of_prdct_ids.") and status = '1' and s.customers_group_id = '" .$customer_group_id. "'");
while ($specials_array = tep_db_fetch_array($specials_query)) {
$new_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price']);
}

// replace specials_new_products_price with those those for the customers_group_id
for ($x = 0; $x < $no_of_products_new; $x++) {

	if(!empty($new_prices)) {
	for ($i = 0; $i < count($new_prices); $i++) {
		if( $products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
		$products_new[$x]['specials_new_products_price'] = $new_prices[$i]['specials_new_products_price'];
		}
	   }
   } // end if(!empty($new_prices)
//	} // end for ($x = 0; $x < $no_of_products_new; $x++)

if (tep_not_null($products_new[$x]['specials_new_products_price'])) {
		$products_price = '<s>' . $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products_new[$x]['specials_new_products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</span>';
} else {
	$products_price = $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id']));
}
?>
	  <tr>
		<td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new[$x]['products_image'], $products_new[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
		<td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '"><b><u>' . $products_new[$x]['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new[$x]['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new[$x]['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>
		<td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new[$x]['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
	  </tr>
	  <tr>
		<td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
<?php // EOF Separate Pricing Per Customer
  } // end for ($x = 0; $x < $products_new_split->number_of_rows; $x++)
}  else { 
?>
	  <tr>
		<td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
<?php
 }
?>
	</table></td>
  </tr>
<?php
 if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>
</table></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'); ?>

Link to comment
Share on other sites

Okay. I'm the umpteenth person to ask WHY AM I GETTING THIS ERROR ON LINE 99 of database.php!

 

I've seen many people ask the question and NO answers.

 

I am using V1.4 which I would have assumed have had the sql fix everyone is talking about, but NOPE... can't find any difference.

 

The only reason I absolutely have to have this installation working is that I am building a Loaded version with over 200 contributions.

 

So here it is. First to answer my question CORRECTLY on why I am getting the error below gets a Loaded version as soon as it releases this month and FREE cPanel hosting for 6 months!

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/xxxxxx/loaded/includes/functions/database.php on line 99

Link to comment
Share on other sites

Okay. I'm the umpteenth person to ask WHY AM I GETTING THIS ERROR ON LINE 99 of database.php!

 

I've seen many people ask the question and NO answers.

 

I am using V1.4 which I would have assumed have had the sql fix everyone is talking about, but NOPE... can't find any difference.

 

The only reason I absolutely have to have this installation working is that I am building a Loaded version with over 200 contributions.

 

So here it is. First to answer my question CORRECTLY on why I am getting the error below gets a Loaded version as soon as it releases this month and FREE cPanel hosting for 6 months!

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/xxxxxx/loaded/includes/functions/database.php on line 99

 

Oh, incidentally the error is showing up on the product_info.php page.

Link to comment
Share on other sites

Sorry to get off topic here. My new products are not displaying correctly...I double checked products_new and it matches the version from 4.1.4, I'm probably missing something stupid again...

 

Make sure you have merged correct in includes\modules\new_products.php.

Link to comment
Share on other sites

Okay. I'm the umpteenth person to ask WHY AM I GETTING THIS ERROR ON LINE 99 of database.php!

 

I've seen many people ask the question and NO answers.

Because it is a generic error, caused by asking the results of a query where there hasn't been any as the following example program will show if you reload the page a couple of times.

<?php
/*
 $Id: test_db.php,v 1.80 2003/06/05 23:28:24 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
?>
<!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 'test'; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<h1>Test</h1>
<?php $time_now = gettimeofday();
$seconds = $time_now['sec'];
echo '<p>';
echo $seconds;
if (is_even($seconds)) {
echo ' Number is even, do query<br>';
$categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c");
} else {
echo ' Number is oneven, do nothing<br>';
}

$no_of_cats = tep_db_fetch_array($categories_query);
echo '<b>Number of categories is: </b>';
echo $no_of_cats['total'];
echo '</p>';

function is_even($num){
  return (is_numeric($num)&(!($num&1)));
}
?>
<!-- body //-->

<!-- body_eof //-->

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

Link to comment
Share on other sites

I need to apply the upgrade(oscommerce-2.2ms2-051113) to osc that involves MySQL compatibility. This involves 3 files:

 

catalog/advanced_search_result.php

catalog/index.php

catalog/admin/categories.php

 

The sections of code that need changed all look to involve code prevously altered for SPPC. Has anybody applied the MySQL 5.0 update to the SPPC code in these files?

 

Thanks for any help :thumbsup:

Link to comment
Share on other sites

I need to apply the upgrade(oscommerce-2.2ms2-051113) to osc that involves MySQL compatibility. This involves 3 files:

 

catalog/advanced_search_result.php

catalog/index.php

catalog/admin/categories.php

 

The sections of code that need changed all look to involve code prevously altered for SPPC. Has anybody applied the MySQL 5.0 update to the SPPC code in these files?

I posted the fixes I had for index.php and advanced_search_results.php not long ago in this post on page 122. I also saw that mrmrsg uploaded those two files today with his fixes. The index.php file he uploaded seems to work fine in MySQL5, but not his advanced_search_results.php (after having done a search and then sort on the price I get the 1054 error back). My "fixes" more closely follow those of hpdl, but I can't judge the relative merits of mrmrsg's changes to mine.

 

I haven't looked at the categories.php page in relation to the November 13, 2005 update.

Link to comment
Share on other sites

Thanks Jan, as always

 

Im assuming you had to run the SQL queries as well?

 

If I do this upgrade BEFORE my host actually upgrades to MySQL 5....will it give me any problems running on an older version of MySQL?

Link to comment
Share on other sites

Im assuming you had to run the SQL queries as well?
Not for SPPC. Haven't seen any problem without them so far. I presume you mean these:
ALTER TABLE whos_online MODIFY COLUMN last_page_url VARCHAR(255) NOT NULL;

ALTER TABLE customers MODIFY COLUMN customers_default_address_id INTEGER;

ALTER TABLE customers_basket MODIFY COLUMN final_price DECIMAL(15,4);

Doesn't look to me they could hurt the shop in some way.

If I do this upgrade BEFORE my host actually upgrades to MySQL 5....will it give me any problems running on an older version of MySQL?
No it shouldn't. It seems to be a matter where MySQL4 is more lenient to the way the query is formulated than MySQL5, so it shouldn't give any problems in MySQL4.
Link to comment
Share on other sites

Hi JanZ,

 

I'm a bit confused abt SPPC. well i've installed it and get it working.I've made 2 customer group; Retailer and Wholesaler. So when a customer will register for an account, he/she will be selected as retailer by default right ? If the client want to be a wholesaler..does he has to mail me a request so that i assign him to the wholesaler group ? Is this how I should be using SPPC..or did I miss something.

 

Thx :)

Link to comment
Share on other sites

I'm a bit confused abt SPPC. well i've installed it and get it working.I've made 2 customer group; Retailer and Wholesaler. So when a customer will register for an account, he/she will be selected as retailer by default right ?
Yes.
If the client want to be a wholesaler..does he has to mail me a request so that i assign him to the wholesaler group ? Is this how I should be using SPPC..or did I miss something.
The default behaviour is that SPPC will email you a warning if the client has filled in a tax_id number. In the code of that page you will also find an alternative: if only a company name has been filled in. When you get the email with the warning you will also see a red dot in the row of the new client (the RA, request authorization) to draw your attention to it.

 

If you want to have a request for that from the customer, just add a dropdown menu somewhere and in the code of the page you look for the posted variable of the dropdown: is it left default, don't send an email. If it is set to something with the text "I want a wholesale account" then have yourself sent an email.

 

The moving customers to another group is a manual thing, done in admin.

Link to comment
Share on other sites

Yes.

The default behaviour is that SPPC will email you a warning if the client has filled in a tax_id number. In the code of that page you will also find an alternative: if only a company name has been filled in. When you get the email with the warning you will also see a red dot in the row of the new client (the RA, request authorization) to draw your attention to it.

 

If you want to have a request for that from the customer, just add a dropdown menu somewhere and in the code of the page you look for the posted variable of the dropdown: is it left default, don't send an email. If it is set to something with the text "I want a wholesale account" then have yourself sent an email.

 

The moving customers to another group is a manual thing, done in admin.

 

Thx again. I'm having problems with my mail function so i'm not able to get the incoming mail. So what do u advice me..use the default behaviour right, coz even a company can buy in retail. What is the tax id ? is it a tax id per country... :blush: . I dnt know much abt these issues..any advice or links that might help me get a better understanding..

Link to comment
Share on other sites

Hello. I've been installing SPPC and I can't get the advanced_search_result.php page to work correctly. I keep getting this error:

 

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 ((pd.products_name like '%crane%' or p.products_model like '%crane%' or m.ma' at line 1

 

select count(distinct p.products_id) as total from ((products p) left join manufacturers m using(manufacturers_id), products_description pd) left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c and ((pd.products_name like '%crane%' or p.products_model like '%crane%' or m.manufacturers_name like '%crane%' or pd.products_description like '%crane%') )

 

[TEP STOP]

 

I've already tried both the newest update of SPPC and the solution stated here, and I still can't get it to work. Can anyone tell me what I'm doing wrong?

Always BACK UP your files and your database before making any changes. Before asking questions, check out the Knowledge Base. Check out the contributions to see if your problem's solved there. Search the forums.

 

Useful threads: Store Speed Optimization How to make a horrible shop Basics for design change How to search the forums

 

Useful contributions: Easypopulate Fast, Easy Checkout Header Tag Controller

Link to comment
Share on other sites

What is the tax id ? is it a tax id per country... I dnt know much abt these issues..any advice or links that might help me get a better understanding..
In a lot of countries (in the EEC, America, and Canada for certain) companies are given a tax id number. In English/England it is called a VAT number (check Google). VAT is value added tax (in Dutch BTW, in German Mehrwertsteuer = MwSt).
I'm having problems with my mail function so i'm not able to get the incoming mail. So what do u advice me..use the default behaviour right, coz even a company can buy in retail.

This is an example of how this can be done. Change the email sending portion (starts around line 282) to:

// BOF Separate Pricing Per Customer: alert shop owner of account created by a company
  // if you would like to have an email when either a company name has been entered in
  // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
  // setting: only email when a tax_id number has been given
 //	if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) { 
/*	 if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) { 
  $alert_email_text = "Please note that " . $firstname . " " . $lastname . " of the company: " . $company . " has created an account.";
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Company account created', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  } */
  if ( $_POST['request_cg'] != 'retail' ) { 
  $alert_email_text = "Please note that " . $firstname . " " . $lastname . " has created an account and applied for a " . tep_db_prepare_input($_POST['request_cg']). " account.";
		$request_subject = tep_db_prepare_input($_POST['request_cg']). " account created";
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $request_subject, $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }
// EOF Separate Pricing Per Customer: alert shop owner of account created by a company

The $_POST['request_cg'] comes from a tr added below the one for the email address (change to your own needs, the define could/should be added to the language file instead of hard code here:

			  <tr>
			<td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
			<td class="main"><?php echo tep_draw_input_field('email_address') . '?' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
		  </tr>
<!-- BOF Separate Pricing Per Customer: drop-down menu for authorization request -->
		  <tr>
			<td class="main"><?php define('ENTRY_REQUEST_CUSTOMER_GROUP', 'Choose the type of account<br> you apply for: ');
							echo ENTRY_REQUEST_CUSTOMER_GROUP; ?></td>
			<td class="main"><?php 
							$request_cg_array[] = array('id' => 'retail', 'text' => 'Retail');
							$request_cg_array[] = array('id' => 'student', 'text' => 'Student');
							$request_cg_array[] = array('id' => 'wholesale customer', 'text' => 'Wholesale customer');
							echo tep_draw_pull_down_menu('request_cg', $request_cg_array) ?></td>
		  </tr>
<!-- EOF Separate Pricing Per Customer: drop-down menu for authorization request -->
		</table></td>

Link to comment
Share on other sites

I've already tried both the newest update of SPPC and the solution stated here, and I still can't get it to work. Can anyone tell me what I'm doing wrong?
Looks like you didn't change the advanced_search_result.php code as posted there. It looks like it is still the code from 5.1.4 (because of the double (( and )) )which is not working in my opinion on that particular page. The code I posted is quite a bit different than 5.1.4 (and much closer to the November 13, 2005 updated code).
Link to comment
Share on other sites

*facepalm* I had two versions of advanced_search_result.php open, and I was copying the code into the wrong one. Thank you, that fixed it.

Always BACK UP your files and your database before making any changes. Before asking questions, check out the Knowledge Base. Check out the contributions to see if your problem's solved there. Search the forums.

 

Useful threads: Store Speed Optimization How to make a horrible shop Basics for design change How to search the forums

 

Useful contributions: Easypopulate Fast, Easy Checkout Header Tag Controller

Link to comment
Share on other sites

In a lot of countries (in the EEC, America, and Canada for certain) companies are given a tax id number. In English/England it is called a VAT number (check Google). VAT is value added tax (in Dutch BTW, in German Mehrwertsteuer = MwSt).

 

This is an example of how this can be done. Change the email sending portion (starts around line 282) to:

// BOF Separate Pricing Per Customer: alert shop owner of account created by a company
  // if you would like to have an email when either a company name has been entered in
  // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
  // setting: only email when a tax_id number has been given
 //	if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) { 
/*	 if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) { 
  $alert_email_text = "Please note that " . $firstname . " " . $lastname . " of the company: " . $company . " has created an account.";
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Company account created', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  } */
  if ( $_POST['request_cg'] != 'retail' ) { 
  $alert_email_text = "Please note that " . $firstname . " " . $lastname . " has created an account and applied for a " . tep_db_prepare_input($_POST['request_cg']). " account.";
		$request_subject = tep_db_prepare_input($_POST['request_cg']). " account created";
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $request_subject, $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }
// EOF Separate Pricing Per Customer: alert shop owner of account created by a company

The $_POST['request_cg'] comes from a tr added below the one for the email address (change to your own needs, the define could/should be added to the language file instead of hard code here:

			  <tr>
			<td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
			<td class="main"><?php echo tep_draw_input_field('email_address') . '?' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
		  </tr>
<!-- BOF Separate Pricing Per Customer: drop-down menu for authorization request -->
		  <tr>
			<td class="main"><?php define('ENTRY_REQUEST_CUSTOMER_GROUP', 'Choose the type of account<br> you apply for: ');
							echo ENTRY_REQUEST_CUSTOMER_GROUP; ?></td>
			<td class="main"><?php 
							$request_cg_array[] = array('id' => 'retail', 'text' => 'Retail');
							$request_cg_array[] = array('id' => 'student', 'text' => 'Student');
							$request_cg_array[] = array('id' => 'wholesale customer', 'text' => 'Wholesale customer');
							echo tep_draw_pull_down_menu('request_cg', $request_cg_array) ?></td>
		  </tr>
<!-- EOF Separate Pricing Per Customer: drop-down menu for authorization request -->
		</table></td>

 

 

Little confused as to which files to enter the above two sets of codes too.

 

Thanks for this JanZ

Link to comment
Share on other sites

Everything should be added to catalog/create_account.php.

 

 

THIS IS GREAT. THANKS JanZ :) :) :) :)

 

Now i have just one other question. When a new customer is filling out the form is it possible to hide the company entry details as default and that it appears only when the customer chooses "Corporate" or "Wholesale" group?

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