Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Mark,

1. How easy would it be to add a check box when adding a adding a new product that instead of displaying the price it would display something like 'Call for best price'?
No need for that. You can set the price for this group at 0 and use the Hide Price if $0 contribution to echo that.

 

2. Is there an easy way of excluding products from certain groups, maybe so one particular product will show in the 'wholesale' group but not in the 'dropship' group. This product must still show up as normal in the 'Retail' group.[/url] Yes, that is the Hide products from customer groups for SPPC contribution.

Posted

Thomas,

But i cant figure out how to make the shipping and payment for each group to match the customer_group_id.

I don't get it. True, SPPC can enable certain shipping and payment modules for specific groups, but those are dealt with in the classes shipping and payment (includes/classes/shipping.php and includes/classes/payment.php) so you don't have to change anything on checkout or shipping pages because of SPPC.
Posted
then you will be presented with the choice to login as another group. This is helpful for the webmaster if he/she needs to change group to check a feature or a price for a group.

 

AHHHH that must have been what I saw then :)

 

OK so I'm still havin trouble with this.. the theory part.. not the installation part..

 

the way it is set up now.. if they reg with a business name and tax id they get reg'd in the retail group until the shop owner manually goes in and moves them to a new group..

 

I tried that code you gave me.. just dropped it in

       $zones_array = array();
      $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");
      while ($zones_values = tep_db_fetch_array($zones_query)) {
        $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
      }
      echo tep_draw_pull_down_menu('state', $zones_array);

$customer_type_array[] = array('id' => '0', 'text' => 'Retail Consumer');
$customer_type_array[] = array('id' => '1', 'text' => 'Licensed Professional');
$customer_type_array[] = array('id' => '2', 'text' => 'Prof - Unlicensed State/Country');
$customer_type_array[] = array('id' => '3', 'text' => 'Wholesale');

echo tep_draw_pull_down_menu('company_tax_id', $customer_type_array);

 

But I see no difference in the form..

 

I will admit I am a total newbie to sql.. the php end is better but not formally trained.. I can usually follow for the most part whats going on and tweak tings to my needs.. but this osC so far as me scratching my head real bad

 

I would also like to have the 2 Prof groups automatically added to that group..

 

thanks

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

Posted
Thomas,

I don't get it. True, SPPC can enable certain shipping and payment modules for specific groups, but those are dealt with in the classes shipping and payment (includes/classes/shipping.php and includes/classes/payment.php) so you don't have to change anything on checkout or shipping pages because of SPPC.

 

Janz, I now that this is in the shipping and payments classes. But when i go to the one page checkout i get all the payments and shipping possibles.

 

I have tried to change so it cacthes the customer_group_id but i cant seem to figure it out.

 

I have tried in checkout_alterenative and in the shipping and payment classes files.

 

Do you have any advice to me on have i can fix it?

 

Have you tried and i did work for you?

 

Thanks for the reply

 

Regards

Thomas

Posted
Jan, I started that thread, not Mark.. but he needed it also..
Yes, but you will also appreciate that I cannot fullfill every request for writing a contribution or a modification of one in view of the fact that osC has over 60,000 members and osC is not the only thing I do in my spare time ;)

 

Actually, you can code it yourself pretty easily. To get started. Change around line 837 in admin/customers a piece of text to add two lines of code that will store the original customer group:

  <td class="main"><?php if ($processed == true) {
   echo $cInfo->customers_group_id . tep_draw_hidden_field('customers_group_id');
   // next line: additional modification
   echo tep_draw_hidden_field('old_customers_group_id');
 } else {	
 echo tep_draw_pull_down_menu('customers_group_id', $existing_customers_array, $cInfo->customers_group_id);
 // next line: additional modification
 echo tep_draw_hidden_field('old_customers_group_id', $cInfo->customers_group_id);
 } ?></td>
</tr>
<!-- EOF Separate Pricing per Customer -->
       </table></td>
     </tr>
<!-- BOF Separate Pricing per Customer -->

Then for example in between these two statements around line 248:

        tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'");

       tep_redirect(tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_id));

you could add code for checking the old_customer_group_id versus the "new" customer_group_id. If it has changed from 0 to the professional group you send them an email using code along the lines of line 262 in create_account.php:

      $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
     tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

Is there anyway to automate placing someone into the "professional group" when choosing that in the sign up?
Yes, this was answered a few pages back. When they enter for example a certain code in the company_tax_id field you can check for that and insert another customer_group_id into the database (instead of relying on mysql to put in a 0, the default value for the field, so retail in the db).

 

Looking thru the files in the MOD, I don't see extra email templates.. can I assume that no matter which group they register with, the stock thanks for registering is sent out??
Yes, the idea is that everybody who registers as a client is put in the retail group and that the admin puts them into another.

 

Can users be mass moved from one group to another or is it a one by one basis?? This one is not a huge issue either.. I can always export the database, adjust and upload..

With an appropriate sql query that shouldn't be a problem.
Posted
Do you have any advice to me on have i can fix it?

 

Have you tried and i did work for you?

For starters you could tell where this checkout_alternative contribution can be found, because you don't show any code of it (probably a very big page ;) so no problem) but I am not a psychic, so I don't know what contribution you are talking about. Sometimes there a quite a few with the same functionality...

Perhaps they replicated code from the shipping and payment classes in there.. I can't tell if I can't see it.

Posted

Jan.. It's got to be me.. being very tick here.. I have now tried to log into the store with the mail address of the owner in the admin.. with and without the password and each time I get :

Error: No match for E-Mail Address and/or Password.

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

Posted
But I see no difference in the form..

Works fine for me on the create_account.php page (around line 400):

<!-- BOF Separate Pricing Per Customer: field for tax id number -->
             <tr>
               <td class="main"><?php echo ENTRY_COMPANY_TAX_ID; ?></td>
               <td class="main"><?php 
$customer_type_array[] = array('id' => '0', 'text' => 'Retail Consumer');
$customer_type_array[] = array('id' => '1', 'text' => 'Licensed Professional');
$customer_type_array[] = array('id' => '2', 'text' => 'Prof - Unlicensed State/Country');
$customer_type_array[] = array('id' => '3', 'text' => 'Wholesale');

echo tep_draw_pull_down_menu('company_tax_id', $customer_type_array);  
 /* echo tep_draw_input_field('company_tax_id') . ' ' . (tep_not_null(ENTRY_COMPANY_TAX_ID_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TAX_ID_TEXT . '</span>': ''); */ ?></td>
             </tr>
<!-- EOF Separate Pricing Per Customer: field for tax id number -->

Posted
Jan.. It's got to be me.. being very tick here.. I have now tried to log into the store with the mail address of the owner in the admin.. with and without the password and each time I get :

Error: No match for E-Mail Address and/or Password.

You do have to register as a client first with that email address. In the process you will also have to enter a password. Does not need to be the admin password, just anything (secure enough) for your test account.
Posted
You do have to register as a client first with that email address. In the process you will also have to enter a password. Does not need to be the admin password, just anything (secure enough) for your test account.

 

Making some progress.. I registered myself as a user, I now see the dropdown in the registration page for the user type.. now I logged off and logged back in with that user info and get the drop down for the group.. the continue image doesn;t show.. the path is correct.. I have no other MOD's installed.. in any case I choose a group click thr X'd image and the page just reloads..

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

Posted

Jan.

 

I have done NOTHING today except wade thru the posts trying to make sense of the changes needed for the features I want. Having just finished adding 25 MODS to a brand new phpBB board with almost no issues, I thought I could do this easy.. they have a fab system over there for validating modifications and releasing them.. I used their format to clarify the changes needed..

 

Please take a look and see if I have them correct before I try this sagin.. I'm nearly bald as of now and dont want to go buy hats tomorrow!

 

This is set up (maybe only partically) for 4 levels of pricing

1. Retail

2. Level 2 Pricing

3. Level 3 Pricing

4. Level 4 Pricing

 

Hopefully if I got this all correct Level 2 will be automatically added to their pricing level with a drop down box in the registration form

 

Additionallly, someone (haha at this point I am not sure who!) will get an email - I belive when they have been moved to level 3 or 4.. Retail & Level 2 should get the canned standard welcome text..

 

CHOOSE GROUP DURING REGISTER

 

#
#MOD choose group during registration
#

Register as a client first with that email address. In the process you will also have to enter a password. Does not need to be the admin password, just anything (secure enough) for your test account.

