Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

That's what the piece of sample code is supposed to do: assign them right into the customer group according to the number they give as tax_id (instead of relying on MySQL to assign them to the default group with customer_group_id 0). If you don't want to be alerted use: $sql_data_array['customers_group_ra'] = '0';

 

No further changes are needed IMO but feel free to disagree.

 

Janz i also have tried to get this to work, but the customer still is assigned the group they are not supposed to.

 

Do you have any idea why?

 

-Thomas-

Link to comment
Share on other sites

I meant if any customer (even if i don't know he/she email) enter a right group # in company tax id field during registration they automatically see all prices with discount

and admin don't need to approve it ?

It's like promotional code that i want print in flyers and when anybody enter this code during registration he will see discounted prices

Is it possible to do that ?

 

That's what the piece of sample code is supposed to do: assign them right into the customer group according to the number they give as tax_id (instead of relying on MySQL to assign them to the default group with customer_group_id 0). If you don't want to be alerted use: $sql_data_array['customers_group_ra'] = '0';

 

No further changes are needed IMO but feel free to disagree.

Link to comment
Share on other sites

Janz i also have tried to get this to work, but the customer still is assigned the group they are not supposed to.
I tried it myself now and I can tell you that it works, in a way... the customer_group_id gets inserted in the mysql table correctly. Since the session variables that are specific for SPPC are not set in create_account.php it won't work until the customer logs out and in again. This is not what you want I guess, so it needs some additional code from login.php to work properly from the moment the customer creates an account.

 

A few lines further (somewhere around line 248) you will see:

      $customer_first_name = $firstname;
     $customer_default_address_id = $address_id;
     $customer_country_id = $country;
     $customer_zone_id = $zone_id;
     tep_session_register('customer_id');
     tep_session_register('customer_first_name');
     tep_session_register('customer_default_address_id');
     tep_session_register('customer_country_id');
     tep_session_register('customer_zone_id');
     tep_session_register('customer_group_id');

 

You need to register the customer_group_id also. To be accurate, the other ones (customer_group_tax_exempt etc.) should be registered also (see login.php). For this we need to add another query and since we only set customer_group_id when they entered a correct tax_id we also have to set this to "0" if they haven't.

 

So you should complement the sample code I gave not only with "$sql_data_array['customers_group_id'] = '2';" but also:

$sppc_customer_group_id = '2';

 

After the tep_session_register section (haven't checked this for errors!) you could add something along the line of:

if (!isset($sppc_customer_group_id)) {
$sppc_customer_group_id = '0';
}

Then some slightly changed code from login.php:

	$check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt, group_specific_taxes_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$sppc_customer_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'];
$group_specific_taxes_exempt = $customer_group_tax['group_specific_taxes_exempt'];

if (tep_not_null($group_specific_taxes_exempt)) {
 $sppc_customer_specific_taxes_exempt = $group_specific_taxes_exempt;
}
tep_session_register('sppc_customer_group_id');
tep_session_register('sppc_customer_group_show_tax');
tep_session_register('sppc_customer_group_tax_exempt');
if (tep_not_null($sppc_customer_specific_taxes_exempt)) {
 tep_session_register('sppc_customer_specific_taxes_exempt');
}

Link to comment
Share on other sites

I meant  if any customer (even if i don't know he/she email) enter a right group # in company tax id field during registration they automatically see all prices with discount

and admin don't need to approve it ?

 

Is it possible to do that ?

Yes, that's what the sample code and the further code needed outlined in the post above should do.
Link to comment
Share on other sites

I tried it myself now and I can tell you that it works, in a way... the customer_group_id gets inserted in the mysql table correctly. Since the session variables that are specific  for SPPC are not set in create_account.php it won't work until the customer logs out and in again. This is not what you want I guess, so it needs some additional code from login.php to work properly from the moment the customer creates an account.

 

A few lines further (somewhere around line 248) you will see:

 ? ? ?$customer_first_name = $firstname;
? ? ?$customer_default_address_id = $address_id;
? ? ?$customer_country_id = $country;
? ? ?$customer_zone_id = $zone_id;
? ? ?tep_session_register('customer_id');
? ? ?tep_session_register('customer_first_name');
? ? ?tep_session_register('customer_default_address_id');
? ? ?tep_session_register('customer_country_id');
? ? ?tep_session_register('customer_zone_id');
? ? ?tep_session_register('customer_group_id');

 

You need to register the customer_group_id also. To be accurate, the other ones (customer_group_tax_exempt etc.) should be registered also (see login.php). For this we need to add another query and since we only set customer_group_id when they entered a correct tax_id we also have to set this to "0" if they haven't.

 

So you should complement the sample code I gave not only with "$sql_data_array['customers_group_id'] = '2';"  but also:

$sppc_customer_group_id = '2';

 

After the tep_session_register section (haven't checked this for errors!) you could add something along the line of:

if (!isset($sppc_customer_group_id)) {
$sppc_customer_group_id = '0';
}

Then some slightly changed code from login.php:

	$check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt, group_specific_taxes_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$sppc_customer_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'];
$group_specific_taxes_exempt = $customer_group_tax['group_specific_taxes_exempt'];

if (tep_not_null($group_specific_taxes_exempt)) {
?$sppc_customer_specific_taxes_exempt = $group_specific_taxes_exempt;
}
tep_session_register('sppc_customer_group_id');
tep_session_register('sppc_customer_group_show_tax');
tep_session_register('sppc_customer_group_tax_exempt');
if (tep_not_null($sppc_customer_specific_taxes_exempt)) {
?tep_session_register('sppc_customer_specific_taxes_exempt');
}

 

Janz

 

I have now tried to insert the codes that you explained.

 

But where should this code go?

$sppc_customer_group_id = '2';

 

This code should this be around line 248?

if (!isset($sppc_customer_group_id)) {

$sppc_customer_group_id = '0';

}

 

Thanks for the help. This is an really good contrib. :D

 

Regards

Thomas

Link to comment
Share on other sites

But where should this code go?

$sppc_customer_group_id = '2';

This should go in the first piece of code I gave, like:

  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)  ) { 
    $sql_data_array['customers_group_ra'] = '1';
    $company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['company_tax_id']);
       if ($company_tax_id == 'your_tax_id_1') {
       $sql_data_array['customers_group_id'] = '1';
    $sppc_customer_group_id = '1';
       } elseif ($company_tax_id == 'your_tax_id_2') {
       $sql_data_array['customers_group_id'] = '2';
    $sppc_customer_group_id = '2';
       }
    }

 

This code should this be around line 248?

if (!isset($sppc_customer_group_id)) {

$sppc_customer_group_id = '0';

}

Yes, together with the fourth block of code I gave (might have small errors...) as one block between:

      tep_session_register('customer_group_id');

and

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

// build the message content

in create_account.php

Link to comment
Share on other sites

I have now tried to insert it too

Not works...

Maybe i do something wrong

It will be great if you explain it more

With this mods this contribution will be better !

I think many people wants to have it

 

Janz

 

I have now tried to insert the codes that you explained.

 

But where should this code go?

$sppc_customer_group_id = '2';

 

This code should this be around line 248?

if (!isset($sppc_customer_group_id)) {

$sppc_customer_group_id = '0';

}

 

Thanks for the help. This is an really good contrib. :D

 

Regards

Thomas

Link to comment
Share on other sites

YES!!!

IT Works !!!!

Tnank you so much for your help !!!!!!

:D

 

This should go in the first piece of code I gave, like:

 ?if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ?) { 
? ? $sql_data_array['customers_group_ra'] = '1';
? ? $company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['company_tax_id']);
? ? ? ?if ($company_tax_id == 'your_tax_id_1') {
? ? ? ?$sql_data_array['customers_group_id'] = '1';
? ? $sppc_customer_group_id = '1';
? ? ? ?} elseif ($company_tax_id == 'your_tax_id_2') {
? ? ? ?$sql_data_array['customers_group_id'] = '2';
? ? $sppc_customer_group_id = '2';
? ? ? ?}
? ? }

 

Yes, together with the fourth block of code I gave (might have small errors...) as one block between:

 ? ? ?tep_session_register('customer_group_id');

and

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

// build the message content

in create_account.php

Link to comment
Share on other sites

Jan,

 

thus piece of code

 

$check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt, group_specific_taxes_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$sppc_customer_group_id. "'");

 

should change to

 

$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'] . "'");

 

 

otherwise if customer add a wrong id # an error (TEP STOP) will appear

 

Thank you again for ypur great contrib. !!

 

Now it works for me and i hope it works for all community !

 

I tried it myself now and I can tell you that it works, in a way... the customer_group_id gets inserted in the mysql table correctly. Since the session variables that are specific  for SPPC are not set in create_account.php it won't work until the customer logs out and in again. This is not what you want I guess, so it needs some additional code from login.php to work properly from the moment the customer creates an account.

 

A few lines further (somewhere around line 248) you will see:

 ? ? ?$customer_first_name = $firstname;
? ? ?$customer_default_address_id = $address_id;
? ? ?$customer_country_id = $country;
? ? ?$customer_zone_id = $zone_id;
? ? ?tep_session_register('customer_id');
? ? ?tep_session_register('customer_first_name');
? ? ?tep_session_register('customer_default_address_id');
? ? ?tep_session_register('customer_country_id');
? ? ?tep_session_register('customer_zone_id');
? ? ?tep_session_register('customer_group_id');

 

