osCmax v2.5 User Manual
Results 1 to 3 of 3

Separate Pricing Per Customer & Login.php

This is a discussion on Separate Pricing Per Customer & Login.php within the osCmax v2 Installation issues forums, part of the osCmax v2.0 Forums category; Hi All I was trying to get Separate Pricing Per Customer working, but for some reason it wasn't. So I ...

      
  1. #1
    New Member
    Join Date
    Mar 2004
    Posts
    11
    Rep Power
    0


    Default Separate Pricing Per Customer & Login.php

    Hi All

    I was trying to get Separate Pricing Per Customer working, but for some reason it wasn't. So I downladed the contribution and went over all the code changes. I found that catalog/login.php was untouched

    Here is the code needed to modify the /catalog/login.php

    Code:
    catalog\login.php
    
    
    Line 4
    
    **AFTER**
    $Id: login.php,v 1.80 2003/06/05 23:28:24 hpdl Exp $
    
    **ADD**
    adapted for Separate Price Per Customer v4.0 2005/02/22
    
    
    
    
    
    Line 29
    
    **REPLACE**
     $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
    
    
    
    
    
    **WITH**
    // BOF Separate Pricing per Customer
    /*    $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); */
        $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_group_id, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
    // EOF Separate Pricing Per Customer
    
    
    
    
    
    
    Line 44
    
    **AFTER**
    if (SESSION_RECREATE == 'True') {
              tep_session_recreate();
            }
    
    
    
    
    
    **ADD**
    // BOF Separate Pricing Per Customer: choice for logging in under any customer_group_id
    // note that tax rates depend on your registered address!
    if ($_GET['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'));
    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']."\">");
    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
    
    
    
    Line 81
    
    **AFTER**
    $customer_first_name = $check_customer['customers_firstname'];
    
    
    **ADD**
    // BOF Separate Pricing per Customer
    	if ($_GET['skip'] == 'true' && $_POST['email_address'] == SPPC_TOGGLE_LOGIN_PASSWORD && isset($_POST['new_customers_group_id']))  {
    	$sppc_customer_group_id = $_POST['new_customers_group_id'] ;
    	$check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$_POST['new_customers_group_id'] . "'");
    	} else {
    	$sppc_customer_group_id = $check_customer['customers_group_id'];
    	$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
    
    
    
    Line 98
    
    **AFTER**
    tep_session_register('customer_default_address_id');
            tep_session_register('customer_first_name');
    
    
    **ADD**
    // 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');
    	// EOF Separate Pricing per Customer
    
    
    
    
    -------------------------------------------------------------------------------------------------------
    
    catalog\logoff.php
    
    
    Line 4
    
    **AFTER**
    $Id: logoff.php,v 1.13 2003/06/05 23:28:24 hpdl Exp $
    
    **ADD**
    adapted for Separate Pricing Per Customer 2005/02/06
    
    
    
    Line 22
    
    **AFTER**
     tep_session_unregister('customer_first_name');
    
    
    
    **ADD**
    // BOF Separate Pricing per Customer
      tep_session_unregister('sppc_customer_group_id');
      tep_session_unregister('sppc_customer_group_show_tax');
      tep_session_unregister('sppc_customer_group_tax_exempt');
      // EOF Separate Pricing per Customer
    This will mean when you log on as a customer you will see products priced according to there customer group.

  2. #2
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default RE: Separate Pricing Per Customer & Login.php

    Those changes are already added to v2.0... You must have replaced it with a non-oscmax version at some point...

    Here is the entire login.php that is included in the v2.0 RC2 download:
    Code:
    <?php
    /*
      $Id: login.php,v 1.5.2.1.2.2 2005/09/21 20:57:17 Michael Sasek Exp $
    
      osCMax Power E-Commerce
      http://oscdox.com
    
      Copyright (c) 2003 osCommerce
    
      Released under the GNU General Public License
    */
    
    // Most of this file is changed or moved to BTS - Basic Template System - format.
    // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).
    //       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).
    // (Sub 'fallback' with your current template to see if there is a template specific file.)
    
      require('includes/application_top.php');
    
    // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
      if ($session_started == false) {
        tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
      }
    
      require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);
    
      $error = false;
    // BOF: MOD - PWA 0.70 :
      if($HTTP_GET_VARS['login'] == 'fail') {
        $fail_reason = (!empty($HTTP_GET_VARS['reason'])) ? urldecode($HTTP_GET_VARS['reason']): TEXT_LOGIN_ERROR;
        $messageStack->add('login', $fail_reason);
      }
    // EOF: MOD - PWA 0.70 :
      if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
        $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
        $password = tep_db_prepare_input($HTTP_POST_VARS['password']);
    
    // Check if email exists
    // LINE CHANGED: MOD - Separate Pricing per Customer
    //  $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
        $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_group_id, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
        if (!tep_db_num_rows($check_customer_query)) {
          $error = true;
        } else {
          $check_customer = tep_db_fetch_array($check_customer_query);
    // Check that password is good
          if (!tep_validate_password($password, $check_customer['customers_password'])) {
            $error = true;
          } else {
            if (SESSION_RECREATE == 'True') {
              tep_session_recreate();
            }
    // BOF: MOD - Separate Pricing Per Customer: choice for logging in under any customer_group_id
    // note that tax rates depend on your registered address!
            if ($_GET['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'));
              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']."\">");
              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: MOD - Separate Pricing Per Customer: choice for logging in under any customer_group_id
            $check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");
            $check_country = tep_db_fetch_array($check_country_query);
    
            $customer_id = $check_customer['customers_id'];
            $customer_default_address_id = $check_customer['customers_default_address_id'];
            $customer_first_name = $check_customer['customers_firstname'];
    // BOF: MOD - Separate Pricing per Customer
            if ($_GET['skip'] == 'true' && $_POST['email_address'] == SPPC_TOGGLE_LOGIN_PASSWORD && isset($_POST['new_customers_group_id']))  {
              $sppc_customer_group_id = $_POST['new_customers_group_id'] ;
              $check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$_POST['new_customers_group_id'] . "'");
            } else {
              $sppc_customer_group_id = $check_customer['customers_group_id'];
              $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: MOD - 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: MOD - 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');
    // EOF: MOD - Separate Pricing per Customer
            tep_session_register('customer_country_id');
            tep_session_register('customer_zone_id');
    
            tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");
    
    // BOF: MOD - GV CREDIT CLASS
    // add these new codes:
            if (tep_session_is_registered('floating_gv_code')) {
              $gv_query = tep_db_query("SELECT c.coupon_id, c.coupon_amount, IF(rt.coupon_id>0, 'true', 'false') AS redeemed FROM ". TABLE_COUPONS ." c LEFT JOIN ". TABLE_COUPON_REDEEM_TRACK." rt USING(coupon_id), ". TABLE_COUPON_EMAIL_TRACK ." et WHERE c.coupon_code = '". $floating_gv_code ."' AND c.coupon_id = et.coupon_id");
              // check if coupon exist
              if (tep_db_num_rows($gv_query) >0) {
                $coupon = tep_db_fetch_array($gv_query);
                // check if coupon_id exist and coupon not redeemed
                if($coupon['coupon_id']>0 && $coupon['redeemed'] == 'false') {
                  tep_session_unregister('floating_gv_code');
                  $gv_query = tep_db_query("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $coupon['coupon_id'] . "', '" . $customer_id . "', now(),'" . $REMOTE_ADDR . "')");
                  $gv_update = tep_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $coupon['coupon_id'] . "'");
                  tep_gv_account_update($customer_id, $coupon['coupon_id']);
                }
              }
            }
    // EOF: MOD - GV CREDIT CLASS
    
    // restore cart contents
            $cart->restore_contents();
    
            if (sizeof($navigation->snapshot) > 0) {
              $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
              $navigation->clear_snapshot();
              tep_redirect($origin_href);
            } else {
              tep_redirect(tep_href_link(FILENAME_DEFAULT));
            }
          }
        }
      }
    
      if ($error == true) {
        $messageStack->add('login', TEXT_LOGIN_ERROR);
      }
    
      $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
    
      $content = CONTENT_LOGIN;
      $javascript = $content . '.js';
    
      include (bts_select('main', $content_template)); // BTSv1.5
    
      require(DIR_WS_INCLUDES . 'application_bottom.php');
    ?>
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  3. #3
    New Member
    Join Date
    Mar 2004
    Posts
    11
    Rep Power
    0


    Default

    Yeah your right it was more like a "blend" of code that had obviously overwritten some lines. I used win merge to see the difference from an original and its all fixed now

Similar Threads

  1. Separate Pricing Per Customer - SPPC
    By tastar in forum osCmax v2 Customization/Mods
    Replies: 0
    Last Post: 07-08-2005, 03:09 AM
  2. Where is Separate Pricing Per Customer?
    By adam71o in forum osCMax v1.7 Installation
    Replies: 11
    Last Post: 06-03-2005, 12:25 PM
  3. Separate Pricing Per Customer 4.1.1 - New version
    By fuzzyphil in forum osCMax v1.7 General Mods Discussion
    Replies: 1
    Last Post: 05-04-2005, 08:39 AM
  4. Separate Pricing per customer & Printable Catalog
    By bdneuman in forum osCMax v1.7 General Mods Discussion
    Replies: 0
    Last Post: 02-21-2005, 08:17 AM
  5. Separate pricing per customer No groups in Products
    By zel in forum osCMax v1.7 General Mods Discussion
    Replies: 6
    Last Post: 02-20-2005, 12:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •