Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Jan- Any input on my above post? Thanks for any help in advance

I think this works better (code in includes/address_book_details.php. Haven't been able to check if the emails have stopped but I think so:

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

Share this post


Link to post
Share on other sites

Thomas,

Since it worked for you then it have to be something wrong on my server(Has happened before)
No idea why it would work for me but not for you.
You didn't change anything og included anything in the checkout alternative.php file?

No, apart from having to add the require class http_Client for the osC UPS to get it to work (which immediatly gives an error when you come to the page and are not a customer yet, because the destination is not set, which is true because you haven't given your address).

Share this post


Link to post
Share on other sites

Jan- Just to verify...that should ONLY replace the following code, correct?

<!-- BOF Separate Pricing Per Customer -->
<?php 
  if (tep_not_null($entry['entry_company_tax_id'])) {
  ?>
         <tr>
           <td class="main"><?php echo ENTRY_COMPANY_TAX_ID; ?></td>
           <td class="main"><?php echo $entry['entry_company_tax_id']; ?></td>
         </tr>
<?php
  } else { // end if (tep_not_null($entry['entry_company_tax_id']))

 

If so, I tried it out. The email issue seems corrected, but theres one new glitch added to the state/country functionality. Now the page doesnt refresh after choosing a new country, and the new state list doesnt display. Any idea on that? I think once this is solved, everything will be 100%. :D

Share this post


Link to post
Share on other sites
Jan- Just to verify...that should ONLY replace the following code, correct?
Yes.
If so, I tried it out. The email issue seems corrected, but theres one new glitch added to the state/country functionality. Now the page doesnt refresh after choosing a new country, and the new state list doesnt display. Any idea on that?

No idea, since this has nothing to do with the functionality of the country state list. Obvious to say, but it worked for me. Perhaps you have JavaScript disabled?

Share this post


Link to post
Share on other sites
No idea, since this has nothing to do with the functionality of the country state list. Obvious to say, but it worked for me. Perhaps you have JavaScript disabled?

 

really? If I have the old modified includes/modules/address_book_details.php in the dropdown menus work fine when editing the your account info or adding a new account. When I upload the file with your above changes, the dropdown menus are there and you can select the different things in them, but if you change the country the page doesnt refresh with the different list of zones.

 

I can swap this file back and furth and it does the same thing over and over......??

Share this post


Link to post
Share on other sites
really? If I have the old modified includes/modules/address_book_details.php in the dropdown menus work fine when editing the your account info or adding a new account. When I upload the file with your above changes, the dropdown menus are there and you can select the different things in them, but if you change the country the page doesnt refresh with the different list of zones.

 

I can swap this file back and furth and it does the same thing over and over......??

This is the complete file (includes/modules/address_book_details.php. Just to be sure we are dealing with the same file/code.

<?php
/*
 $Id: address_book_details.php,v 1.10 2003/06/09 22:49:56 hpdl Exp $
 adapted for Separate Pricing Per Customer (show tax_id number, as not editable)
 Country-State Selector contribution no.2028 added plus fix to SPPC code 2005/07/28

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if (!isset($process)) $process = false;
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td class="main"><b><?php echo NEW_ADDRESS_TITLE; ?></b></td>
       <td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>
     </tr>
   </table></td>
 </tr>
 <tr>
   <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
     <tr class="infoBoxContents">
       <td><table border="0" cellspacing="2" cellpadding="2">
<?php
 if (ACCOUNT_GENDER == 'true') {
   if (isset($gender)) {
     $male = ($gender == 'm') ? true : false;
   } else {
     $male = ($entry['entry_gender'] == 'm') ? true : false;
   }
   $female = !$male;
?>
         <tr>
           <td class="main"><?php echo ENTRY_GENDER; ?></td>
           <td class="main"><?php echo tep_draw_radio_field('gender', 'm', $male) . '  ' . MALE . '  ' . tep_draw_radio_field('gender', 'f', $female) . '  ' . FEMALE . ' ' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
         </tr>
<?php
 }
?>
         <tr>
           <td class="main"><?php echo ENTRY_FIRST_NAME; ?></td>
           <td class="main"><?php echo tep_draw_input_field('firstname', $entry['entry_firstname']) . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo ENTRY_LAST_NAME; ?></td>
           <td class="main"><?php echo tep_draw_input_field('lastname', $entry['entry_lastname']) . ' ' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
         </tr>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
<?php
 if (ACCOUNT_COMPANY == 'true') {
?>
         <tr>
           <td class="main"><?php echo ENTRY_COMPANY; ?></td>
           <td class="main"><?php echo tep_draw_input_field('company', $entry['entry_company']) . ' ' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>
         </tr>
<!-- BOF Separate Pricing Per Customer -->
<?php 
  if (tep_not_null($entry['entry_company_tax_id']) || $refresh == true ) {
   echo ($refresh !== true ? '<input type="hidden" name="company_tax_no" value="' . $entry['entry_company_tax_id'] .'">': '');
  ?>
         <tr>
           <td class="main"><?php echo ENTRY_COMPANY_TAX_ID; ?></td>
           <td class="main"><?php echo (isset($entry['entry_company_tax_id'])? $entry['entry_company_tax_id'] : $_POST['company_tax_no'] ); ?></td>
<?php    if ($refresh == true && !isset($_POST['company_tax_no'])) {
echo '<input type="hidden" name="company_tax_id" value="' . $entry['entry_company_tax_id'] .'">';
        } elseif ($refresh == true && isset($_POST['company_tax_no'])) {
echo '<input type="hidden" name="company_tax_no" value="' . $_POST['company_tax_no'] .'">';  
 }
?>
         </tr>
<?php
  } else { // end if (tep_not_null($entry['entry_company_tax_id'])) 
?>       <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>
<?php
  } // end else 
?><!-- EOF Separate Pricing Per Customer -->
          <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
<?php
 }
?>
         <tr>
           <td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td>
           <td class="main"><?php echo tep_draw_input_field('street_address', $entry['entry_street_address']) . ' ' . (tep_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>
         </tr>
<?php
 if (ACCOUNT_SUBURB == 'true') {
?>
         <tr>
           <td class="main"><?php echo ENTRY_SUBURB; ?></td>
           <td class="main"><?php echo tep_draw_input_field('suburb', $entry['entry_suburb']) . ' ' . (tep_not_null(ENTRY_SUBURB_TEXT) ? '<span class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?></td>
         </tr>
<?php
 }
?>
         <tr>
           <td class="main"><?php echo ENTRY_POST_CODE; ?></td>
           <td class="main"><?php echo tep_draw_input_field('postcode', $entry['entry_postcode']) . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo ENTRY_CITY; ?></td>
           <td class="main"><?php echo tep_draw_input_field('city', $entry['entry_city']) . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
         </tr>
<?php
 if (ACCOUNT_STATE == 'true') {
?>
         <tr>
           <td class="main"><?php echo ENTRY_STATE; ?></td>
           <td class="main">
<?php
/*    if ($process == true) {
     if ($entry_state_has_zones == true) {
       $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);
     } else {
       echo tep_draw_input_field('state');
     }
   } else {
     echo tep_draw_input_field('state', tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']));
   } */
// +Country-State Selector
    $zones_array = array();
    $zones_query = tep_db_query("select zone_name, zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$entry['entry_country_id'] . "' order by zone_name");
    while ($zones_values = tep_db_fetch_array($zones_query)) {
      $zones_array[] = array('id' => $zones_values['zone_id'], 'text' => $zones_values['zone_name']);
      }
    if (count($zones_array) > 0) {
      echo tep_draw_pull_down_menu('zone_id', $zones_array, $entry['entry_zone_id']);
      echo tep_draw_hidden_field('state', '');
    } else {
      echo tep_draw_input_field('state', $entry['entry_state']);
    }
// -Country-State Selector
   if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;
?></td>
         </tr>
<?php
 }
?>
         <tr>
           <td class="main"><?php echo ENTRY_COUNTRY; ?></td>
    <!--       <td class="main"><?php // echo tep_get_country_list('country', $entry['entry_country_id']) . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td> -->
            <?php // +Country-State Selector ?>
           <td class="main"><?php echo tep_get_country_list('country', $entry['entry_country_id'],
             'onChange="return refresh_form(addressbook);"') . ' ' . 
             (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
           <?php // -Country-State Selector ?>    
         </tr>
<?php
 if ((isset($HTTP_GET_VARS['edit']) && ($customer_default_address_id != $HTTP_GET_VARS['edit'])) || (isset($HTTP_GET_VARS['edit']) == false) ) {
?>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td colspan="2" class="main"><?php echo tep_draw_checkbox_field('primary', 'on', false, 'id="primary"') . ' ' . SET_AS_PRIMARY; ?></td>
         </tr>
<?php
 }
?>
       </table></td>
     </tr>
   </table></td>
 </tr>
</table>

Share this post


Link to post
Share on other sites

thanks for posting that. Wow, nice blooper on my end...I must have changed the code in my original file and used that instead of the file modified for the state-country contrib. Guess that would cause the refresh not to work!

 

Your right, seems to work awesome now. Time for the final testing of this store, hope all goes well. Thanks ALOT for your awesome help!

Share this post


Link to post
Share on other sites

still a few issues, but it works.. YIPPEEE.. I started from scratch again after a few issues it works.. A few issues yet to resolve..

 

The red light does not turn itself off when auto added to a group

 

custom email to those in prof or wholesale pricing was a failure - ideally each would get their own thanks for registering, then the wholesale will get a private response when approved directly from the merchant

 

when I log in with the "master user name" I am presented with the group to choose drop down, but when I choose and click to continue (the image doesnt show either) nothing happens.. the page just reloads

 

I still need to change some wording but I thnk I can handle that myself

 

#MOD choose group during registration & auto assign to group
#

Files to change:
#---[ OPEN catalog/admin/includes/languages/english.php ]----------------------------
#---[ OPEN catalog/create_account.php ]----------------------------
#---[ OPEN catalog/includes/languages/english/english.php ]----------------------------
#---[ OPEN catalog/includes/languages/english/login.php ]----------------------------
#


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\admin\includes\languages\english.php ]----------------------------

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

define('ENTRY_COMPANY

define('ENTRY_COMPANY_TAX_ID', 'Company\'s tax id number:');

#
#---[ REPLACE WITH ]----------------------------
change text to suit

#
#---[ OPEN catalog\includes\languages\english\english.php ]----------------------------

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

define('ENTRY_COMPANY
define('ENTRY_COMPANY_TAX_ID', 'Company\'s tax id number:');

#
#---[ REPLACE WITH ]----------------------------
change text to suit

#
#---[ 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 -->


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

 if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)  ) { 
     $sql_data_array['customers_group_ra'] = '1';
     }

#
#---[ 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 == '1') {
     $sql_data_array['customers_group_id'] = '1';
  $sppc_customer_group_id = '1';
     } elseif ($company_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 ]------------
// 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

#
#---[ 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 ]----------------------------
//define EMAIL_TEXT catalog/includes/languages/english/create_account.php 

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)


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

Share this post


Link to post
Share on other sites
The red light does not turn itself off when auto added to a group
That is because of the: ?$sql_data_array['customers_group_ra'] = '1';

If you want to avoid that, change it to '0' for the ones you auto add:

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

 

custom email to those in prof or wholesale pricing was a failure - ideally each would get their own thanks for registering, then the wholesale will get a private response when approved directly from the merchant
The code you have for that in your post is for the page admin/customers.php and assumes you didn't use automatic assigning of registering customers into a group.

 

If you want to do this on the create_account.php page you will to add some more code in this area:

// build the message content
     $name = $firstname . ' ' . $lastname;

     if (ACCOUNT_GENDER == 'true') {
        if ($gender == 'm') {
          $email_text = sprintf(EMAIL_GREET_MR, $lastname);
        } else {
          $email_text = sprintf(EMAIL_GREET_MS, $lastname);
        }
     } else {
       $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
     }

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

I would add some code just above the last $email_text that adds a different EMAIL_WELCOME depending on the sppc_customer_group_id and then continue with the last $email_text .= concanation without the "EMAIL_WELCOME ."

 

So along the lines of:

if ($sppc_customer_group_id == '1') {
$email_text .= EMAIL_WELCOME1;
} elseif ($sppc_customer_group_id == '2') {
$email_text .= EMAIL_WELCOME2;
} else { // anything else than customer group 1 or 2 gets the generic one:
$email_text .= EMAIL_WELCOME;
}

 

when I log in with the "master user name" I am presented with the group to choose drop down, but when I choose and click to continue (the image doesnt show either) nothing happens.. the page just reloads
That is because the super duper SEO enhancement <_< you added cannot handle the additional GET variable that is added to the URL. I'll make it easy for you and show you the code changes to do this:

// BOF Separate Pricing Per Customer: choice for logging in under any customer_group_id
// note that tax rates depend on your registered address!
// GET changed to POST
if ($_POST['skip'] != 'true' && $_POST['email_address'] == SPPC_TOGGLE_LOGIN_PASSWORD ) {
  $existing_customers_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");
echo '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">';
print ("\n<html ");
echo HTML_PARAMS; 
print (">\n<head>\n<title>Choose a Customer Group</title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
echo CHARSET;
print ("\"\n<base href=\"");
echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG;
print ("\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\">\n");
echo '<body bgcolor="#ffffff" style="margin:0">';
print ("\n<table border=\"0\" width=\"100%\" height=\"100%\">\n<tr>\n<td style=\"vertical-align: middle\" align=\"middle\">\n");
// echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process&skip=true', 'SSL'));
// GET variable removed
echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'));
print ("\n<table border=\"0\" bgcolor=\"#f1f9fe\" cellspacing=\"10\" style=\"border: 1px solid #7b9ebd;\">\n<tr>\n<td class=\"main\">\n");
 $index = 0;
 while ($existing_customers =  tep_db_fetch_array($existing_customers_query)) {
$existing_customers_array[] = array("id" => $existing_customers['customers_group_id'], "text" => "?".$existing_customers['customers_group_name']."?");
   ++$index;
 }
print ("<h1>Choose a Customer Group</h1>\n</td>\n</tr>\n<tr>\n<td align=\"center\">\n");
echo tep_draw_pull_down_menu('new_customers_group_id', $existing_customers_array, $check_customer['customers_group_id']);
print ("\n<tr>\n<td class=\"main\">?<br />\n?");
print ("<input type=\"hidden\" name=\"email_address\" value=\"".$_POST['email_address']."\">");
// line added to add a POST variable of skip instead of using  a GET in the URL
print ("<input type=\"hidden\" name=\"skip\" value=\"true\">");
print ("<input type=\"hidden\" name=\"password\" value=\"".$_POST['password']."\">\n</td>\n</tr>\n<tr>\n<td align=\"right\">\n");
echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE);
print ("</td>\n</tr>\n</table>\n</form>\n</td>\n</tr>\n</table>\n</body>\n</html>\n");
exit;
}
// EOF Separate Pricing Per Customer: choice for logging in under any customer_group_id

Share this post


Link to post
Share on other sites
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.

Janz.

 

I have now tried the hole weekend.

 

But without any luck.

 

Could you please put out which files you have changed so that i can compare them to see what im missing.

 

And what about the http_client?

 

Regards

Thomas

Share this post


Link to post
Share on other sites

Thomas,

I have now tried the hole weekend.

 

But without any luck.

Perhaps it would be good if you describe exactly how you setup shipping and payment modules for your groups and what exactly is happening/going wrong. I might be guessing to what your problem is.

 

Could you please put out which files you have changed so that i can compare them to see what im missing.
The change I mentioned in an earlier post is in includes/classes/shipping.php and a similar change should be made in the includes/classes/payment.php to deal with the fact that customer_id might not be set when this class is called (it normally is: you cannot go to shipping before creating an account or having logged-in) and so only the options for the retail group should be selected in that case.

 

And what about the http_client?
The page checkout_shipping.php which is kind of incorporated in checkout_alternative.php requires the class http_client.php:

  require('includes/classes/http_client.php');

Checkout_alternative.php doesn't have this "require" and you will get an error e.g. with the standard UPS module. So this should be added to that page. If you haven't seen an error about mentioning the class http_client you apparently don't need it with the shipping modules you are using.

Share this post


Link to post
Share on other sites

Hi Jan,

 

I just reinstalled my osCommerce and decided to try your contribution of Separate Pricing Per Customer.

 

I had uploaded the Option Field Attribute contribution so had to only do a PARTIAL manual install of about 5 files, and then just uploaded the rest.

 

Everything is working as it should. Your work is very impressive. Thank you for the contribution, and continuing support on the contribution support thread.

NICE JOB!!

 

Off hand, do you know of any contributions to stay away from that might bring this one down?

 

I was wanting to use the Checkout without an Account contribution, because some people are afraid of having their information stored, and would be willing to pay retail just to avoid Creating an Account somewhere.

 

Thank you again

Share this post


Link to post
Share on other sites
I was wanting to use the Checkout without an Account contribution, because some people are afraid of having their information stored, and would be willing to pay retail just to avoid Creating an Account somewhere.

 

Thank you again

 

 

perfect timing I was just thinking if that one will work along side SPPC.. for the retail people ..


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

Share this post


Link to post
Share on other sites

I just finished installing my Purchase Without an Account contribution; and this and the Sep Price Per Customer "jive" fine.

 

(I guess it's not totally true that their "info wont be saved"--it is, until I delete it,--they just can't access it with a password) :-"

Share this post


Link to post
Share on other sites

I'd still be curious to know which contributions out there will cause problems for the "SEPARATE PRICES FOR SEPARATE CUSTOMERS"

 

SID killer?

Header Tags Controller?

Ultimate Urls?

Share this post


Link to post
Share on other sites
I just finished installing my Purchase Without an Account contribution; and this and the Sep Price Per Customer "jive" fine.

 

(I guess it's not totally true that their "info wont be saved"--it is, until I delete it,--they just can't access it with a password)  :-"

 

 

Excellant!! thaks for the update..


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

Share this post


Link to post
Share on other sites
I just finished installing my Purchase Without an Account contribution; and this and the Sep Price Per Customer "jive" fine.

 

(I guess it's not totally true that their "info wont be saved"--it is, until I delete it,--they just can't access it with a password)  :-"

 

 

I meant to ask.. does this allow others outside the retal group to purchase without an account also?? or just the retail people??


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

Share this post


Link to post
Share on other sites
Thomas,

Perhaps it would be good if you describe exactly how you setup shipping and payment modules for your groups and what exactly is happening/going wrong. I might be guessing to what your problem is.

 

The change I mentioned in an earlier post is in includes/classes/shipping.php and a similar change should be made in the includes/classes/payment.php to deal with the fact that customer_id might not be set when this class is called (it normally is: you cannot go to shipping before creating an account or having logged-in) and so only the options for the retail group should be selected in that case.

 

The page checkout_shipping.php which is kind of incorporated in checkout_alternative.php requires the class http_client.php:

 ?require('includes/classes/http_client.php');

Checkout_alternative.php doesn't have this "require" and you will get an error e.g. with the standard UPS module. So this should be added to that page. If you haven't seen an error about mentioning the class http_client you apparently don't need it with the shipping modules you are using.

 

Janz

 

I have now figured it out. I dont now what i have done wrong but i tried one last time and then it worked :D

 

Thanks again for all the help you are the best.

 

Regards

Thomas

Share this post


Link to post
Share on other sites
thanks for posting that. Wow, nice blooper on my end...I must have changed the code in my original file and used that instead of the file modified for the state-country contrib. Guess that would cause the refresh not to work!

 

Your right, seems to work awesome now. Time for the final testing of this store, hope all goes well. Thanks ALOT for your awesome help!

 

Hi Bob and Janz,

 

Just for people want to install this contribution (like me :-"), Can you do a recapitulation of what to do in order for working with SPPC 4.1 or make an update to this contribution. It will help many people, I'm sure. Thank you in advance. :thumbsup:


John

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

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites
I'd still be curious to know which contributions out there will cause problems for the "SEPARATE PRICES FOR SEPARATE CUSTOMERS"

I don't think very many. SPPC deals with prices (mainly) and that's about it. Other contributions might be more difficult to put in because line numbers don't match anymore but it shouldn't get in the way in general.

 

Of course, any other contribution that uses prices (X-sell, column product listings) will need to be "fixed" to use the correct prices for the group. A few of them have already been "fixed" in the thread or were uploaded as a separate contribution (Quantity Price Breaks for example). Others apparently don't give any problems (I have not seen any complaints about Credit Class & Gift Voucher for example, which seems to be the most downloaded contribution).

Share this post


Link to post
Share on other sites

Jean-Pierre/Jeep,

Just for people want to install this contribution (like me  :-"), Can you do a recapitulation of what to do  in order for working with SPPC 4.1 or make an update to this contribution.

From what I can find back, to make it work with Country-State Selector you only need to make additional changes for SPPC to two files. That is includes/modules/address_book_details.php, the changed file was posted here and to catalog/address_book_process.php which I will post below.

<?php
/*
 $Id: address_book_process.php,v 1.79 2003/06/09 23:03:52 hpdl Exp $
 adapted for Separate Pricing Per Customer 2005/02/16
 and Country-State Selector (contribution 2028) 2005/08/01

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

// needs to be included earlier to set the success message in the messageStack
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADDRESS_BOOK_PROCESS);

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'deleteconfirm') && isset($HTTP_GET_VARS['delete']) && is_numeric($HTTP_GET_VARS['delete'])) {
   tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . (int)$HTTP_GET_VARS['delete'] . "' and customers_id = '" . (int)$customer_id . "'");

   $messageStack->add_session('addressbook', SUCCESS_ADDRESS_BOOK_ENTRY_DELETED, 'success');

   tep_redirect(tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
 }

// error checking when updating or adding an entry
 $process = false;
/*  if (isset($HTTP_POST_VARS['action']) && (($HTTP_POST_VARS['action'] == 'process') || ($HTTP_POST_VARS['action'] == 'update'))) {
   $process = true; */
   
  // +Country-State Selector

 $refresh = false;
 if (isset($HTTP_POST_VARS['action']) && (($HTTP_POST_VARS['action'] == 'process') || ($HTTP_POST_VARS['action'] == 'update') ||
     ($HTTP_POST_VARS['action'] == 'refresh'))) {
   if ($HTTP_POST_VARS['action'] != 'refresh') { $process = true; } else { $refresh = true; }
 // -Country-State Selector   
   $error = false;

   if (ACCOUNT_GENDER == 'true') $gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);
   if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);
   // BOF Separate Pricing Per Customer
   if (ACCOUNT_COMPANY == 'true' && isset($HTTP_POST_VARS['company_tax_id'])) {
$company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['company_tax_id']);    
   }
   // EOF Separate Pricing Per Customer
   $firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
   $lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
   $street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);
   if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);
   $postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
   $city = tep_db_prepare_input($HTTP_POST_VARS['city']);
   $country = tep_db_prepare_input($HTTP_POST_VARS['country']);
   if (ACCOUNT_STATE == 'true') {
     if (isset($HTTP_POST_VARS['zone_id'])) {
       $zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
     } else {
       $zone_id = false;
     }
     $state = tep_db_prepare_input($HTTP_POST_VARS['state']);
   }

    // +Country-State Selector