You need to register the customer_group_id also. To be accurate, the other ones (customer_group_tax_exempt etc.) should be registered also (see login.php). For this we need to add another query and since we only set customer_group_id when they entered a correct tax_id we also have to set this to "0" if they haven't.

 

So you should complement the sample code I gave not only with "$sql_data_array['customers_group_id'] = '2';"  but also:

$sppc_customer_group_id = '2';

 

After the tep_session_register section (haven't checked this for errors!) you could add something along the line of:

if (!isset($sppc_customer_group_id)) {
$sppc_customer_group_id = '0';
}

Then some slightly changed code from login.php:

	$check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt, group_specific_taxes_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$sppc_customer_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'];
$group_specific_taxes_exempt = $customer_group_tax['group_specific_taxes_exempt'];

if (tep_not_null($group_specific_taxes_exempt)) {
?$sppc_customer_specific_taxes_exempt = $group_specific_taxes_exempt;
}
tep_session_register('sppc_customer_group_id');
tep_session_register('sppc_customer_group_show_tax');
tep_session_register('sppc_customer_group_tax_exempt');
if (tep_not_null($sppc_customer_specific_taxes_exempt)) {
?tep_session_register('sppc_customer_specific_taxes_exempt');
}

Link to comment
Share on other sites

This should go in the first piece of code I gave, like:

 ?if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ?) { 
? ? $sql_data_array['customers_group_ra'] = '1';
? ? $company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['company_tax_id']);
? ? ? ?if ($company_tax_id == 'your_tax_id_1') {
? ? ? ?$sql_data_array['customers_group_id'] = '1';
? ? $sppc_customer_group_id = '1';
? ? ? ?} elseif ($company_tax_id == 'your_tax_id_2') {
? ? ? ?$sql_data_array['customers_group_id'] = '2';
? ? $sppc_customer_group_id = '2';
? ? ? ?}
? ? }

 

Yes, together with the fourth block of code I gave (might have small errors...) as one block between:

 ? ? ?tep_session_register('customer_group_id');

and

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

// build the message content

in create_account.php

 

 

Thanks Janz

 

Now it works for me too :D

 

-Thomas-

Link to comment
Share on other sites

Hi there,

 

I just enabled search engine friendly urls and everything seems to work fine with the exception of logging in with the SPPC admin login to view customer groups. Poked around a bit trying to see if I could spot anything interesting between the stock login and the sppc login but no luck.

 

Does anyone know how to get the login working with SEF urls or can give me some advice on where to look to even start addressing the issue?

 

Thanks much!

Iggy

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

Link to comment
Share on other sites

Iggy,

Does anyone know how to get the login working with SEF urls or can give me some advice on where to look to even start addressing the issue?
There was a thread on this somewhere, but I guess not in this one because I can't find it that quickly (wasn't too long ago). The variable skip=true should be made a post variable instead of a get (so add a hidden field with that variable) and the code changed accordingly of course. That should do it.
Link to comment
Share on other sites

I am having a problem with timeouts. I now have over 13,000 products and when I try to download the complete file, it timesout with a 500 error. I have tried to send the complete file to the temp directory and download it via FTP, but it still timesout now that I have added more products.

 

Any idea how to get around this?

 

Thanks in advance,

Shawn

Link to comment
Share on other sites

Wrong message board, this should have been posted in the EasyPopulate message board. Sorry. I tried to delete my own message, but I dont think you can.

 

 

I am having a problem with timeouts.  I now have over 13,000 products and when I try to download the complete file, it timesout with a 500 error.  I have tried to send the complete file to the temp directory and download it via FTP, but it still timesout now that I have added more products.

 

Any idea how to get around this?

 

Thanks in advance,

Shawn

Link to comment
Share on other sites

Hello Everyone... I have loaded this great contrib, but I am getting this error in the Admin/customergroups.php screen shipping module section... I have not a clue what is wrong or how to fix it. Can anyone help?

 

Fatal error: Cannot redeclare _selectoptions() (previously declared in /hsphere/local/home/happydan/myhappydance.com/includes/modules/payment/authorizenet.php:281) in /hsphere/local/home/happydan/myhappydance.com/includes/modules/shipping/dhlairborne.php on line 588

 

This is a call on two other contribs I have installed. What does this section have to do with them?

 

I also have no submit button on this page so no way to submit new customer groups?

 

Help!

Link to comment
Share on other sites

Hello,

 

I've been scanning the most recent pages of this thread, but I did not see what I was looking for. I think this contribution is almost exactly what I need, but I'm not 100%. Can anyone verify/explain for me:

 

1). I want to be able to have retail and wholesale pricing, which it appears I can do.

2). I would like for someone to buy a subscription and automatically be placed in the group that receives the special wholesale pricing. I do not want to manually approve or place them in a group.

3). I would like for customers to be able to belong to more than one group.

 

That last one is the kicker. The site I am installing osCommerce on is for mutliple artists. Each one will offer subscriptions to customers which allows them special pricing and access to material regular customers won't see. In theory though, someone could buy a subscription to Artist A and Artist B. If I put them in the special group that gets the discount and hidden products for Artist A, how do I also now show them those things for Artist B?

 

Any thoughts/advice would be greatly appreciated! I have waited to install this just to see what contributions are out there and whether or not I could modify them more myself to suit the needs of the site. I'm fairly new to PHP and mySQL, so it'd be a decent sized learning curve, I'm afraid.

Link to comment
Share on other sites

Fatal error: Cannot redeclare _selectoptions() (previously declared in /hsphere/local/home/happydan/myhappydance.com/includes/modules/payment/authorizenet.php:281) in /hsphere/local/home/happydan/myhappydance.com/includes/modules/shipping/dhlairborne.php on line 588

 

This is a call on two other contribs I have installed.  What does this section have to do with them? 

In this page you do set payment and shipping options for the groups but the way it is done by reading the directory. I don't see how reading a directory trips a function or class called _selectoptions.
Link to comment
Share on other sites

1). I want to be able to have retail and wholesale pricing, which it appears I can do.
That's indeed the purpose of this mod.
2). I would like for someone to buy a subscription and automatically be placed in the group that receives the special wholesale pricing. I do not want to manually approve or place them in a group.
Shouldn't be too difficult to code.
3). I would like for customers to be able to belong to more than one group.

 

That last one is the kicker. The site I am installing osCommerce on is for mutliple artists. Each one will offer subscriptions to customers which allows them special pricing and access to material regular customers won't see. In theory though, someone could buy a subscription to Artist A and Artist B. If I put them in the special group that gets the discount and hidden products for Artist A, how do I also now show them those things for Artist B?

I don't think you can and should do that by putting them in more than one group. Perhaps you can solve this by treating the artists as manufacturer (code wise that is) and than adding a column to the customer table in the manner as hide_for_groups does (so @,1,3). 1 And 3 would be the artists and then when products need to be shown or priced check whether this client has a subscription to the artist.

I'm fairly new to PHP and mySQL, so it'd be a decent sized learning curve, I'm afraid.

Yes.
Link to comment
Share on other sites

In this page you do set payment and shipping options for the groups but the way it is done by reading the directory. I don't see how reading a directory trips a function or class called _selectoptions.

 

Any idea what I need to do to fix this? What files I should look in first?

Edited by happydance
Link to comment
Share on other sites

Any idea what I need to do to fix this? What files I should look in first?

 

Should I back out of DHL and try another shipping module??? I've heard the DHL module isn't what it should be.

 

I cannot get out of Authorize.net as it processes all my payments.

 

