Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Eric,

i installed login obligator contrib because i want the store to be available only for groups other than retail group, but once the customer create account, they are automatically became retail group. now i dont want customer to be on retail group after creating an account i just want them to be on pending status and not be able to enter the restricted area until admin approve their account.
I'm not familiar with login obligator, but as long as you leave that contribution in, I don't think anything will change. If there is a database field in the table customers that has to be changed for them to be able to login, they still can't after having created an account and gone into the retail group (the default group).

Share this post


Link to post
Share on other sites
ok that might not be sufficient information.. i will explain my situation further so maybe you guys have other resort or idea for me.

 

i installed login obligator contrib because i want the store to be available only for groups other than retail group, but once the customer create account, they are automatically became retail group. now i dont want customer to be on retail group after creating an account i just want them to be on pending status and not be able to enter the restricted area until admin approve their account.

 

Please help. thank you in advance

 

Eric,

 

I use "Control Login 2.1" and it's very good and simple. Any user who register on the online store can't login till I give him the group price I want and after, I activate his account and the customer can login. Nice contribution. Check this out and give me news about it...

Edited by Jeep_ice

John

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

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites

I installed this contrib afew days back and it is just what i need, it is working perfectly.

 

I just wanted to ask if anybody knew how to add an additional page that only a certain group can see the link to once logged in.

 

Basically I have two customer groups, retail and wholesale, and I would like the wholesale customers to be able to see a seperate page where I can recommend to them the best selling products as a list. (the list i would create my self.)

 

Also while i am here JANZ suggested to somebody (on page 34 of this forum) a code that enables the retail price to be shown to the wholesale customers for comparison. I was wondering if anybody knew how to change the position of the "list price" in that code.

 

many thanks

Share this post


Link to post
Share on other sites
I just wanted to ask if anybody knew how to add an additional page that only a certain group can see the link to once logged in.
See this post for the header function and this post for the correct code to show a link depending on the customer group.

Share this post


Link to post
Share on other sites
See this post for the header function and this post for the correct code to show a link depending on the customer group.

 

Janz,

 

could you please give me more info of where you have said "header function"

 

thanks

Share this post


Link to post
Share on other sites
could you please give me more info of where you have said "header function"
To keep regular customers out if they hear about this and type in the url manually you will need to add some code to those "advanced members" files: look for the session variable (see above) and if that is not OK do a:

header("Location: http://whatever_your_site_is/index.php");
exit;

That will redirect the browsers of the not allowed customers to your index page and hackers will not get the page either because you do an exit. See the PHP website.

Share this post


Link to post
Share on other sites

right, i'm probably being really stupid now, but can you tell which code i need to add to the files listed here:

 

Then only do the changes to create_account.php, login.php, logoff.php (and any respective language files), includes/database_tables for any new tables (also on the admin side). On the admin side you only would need to add customers_groups.php and change customers.php.

 

Correct me if i am wrong, the things i need to do is run the mysql:

 

CODEALTER TABLE customers

ADD customers_group_id smallint UNSIGNED NOT NULL default '0',

ADD customers_group_ra enum('0','1') NOT NULL;

 

DROP TABLE IF EXISTS customers_groups;

CREATE TABLE customers_groups (

customers_group_id smallint UNSIGNED NOT NULL,

customers_group_name varchar(32) NOT NULL default '',

customers_group_show_tax enum('1','0') NOT NULL,

customers_group_tax_exempt enum('0','1') NOT NULL,

group_payment_allowed varchar(255) NOT NULL default '',

group_shipment_allowed varchar(255) NOT NULL default '',

PRIMARY KEY (customers_group_id)

);

 

INSERT INTO customers_groups VALUES('0','Retail','1','0','','');

 

ALTER TABLE address_book

ADD entry_company_tax_id VARCHAR(32) DEFAULT NULL AFTER entry_company;

 

 

and then add the following code:

 

CODEheader("Location: http://whatever_your_site_is/index.php");

exit;

 

to the above mentioned files?

 

Is there any other code?

Share this post


Link to post
Share on other sites

Hi,

 

I have installed SPPC and am very pleased with it.

 

I just wondered if anyone know of a contrib that i could install to work with easy populate.

 

