Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I now need to remove the SPPC modification..

 

ideas???

Not remove it? It is not that the site in question is heavily burdened with the code for SPPC because of excess sql queries so there is not much to gain there. If ever the site owner wants something special for a customer (paying by invoice which not everybody will be offered for example) the code for it is in place.

 

If you still want to remove it, the easiest way is to use fresh files from the November 13, 2005 update if there are no other contributions in those files already of course.

Link to comment
Share on other sites

You changed it using FILENAME_FEATURED_PRODUCTS? And did you add this to /catalog/admin/includes/filenames.php (step 3 in the readme.txt)
define('FILENAME_FEATURED_PRODUCTS', 'featured_products.php');

OK, sorry to have been dragging things about... i figured it out...

(i had put FILENAME_FEATURED instead of FILENAME_FEATURED_PRODUCTS)

Thanks!

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

-David Gilmour

Link to comment
Share on other sites

Not remove it? It is not that the site in question is heavily burdened with the code for SPPC because of excess sql queries so there is not much to gain there. If ever the site owner wants something special for a customer (paying by invoice which not everybody will be offered for example) the code for it is in place.

 

If you still want to remove it, the easiest way is to use fresh files from the November 13, 2005 update if there are no other contributions in those files already of course.

 

 

hahah Jan.. yea I didnt want to go thru that.. I think I'll just move all the cust to the lowest group and remove the other groups

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

Is there any adverse effects adding in "minimum order amount" mod when the cart has SPPC???
No, actually there is code in this thread to differentiate the minimum order amount based on the customer group.
Link to comment
Share on other sites

Hi, I've just installed SPPC.

 

Don't know if this questions has been asked before without reading through all the 131 pages but...

 

Is there any way to automate the allocating of customers to groups without having to do it manually in admin? Like, can they choose a group in create_account.php, and it automatically puts them in that group in Admin.

 

I can check before I send out the goods whether they're entittled to the discount - not so worried about verifiy them before they shop.

 

Thanks for your help

Link to comment
Share on other sites

Hi,

 

First - I would like to say THANK YOU for these fine contributions.

 

I am needing help with Hide Products & Categories for SPPC.

 

I am needing to know what code to use in the admin/categories.php file. My code looks like this:

		  <tr>

		<td class="main"><?php echo TEXT_EDIT_SORT_ORDER; ?></td>

		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'); ?></td>

	  </tr>

	  <tr>

 

