Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customer Groups


Guest

Recommended Posts

I have a question with relation to creating customer groups.

 

Is there a Contribution where you can setup customer groups and that when a customer signs up for an account they will automatically added to a group dependent on the country they choose.

 

For example if I had a price for local customers and international customers, dependent on the country they choose on signup they will automatically be added to either a local group or international group.

 

Or would it be possible to customise a contribution to meet these requirements?

 

Thanks in advance

Link to comment
Share on other sites

Cheers for that Matti!

 

Just one more question I am reading through the information for this contribution but I do not see anything about automatically assigning customers to groups when a customer signs up for an account.

 

Does this contribution have this feature or does it have to be customised to add this.

 

Thanks again

Link to comment
Share on other sites

I did say you would need to modify it :)

 

It does assign a default group - it would be simple enough to add groups to the query at account signup based on location.

 

Matti

Link to comment
Share on other sites

Hi Matti

 

I am fairly new to PHP but learning fast. Would you be able to help me identify what pages would have to be updated and provide some example code.

 

I know this is a big ask, and apologise if this is not proper forum behaviour.

Link to comment
Share on other sites

Sorry for the wait - I had to sleep :blink:

 

create_account.php should be the only file you need to modify. I shall take a look at the Xprices structure today and post a mod.

 

Matti

Link to comment
Share on other sites

Thank you Matti :D

 

I think we are probably on different time zones! I am really looking forward to your reply.

Link to comment
Share on other sites

Ok - I shall try and run through this simply - I will assume that you have Xprices installed. Backup your database.

 

In admin->configuration->my store: set 'Number Of Prices Per Products to 2'.

 

In admin->customers->groups: rename 'Wholesale' to 'International ->select product price 2.

 

In catalog/create_account.php, after:

 

 ? ?$country = tep_db_prepare_input($HTTP_POST_VARS['country']);

 

add:

 

//Xprices mod - [email protected] ? ?
? ?if ($HTTP_POST_VARS['country'] == 223) {
? ?$customer_group = '1';
? ?} else {
? ?$customer_group = '2';
? ?}
//Xprices mod = EOF

 

after:

 

'customers_newsletter' => $newsletter,

 

add:

 

//Xprices mod - [email protected] ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'customers_groups_id' => $customer_group,
//Xprices mod = EOF

 

In the above code, '223' is the countries_id for USA from the countries table in your database - change this to the country of your choice.

 

Add your new prices in your admin->categories/products edit page.

 

Thats it! :)

 

Matti

Link to comment
Share on other sites

Thanks Matti! Your a star!!

 

I have not worked on it yet but am going to try it now. Will let you know how I get on...

Link to comment
Share on other sites

Hi Matti

 

Unfortunately that did not do the trick. I followed your instructions and copied and pasted your code and also changed the country number.

 

I also setup both the International price and the Default price. I then went into the shop and logged in as a user from the local country and it displayed the default price. However when I logged in as a customer from the UK or US the default price still appeared.

 

I also loaded a fresh install of osCommerce and installed the Xprices Contribution and then added your code as descripbed. Unfortunately I had the same result as above.

 

Any suggestions?

 

Thanks in advance

Link to comment
Share on other sites

Hi Matti

 

Please ignore my previous post I have it working now. I made a slight code error after revising.

 

My apologies your code worked perfectly!! :D

 

However just one final question. I noticed that if a customer has created an account and have been assigned to a group and then decide to change their address details "Country" that they are not changed to the appropriate group.

 

Would a solution to this simply be to copy your code into catalog/address_book.php?

 

Thanks Matti for all your help!!

Link to comment
Share on other sites

I noticed that if a customer has created an account and have been assigned to a group and then decide to change their address details "Country" that they are not changed to the appropriate group. 

 

Would a solution to this simply be to copy your code into catalog/address_book.php?

Pretty much :)

 

Put the second code snippet after:

 

'customers_lastname' => $lastname,

 

Matti

Link to comment
Share on other sites

Cheers! that worked

 

However instead of changing catalog/address_book.php I had to make the changes in catalog/address_book_process.php

 

I have it all working perfectly - Thanks for all you help with this code you are a life saver! :D

Link to comment
Share on other sites

However instead of changing catalog/address_book.php I had to make the changes in catalog/address_book_process.php

 

Yes - I forgot to say :P

 

 

I have it all working perfectly - Thanks for all you help with this code you are a life saver!  :D

 

 

No prob - was fun :)

 

Matti

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...