When i down load a product listing using easy populate, it just has the retail prices on there. Is there any way i can download with all the prices (Trade, Retail etc) on easy populate? I want to give certain groups a percentage off the trade price, and i think the quickest way to this is in excel.

 

Thanks for your time.

 

Andy

Share this post


Link to post
Share on other sites
Hi,

 

I have installed SPPC and am very pleased with it.

 

I just wondered if anyone know of a contrib that i could install to work with easy populate.

 

When i down load a product listing using easy populate, it just has the retail prices on there. Is there any way i can download with all the prices (Trade, Retail etc) on easy populate? I want to give certain groups a percentage off the trade price, and i think the quickest way to this is in excel.

 

Thanks for your time.

 

Andy

 

Andy,

 

You have to modify EasyPopulate for working with the group price you have, here what you have to do, just folows the instructions and you gonna have fun with EasyPopulate :

 

Open admin/easypopulate.php and search the following lines :

 

// uncomment the customer_price and customer_group to support multi-price per product contrib
$filelayout = array(
'v_products_model' => $iii++,
'v_products_price' => $iii++,
'v_products_quantity' => $iii++,
'v_customer_price_1' => $iii++,
'v_customer_group_id_1' => $iii++,
'v_customer_price_2' => $iii++,
'v_customer_group_id_2' => $iii++,
'v_customer_price_3' => $iii++,
'v_customer_group_id_3' => $iii++,
'v_customer_price_4' => $iii++,
'v_customer_group_id_4' => $iii++,

 

These line will be commented out. For each customer group you have, uncomment one of the lines... If you have normal prices, and two another price like me, uncomment group id #1 and #2 and #3.

 

After that, a little lower, you can find the text file about sql data. It looks like this :

 

// and insert the new record
if ($v_customer_price_1 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_1 . ',
' . $v_customer_price_1 . ',
' . $v_products_id . ',
' . $v_products_price .'
)'
);
}
if ($v_customer_price_2 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_2 . ',
' . $v_customer_price_2 . ',
' . $v_products_id . ',
' . $v_products_price . '
)'
);
}
if ($v_customer_price_3 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_3 . ',
' . $v_customer_price_3 . ',
' . $v_products_id . ',
' . $v_products_price . '
)'
);
}
if ($v_customer_price_4 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_4 . ',
' . $v_customer_price_4 . ',
' . $v_products_id . ',
' . $v_products_price . '
)'
);
}

}

 

The line ' . $v_products_price . ' is not needed. Erase that whole line. I don't know why commenting the line won't work...but it won't.

 

Anyway, the line above the one you just erased has a comma at the end of it. Erase the comma so that sql knows to start another line.

 

That's it.

Just upload your excel file in admin panel via Easy Populate.


John

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

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites
I just wanted to ask if anybody knew how to add an additional page that only a certain group can see the link to once logged in.

 

Basically I have two customer groups, retail and wholesale, and I would like the wholesale customers to be able to see a seperate page where I can recommend to them the best selling products as a list. (the list i would create my self.)

I thought I was clear on the directions on how to do it, but here they are spelled out.

Say you don't want to show your conditions.php page to retail customers. Then the code to change in catalog/includes/boxes/information.php would look like this:

<!-- information //-->
	  <tr>
		<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
									 '<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' . ((!isset($_SESSION['sppc_customer_group_id']) || (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] == '0' )) ?
'': '<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>') .
									 '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');

 new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- information_eof //-->