if ($refresh) {$state = '';}
if ($process) {
// -Country-State Selector
   if (ACCOUNT_GENDER == 'true') {
     if ( ($gender != 'm') && ($gender != 'f') ) {
       $error = true;

       $messageStack->add('addressbook', ENTRY_GENDER_ERROR);
     }
   }

   if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
     $error = true;

     $messageStack->add('addressbook', ENTRY_FIRST_NAME_ERROR);
   }

   if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
     $error = true;

     $messageStack->add('addressbook', ENTRY_LAST_NAME_ERROR);
   }

   if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
     $error = true;

     $messageStack->add('addressbook', ENTRY_STREET_ADDRESS_ERROR);
   }

   if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
     $error = true;

     $messageStack->add('addressbook', ENTRY_POST_CODE_ERROR);
   }

   if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
     $error = true;

     $messageStack->add('addressbook', ENTRY_CITY_ERROR);
   }

   if (!is_numeric($country)) {
     $error = true;

     $messageStack->add('addressbook', ENTRY_COUNTRY_ERROR);
   }

   if (ACCOUNT_STATE == 'true') {
/*     $zone_id = 0;
     $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
     $check = tep_db_fetch_array($check_query);
     $entry_state_has_zones = ($check['total'] > 0);
     if ($entry_state_has_zones == true) {
       $zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
       if (tep_db_num_rows($zone_query) == 1) {
         $zone = tep_db_fetch_array($zone_query);
         $zone_id = $zone['zone_id'];
       } else {
         $error = true;

         $messageStack->add('addressbook', ENTRY_STATE_ERROR_SELECT);
       }
     } else { */
     // +Country-State Selector
       if ($zone_id == 0) {
     // -Country-State Selector
       if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
         $error = true;

         $messageStack->add('addressbook', ENTRY_STATE_ERROR);
       }
     }
   }