instead of:

 

		$contents[] = array('text' => '<br>' . TEXT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', '', 'size="2"'));

 

So this code does not work to choose the sppc groups to hide a category from:

// BOF SPPC hide products and categories from groups
	$category_hide_string = '<br>'. "\n" . TEXT_HIDE_CATEGORIES_FROM_GROUPS;
	 for ($i = 0; $i < count($customers_groups); $i++) {
   $category_hide_string .= '<br>' . "\n" . tep_draw_checkbox_field('hide_cat[' . $customers_groups[$i]['id'] . ']',  $customers_groups[$i]['id'] , 0) . '  ' . $customers_groups[$i]['text']; 
	  }
	$contents[] = array('text' => $category_hide_string);
// EOF SPPC hide products and categories from groups

 

Any help would be great!

 

Thanks,

Philip

Link to comment
Share on other sites

I am using the category descriptions contribution - so that changes the code. I saw where it was in the forum - but I could not see where there was some finished code. Does anyone have that?

 

Thanks,

Philip

Link to comment
Share on other sites

I saw this:

Built something in in login.php (based on $sppc_customer_group_id:

//BOF SPPC
if ($sppc_customer_group_id == '0') {
// EOF SPPC
	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	}
} // end if ($sppc_customer_group_id == '0')
else {
tep_redirect(tep_href_link('you_special_page.php'));
}

 

and I believe it is something I could use. I'm not sure where to put the code though. Would you mind elaborate a bit more, thank you! When I tried I got this message (free translation):

The redirectionlimit for this URL was exceeded. Can not fetch the requested page. This can depend on blocked cockies.

 

I have three customer groups and want to show them different greetings, text, links and so forth.

 

I have another question regarding the new version 2.0.1 of the Hide Products [and categories] from customer groups for SPPC contribution. When this operation is undertaken:

We now need to run a script ONCE, to add the taxfield to table customers, move the data from addressbook to customers and delete the taxfield in addressbook.
then I would like to know if there are any risks involved, other scripts that might stop working, etc?
Link to comment
Share on other sites

I am needing to know what code to use in the admin/categories.php file. My code looks like this:

		  <tr>
		<td class="main"><?php echo TEXT_EDIT_SORT_ORDER; ?></td>
		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'); ?></td>
	  </tr>
	  <tr>

instead of:

		$contents[] = array('text' => '<br>' . TEXT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', '', 'size="2"'));

Does this work? :

// BOF SPPC hide products and categories from groups
	$category_hide_string = '<tr>'. "\n" .'  <td class="main">'.  TEXT_HIDE_CATEGORIES_FROM_GROUPS . '</td>' . "\n";
	 for ($i = 0; $i < count($customers_groups); $i++) {
   $category_hide_string .= '  <td class="main">' . tep_draw_checkbox_field('hide_cat[' . $customers_groups[$i]['id'] . ']',  $customers_groups[$i]['id'] , 0) . '??' . $customers_groups[$i]['text']. '</td>' . "\n"; 
	  }
	$category_hide_string .= '</tr>'. "\n";
	 echo $category_hide_string;
// EOF SPPC hide products and categories from groups

Link to comment
Share on other sites

I'm not sure where to put the code though.
This is code that is situated in login.php, just after:

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

and before:

  if ($error == true) {
$messageStack->add('login', TEXT_LOGIN_ERROR);
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

When I tried I got this message (free translation):
You did change the 'you_special_page.php' in the tep_href_link to something valid I hope?
I have three customer groups and want to show them different greetings, text, links and so forth.
You can also send them to the same page and echo something different (or maybe easier include something different) on that page depending on their customer group.

 

I have another question regarding the new version 2.0.1 of the Hide Products [and categories] from customer groups for SPPC contribution. When this operation is undertaken: then I would like to know if there are any risks involved, other scripts that might stop working, etc?
That code does not having anything to do with Hide Products but only with the table where the tax_id number is stored. Since that field is typical for SPPC there is not much risk that it will break anything (especially not on the catalog side). However, I would leave out the last sql statement that drops the field from the addres_book table. You can always do that later with phpMyAdmin after you verified all tax_id's were transferred (I'm not sure it will).
Link to comment
Share on other sites

Don't know if this questions has been asked before without reading through all the 131 pages but...

 

Is there any way to automate the allocating of customers to groups without having to do it manually in admin? Like, can they choose a group in create_account.php, and it automatically puts them in that group in Admin.

 

I can check before I send out the goods whether they're entittled to the discount - not so worried about verifiy

Yes, it has come up a number of times in this thread. The drop-down menu can be found in this post but that is not all that need to be done. The post variable that that drop-down creates should be evaluated (in the top of the file around line 34) and added to $sql_data_array (on this moment the code expects MySQL to add the default value of 0 in the field customers_group_id on insertion). That should happen above:

	  // BOF Separate Pricing Per Customer
  // if you would like to have an alert in the admin section 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 alert 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)  ) { 
  $sql_data_array['customers_group_ra'] = '1';
  }
  // EOF Separate Pricing Per Customer
  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

It also needs some adapted code for the create_account.php page because so far it depended on always having retail as the default after creating an account. For the upcoming version 4.20 I wrote the following instructions:

Line 233-235 ?

**AFTER**

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

**ADD**

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


Line 254

**AFTER**

  tep_session_register('customer_zone_id');

**ADD**

// BOF Separate Pricing Per Customer
  tep_session_register('sppc_customer_group_id');
  tep_session_register('sppc_customer_group_show_tax');
  tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing Per Customer

Link to comment
Share on other sites

This is code that is situated in login.php, just after:

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

and before:

  if ($error == true) {
$messageStack->add('login', TEXT_LOGIN_ERROR);
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

 

I put it there now and it seems to work. Thank you!

 

Further down - after this new addition - just above:

  if ($error == true) {
$messageStack->add('login', TEXT_LOGIN_ERROR);
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

I have a similar code:

		
// restore wishlist to sesssion
	$wishList->restore_wishlist();

	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	}
  }
}
 }