Top part of the changed code on the catalog/condtions.php page would look like this (http://whatever_your_site_is/index.php needs to be changed):

  Released under the GNU General Public License
*/

 require('includes/application_top.php');

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

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONDITIONS));

 if (!isset($_SESSION['sppc_customer_group_id']) || (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] == '0' )) {
 header("Location: http://whatever_your_site_is/index.php");
 exit;
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

Note that the "header" has to come before the <!doctype etc. otherwise you will get the infamous error "headers already sent".

Share this post


Link to post
Share on other sites
I thought I was clear on the directions on how to do it, but here they are spelled out.

 

Nice one JANZ, sorry you had to spell it out, but i was confused on the other information you gave me!

 

Thanks again!

Share this post


Link to post
Share on other sites

If I have a clean istall of OSC and re write the files from SPPC will this be ok ? And I would like to have some sort of approval for my customers who join the site so I can put them into the appropriate pricing catagory before they can log on ? can somone reccomend a contrib to use that will work in with SPPC.

 

 

Thanks Viss

Share this post


Link to post
Share on other sites
If I have a clean istall of OSC and re write the files from SPPC will this be ok ? And I would like to have some sort of approval for my customers who join the site so I can put them into the appropriate pricing catagory before they can log on ? can somone reccomend a contrib to use that will work in with SPPC.

Thanks Viss

 

Install a clean OSC and and overwrite with SPPC 4.11 and all will be ok, it's the best to start. For approval your customer who join the site with the appropriate pricing, just do a research on this topic at the bottom left, Janz have explained this many time ago. Have fun and welcome in the world of OsCommerce and SPPC.


John

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

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites

Hi I am having major problems... I installed Seperate Pricing Per Customer a couple weeks ago. Everything was working fine untill my clients server crashed. Then sppc stop displaying the table that shows all the discounts on the product page. everything else works fine except for the table. We restored the old database before the server crash and re uploaded the updated work files that were modifed from the orignal spppc, still not displaying? Whats up? Can you help me out?

Share this post


Link to post
Share on other sites

Well... after about an hour or so, I was able to successfully install this contribution without any issues. Well almost none.

 

I've tested everything, and it seems to work fine.

 

But I do have a problem with a conflicting contribution. I have the Autologon contribution installed and it doesn't seem that they are co-operating together.

 

http://www.oscommerce.com/community/contri...earch,autologon

 

The problem is fairly simple I think but I just can't figure out how to fix it. I can create a new user, approve him to the wholesale group. Login as him for the first time and everything seems to be ok. The user can see the discounted prices I have set, etc. However, the Autologon contrib allows a user to check a box that creates a cookie with a saved username/password and automatically logs the user on the next time the user visits the site. Here's where the problem starts. The first time the wholesale user logs in, checks the autologon box, and everything looks ok. Close the browser, open the browser and autologon runs, the prices displayed are now retail. I assume there's a problem with how the session is registered. I just don't know.

 

Anyway, anyone else have this problem? Has anyone been able to fix?

 

 

Thanks!

shayne

Share this post


Link to post
Share on other sites
Well... after about an hour or so, I was able to successfully install this contribution without any issues. Well almost none.

 

I've tested everything, and it seems to work fine.

 

But I do have a problem with a conflicting contribution. I have the Autologon contribution installed and it doesn't seem that they are co-operating together.

 

http://www.oscommerce.com/community/contri...earch,autologon

 

The problem is fairly simple I think but I just can't figure out how to fix it. I can create a new user, approve him to the wholesale group. Login as him for the first time and everything seems to be ok. The user can see the discounted prices I have set, etc. However, the Autologon contrib allows a user to check a box that creates a cookie with a saved username/password and automatically logs the user on the next time the user visits the site. Here's where the problem starts. The first time the wholesale user logs in, checks the autologon box, and everything looks ok. Close the browser, open the browser and autologon runs, the prices displayed are now retail. I assume there's a problem with how the session is registered. I just don't know.

 

Anyway, anyone else have this problem? Has anyone been able to fix?

Thanks!

shayne

 

 

Shayne. I have both autologin and SPPC insalled on one of my stores (www.blackwidowsecurity.com/store/) with no problems (that I know of). To me, after reading what you said it sounds that this is being caused by a page be cached, but I could be wrong. Do you happen to have a page cache contribution installed? If so, try to turn it off and then repeat the steps which were giving you problems before.

 

Good Luck,

 

Nate

Share this post


Link to post
Share on other sites
Here's where the problem starts. The first time the wholesale user logs in, checks the autologon box, and everything looks ok. Close the browser, open the browser and autologon runs, the prices displayed are now retail. I assume there's a problem with how the session is registered. I just don't know.
Did you alter the autologon code to query the customers database table for a few more variables (like the customers_group_id) and then add a few more session variables to the session (see login.php)? To long ago since I seen that contribution to remember accurately what needed fixing (Nate/JEWbacca had an issue with it too I seem to recall).

Share this post


Link to post
Share on other sites

Hi, Jan,

 

GREAT GREAT contribution! Just 2 quick questions:

 

1) On the create account page, the Company Tax ID entry shows a blank input space when the page is loaded initially. I tested it by filling no information on that page at all (so I can see the error messages) and click Continue, the input space for the Company Tax ID entry has a '0' in it!!!!!!! I believe the problem is in entry_company_tax_id properties in MySQL. I have been playing around with that but I can't get rid of that '0'.

 