#
#---[ OPEN catalog/includes/languages/english/login.php ]----------------------------

#
#---[ FIND ]----------------------------
root@localhost

#
#---[ REPLACE WITH--
email address used during registration to test

#
#---[ OPEN catalog/create_account.php ]----------------------------

#
#---[ FIND ]----------------------------

<!-- BOF Separate Pricing Per Customer: field for tax id number -->
             <tr>
               <td class="main"><?php echo ENTRY_COMPANY_TAX_ID; ?></td>
               <td class="main"><?php echo tep_draw_input_field('company_tax_id') . ' ' . (tep_not_null(ENTRY_COMPANY_TAX_ID_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TAX_ID_TEXT . '</span>': ''); ?></td>
             </tr>
<!-- EOF Separate Pricing Per Customer: field for tax id number -->


#
#---[ REPLACE WITH ]----------------------------
<!-- BOF Separate Pricing Per Customer: field for tax id number -->
            <tr>
              <td class="main"><?php echo ENTRY_COMPANY_TAX_ID; ?></td>
              <td class="main"><?php 
$customer_type_array[] = array('id' => '0', 'text' => 'Retail Consumer');
$customer_type_array[] = array('id' => '1', 'text' => 'Level 2 pricing');
$customer_type_array[] = array('id' => '2', 'text' => 'Level 3 pricing');
$customer_type_array[] = array('id' => '3', 'text' => 'Level 4 pricing');

echo tep_draw_pull_down_menu('company_tax_id', $customer_type_array);  
/* echo tep_draw_input_field('company_tax_id') . ' ' . (tep_not_null(ENTRY_COMPANY_TAX_ID_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TAX_ID_TEXT . '</span>': ''); */ ?></td>
            </tr>
<!-- EOF Separate Pricing Per Customer: field for tax id number -->

#
#---[ OPEN /catalog/admin/customers.php ]----------------------------

#
#---[ FIND ]----------------------------
 <td class="main"><?php if ($processed == true) {
   echo $cInfo->customers_group_id . tep_draw_hidden_field('customers_group_id');
#
#---[ ADD,AFTER ]----------------------------
 // next line: additional modification
  echo tep_draw_hidden_field('old_customers_group_id');
} else { 
echo tep_draw_pull_down_menu('customers_group_id', $existing_customers_array, $cInfo->customers_group_id);
// next line: additional modification
echo tep_draw_hidden_field('old_customers_group_id', $cInfo->customers_group_id);

#
#---[ FIND ]----------------------------
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'");

#
#---[ ADD,AFTER ]----------------------------
    $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
    tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

 

Auto Add User to Group at Register

#
#MOD Auto add new user to specific group
#

#
#---[ OPEN /catalog/create_account.php ]----------------

#
#---[ FIND ]-----------------

  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)  ) { 

#
#---[ REPLACE WITH ]-----------------

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

#
#---[ FIND ]----------------

     tep_session_register('customer_country_id');
     tep_session_register('customer_zone_id');

#
#---[ ADD,AFTER ]------------


    tep_session_register('customer_group_id');

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


#
#---[ OPEN /catalog/login.php ]--------------

#
#---[ FIND ]--------------

$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');
#
#---[ REPLACE WITH ]----------------------

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

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

Posted
For starters you could tell where this checkout_alternative contribution can be found, because you don't show any code of it (probably a very big page ;) so no problem) but I am not a psychic, so I don't know what contribution you are talking about. Sometimes there a quite a few with the same functionality...

Perhaps they replicated code from the shipping and payment classes in there.. I can't tell if I can't see it.

 

Janz im sorry i totally forgot to insert the link to the contribution. Sorry

 

Here is the link for that contribution i uses

 

http://www.oscommerce.com/community/contri...out_alternative

 

Hope someone of you can help we with this.

 

Regards

Thomas

Posted

Debbie,

I have done NOTHING today except wade thru the posts trying to make sense of the changes needed for the features I want.  Having just finished adding 25 MODS to a brand new phpBB board with almost no issues, I thought I could do this easy.. they have a fab system over there for validating modifications and releasing them.. I used their format to clarify the changes needed..
Complaints about the service should be directed to the management ;)

 

Actuallly, I came across an interesting post the other day. Although I don't think what Lev proposes is something that will go forward, I can sympathize with a lot of things he says.

 