and it doesn't work now, that is, it doesn't keep an added product so it can be seen next session as it used to.

Link to comment
Share on other sites

Hi JanZ,

 

This is the code I have:

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

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

 

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

 

Thanks,

Philip

 

 

 

Does this work? :

// BOF SPPC hide products and categories from groups
	$category_hide_string = '<tr>'. "\n" .'  <td class="main">'.  TEXT_HIDE_CATEGORIES_FROM_GROUPS . '</td>' . "\n";
	 for ($i = 0; $i < count($customers_groups); $i++) {
   $category_hide_string .= '  <td class="main">' . tep_draw_checkbox_field('hide_cat[' . $customers_groups[$i]['id'] . ']',  $customers_groups[$i]['id'] , 0) . '  ' . $customers_groups[$i]['text']. '</td>' . "\n"; 
	  }
	$category_hide_string .= '</tr>'. "\n";
	 echo $category_hide_string;
// EOF SPPC hide products and categories from groups

Link to comment
Share on other sites

Real quick question before I dive into installation of this beast, we can set a percentage discount that will apply across all products as well as specific product based pricing correct?

 

So for group A, I want to be able to apply a 50% across all products, but for a few products I will go in and make it 40% off. This is what the mod can handle correct?

Link to comment
Share on other sites

Real quick question before I dive into installation of this beast, we can set a percentage discount that will apply across all products as well as specific product based pricing correct?

 

So for group A, I want to be able to apply a 50% across all products, but for a few products I will go in and make it 40% off. This is what the mod can handle correct?

Something like that can be done if you will install Admin Specials by Categories for SPPC which is easy to do it.

Link to comment
Share on other sites

I have been able to get the hide categories for SPPC to work with categories description now.

 

One thing I can't figure out though. In the category listing, I would like to have the groups that it is disabled for (like it has on the right when you click on a category) instead of that little icon_tick.gif image. How can I do that?

 

Thanks,

Philip

Link to comment
Share on other sites

I have been able to get the hide categories for SPPC to work with categories description now.
Good, I did notice there was a double loop there (while and then the for within) but I don't know the categories description contribution so I didn't understand very well what to think of that code.

 

In the category listing, I would like to have the groups that it is disabled for (like it has on the right when you click on a category) instead of that little icon_tick.gif image. How can I do that?
texmaxx and I figured there wouldn't be room for that, that is why the tick icons (depending on the layout you choose) have the groups in the title tag.

 

In the LAYOUT_HIDE_FROM == '1' version the text is set here: $category_hidden_from_string = TEXT_HIDDEN_FROM_GROUPS . $category_hidden_from_string; so you could echo $category_hidden_from_string there. In the other one it is here:

		// default layout: icons for all groups
  for ($i = 0; $i < count($customers_groups); $i++) {
	if (in_array($customers_groups[$i]['id'], $hide_cat_from_groups_array)) {
	  echo tep_image(DIR_WS_ICONS . 'icon_tick.gif', $customers_groups[$i]['text'], 11, 11) . '??';
	} else {
	  echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', 11, 11) . '??';
	}
  }