2) May I know how to put a "switch" on the automated email subject line after the approval of the non-retail account? Say if I approve it as a wholesale account, the email subject line will say 'wholesale'. If I approve it as a mass volume account, the email subject line will automatically say 'mass volume account'.

I know I can use if statement as shown in previous post in this forum, however, if there is a "switch" that can show the NAME of the type of merchant account then we don't even need the english file to define EMAIL_SUBJECT_1, EMAIL_SUBJECT_2, etc.

 

Thanks a lot!

 

Ken

Share this post


Link to post
Share on other sites
Did you alter the autologon code to query the customers database table for a few more variables (like the customers_group_id) and then add a few more session variables to the session (see login.php)? To long ago since I seen that contribution to remember accurately what needed fixing (Nate/JEWbacca had an issue with it too I seem to recall).

 

No... I haven't altered the code at all. Actualy, I wouldn't know what to change. My coding skills are very limited but I follow instuctions very well. I've searched in this thread for some ideas but I didn't find anything. Could you point me in the right direction? I'll keep searching the rest of the forum for clues.

 

Any help is greatly appriciated.

 

Thanks!

Shayne

Share this post


Link to post
Share on other sites

Hi, Jan,

 

I found out why there is a zero appears at the Company Tax ID input box when the Create Account page is refreshed.

 

In create_account.php, if I commented out: $company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['company_tax_id']); in the following code -

 

// BOF Separate Pricing Per Customer, added: field for tax id number

if (ACCOUNT_COMPANY == 'true') {

$company = tep_db_prepare_input($HTTP_POST_VARS['company']);

// $company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['company_tax_id']);

}

// EOF Separate Pricing Per Customer, added: field for tax id number

[code]

 

The zero disappears! I am just wondering what are the consequences of commenting out that particular line....

 

In addition, I still can't figure out how to do a simple automatic "switch" for generating the email approval subject for each class of non-retail account (e.g. wholesale, mass volume, etc.)...

 

Ken

Share this post


Link to post
Share on other sites

Hi again!

 

This hopefully will be my last question since the contribution is very well-written and I am at the final stage of testing this out:

 

After a customer puts in Tax ID number, he/she will not be able to make changes to it in the address book, which is a great feature. What I want to do is to add a line next to the displayed Tax ID, saying something like Activated, Denied or Subject to Activation. I have modified some codes but it's not working in catalog/modules/address_book_details.php:

 

After

		  <tr>
		<td class="main"><?php echo ENTRY_COMPANY_TAX_ID; ?></td>
		<td class="main"><?php echo $entry['entry_company_tax_id']; ?>

 

Add

<?php
 $customers_group_id = tep_db_prepare_input($HTTP_POST_VARS['customers_group_id']);
 $customers_group_ra = tep_db_prepare_input($HTTP_POST_VARS['customers_group_ra']);
 $old_customers_group_id = $_POST['old_customers_group_id'];
 if ($old_customers_group_id <= 0 && $customers_group_id >= 1) {
 echo " (Activated)";
 } elseif ($customers['customers_group_ra'] == '1') {
 echo " (Subject to Activation)";
 } else {
 echo " (Denied)"; }
  ?>

 

The reasoning is if the customers_group_id changes from 0 to 1 or above, irregardless of the RA red light status, it will display "Activated." If there is no change in customers_group_id, then it depends on whether the RA light is on or not. If it is on, it will display "Subject to Activation." Or else, it will displayed "Denied."

 

The reason for doing this is that a customer can easily login to the account to see the status.

 