// +Country-State Selector
   }
   if (!$refresh) {
// -Country-State Selector
   if ($error == false) {
     $sql_data_array = array('entry_firstname' => $firstname,
                             'entry_lastname' => $lastname,
                             'entry_street_address' => $street_address,
                             'entry_postcode' => $postcode,
                             'entry_city' => $city,
                             'entry_country_id' => (int)$country);

     if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
     if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
     // BOF Separate Pricing Per Customer
     if (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)) {
      $sql_data_array['entry_company_tax_id'] = $company_tax_id;
     }
     // EOF Separate Pricing Per Customer
     if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
     if (ACCOUNT_STATE == 'true') {
       if ($zone_id > 0) {
         $sql_data_array['entry_zone_id'] = (int)$zone_id;
         $sql_data_array['entry_state'] = '';
       } else {
         $sql_data_array['entry_zone_id'] = '0';
         $sql_data_array['entry_state'] = $state;
       }
     }

     if ($HTTP_POST_VARS['action'] == 'update') {
       tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "address_book_id = '" . (int)$HTTP_GET_VARS['edit'] . "' and customers_id ='" . (int)$customer_id . "'");

// BOF Separate Pricing Per Customer: alert shop owner of tax id number added to an account
     if (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)) {
      $sql_data_array2['customers_group_ra'] = '1';
     tep_db_perform(TABLE_CUSTOMERS, $sql_data_array2, 'update', "customers_id ='" . (int)$customer_id . "'");
     
     // if you would *not* like to have an email when a tax id number has been entered in
     // the appropriate field, comment out this section. The alert in admin is raised anyway
     
     $alert_email_text = "Please note that " . $firstname . " " . $lastname . " of the company: " . $company . " has added a tax id number to his account information.";
     tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Tax id number added', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
// EOF Separate Pricing Per Customer: alert shop owner of account created by a company


// reregister session variables
       if ( (isset($HTTP_POST_VARS['primary']) && ($HTTP_POST_VARS['primary'] == 'on')) || ($HTTP_GET_VARS['edit'] == $customer_default_address_id) ) {
         $customer_first_name = $firstname;
         $customer_country_id = $country_id;
         $customer_zone_id = (($zone_id > 0) ? (int)$zone_id : '0');
         $customer_default_address_id = (int)$HTTP_GET_VARS['edit'];

         $sql_data_array = array('customers_firstname' => $firstname,
                                 'customers_lastname' => $lastname,
                                 'customers_default_address_id' => (int)$HTTP_GET_VARS['edit']);

         if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;

         tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int)$customer_id . "'");
       }
     } else {
       $sql_data_array['customers_id'] = (int)$customer_id;
       tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

       $new_address_book_id = tep_db_insert_id();

// reregister session variables
       if (isset($HTTP_POST_VARS['primary']) && ($HTTP_POST_VARS['primary'] == 'on')) {
         $customer_first_name = $firstname;
         $customer_country_id = $country_id;
         $customer_zone_id = (($zone_id > 0) ? (int)$zone_id : '0');
         if (isset($HTTP_POST_VARS['primary']) && ($HTTP_POST_VARS['primary'] == 'on')) $customer_default_address_id = $new_address_book_id;

         $sql_data_array = array('customers_firstname' => $firstname,
                                 'customers_lastname' => $lastname);

         if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
         if (isset($HTTP_POST_VARS['primary']) && ($HTTP_POST_VARS['primary'] == 'on')) $sql_data_array['customers_default_address_id'] = $new_address_book_id;

         tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int)$customer_id . "'");
       }
     }

     $messageStack->add_session('addressbook', SUCCESS_ADDRESS_BOOK_ENTRY_UPDATED, 'success');

     tep_redirect(tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
   }
 }
 // +Country-State Selector
}

  if ($refresh) {
    // Recreate $entry from post values collected above
    $entry = array(
      'entry_firstname' => $firstname,
      'entry_lastname' => $lastname,
      'entry_street_address' => $street_address,
      'entry_postcode' => $postcode,
      'entry_city' => $city,
      'entry_state' => "",
      'entry_zone_id' => (int)0,
      'entry_country_id' => (int)$country);
    if (ACCOUNT_GENDER == 'true') $entry['entry_gender'] = $gender;
    if (ACCOUNT_COMPANY == 'true') $entry['entry_company'] = $company;
    if (ACCOUNT_COMPANY == 'true') $entry['entry_company_tax_id'] = $company_tax_id;
    if (ACCOUNT_SUBURB == 'true') $entry['entry_suburb'] = $suburb;
    }
  else
// -Country-State Selector
// BOF Separate Pricing Per Customer
 if (isset($HTTP_GET_VARS['edit']) && is_numeric($HTTP_GET_VARS['edit'])) {
   $entry_query = tep_db_query("select entry_gender, entry_company, entry_company_tax_id, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_zone_id, entry_country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$HTTP_GET_VARS['edit'] . "'");
// EOF Separate Pricing Per Customer
   if (!tep_db_num_rows($entry_query)) {
     $messageStack->add_session('addressbook', ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY);

     tep_redirect(tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
   }

   $entry = tep_db_fetch_array($entry_query);
 } elseif (isset($HTTP_GET_VARS['delete']) && is_numeric($HTTP_GET_VARS['delete'])) {
   if ($HTTP_GET_VARS['delete'] == $customer_default_address_id) {
     $messageStack->add_session('addressbook', WARNING_PRIMARY_ADDRESS_DELETION, 'warning');

     tep_redirect(tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
   } else {
     $check_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . (int)$HTTP_GET_VARS['delete'] . "' and customers_id = '" . (int)$customer_id . "'");
     $check = tep_db_fetch_array($check_query);

     if ($check['total'] < 1) {
       $messageStack->add_session('addressbook', ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY);

       tep_redirect(tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
     }
   }
 } else {
   $entry = array();
       // +Country-State Selector
   if (!isset($country)) $country = DEFAULT_COUNTRY;
   $entry['entry_country_id'] = $country;
   // -Country-State Selector
 }

 if (!isset($HTTP_GET_VARS['delete']) && !isset($HTTP_GET_VARS['edit'])) {
   if (tep_count_customer_address_book_entries() >= MAX_ADDRESS_BOOK_ENTRIES) {
     $messageStack->add_session('addressbook', ERROR_ADDRESS_BOOK_FULL);

     tep_redirect(tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
   }
 }

 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));

 if (isset($HTTP_GET_VARS['edit']) && is_numeric($HTTP_GET_VARS['edit'])) {
   $breadcrumb->add(NAVBAR_TITLE_MODIFY_ENTRY, tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $HTTP_GET_VARS['edit'], 'SSL'));
 } elseif (isset($HTTP_GET_VARS['delete']) && is_numeric($HTTP_GET_VARS['delete'])) {
   $breadcrumb->add(NAVBAR_TITLE_DELETE_ENTRY, tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $HTTP_GET_VARS['delete'], 'SSL'));
 } else {
   $breadcrumb->add(NAVBAR_TITLE_ADD_ENTRY, tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, '', 'SSL'));
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php
 if (!isset($HTTP_GET_VARS['delete'])) {
   include('includes/form_check.js.php');
 }