I need this module to work as I have different rates for retail, wholesale, fundraising, and distributors. I also have multiple drop ship vendors and will be loading the contrib for that soon. But I really need to get the bugs out of this asap as I cannot add or update new customers either. Same exact error as in the customergroups, and the page ends there [i don't even have a submit button on either page]. This contrib is too involved to back out of and I really do need it to work, so please, please help. :blush: Thank you.

Link to comment
Share on other sites

But I really need to get the bugs out of this asap as I cannot add or update new customers either.  Same exact error as in the customergroups, and the page ends there [i don't even have a submit button on either page].

I have googled for the source of the error. The function _setOptions is found in the file/class includes/modules/shipping/dhlairborne.php. The file is "included" in customer_groups and for some reason another file is calling on the same file also. This would be a redeclare of the function which give the error.

 

Find the "include" statements in customer_groups and change them to "include_once". Particularly lines 522-523 as found in this piece of code:

    $ship_module_active = explode (";",MODULE_SHIPPING_INSTALLED);
   $installed_shipping_modules = array();
   for ($i = 0, $n = sizeof($ship_directory_array); $i < $n; $i++) {
   $file = $ship_directory_array[$i];
   if (in_array ($ship_directory_array[$i], $ship_module_active)) {
     include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/shipping/' . $file);
     include($ship_module_directory . $file);

You can do it anywhere in the file (shouldn't change a thing in the functioning of the page, apart from redeclare errors) but this is one is probably vital. So change it to:

      include_once(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/shipping/' . $file);
     include_once($ship_module_directory . $file);

Link to comment
Share on other sites

I have googled for the source of the error. The function _setOptions is found in the file/class includes/modules/shipping/dhlairborne.php. The file is "included" in customer_groups and for some reason another file is calling on the same file also. This would be a redeclare of the function which give the error.

 

Find the "include" statements in customer_groups and change them to "include_once". Particularly lines 522-523 as found in this piece of code:

 ? ?$ship_module_active = explode (";",MODULE_SHIPPING_INSTALLED);
? ?$installed_shipping_modules = array();
? ?for ($i = 0, $n = sizeof($ship_directory_array); $i < $n; $i++) {
? ?$file = $ship_directory_array[$i];
? ?if (in_array ($ship_directory_array[$i], $ship_module_active)) {
? ? ?include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/shipping/' . $file);
? ? ?include($ship_module_directory . $file);

You can do it anywhere in the file (shouldn't change a thing in the functioning of the page, apart from redeclare errors) but this is one is probably vital. So change it to:

 ? ? ?include_once(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/shipping/' . $file);
? ? ?include_once($ship_module_directory . $file);

 

Thank you for your help. Unfortunately, this didn't seem to do anything. The error is still there.

Link to comment
Share on other sites

hi everyone

 

 

 

i'm so tired i spent the night to mix sppc 4.1, QB for SPPC, and hide_product and ...

 

it works !! :thumbsup:

 

Big up to this contrib makers, who made thoses install.txt that clear... and to the coders of compare & merge... :blink:

 

 

Still a pb : manufacturers.php (a box i use a lot) now shows some empty categories !

i'm sure that a sql query modif would do it : it should check if the manufacturer has some unhidden products before displaying its name...

 

but i don't know much about "join" , "c." , "p." and other "left" .. :)

 

could someone help ??

 

 

i read about the "workaround" to hide specific categories, but i want them all, if they are not empty...

 

other thing is the catalog : i can't get the prices right !!!

i saw a post of someone who had it running perfect... and disappeared !

 

bye

these contrib' should be integrated in ms4 !!!!!

note : i'm on a creloaded 6.1a and template system has some tricks. i can 'help' the ones that try. just mail me.

Link to comment
Share on other sites

Mathieu,

i'm so tired i spent the night to mix sppc 4.1, QB for SPPC, and hide_product
You have been busy ;)
Still a pb : manufacturers.php (a box i use a lot) now shows some empty categories !

  i'm sure that a sql query modif would do it : it should check if the manufacturer has some unhidden products before displaying its name...

That box (in the regular osC) doesn't show any categories ... I'm afraid I lost you here. Perhaps you can post the code?
other thing is the catalog : i can't get the prices right !!!

i saw a post of someone who had it running perfect... and disappeared !

Can you elaborate on what prices are not right?
these contrib' should be integrated in ms4 !!!!!
I don't think that will happen ;)
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...