I am not sure why the code above is not working. (I am not a coder at all, not by any kind of education/experience, so please bear with me as I am trying my best.) I *think* it might be due to fact that some of these variables are defined in the /admin rather than in /catalog. But well, only a wild guess.

 

Thanks a lot for any help!

 

Ken

Share this post


Link to post
Share on other sites
After a customer puts in Tax ID number, he/she will not be able to make changes to it in the address book, which is a great feature. What I want to do is to add a line next to the displayed Tax ID, saying something like Activated, Denied or Subject to Activation. I have modified some codes but it's not working in catalog/modules/address_book_details.php:

<?php
 $customers_group_id = tep_db_prepare_input($HTTP_POST_VARS['customers_group_id']);
 $customers_group_ra = tep_db_prepare_input($HTTP_POST_VARS['customers_group_ra']);
 $old_customers_group_id = $_POST['old_customers_group_id'];
 if ($old_customers_group_id <= 0 && $customers_group_id >= 1) {
 echo " (Activated)";
 } elseif ($customers['customers_group_ra'] == '1') {
 echo " (Subject to Activation)";
 } else {
 echo " (Denied)"; }
  ?>

 

The reasoning is if the customers_group_id changes from 0 to 1 or above, irregardless of the RA red light status, it will display "Activated." If there is no change in customers_group_id, then it depends on whether the RA light is on or not. If it is on, it will display "Subject to Activation." Or else, it will displayed "Denied."

 

The reason for doing this is that a customer can easily login to the account to see the status.

 

I am not sure why the code above is not working. (I am not a coder at all, not by any kind of education/experience, so please bear with me as I am trying my best.) I *think* it might be due to fact that some of these variables are defined in the /admin rather than in /catalog. But well, only a wild guess.

The last thing is correct. You are mixing code that was for some modification in the admin (old_customers_group_id) that had to keep track of changes in the customer_group_id with code in a totally unrelated page. That will not work.

 

You could write code for "Activated" (depending on customer_group_id >= 1) or Subject to Activation as long as $customers['customers_group_ra'] == '1' but I don't clearly see how you could differentiate between retail and a "denied" customer (both have customer_group_id 0 and RA turned off).

 

Regarding the zero in the company_tax_id, I checked that again and I can't reproduce that error. The database field is nullable, so I don't see how you can go from "nothing" to "0".

Share this post


Link to post
Share on other sites
The last thing is correct. You are mixing code that was for some modification in the admin (old_customers_group_id) that had to keep track of changes in the customer_group_id with code in a totally unrelated page. That will not work.

 

You could write code for "Activated" (depending on customer_group_id >= 1) or Subject to Activation as long as $customers['customers_group_ra'] == '1' but I don't clearly see how you could differentiate between retail and a "denied" customer (both have customer_group_id 0 and RA turned off).

 

Regarding the zero in the company_tax_id, I checked that again and I can't reproduce that error. The database field is nullable, so I don't see how you can go from "nothing" to "0".

 

Hi, Jan,

 

Thanks so much for your reply! I really really appreciate it!

 

Regarding the zero, if I commented out the line // $company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['company_tax_id']);:

 

// BOF Separate Pricing Per Customer, added: field for tax id number

if (ACCOUNT_COMPANY == 'true') {

$company = tep_db_prepare_input($HTTP_POST_VARS['company']);

// $company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['company_tax_id']);

}

// EOF Separate Pricing Per Customer, added: field for tax id number

[code]

 

Would that affect anything at all? I totally agree with you that it can't be changed from nothing to 0. I have no idea too.

 

As for the Activated/Denied code, do you mind just giving me some hints on what to change in order to make it work under the /catalog folder? I have very very limited knowledge on php. Just a few guidelines will be most helpful! I am not so concerned on the pure Retail customers since under SPPC original code if they don't type in the Company Tax ID number they won't see the Activated/Denied Code anyway.

 

Ken

Share this post


Link to post
Share on other sites
Robert,

You are the second one who says he needed that for Canada (Marvin was the first). It has been coded, but supposed to be in the next version of SPPC. That hasn't been released yet. I will see what I have.

 

This is something I could use aswell... Tax Exempt on PST Tax Class only. Has anyone else been able to code something for this?

 

Thanks

Shayne

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

×