Please take a look and see if I have them correct before I try this again..
I think (have not fully checked) it is a nice sumup of some of the changes that are needed if you want to do the things you want (and Mark apparently also) but it needs a few more.
Posted (edited)
Debbie,

Complaints about the service should be directed to the management ;)

 

Actuallly, I came across an interesting post the other day. Although I don't think what Lev proposes is something that will go forward, I can sympathize with a lot of things he says.

 

I think (have not fully checked) it is a nice sumup of some of the changes that are needed if you want to do the things you want (and Mark apparently also) but it needs a few more.

 

 

Hahahah I *am* the mangement :) and will put in a complaint form right away good idea thanks!

 

Honestly if this attempt to modify the files goes dirty on me I was going to ask you to do it for a fee.. I am not opposed to doing so and know enough when to raise my hand and and say I havent a clue.. I am getting a better grasp now of the files in the package.. it confuses me as to why there is something like 4 login files and 4 this other file in different places.. I also think the method of approving and commenting MOD's at phpBB is outstanding and definately helps the newbies learn faster. No way could I have had that forum up and running the way I wanted it with 25+ MODS in a weekend if it was documented in any other manner.

 

osC is a FINE piece of progrmaming the contributions are plentyfull.. I'm only saying I wish they were better (more clearly maybe is a better term?) documented.. when I go to the MOD's section and find a MOD there.. I am not 100% sure what to download.. phpbb removes the older version so there is little to no confusion..

 

Please look over the info I so pain stakingly put together and make any adjustments it might need so I can move forth :) My client is starting to bug out!

 

thanks for you help! :thumbsup:

Edited by wkdwich

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

Posted
It took me a while to get just enough of that contribution installed to get it working but I see and understand the problem now.

 

What happens: if a company_tax_id is in the database the code notices that and only echoes the value. Doesn't do an input field. Alternatively: if there is no tax id in the database, it will show an empty input field to give the customer the chance to submit it.

 

When the page does the refresh there is no database query, so the code assumes there is no entry for the tax id and shows the blank input field. The bad thing is it will be processed and if left blank the value in the database will be overwritten.

 

A temporary fix for it would be to add:

if (ACCOUNT_COMPANY == 'true') $entry['entry_company_tax_id'] = $company_tax_id;

to address_book_process.php.

Also needed is adding a hidden field with that value in address_book_details.php (around line 70) (that will create the necessary POST variable) and " || $refresh == true" a little above that:

<!-- BOF Separate Pricing Per Customer -->
<?php 
? if (tep_not_null($entry['entry_company_tax_id']) || $refresh == true ) {
? ?>
? ? ? ? ?<tr>
? ? ? ? ? ?<td class="main"><?php echo ENTRY_COMPANY_TAX_ID; ?></td>
? ? ? ? ? ?<td class="main"><?php echo $entry['entry_company_tax_id']; ?></td>
? ? <input type="hidden" name="company_tax_id" value="<?php echo $entry['entry_company_tax_id']; ?>">
? ? ? ? ?</tr>
<?php
? } else { // end if (tep_not_null($entry['entry_company_tax_id'])) 
?> ? ? ? <tr>

It is not a perfect solution: once the refresh is done, the input field with tax id is no longer an input field but is echo'ed. The customer cannot edit the field anymore, it will be stored in the database though. Another problem is that it opens the door for manipulation of the tax id by the customer: storing it locally, change it with a text editor and then submit it...  <_<

 

For now, it is better than it was.

 

Jan- Now in the address book the tax id is non-editable in the primary addresswhen editing, but can be entered when adding a new address.....as we discussed. Thats OK with me. I was wondering if you had any insite into this little side effect:

The email notifying me of somebody adding a tax ID is NOT sent when somebody creates a new address with the tax ID field filled in. I DO get an email whenever a person goes into any of their addresses and presses UPDATE.....even if the tax ID field was unchanged. Even when updating in the primary address when you CANT change the tax id, the email is still sent. You know why?

Posted

Debbie,

it confuses me as to why there is something like 4 login files and 4 this other file in different places..
This has to do with the separation of code and language files. Also there is much duplication in file names in the admin section. So you might find 4 files of the same name in the whole of osC.
I also think the method of approving and commenting MOD's at phpBB is outstanding and definately helps the newbies learn faster. No way could I have had that forum up and running the way I wanted it with 25+ MODS in a weekend if it was documented in any other manner.
I am not familiar with phpBB but there are over 2800 contributions for osC and most have several packages and updates in them. There is no validation of contributions at osC. I don't think it is realistic to expect the man power to be available to do that anyway. In many ways the users of the contributions themselves are the beta-testers.

 

osC is a FINE piece of progrmaming the contributions are plentyfull.. I'm only saying I wish they were better (more clearly maybe is a better term?) documented.. when I go to the MOD's section and find a MOD there.. I am not 100% sure what to download..
Not everybody follows the directions and always uploads a complete package when they make a small change. Not everybody takes the time to thoroughly document a contribution and painstakingly write install instructions. I can understand that though. If you just spend a lot of time coding a contribution and then have to put in another major effort to write good documentation, that quickly goes over the wayside. In the case of SPPC Marvin Miller did the documentation and testing.

 

phpbb removes the older version so there is little to no confusion..
Since the contributions are not centrally validated, this is not an option with osC.

 

OK, regarding the changes you put together.

 

Changes to catalog/login.php were not necessary. Probably you saw changes from a post of mine, but what I posted there had code for a future version of SPPC in it, that will enable one to make specific taxes exempt for certain groups or even certain customers. The confusion is my fault.

 

In the part headed CHOOSE GROUP DURING REGISTER you write for a change in admin/customers.php:

#---[ FIND ]----------------------------
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'");

#
#---[ ADD,AFTER ]----------------------------
   $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
   tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

That is a little short on code. This way everytime you make a change in the data of a customer he/she will be sent an email. Since all the defines (EMAIL_WELCOME, EMAIL_TEXT) are not defined (those would be typically found in admin/includes/languages/english/login.php) it will not be a very interesting message.

 

So you should define EMAIL_TEXT there (check catalog/includes/languages/english/create_account.php to see how that is done).

EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;

concanates all the text defined in the different defines to one message. So you can use only one for the message: EMAIL_TEXT and one for the email subject of course: EMAIL_SUBJECT

 

I suppose you only want to send messages if you put them from one certain level to another. That is what the old_customers_group_id was for. My suggestion:

 

[CODE]#---[ FIND ]----------------------------
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'");

#
#---[ ADD,AFTER ]----------------------------

$old_customers_group_id = $_POST['old_customers_group_id'];
if ($old_customers_group_id <= 2 && $customers_group_id >= 3) {
$name = $customers_firstname . $customers_lastname;
// perhaps email_text should start with greeting: Dear mr./mrs " . $customers_lastname . ",\n\n
  $email_text = EMAIL_TEXT;
  tep_mail($name, $customers_email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
} // end if ($old_customers_group_id <= 2 && $customers_group_id .>= 3)

 

 

In the part headed Auto Add User to Group at Register regarding catalog/create_account.php you wrote:

#---[ FIND ]----------------

    tep_session_register('customer_country_id');
    tep_session_register('customer_zone_id');

#
#---[ ADD,AFTER ]------------


   tep_session_register('customer_group_id');

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

Just this weekend I did a bugfix on that part. For the "regular" create_account.php page it should be:

#---[ FIND ]----------------

    tep_session_register('customer_country_id');
    tep_session_register('customer_zone_id');

#
#---[ ADD,AFTER ]------------
// BOF Separate Pricing Per Customer 
// register SPPC session variables for a retail customer
// since this is the default for a new account
     $check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '0'");
     $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'];

     $sppc_customer_group_id = '0';
     tep_session_register('sppc_customer_group_id');
     tep_session_register('sppc_customer_group_show_tax');
     tep_session_register('sppc_customer_group_tax_exempt');
// BOF Separate Pricing Per Customer

To prevent any clash with another contribution that might use "customer_group_id" I opted to put "sppc_" in front of all the session variables. That way it is always clear which ones are from SPPC. So tep_session_register('customer_group_id'); is not correct.

Since you are setting customers_group_id's right on that page that little piece of code needs a few changes for you:

#---[ ADD,AFTER ]------------
// BOF Separate Pricing Per Customer 
// register SPPC session variables for the customer

  if (!isset($sppc_customer_group_id)) {
  $sppc_customer_group_id = '0';
  }
     $check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" . $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'];

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

Posted

Thomas,

Janz, I know that this is in the shipping and payments classes. But when i go to the one page checkout i get all the payments and shipping possibles.

 

I have tried to change so it cacthes the customer_group_id but i cant seem to figure it out.

I suspect there is trouble with the fact that the customer_id might not be available with the mod you are using. Since that is used in the classes shipping and payment to check for the customer specific payment and shipping options you better use some extra code to check for it.

For example in shipping.php you could try changing:

     global $sppc_customer_group_id, $customer_id;
    if(!tep_session_is_registered('sppc_customer_group_id')) { 
    $customer_group_id = '0';
    } else {
     $customer_group_id = $sppc_customer_group_id;
    }
  $customer_shipment_query = tep_db_query("select IF(c.customers_shipment_allowed <> '', c.customers_shipment_allowed, cg.group_shipment_allowed) as shipment_allowed from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_id = '" . $customer_id . "' and cg.customers_group_id =  '" . $customer_group_id . "'");

to

     global $sppc_customer_group_id, $customer_id;
    if(!tep_session_is_registered('sppc_customer_group_id')) { 
    $customer_group_id = '0';
    } else {
     $customer_group_id = $sppc_customer_group_id;
    }
if (tep_session_is_registered('customer_id')) {
  $customer_shipment_query = tep_db_query("select IF(c.customers_shipment_allowed <> '', c.customers_shipment_allowed, cg.group_shipment_allowed) as shipment_allowed from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_id = '" . $customer_id . "' and cg.customers_group_id =  '" . $customer_group_id . "'");
} else {
  $customer_shipment_query = tep_db_query("select cg.group_shipment_allowed as shipment_allowed from " . TABLE_CUSTOMERS_GROUPS . " cg where cg.customers_group_id =  '" . $customer_group_id . "'");
}

The code change for payment.php would be pretty similar if this works.

Posted (edited)

Jan, thanks for all that I am getting a better hold now of this

 

I am not familiar with phpBB but there are over 2800 contributions for osC and most have several packages and updates in them. There is no validation of contributions at osC. I don't think it is realistic to expect the man power to be available to do that anyway. In many ways the users of the contributions themselves are the beta-testers.

 

phpbb has as many contrib's also open source.. just making a comparison.. I guess I was either fortunate by working on that before this or spoiled by it :)

 

 

Changes to catalog/login.php were not necessary. Probably you saw changes from a post of mine, but what I posted there had code for a future version of SPPC in it, that will enable one to make specific taxes exempt for certain groups or even certain customers. The confusion is my fault.

 

gotcha on that

 

In the part headed CHOOSE GROUP DURING REGISTER you write for a change in admin/customers.php:

SNIP   

So you should define EMAIL_TEXT there (check catalog/includes/languages/english/create_account.php to see how that is done).

EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;

concanates all the text defined in the different defines to one message. So you can use only one for the message: EMAIL_TEXT and one for the email subject of course: EMAIL_SUBJECT

$customers_lastname . ",\n\n

? $email_text = EMAIL_TEXT;

? tep_mail($name, $customers_email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

} // end if ($old_customers_group_id <= 2 && $customers_group_id .>= 3)

[/code]

 

Can I define my own email content?

 

define('EMAIL_SUBJECT', 'Welcome to ' . STORE_NAME);

define('EMAIL_GREET_MR', 'Dear Mr. %s,' . "\n\n");

define('EMAIL_GREET_MS', 'Dear Ms. %s,' . "\n\n");

define('EMAIL_GREET_NONE', 'Dear %s' . "\n\n");

define('EMAIL_WELCOME', 'We welcome you to <b>' .

define('EMAIL_TEXT2', 'You need to log log and back on to see your professional pricing

SNIP

and change that code to:

$email_text = EMAIL_TEXT2;

tep_mail($name, $customers_email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

In essesnse customize this particular mail when they get approved or moved to a new group

 

OK last Q before I make this jump into the pool

 

in reference to the auto add to group part..

 

Groups defined as:

$customer_type_array[] = array('id' => '0', 'text' => 'Retail Consumer');
$customer_type_array[] = array('id' => '1', 'text' => 'Licensed Professional');
$customer_type_array[] = array('id' => '2', 'text' => 'Prof - Unlicensed State/Country');
$customer_type_array[] = array('id' => '3', 'text' => 'Wholesale');

 

Code to auto place in group:

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

 

I think in my case with this drop down box .. this needs to look like:

 

 ? ? ? if ($company_tax_id == 'retail') {
? ? ? $sql_data_array['customers_group_id'] = '0';
? ?$sppc_customer_group_id = '0';
? ? ? } elseif ($company_tax_id == 'professional') {
? ? ? $sql_data_array['customers_group_id'] = '1';
? ?$sppc_customer_group_id = '1';
? ? ? } elseif ($company_tax_id == 'professional2') {
? ? ? $sql_data_array['customers_group_id'] = '2';
? ?$sppc_customer_group_id = '2';

 

Would that cause the desired effect of putting the retail people in their group, the professional people their reespective groups and then the wholesale people into the retail group awaiting approval to be moved to their group???

 

Do I ned to define the groups as single strings or will osC replace the spaces with _ characters???

 

Prof - Unlicensed State/Country

 

Prof_Unlicensed_State_Country

 

Please tell me I got this right :)

 

 

Oh yea.. one more I am sure is simple.. I see all over in osC tep this and tep that.. what does that stand for??

 

thanks!

Edited by wkdwich

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

Posted
Can I define my own email content?

 

define('EMAIL_SUBJECT', 'Welcome to ' . STORE_NAME);

define('EMAIL_GREET_MR', 'Dear Mr. %s,' . "\n\n");

define('EMAIL_GREET_MS', 'Dear Ms. %s,' . "\n\n");

define('EMAIL_GREET_NONE', 'Dear %s' . "\n\n");

define('EMAIL_WELCOME', 'We welcome you to <b>' .

define('EMAIL_TEXT2', 'You need to log log and back on to see your professional pricing

SNIP 

and change that code to:

  $email_text = EMAIL_TEXT2;

  tep_mail($name, $customers_email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

Sure, better check create_account.php how that is done. The EMAIL_GREET_MR etc. uses a sprintf I think to put text in the %s.
in reference to the auto add to group part..

 

Groups defined as:

$customer_type_array[] = array('id' => '0', 'text' => 'Retail Consumer');
$customer_type_array[] = array('id' => '1', 'text' => 'Licensed Professional');
$customer_type_array[] = array('id' => '2', 'text' => 'Prof - Unlicensed State/Country');
$customer_type_array[] = array('id' => '3', 'text' => 'Wholesale');

 

I think in my case with this drop down box .. this needs to look like:

 

 ? ? ? if ($company_tax_id == 'retail') {
? ? ? $sql_data_array['customers_group_id'] = '0';
? ?$sppc_customer_group_id = '0';
? ? ? } elseif ($company_tax_id == 'professional') {
? ? ? $sql_data_array['customers_group_id'] = '1';
? ?$sppc_customer_group_id = '1';
? ? ? } elseif ($company_tax_id == 'professional2') {
? ? ? $sql_data_array['customers_group_id'] = '2';
? ?$sppc_customer_group_id = '2';

No, since the id values are sent over in the POST process. Not the text. So either change the id from 0 to retail, 1 to professional, etc. or use the 0, 1, 2.
Would that cause the desired effect of putting the retail people in  their group, the professional people their reespective groups and then the wholesale people into the retail group awaiting approval to be moved to their group???
Yes, the addition to $sql_data_array takes care of that.

 

Oh yea.. one more I am sure is simple.. I see all over in osC tep this and tep that.. what does that stand for??

That's an osCommerce thing. All the osCommerce defined functions start with tep_. You can find those functions in files in catalog/includes/functions e.g. html_output.php. The tep_ is from an older name of the project. It was then called The Exchange Project. In MS3 all the tep_'s will be replaced by osc_'s by the way.
Posted
Thomas,

I suspect there is trouble with the fact that the customer_id might not be available with the mod you are using. Since that is used in the classes shipping and payment to check for the customer specific payment and shipping options you better use some extra code to check for it.

For example in shipping.php you could try changing:

 ? ? global $sppc_customer_group_id, $customer_id;
? ? if(!tep_session_is_registered('sppc_customer_group_id')) { 
? ? $customer_group_id = '0';
? ? } else {
? ? ?$customer_group_id = $sppc_customer_group_id;
? ? }
? $customer_shipment_query = tep_db_query("select IF(c.customers_shipment_allowed <> '', c.customers_shipment_allowed, cg.group_shipment_allowed) as shipment_allowed from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_id = '" . $customer_id . "' and cg.customers_group_id = ?'" . $customer_group_id . "'");

to

 ? ? global $sppc_customer_group_id, $customer_id;
? ? if(!tep_session_is_registered('sppc_customer_group_id')) { 
? ? $customer_group_id = '0';
? ? } else {
? ? ?$customer_group_id = $sppc_customer_group_id;
? ? }
if (tep_session_is_registered('customer_id')) {
? $customer_shipment_query = tep_db_query("select IF(c.customers_shipment_allowed <> '', c.customers_shipment_allowed, cg.group_shipment_allowed) as shipment_allowed from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_id = '" . $customer_id . "' and cg.customers_group_id = ?'" . $customer_group_id . "'");
} else {
? $customer_shipment_query = tep_db_query("select cg.group_shipment_allowed as shipment_allowed from " . TABLE_CUSTOMERS_GROUPS . " cg where cg.customers_group_id = ?'" . $customer_group_id . "'");
}

The code change for payment.php would be pretty similar if this works.

 

 

Hi Janz,

 

Thanks for the help.

 

This doens't seems to work. i have tried many times. But it wont change to it.

 

Do you have any other tips for me?

 

Thanks again for the help

 

Regards

Thomas

Posted
Not too many people seem to need it, but I have been working on it some time ago but haven't got round to the admin side. Perhaps you want to try to follow these instructions (backup your files first of course) and see how it works. I used and adapted code from FalseDawn to keep the extra number of queries that will be needed to a minimum.

This modification enables attribute pricing for customer groups and assumes you have SPPC already installed. Since the admin side for this modifcation is not finished, you will have to manually add the prices, price_prefix (either a plus or a minus) etc. to the table products_attributes_groups after having created that table by running the following sql query on your MySQL database (using e.g. phpMyAdmin):

CREATE TABLE `products_attributes_groups` (
?`products_attributes_id` int(11) NOT NULL default '0',
?`customers_group_id` smallint(5) NOT NULL default '0',
?`options_values_price` decimal(15,4) NOT NULL default '0.0000',
?`price_prefix` char(1) NOT NULL default '',
?`products_id` int(11) NOT NULL default '0',
?PRIMARY KEY ?(`customers_group_id`,`products_attributes_id`)
) TYPE=MyISAM;

The "connection" between the tables is established through the products_attributes_id from the table products_attributes. You will have to look up that value in products_attributes before entering the price and other data for a product in products_attributes_groups.

------------------------------------------
Make changes in the following three files:
------------------------------------------
catalog/includes/database_tables.php
.
.
.
.
.

Note that with copying and pasting code from a webpage you might introduce UTF-8 white space characters in your PHP code that will raise error messages (depending on browser and platform I guess, I encountered it often). Make sure you save the changed files as ASCII or use NotePad on Windows to get rid of those characters.

 

Thanks JanZ, this code is exactly what i am looking for. Is there any chance of you finishing off the admin side soon? I would love to have on the site.

Posted

Thomas,

This doens't seems to work. i have tried many times. But it wont change to it.

I now installed this contribution and I can tell you it needs the checking if the customer_id is known and the code I gave above. With that I do exclude shipping choices that I set not to be available for retail customers.

 

So... I can't tell you why it is not working for you.

Posted
Is there any chance of you finishing off the admin side soon? I would love to have on the site.

I haven't even started on the admin side yet, sorry. You could use phpMyAdmin to put the necessary data and group attribute prices in the new table though.
Posted
Thomas,

I now installed this contribution and I can tell you it needs the checking if the customer_id is known and the code I gave above. With that I do exclude shipping choices that I set not to be available for retail customers.

 

So... I can't tell you why it is not working for you.

 

Thanks again Janz,

 

I dont now why it dont works for me. But i will try it again.

 

Since it worked for you then it have to be something wrong on my server(Has happened before)

 

You didn't change anything og included anything in the checkout alternative.php file?

 

I will try it again tonight.

 

Thanks for all the help Janz.

 

Regards

Thomas

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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