Instead of echo tep_image(DIR_WS_ICONS . 'icon_tick.gif', $customers_groups[$i]['text'], 11, 11) you would have to add it to a string (concatenation, so start with $all_groups_hidden_from = '' somewhere above it and then $all_groups_hidden_from .= $customers_groups[$i]['text']; to echo the $all_groups_hidden_from on the appropriate place.

Link to comment
Share on other sites

Greetings All !

 

I installed the SPPC mod version v.4.1.5 (build 051113)... the "latest" version from July 9th.

 

But when I do a product search, I get an error saying:

 

"1066 - Not unique table/alias: 'pd' "

 

 

So, I searched the forums / this thread and was pointed to a particular post... http://www.oscommerce.com/forums/index.php?sho...mp;#entry870200

 

This situation didn't fit mine... I'm on MySQL 4.0.27, not MySQL five... but I basically did what was suggested to SOME of the code:

 

BEFORE:

 

if ($status_tmp_product_prices_table == true) {

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

} elseif ($status_tmp_special_prices_table == true) {

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

} else {

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

}

 

 

 

AFTER:

 

if ($status_tmp_product_prices_table == true) {

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) " . " left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

} elseif ($status_tmp_special_prices_table == true) {

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) " . " left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

} else {

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) " . " left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

}

 

 

However, after doing THIS now I'm getting:

 

1066 - Not unique table/alias: 'c'

 

 

 

Fearing I was getting into a deeper mess of XXXX.... I figured I'd post here and see what all fixes I need to make to advanced_search_result. Judging from the posts here, I'm wondering why the correct file wasn't included in that July 9th package... or why somebody hasn't posted a fix there on the contribution page since then?

 

 

Thanks !

 

-= Dave =-

Link to comment
Share on other sites

Greetings All !

 

I installed the SPPC mod version v.4.1.5 (build 051113)... the "latest" version from July 9th.

 

But when I do a product search, I get an error saying:

-= Dave =-

]

 

Try throwing the stock advanced search file back up there and see if it works. If it does, try merging the two files by hand and see if that works. If it does, let us know.

 

I'm running the same install you are and mine is functional. I'll forward it to you if you like.

 

Iggy

Everything's funny but nothing's a joke...

Link to comment
Share on other sites

Thanks JanZ - the above really helped. I have it showing now. I know it takes more space - but I do not have the left menu (it is all in nice css menues acrose the top) so I have more space. So I pretty well have the bugs worked out of this and have installed close to 100 mods/contribs and many changes myself. I have done this in about a month thanks to great people like you. http://www.herbalmanufacturing.com.

 

Thanks,

Philip

Link to comment
Share on other sites

Dave,

Fearing I was getting into a deeper mess of XXXX.... I figured I'd post here and see what all fixes I need to make to advanced_search_result. Judging from the posts here, I'm wondering why the correct file wasn't included in that July 9th package... or why somebody hasn't posted a fix there on the contribution page since then?
The before and after you posted are not from the post of mine you refer you. I suggest you use the "original" 4.11 version and then apply the changes mentioned in that post for both index.php and advanced_search_results.php. MySQL 5 is more strict than MySQL4 so there is no reason for sql that works on MySQL5 to not work on MySQL4.

 

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

 

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

 

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

Link to comment
Share on other sites

This is code that is situated in login.php, just after:

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