?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"
<?php // +Country-State Selector
if ($refresh) { echo ' onLoad="document.addressbook.state.focus();"';} 
// -Country-State Selector 
?>
>
<!-- header Country-State Selector included //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><?php if (!isset($HTTP_GET_VARS['delete'])) echo tep_draw_form('addressbook', tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, (isset($HTTP_GET_VARS['edit']) ? 'edit=' . $HTTP_GET_VARS['edit'] : ''), 'SSL'), 'post', 'onSubmit="return check_form(addressbook);"'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php if (isset($HTTP_GET_VARS['edit'])) { echo HEADING_TITLE_MODIFY_ENTRY; } elseif (isset($HTTP_GET_VARS['delete'])) { echo HEADING_TITLE_DELETE_ENTRY; } else { echo HEADING_TITLE_ADD_ENTRY; } ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_address_book.gif', (isset($HTTP_GET_VARS['edit']) ? HEADING_TITLE_MODIFY_ENTRY : HEADING_TITLE_ADD_ENTRY), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 if ($messageStack->size('addressbook') > 0) {
?>
     <tr>
       <td><?php echo $messageStack->output('addressbook'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }

 if (isset($HTTP_GET_VARS['delete'])) {
?>
     <tr>
       <td class="main"><b><?php echo DELETE_ADDRESS_TITLE; ?></b></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main" width="50%" valign="top"><?php echo DELETE_ADDRESS_DESCRIPTION; ?></td>
               <td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="main" align="center" valign="top"><b><?php echo SELECTED_ADDRESS; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
                   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                   <td class="main" valign="top"><?php echo tep_address_label($customer_id, $HTTP_GET_VARS['delete'], true, ' ', '<br>'); ?></td>
                   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                 </tr>
               </table></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td><?php echo '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
               <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $HTTP_GET_VARS['delete'] . '&action=deleteconfirm', 'SSL') . '">' . tep_image_button('button_delete.gif', IMAGE_BUTTON_DELETE) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 } else {
?>
     <tr>
       <td><?php include(DIR_WS_MODULES . 'address_book_details.php'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   if (isset($HTTP_GET_VARS['edit']) && is_numeric($HTTP_GET_VARS['edit'])) {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td><?php echo '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
               <td align="right"><?php echo tep_draw_hidden_field('action', 'update') . tep_draw_hidden_field('edit', $HTTP_GET_VARS['edit']) . tep_image_submit('button_update.gif', IMAGE_BUTTON_UPDATE); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
   } else {
     if (sizeof($navigation->snapshot) > 0) {
       $back_link = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
     } else {
       $back_link = tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL');
     }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td><?php echo '<a href="' . $back_link . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
               <td align="right"><?php echo tep_draw_hidden_field('action', 'process') . tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>

<?php
   }
 }
?>
   </table><?php if (!isset($HTTP_GET_VARS['delete'])) echo '</form>'; ?></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

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

Share this post


Link to post
Share on other sites
Jean-Pierre/Jeep,

From what I can find back, to make it work with Country-State Selector you only need to make additional changes for SPPC to two files. That is includes/modules/address_book_details.php, the changed file was posted here and to catalog/address_book_process.php which I will post below.

 

Thank you JanZ, I will try this out tomorrow.... :thumbsup:


John

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

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites

Jean- Yeah, those two file changes should be it. I dont think I had any other issues between the two contribs. I gave it a pretty decent testing after the country-state contrib install and I think Jan took care of all the bugs.

 

Thanks again Jan

Share this post


Link to post
Share on other sites

Hi Jan,

 

Still loving your contribution! Can you tell me where code is located to set the customer database id default that is currently "0" which is the retail---to a number representing wholesale instead. I only have

 

Retail

Wholesale

Tax Exempt

 

I want everyone to see the retail, BUT for everyone who creates an account I would like everyone to automatically be Wholesale.

The "retail" customers can checkout without an account for the retail prices and everyone else just by virtue of "creating an account" gets to be wholesale Automatically without my approval, so they can order that same day without waiting.

 

This is not obvious to me. I have my copy of Sam's Learn PHP in 24 hours but haven't read enough yet.

 

Thank you for your support.

 

(I know about the red light issue of changing it to zero to turn it off for those added automatically:)

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

×