and before:

  if ($error == true) {
$messageStack->add('login', TEXT_LOGIN_ERROR);
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

You did change the 'you_special_page.php' in the tep_href_link to something valid I hope?

You can also send them to the same page and echo something different (or maybe easier include something different) on that page depending on their customer group.

JanZ, i put the code where you specified, best i can tell anyway. but i get a parse error...

i copied my index.php to windex.php and specifed that file in the code.

 

here is my login.php file:

<?php
/*
 $Id: login.php,v 1.80 2003/06/05 23:28:24 hpdl Exp $
 adapted for Separate Price Per Customer v3.6 2005/02/22

 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');

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
 if ($session_started == false) {
tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
 }

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

 $error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);

// Check if email exists
// BOF Separate Pricing per Customer
/*	$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); */
$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_group_id, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
// EOF Separate Pricing Per Customer
if (!tep_db_num_rows($check_customer_query)) {
  $error = true;
} else {
  $check_customer = tep_db_fetch_array($check_customer_query);
// Check that password is good
  if (!tep_validate_password($password, $check_customer['customers_password'])) {
	$error = true;
  } else {
	if (SESSION_RECREATE == 'True') {
	  tep_session_recreate();
	}
// BOF Separate Pricing Per Customer: choice for logging in under any customer_group_id
// note that tax rates depend on your registered address!
if ($_GET['skip'] != 'true' && $_POST['email_address'] == SPPC_TOGGLE_LOGIN_PASSWORD ) {
  $existing_customers_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");
echo '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">';
print ("\n<html ");
echo HTML_PARAMS; 
print (">\n<head>\n<title>Choose a Customer Group</title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
echo CHARSET;
print ("\"\n<base href=\"");
echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG;
print ("\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\">\n");
echo '<body bgcolor="#ffffff" style="margin:0">';
print ("\n<table border=\"0\" width=\"100%\" height=\"100%\">\n<tr>\n<td style=\"vertical-align: middle\" align=\"middle\">\n");
echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process&skip=true', 'SSL'));
print ("\n<table border=\"0\" bgcolor=\"#f1f9fe\" cellspacing=\"10\" style=\"border: 1px solid #7b9ebd;\">\n<tr>\n<td class=\"main\">\n");
 $index = 0;
 while ($existing_customers =  tep_db_fetch_array($existing_customers_query)) {
$existing_customers_array[] = array("id" => $existing_customers['customers_group_id'], "text" => " ".$existing_customers['customers_group_name']." ");
++$index;
 }
print ("<h1>Choose a Customer Group</h1>\n</td>\n</tr>\n<tr>\n<td align=\"center\">\n");
echo tep_draw_pull_down_menu('new_customers_group_id', $existing_customers_array, $check_customer['customers_group_id']);
print ("\n<tr>\n<td class=\"main\"> <br />\n ");
print ("<input type=\"hidden\" name=\"email_address\" value=\"".$_POST['email_address']."\">");
print ("<input type=\"hidden\" name=\"password\" value=\"".$_POST['password']."\">\n</td>\n</tr>\n<tr>\n<td align=\"right\">\n");
echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE);
print ("</td>\n</tr>\n</table>\n</form>\n</td>\n</tr>\n</table>\n</body>\n</html>\n");
exit;
}
// EOF Separate Pricing Per Customer: choice for logging in under any customer_group_id
	$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");
	$check_country = tep_db_fetch_array($check_country_query);

	$customer_id = $check_customer['customers_id'];
	$customer_default_address_id = $check_customer['customers_default_address_id'];
	$customer_first_name = $check_customer['customers_firstname'];
// BOF Separate Pricing per Customer
if ($_GET['skip'] == 'true' && $_POST['email_address'] == SPPC_TOGGLE_LOGIN_PASSWORD && isset($_POST['new_customers_group_id']))  {
$sppc_customer_group_id = $_POST['new_customers_group_id'];
$check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$_POST['new_customers_group_id'] . "'");
} else {
$sppc_customer_group_id = $check_customer['customers_group_id'];
$check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$check_customer['customers_group_id'] . "'");
}
$customer_group_tax = tep_db_fetch_array($check_customer_group_tax);
$sppc_customer_group_show_tax = (int)$customer_group_tax['customers_group_show_tax'];
$sppc_customer_group_tax_exempt = (int)$customer_group_tax['customers_group_tax_exempt'];
// EOF Separate Pricing per Customer
	$customer_country_id = $check_country['entry_country_id'];
	$customer_zone_id = $check_country['entry_zone_id'];
	tep_session_register('customer_id');
	tep_session_register('customer_default_address_id');
	tep_session_register('customer_first_name');
// BOF Separate Pricing per Customer
tep_session_register('sppc_customer_group_id');
tep_session_register('sppc_customer_group_show_tax');
tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing per Customer	
	tep_session_register('customer_country_id');
	tep_session_register('customer_zone_id');

	tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");

// restore cart contents
	$cart->restore_contents();
//BOF SPPC
if ($sppc_customer_group_id == '0') {
	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($nav$
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	}
} // end if ($sppc_customer_group_id == '0')
else {
tep_redirect(tep_href_link('windex.php'));
}
//EOF SPPC
	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	}
  }
}
 }

 if ($error == true) {
$messageStack->add('login', TEXT_LOGIN_ERROR);
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<script LANGUAGE="JavaScript1.2" SRC="includes/menu_animation.js"></SCRIPT>

<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 session_win() {
 window.open("<?php echo tep_href_link(FILENAME_INFO_SHOPPING_CART); ?>","info_shopping_cart","height=460,width=430,toolbar=no,statusbar=no,scrollbars=yes").focus();
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- coolMenu //-->
<?php require(DIR_WS_INCLUDES . 'coolmenu.php'); ?>
<!-- coolMenu_eof //-->

<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')); ?><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_login.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 if ($messageStack->size('login') > 0) {
?>
  <tr>
	<td><?php echo $messageStack->output('login'); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }

 if ($cart->count_contents() > 0) {
?>
  <tr>
	<td class="smallText"><?php echo TEXT_VISITORS_CART; ?></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">
	  <tr>
		<td class="main" width="50%" valign="top"><b><?php echo HEADING_NEW_CUSTOMER; ?></b></td>
		<td class="main" width="50%" valign="top"><b><?php echo HEADING_RETURNING_CUSTOMER; ?></b></td>
	  </tr>
	  <tr>
		<td width="50%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
		  <tr class="infoBoxContents">
			<td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			  </tr>
			  <tr>
				<td class="main" valign="top"><?php echo TEXT_NEW_CUSTOMER . '<br><br>' . TEXT_NEW_CUSTOMER_INTRODUCTION; ?></td>
			  </tr>
			  <tr>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			  </tr>
			  <tr>
				<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_CREATE_ACCOUNT, '', 'SSL') . '">' . 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>
		</table></td>
		<td width="50%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
		  <tr class="infoBoxContents">
			<td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			  </tr>
			  <tr>
				<td class="main" colspan="2"><?php echo TEXT_RETURNING_CUSTOMER; ?></td>
			  </tr>
			  <tr>
				<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			  </tr>
			  <tr>
				<td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>
				<td class="main"><?php echo tep_draw_input_field('email_address'); ?></td>
			  </tr>
			  <tr>
				<td class="main"><b><?php echo ENTRY_PASSWORD; ?></b></td>
				<td class="main"><?php echo tep_draw_password_field('password'); ?></td>
			  </tr>
			  <tr>
				<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			  </tr>
			  <tr>
				<td class="smallText" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . TEXT_PASSWORD_FORGOTTEN . '</a>'; ?></td>
			  </tr>
			  <tr>
				<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			  </tr>
			  <tr>
				<td colspan="2"><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 tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?></td>
					<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				  </tr>
				</table></td>
			  </tr>
			</table></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

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

?>

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

-David Gilmour

Link to comment
Share on other sites

i put the code where you specified, best i can tell anyway. but i get a parse error...
Actually, you doubled the code. I think I showed how to "wrap" the code that does the redirection in an if that only gets executed when the customer is retail and all others are redirected to another page. You put it in there and left the "old" code in.

 

The parse error you get puzzled me, since the } and { seem to fit. I overlooked the fact that you mangled the code to something undecipherable here (last three lines):

//BOF SPPC
if ($sppc_customer_group_id == '0') {
	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($nav$
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);

tep_array_to_string($nav$ ?

Link to comment
Share on other sites

Actually, you doubled the code. I think I showed how to "wrap" the code that does the redirection in an if that only gets executed when the customer is retail and all others are redirected to another page. You put it in there and left the "old" code in.

 

The parse error you get puzzled me, since the } and { seem to fit. I overlooked the fact that you mangled the code to something undecipherable here (last three lines):

//BOF SPPC
if ($sppc_customer_group_id == '0') {
	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($nav$
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);

tep_array_to_string($nav$ ?

sorry JanZ im a little slow... i replaced everything between

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

and

if ($error == true) {
...

with the code you posted:

//BOF SPPC
if ($sppc_customer_group_id == '0') {
// EOF SPPC
	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	}
} // end if ($sppc_customer_group_id == '0')
else {
tep_redirect(tep_href_link('you_special_page.php'));
}

and it still doesn't work... (still a parse error)

if you could just elaborate a bit more it would help

 

thanks, code mangler out ;)

Edited by herot

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

-David Gilmour

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