Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

function display_price($products_price, $products_tax, $quantity = 1) {
       if (TAX_INFO_ONOFF == 'Enabled') {
       $return = $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
       global $tag;
if ($customer_group_id == '2') {
$text_info_tax = TEXT_INFO_TAX2;
} elseif ($customer_group_id == '3') {
$text_info_tax = TEXT_INFO_TAX3;
} else {
$text_info_tax = TEXT_INFO_TAX;
}

       $return .= "<br><div class=\"tax_info\">" . sprintf($text_info_tax, $products_tax , tep_href_link(FILENAME_SHIPPING)) . "</div>";
       return $return;
       } else {
       return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
     }

its not works the only one is the TEXT_INFO_TAX and the rest goes not is this a bug in my shop the tax_info_onoff is the tax info contrieb for enable disable the tax display by price.

Share this post


Link to post
Share on other sites

My Account, Checkout and Create An Account pages are not loading from the main page. If I click on Shopping Cart, that loads, but the other 2 normally go to the log in screen if not already logged in, and the log in screen is not loading when I click either My Account or Checkout from the main page. Any ideas?

 

Doesnt give an error, just loads a blank white page.

 

Thanks!

 

Julie

Edited by Baybee

Share this post


Link to post
Share on other sites
its not works  the only one is the TEXT_INFO_TAX and the rest goes not is this a bug in my shop the tax_info_onoff is the tax info contrieb for enable disable the tax display by price.
True, inside the function you will have to "establish" the customer group id again. Perhaps "global customer_group_id;" will do the trick. Otherwise:

 

function display_price($products_price, $products_tax, $quantity = 1) {
? ? ? ?if (TAX_INFO_ONOFF == 'Enabled') {
? ? ? ?$return = $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
? ? ? ?global $tag;
    // BOF Separate Price per Customer
    global $sppc_customer_group_id;
    if (!tep_session_is_registered('sppc_customer_group_id')) { 
    $customer_group_id = '0';
    } else {
     $customer_group_id = $sppc_customer_group_id;
    }
  // EOF Separate Price per Customer

if ($customer_group_id == '2') {
$text_info_tax = TEXT_INFO_TAX2;
} elseif ($customer_group_id == '3') {
$text_info_tax = TEXT_INFO_TAX3;
} else {
$text_info_tax = TEXT_INFO_TAX;
}

? ? ? ?$return .= "<br><div class=\"tax_info\">" . sprintf($text_info_tax, $products_tax , tep_href_link(FILENAME_SHIPPING)) . "</div>";
? ? ? ?return $return;
? ? ? ?} else {
? ? ? ?return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
? ? ?}

Share this post


Link to post
Share on other sites
My Account, Checkout and Create An Account pages are not loading from the main page.

 

Doesnt give an error, just loads a blank white page.

Of course there is an error, but since your hosting company configured the settings of the server to not show errors to the users you don't "see" anything. Just a blank screen (at least that what I think is happening).

 

A. Find out if they log PHP errors and how to get hold of it.

B. You shouldn't add new contributions to your live website (unless you are not live yet). First do them locally (on a PC or a Mac OS X machine with a webserver like Apache, PHP, and MySQL installed on it), make sure everything works fine and then do the changes to the live database and upload the new files.

 

Locally you can have all errors and warnings shown. This is a security risk for a website though because it give information on file paths, settings etc.

Share this post


Link to post
Share on other sites
You shouldn't add new contributions to your live website (unless you are not live yet). First do them locally (on a PC or a Mac OS X machine with a webserver like Apache, PHP, and MySQL installed on it), make sure everything works fine and then do the changes to the live database and upload the new files.

 

Jan, this is good advice, and I've been meaning to set up such a local development environment. Is there one place I can go to download Apache, PHP, and MySQL, or should I find them invididually?

 

Thanks.

 

Mike


Mike in Key West

Share this post


Link to post
Share on other sites
Is there one place I can go to download Apache, PHP, and MySQL, or should I find them invididually?
If you like tinkering with config files you can download them all separately (interesting, but time consuming). It will be easier to use a package. You can use e.g. XAMPP but there are plenty others to choose from.

Share this post


Link to post
Share on other sites
Is there one place I can go to download Apache, PHP, and MySQL, or should I find them invididually?

 

Yeah, I recommend EasyPHP if you have a Windows system, very friendly user. Simple and good.


John

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

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites

Tax_info 1.0 and SPPC works.

 

function display_price($products_price, $products_tax, $quantity = 1) {
    if (TAX_INFO_ONOFF == 'Enabled') {
    $return = $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
    global $tag;
 // BOF Separate Price per Customer
 global $sppc_customer_group_id;
 if (!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
// EOF Separate Price per Customer

if ($customer_group_id == '2') {
$text_info_tax = TEXT_INFO_TAX2;
} elseif ($customer_group_id == '3') {
$text_info_tax = TEXT_INFO_TAX3;
} else {
$text_info_tax = TEXT_INFO_TAX;
}

    $return .= "<br><div class=\"tax_info\">" . sprintf($text_info_tax, $products_tax , tep_href_link(FILENAME_SHIPPING)) . "</div>";
    return $return;
    } else {
    return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
  }

The define text:

define('TEXT_INFO_TAX', '[inkl. %s%% MwSt zzgl. <a href="%s" class="tax_info"><u>Versandkosten</u></a>]');
define('TEXT_INFO_TAX2', '[inkl. %s%% MwSt zzgl. <a href="%s" class="tax_info"><u>Versandkosten</u></a>]');
define('TEXT_INFO_TAX3', '[excl. %s%% MwSt zzgl. <a href="%s" class="tax_info"><u>Versandkosten</u></a>]');

 

 

But its must changed for tax_info 1.3 bug in dropdown-menue:

 

function display_price($products_price, $products_tax, $quantity = 1) {
       if (TAX_INFO_ONOFF == 'Enabled') {
       $return = $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
       global $tag;
       $return .= "<br><div class=\"tax_info\">" . sprintf(TEXT_INFO_TAX, $products_tax , tep_href_link(FILENAME_SHIPPING)) . "</div>";
       return $return;
       } else {
       return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
       }
 }
 function display_price2($products_price, $products_tax, $quantity = 1) {
       if (TAX_INFO_ONOFF == 'Enabled') {
       $return = $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
       global $tag;
     #$return .= "<br><div class=\"tax_info\">" . sprintf(TEXT_INFO_TAX, $products_tax , tep_href_link(FILENAME_SHIPPING)) . "</div>";
       return $return;
       } else {
       return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
       }
 }
}  

changed in product_info.php

  // $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price2($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
 

i have test it but its not works.

 

function display_price($products_price, $products_tax, $quantity = 1) {
       if (TAX_INFO_ONOFF == 'Enabled') {
       $return = $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
       global $tag;
    // BOF Separate Price per Customer
 global $sppc_customer_group_id;
 if (!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
// EOF Separate Price per Customer

if ($customer_group_id == '2') {
$text_info_tax = TEXT_INFO_TAX2;
} elseif ($customer_group_id == '3') {
$text_info_tax = TEXT_INFO_TAX3;
} else {
$text_info_tax = TEXT_INFO_TAX;
}
       $return .= "<br><div class=\"tax_info\">" . sprintf(TEXT_INFO_TAX, $products_tax , tep_href_link(FILENAME_SHIPPING)) . "</div>";
       return $return;
       } else {
       return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
       }
 }
 function display_price2($products_price, $products_tax, $quantity = 1) {
       if (TAX_INFO_ONOFF == 'Enabled') {
       $return = $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
       global $tag;
    // BOF Separate Price per Customer
 global $sppc_customer_group_id;
 if (!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
// EOF Separate Price per Customer

if ($customer_group_id == '2') {
$text_info_tax = TEXT_INFO_TAX2;
} elseif ($customer_group_id == '3') {
$text_info_tax = TEXT_INFO_TAX3;
} else {
$text_info_tax = TEXT_INFO_TAX;
}
     #$return .= "<br><div class=\"tax_info\">" . sprintf(TEXT_INFO_TAX, $products_tax , tep_href_link(FILENAME_SHIPPING)) . "</div>";
       return $return;
       } else {
       return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
       }
 }
}  


?>

i can kill me :blush:

Please the last step, i cant say what i can do. :blush:

Share this post


Link to post
Share on other sites
i have test it but its not works.
That is most likely because you overlooked the change from TEXT_INFO_TAX to $text_info_tax... subtle, true.
function display_price($products_price, $products_tax, $quantity = 1) {

? ? ? ?if (TAX_INFO_ONOFF == 'Enabled') {

? ? ? ?$return = $this->format(tep_add_tax($products_price, $products_tax) * $quantity);

? ? ? ?global $tag;

? ? // BOF Separate Price per Customer

?global $sppc_customer_group_id;

?if (!tep_session_is_registered('sppc_customer_group_id')) {

?$customer_group_id = '0';

?} else {

? $customer_group_id = $sppc_customer_group_id;

?}

// EOF Separate Price per Customer

 

if ($customer_group_id == '2') {

$text_info_tax = TEXT_INFO_TAX2;

} elseif ($customer_group_id == '3') {

$text_info_tax = TEXT_INFO_TAX3;

} else {

$text_info_tax = TEXT_INFO_TAX;

}

// change TEXT_INFO_TAX to $text_info_tax

 

? ? ? ?$return .= "<br><div class=\"tax_info\">" . sprintf(TEXT_INFO_TAX, $products_tax , tep_href_link(FILENAME_SHIPPING)) . "</div>";

? ? ? ?return $return;

? ? ? ?} else {

? ? ? ?return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);

? ? ? ?}

?}

?function display_price2($products_price, $products_tax, $quantity = 1) {

? ? ? ?if (TAX_INFO_ONOFF == 'Enabled') {

? ? ? ?$return = $this->format(tep_add_tax($products_price, $products_tax) * $quantity);

? ? ? ?global $tag;

? ? // BOF Separate Price per Customer

?global $sppc_customer_group_id;

?if (!tep_session_is_registered('sppc_customer_group_id')) {

?$customer_group_id = '0';

?} else {

? $customer_group_id = $sppc_customer_group_id;

?}

// EOF Separate Price per Customer

 

if ($customer_group_id == '2') {

$text_info_tax = TEXT_INFO_TAX2;

} elseif ($customer_group_id == '3') {

$text_info_tax = TEXT_INFO_TAX3;

} else {

$text_info_tax = TEXT_INFO_TAX;

}

// change TEXT_INFO_TAX to $text_info_tax

and remove the comment tag "#" of course

? ? ?#$return .= "<br><div class=\"tax_info\">" . sprintf(TEXT_INFO_TAX, $products_tax , tep_href_link(FILENAME_SHIPPING)) . "</div>";

? ? ? ?return $return;

? ? ? ?} else {

? ? ? ?return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);

? ? ? ?}

?}

} ?

?>

Edited by JanZ

Share this post


Link to post
Share on other sites

I have insert in my store SPPC 4.1 and Pricebreak for SPPC and now i will add the hiden Products for SPPC but i have a problem with the code

the last step in catalog/admin/categories.php

 

this i have

Separate Pricing Per Customer -->/price break

<!-- BOF Separate Pricing Per Customer -->/price break
<?php
   $customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id");
   $header = false;
   while ($customers_group = tep_db_fetch_array($customers_group_query)) {
    
    if (tep_db_num_rows($customers_group_query) > 0) {
      $attributes_query = tep_db_query("select customers_group_id, customers_group_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $pInfo->products_id . "' and customers_group_id = '" . $customers_group['customers_group_id'] . "' order by customers_group_id");
    } else {
        $attributes = array('customers_group_id' => 'new');
    }
if (!$header) { ?>

   <tr bgcolor="#ebebff"">
   <td class="main" colspan="2" style="font-style: italic">Note that if the price field for the customer group is left empty, <b>no</b> price and <b>no</b> price break levels and quantities for that customer group will be inserted in the database.<br />
If a field or fields is/are filled, but the checkbox is unchecked no price/price break levels etc. will be inserted either.<br />
If a price and price break levels are already inserted in the database, but the checkbox unchecked they will be removed from the database.
</td>
   </tr>
<?php 
$header = true; 
} // end if (!header), makes sure this is only shown once   
?>
       <tr bgcolor="#ebebff">
      <td class="main"><?php 
            if (isset($pInfo->sppcoption)) {
   echo tep_draw_checkbox_field('sppcoption[' . $customers_group['customers_group_id'] . ']', 'sppcoption[' . $customers_group['customers_group_id'] . ']', (isset($pInfo->sppcoption[ $customers_group['customers_group_id']])) ? 1: 0);
     } else {
     echo tep_draw_checkbox_field('sppcoption[' . $customers_group['customers_group_id'] . ']', 'sppcoption[' . $customers_group['customers_group_id'] . ']', true) . ' ' . $customers_group['customers_group_name'];
     }
 </td>
      <td class="main"><?php
      $customer_prices_set = false;
      $customer_prices_in_post = false;
      if ($attributes = tep_db_fetch_array($attributes_query)) { 
       $customer_prices_set = true;
      echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcprice[' . $customers_group['customers_group_id'] . ']', $attributes['customers_group_price']); 
      }  else {
       if (isset($pInfo->sppcprice[$customers_group['customers_group_id']])) { // when a preview was done and the back button used
        $customer_prices_in_post = true;
        $sppc_cg_price = $pInfo->sppcprice[$customers_group['customers_group_id']];
       } else { // nothing in the db, nothing in the post variables
        $sppc_cg_price = '';
       }
   echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcprice[' . $customers_group['customers_group_id'] . ']', $sppc_cg_price );
 }  ?></td>
   </tr>
         <tr>
           <td class="main"><?php echo TEXT_PRODUCTS_QTY_BLOCKS; ?></td>
           <td class="main"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_qty_blocks = $attributes['products_qty_blocks'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_qty_blocks = $pInfo->sppcproducts_qty_blocks[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_qty_blocks = ''; 
    } 
    echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_qty_blocks[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_qty_blocks, 'size="10"') . ' ' . TEXT_PRODUCTS_QTY_BLOCKS_INFO;
?></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_PRODUCTS_PRICE1; ?></td>
           <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price1 = $attributes['products_price1'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price1 = $pInfo->sppcproducts_price1[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price1 = ''; 
    } 
    echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price1[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price1, 'size="10"'); ?></td>
           <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE1_QTY; ?></td>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price1_qty = $attributes['products_price1_qty'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price1_qty = $pInfo->sppcproducts_price1_qty[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price1_qty = ''; 
    } 
    echo tep_draw_input_field('sppcproducts_price1_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price1_qty, 'size="10"'); ?></td>
           </tr></table></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_PRODUCTS_PRICE2; ?></td>
           <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price2 = $attributes['products_price2'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price2 = $pInfo->sppcproducts_price2[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price2 = ''; 
    } 
    echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price2[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price2, 'size="10"'); ?></td>
           <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE2_QTY; ?></td>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price2_qty = $attributes['products_price2_qty'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price2_qty = $pInfo->sppcproducts_price2_qty[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price2_qty = ''; 
    } 
    echo tep_draw_input_field('sppcproducts_price2_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price2_qty, 'size="10"'); ?></td>
           </tr></table></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_PRODUCTS_PRICE3; ?></td>
           <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price3 = $attributes['products_price3'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price3 = $pInfo->sppcproducts_price3[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price3 = ''; 
    } 
    echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price3[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price3, 'size="10"'); ?></td>
           <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE3_QTY; ?></td>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price3_qty = $attributes['products_price3_qty'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price3_qty = $pInfo->sppcproducts_price3_qty[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price3_qty = ''; 
    } 
    echo tep_draw_input_field('sppcproducts_price3_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price3_qty, 'size="10"'); ?></td>
           </tr></table></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_PRODUCTS_PRICE4; ?></td>
           <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price4 = $attributes['products_price4'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price4 = $pInfo->sppcproducts_price4[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price4 = ''; 
    } 
    echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price4[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price4, 'size="10"'); ?></td>
           <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE4_QTY; ?></td>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price4_qty = $attributes['products_price4_qty'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price4_qty = $pInfo->sppcproducts_price4_qty[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price4_qty = ''; 
    } 
    echo tep_draw_input_field('sppcproducts_price4_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price4_qty, 'size="10"'); ?></td>
           </tr></table></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_PRODUCTS_PRICE5; ?></td>
           <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price5 = $attributes['products_price5'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price5 = $pInfo->sppcproducts_price5[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price5 = ''; 
    } 
    echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price5[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price5, 'size="10"'); ?></td>
           <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE5_QTY; ?></td>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price5_qty = $attributes['products_price5_qty'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price5_qty = $pInfo->sppcproducts_price5_qty[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price5_qty = ''; 
    } 
    echo tep_draw_input_field('sppcproducts_price5_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price5_qty, 'size="10"'); ?></td>
           </tr></table></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_PRODUCTS_PRICE6; ?></td>
           <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price6 = $attributes['products_price6'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price6 = $pInfo->sppcproducts_price6[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price6 = ''; 
    } 
    echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price6[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price6, 'size="10"'); ?></td>
           <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE6_QTY; ?></td>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price6_qty = $attributes['products_price6_qty'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price6_qty = $pInfo->sppcproducts_price6_qty[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price6_qty = ''; 
    } 
    echo tep_draw_input_field('sppcproducts_price6_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price6_qty, 'size="10"'); ?></td>
           </tr></table></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_PRODUCTS_PRICE7; ?></td>
           <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price7 = $attributes['products_price7'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price7 = $pInfo->sppcproducts_price7[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price7 = ''; 
    } 
    echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price7[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price7, 'size="10"'); ?></td>
           <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE7_QTY; ?></td>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price7_qty = $attributes['products_price7_qty'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price7_qty = $pInfo->sppcproducts_price7_qty[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price7_qty = ''; 
    } 
    echo tep_draw_input_field('sppcproducts_price7_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price7_qty, 'size="10"'); ?></td>
           </tr></table></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_PRODUCTS_PRICE8; ?></td>
           <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price8 = $attributes['products_price8'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price8 = $pInfo->sppcproducts_price8[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price8 = ''; 
    } 
    echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price8[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price8, 'size="10"'); ?></td>
           <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE8_QTY; ?></td>
           <td class="main" align="left"><?php if ($customer_prices_set == true) {
    $sppc_cg_products_price8_qty = $attributes['products_price8_qty'];
    } elseif ($customer_prices_in_post == true) {
    $sppc_cg_products_price8_qty = $pInfo->sppcproducts_price8_qty[$customers_group['customers_group_id']];
    } else {
     $sppc_cg_products_price8_qty = ''; 
    } 
    echo tep_draw_input_field('sppcproducts_price8_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price8_qty, 'size="10"'); ?></td>
           </tr></table></td>
         </tr>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>
<?php
       } // end while ($customers_group = tep_db_fetch_array($customers_group_query))
?>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>
<!-- EOF Separate Pricing Per Customer -->

 

and this is the code of hidenproduct i cant see what i must change.

 

<!-- BOF Separate Pricing Per Customer --> hidenproduct
<?php
   $customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id");
   $header = false;
   while ($customers_group = tep_db_fetch_array($customers_group_query)) {
    
    if (tep_db_num_rows($customers_group_query) > 0) {
      $attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $pInfo->products_id . "' and customers_group_id = '" . $customers_group['customers_group_id'] . "' order by customers_group_id");
    } else {
        $attributes = array('customers_group_id' => 'new');
    }
if (!$header) { ?>

   <tr bgcolor="#ebebff">
   <td class="main" colspan="2" style="font-style: italic">Note that if a field is left empty, no price for that customer group will be inserted in the database.<br />
If a field is filled, but the checkbox is unchecked no price will be inserted either.<br />
If a price is already inserted in the database, but the checkbox unchecked it will be removed from the database.
</td>
   </tr>
<?php 
$header = true; 
} // end if (!header), makes sure this is only shown once   
?>
       <tr bgcolor="#ebebff">
      <td class="main"><?php 
            if (isset($pInfo->sppcoption)) {
   echo tep_draw_checkbox_field('sppcoption[' . $customers_group['customers_group_id'] . ']', 'sppcoption[' . $customers_group['customers_group_id'] . ']', (isset($pInfo->sppcoption[ $customers_group['customers_group_id']])) ? 1: 0);
     } else {
     echo tep_draw_checkbox_field('sppcoption[' . $customers_group['customers_group_id'] . ']', 'sppcoption[' . $customers_group['customers_group_id'] . ']', true) . ' ' . $customers_group['customers_group_name'];
     }
?>
 </td>
      <td class="main"><?php 
      if ($attributes = tep_db_fetch_array($attributes_query)) { 
      echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcprice[' . $customers_group['customers_group_id'] . ']', $attributes['customers_group_price']); 
      }  else {
       if (isset($pInfo->sppcprice[$customers_group['customers_group_id']])) { // when a preview was done and the back button used
        $sppc_cg_price = $pInfo->sppcprice[$customers_group['customers_group_id']];
       } else { // nothing in the db, nothing in the post variables
        $sppc_cg_price = '';
       }
   echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcprice[' . $customers_group['customers_group_id'] . ']', $sppc_cg_price);
 }  ?></td>
   </tr>
<?php
       } // end while ($customers_group = tep_db_fetch_array($customers_group_query))
?>
<!-- BOF SPPC hide from groups mod -->
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>
         <tr>
           <td colspan="2" class="main" ><?php echo TEXT_HIDE_PRODUCTS_FROM_GROUP; ?></td>
         </tr>
<?php   
  $hide_customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id");
  $hide_from_groups_array = explode(',',$pInfo->products_hide_from_groups);
  $hide_from_groups_array = array_slice($hide_from_groups_array, 1); // remove "@" from the array
  while ($hide_customers_group = tep_db_fetch_array($hide_customers_group_query)) {
?>
     <tr bgcolor="#ebebff">
      <td class="main" colspan="2"><?php 
     if (isset($pInfo->hide)) {
   echo tep_draw_checkbox_field('hide[' . $hide_customers_group['customers_group_id'] . ']',  $hide_customers_group['customers_group_id'] , (isset($pInfo->hide[ $hide_customers_group['customers_group_id']])) ? 1: 0);
     } else {
     echo tep_draw_checkbox_field('hide[' . $hide_customers_group['customers_group_id'] . ']',  $hide_customers_group['customers_group_id'] , (in_array($hide_customers_group['customers_group_id'], $hide_from_groups_array)) ? 1: 0);
     } ?>  <?php echo $hide_customers_group['customers_group_name']; ?></td>
     </tr>
<?php
       } // end while ($hide_customers_group = tep_db_fetch_array($hide_customers_group_query))
?>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>
<!-- EOF Separate Pricing Per Customer -->

Share this post


Link to post
Share on other sites

Look for "// end while ($customers_group = tep_db_fetch_array($customers_group_query))" in the code in the top and start adding the code (partially) shown below, from <!-- BOF SPPC hide from groups mod -->" onwards.

<?php
      } // end while ($customers_group = tep_db_fetch_array($customers_group_query))
?>
<!-- BOF SPPC hide from groups mod -->
        <tr>
          <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
        </tr>
        <tr>
          <td colspan="2" class="main" ><?php echo TEXT_HIDE_PRODUCTS_FROM_GROUP; ?></td>
        </tr>
etcetera, etcetera

Share this post


Link to post
Share on other sites

Does anyone know of a way to make it so that the customer doesn't have to log off and log back in to view the price changes?

 

The reason I ask is because I want it so that when a customer enters a VAT number the total on check out shows the price without VAT. With the current config the customer must log out and in again to be able to purchase the product without VAT.

 

Any thoughts?

 

Thanks.

Share this post


Link to post
Share on other sites
The reason I ask is because I want it so that when a customer enters a VAT number the total on check out shows the price without VAT. With the current config the customer must log out and in again to be able to purchase the product without VAT.
A matter of registering or unregistering and re-registering the right session variable. Normally, the registering the done in login.php and the unregistering in logoff.php, but in principle it can be done on any page and any moment.

Share this post


Link to post
Share on other sites
A matter of registering or unregistering and re-registering the right session variable. Normally, the registering the done in login.php and the unregistering in logoff.php, but in principle it can be done on any page and any moment.

 

Hi Janz,

 

Thanks for the response.

Would this mean the customer is being logged off and logged back in without them knowing? That would be great!

 

errrm.... how would I do that? :-"

Share this post


Link to post
Share on other sites

I've just realized that all new customers get put in the retail group not just customers that sign up with a tax ID.

 

This revelation makes my last post pointless unless I can put customers that sign up with a tax ID into a different group then the customers who sign-up without a tax id (automatically).

 

Hummm, do you think this could be done quite easily? Or am I flogging a dead horse by using this contribution to achieve this?

 

I have a feeling I might be back to square one :blush:

Share this post


Link to post
Share on other sites
unless I can put customers that sign up with a tax ID into a different group then the customers who sign-up without a tax id (automatically).

 

Hummm, do you think this could be done quite easily?

I don't think that is really difficult to code. It would be good to check whether the tax ID is valid (perhaps use something like the class VAT checker?) before you put them automatically in another group. You would need to add somewhere 'customer_group_id' => $number_depending_on_tax_id_input) in the building of the $sql_array after you have done your checking of the VAT number. For example (similar code on several places):

      $sql_data_array = array('customers_id' => $customer_id,
                             'entry_firstname' => $firstname,
                             'entry_lastname' => $lastname,
                             'entry_street_address' => $street_address,
                             'entry_postcode' => $postcode,
                             'entry_city' => $city,
                             'entry_country_id' => $country);

Then somewhere around line 236-244 you will see tep_session_register statements. To these should be added (at least) the session register for customer_group_id and perhaps the tax_exempt? Well, you get the idea I guess.

Share this post


Link to post
Share on other sites

Thanks for your help Jan but I decided to go an easier route to achieve the above.

 

For anyone who needs to do this... edit create_account.php and put in an extra line -

 

$sql_data_array['customers_group_id'] = '1';

 

You can see where the line is in the code below. In this case if the customer provides a TAX ID they will be put into group 1 and not group 0. If they leave the TAX ID blank they will be put into group 0.

 

      // BOF Separate Pricing Per Customer
     // if you would like to have an alert in the admin section when either a company name has been entered in
     // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
     // setting: only alert when a tax_id number has been given
 //    if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) { 
  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)  ) { 
     $sql_data_array['customers_group_ra'] = '1';
     $sql_data_array['customers_group_id'] = '1';
     }
     // EOF Separate Pricing Per Customer

Edited by Dolcev

Share this post


Link to post
Share on other sites

I love this contribution, but have one question.

 

Is it possible to make a link or menu item which shows all the products which has seperate prices. If the customer is retail - this option should not show up.

 

This would be relly helpful for my site.

 

/MR.T

Share this post


Link to post
Share on other sites
Is it possible to make a link or menu item which shows all the products which has seperate prices. If the customer is retail - this option should not show up.
Sure, just wrap it (once $customer_group_id has been determined in the code) in:

if ($customer_group_id !=0 ) {
echo put your link here;
}

Then you would need to make an additional page with the items that have separate prices (with in it code before the <html> tag that looks at the customer_group_id and redirect to e.g. the index page if the customer group is not the one that is supposed to see that.

 

You might also want to use Hide products for customer groups for SPPC.

Share this post


Link to post
Share on other sites

I have build in my shop the Pr?ix contrieb an it works on all pages but the admin/costumers.php i became this error.

 

database_tables.php

define('TABLE_CUSTOMERS_GROUPS', DB_TABLE_PREFIX . 'customers_groups');

 

1146 - Table 'xoops.customers_groups' doesn't exist

 

select count(*) as total from es_esc_customers c left join es_esc_address_book a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id left join customers_groups cg on c.customers_group_id = cg.customers_group_id

 

<?php

/*

 $Id: customers.php,v 1.82 2003/06/30 13:54:14 dgw_ Exp $

 adapted for Separate Pricing Per Customer v4 2005/03/04

 customer_sort_admin_v1 http://www.oscommerce.com/community/contributions,223'>http://www.oscommerce.com/community/contributions,223 added

 

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

 

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

 $error = false;

 $processed = false;

 

 if (tep_not_null($action)) {

   switch ($action) {

     case 'update':

       $customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);

       $customers_firstname = tep_db_prepare_input($HTTP_POST_VARS['customers_firstname']);

       $customers_lastname =

tep_db_prepare_input($HTTP_POST_VARS['customers_lastname']);

       $customers_email_address = tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']);

       $customers_telephone = tep_db_prepare_input($HTTP_POST_VARS['customers_telephone']);

       $customers_fax = tep_db_prepare_input($HTTP_POST_VARS['customers_fax']);

       $customers_newsletter = tep_db_prepare_input($HTTP_POST_VARS['customers_newsletter']);

// BOF Separate Pricing per Customer

$customers_group_id = tep_db_prepare_input($HTTP_POST_VARS['customers_group_id']);

$customers_group_ra = tep_db_prepare_input($HTTP_POST_VARS['customers_group_ra']);

$entry_company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['entry_company_tax_id']);

if ($HTTP_POST_VARS['customers_payment_allowed'] && $HTTP_POST_VARS['customers_payment_settings'] == '1') {

$customers_payment_allowed = tep_db_prepare_input($HTTP_POST_VARS['customers_payment_allowed']);

} else { // no error with subsequent re-posting of variables

$customers_payment_allowed = '';

if ($HTTP_POST_VARS['payment_allowed'] && $HTTP_POST_VARS['customers_payment_settings'] == '1') {

 while(list($key, $val) = each($HTTP_POST_VARS['payment_allowed'])) {

     if ($val == true) {

     $customers_payment_allowed .= tep_db_prepare_input($val).';';

     }

  } // end while

   $customers_payment_allowed = substr($customers_payment_allowed,0,strlen($customers_payment_allowed)-1);

} // end if ($HTTP_POST_VARS['payment_allowed'])

} // end else ($HTTP_POST_VARS['customers_payment_allowed']

if ($HTTP_POST_VARS['customers_shipment_allowed'] && $HTTP_POST_VARS['customers_shipment_settings'] == '1') {

$customers_shipment_allowed = tep_db_prepare_input($HTTP_POST_VARS['customers_shipment_allowed']);

} else { // no error with subsequent re-posting of variables

 

 $customers_shipment_allowed = '';

 if ($HTTP_POST_VARS['shipping_allowed'] && $HTTP_POST_VARS['customers_shipment_settings'] == '1') {

   while(list($key, $val) = each($HTTP_POST_VARS['shipping_allowed'])) {

     if ($val == true) {

     $customers_shipment_allowed .= tep_db_prepare_input($val).';';

     }

   } // end while

   $customers_shipment_allowed = substr($customers_shipment_allowed,0,strlen($customers_shipment_allowed)-1);

 } // end if ($HTTP_POST_VARS['shipment_allowed'])

} // end else ($HTTP_POST_VARS['customers_shipment_allowed']

 

// EOF Separate Pricing per Customer

       $customers_gender = tep_db_prepare_input($HTTP_POST_VARS['customers_gender']);

       $customers_dob = tep_db_prepare_input($HTTP_POST_VARS['customers_dob']);

 

       $default_address_id = tep_db_prepare_input($HTTP_POST_VARS['default_address_id']);

       $entry_street_address = tep_db_prepare_input($HTTP_POST_VARS['entry_street_address']);

       $entry_suburb = tep_db_prepare_input($HTTP_POST_VARS['entry_suburb']);

       $entry_postcode = tep_db_prepare_input($HTTP_POST_VARS['entry_postcode']);

       $entry_city = tep_db_prepare_input($HTTP_POST_VARS['entry_city']);

       $entry_country_id = tep_db_prepare_input($HTTP_POST_VARS['entry_country_id']);

 

       $entry_company = tep_db_prepare_input($HTTP_POST_VARS['entry_company']);

       $entry_state = tep_db_prepare_input($HTTP_POST_VARS['entry_state']);

       if (isset($HTTP_POST_VARS['entry_zone_id'])) $entry_zone_id = tep_db_prepare_input($HTTP_POST_VARS['entry_zone_id']);

 

       if (strlen($customers_firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {

         $error = true;

         $entry_firstname_error = true;

       } else {

         $entry_firstname_error = false;

       }

 

       if (strlen($customers_lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {

         $error = true;

         $entry_lastname_error = true;

       } else {

         $entry_lastname_error = false;

       }

 

       if (ACCOUNT_DOB == 'true') {

         if (checkdate(substr(tep_date_raw($customers_dob), 4, 2), substr(tep_date_raw($customers_dob), 6, 2), substr(tep_date_raw($customers_dob), 0, 4))) {

           $entry_date_of_birth_error = false;

         } else {

           $error = true;

           $entry_date_of_birth_error = true;

         }

       }

 

       if (strlen($customers_email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {

         $error = true;

         $entry_email_address_error = true;

       } else {

         $entry_email_address_error = false;

       }

 

       if (!tep_validate_email($customers_email_address)) {

         $error = true;

         $entry_email_address_check_error = true;

       } else {

         $entry_email_address_check_error = false;

       }

 

       if (strlen($entry_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {

         $error = true;

         $entry_street_address_error = true;

       } else {

         $entry_street_address_error = false;

       }

 

       if (strlen($entry_postcode) < ENTRY_POSTCODE_MIN_LENGTH) {

         $error = true;

         $entry_post_code_error = true;

       } else {

         $entry_post_code_error = false;

       }

 

       if (strlen($entry_city) < ENTRY_CITY_MIN_LENGTH) {

         $error = true;

         $entry_city_error = true;

       } else {

         $entry_city_error = false;

       }

 

       if ($entry_country_id == false) {

         $error = true;

         $entry_country_error = true;

       } else {

         $entry_country_error = false;

       }

 

       if (ACCOUNT_STATE == 'true') {

         if ($entry_country_error == true) {

           $entry_state_error = true;

         } else {

           $zone_id = 0;

           $entry_state_error = false;

           $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$entry_country_id . "'");

           $check_value = tep_db_fetch_array($check_query);

           $entry_state_has_zones = ($check_value['total'] > 0);

           if ($entry_state_has_zones == true) {

             $zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$entry_country_id . "' and zone_name = '" . tep_db_input($entry_state) . "'");

             if (tep_db_num_rows($zone_query) == 1) {

               $zone_values = tep_db_fetch_array($zone_query);

               $entry_zone_id = $zone_values['zone_id'];

             } else {

               $error = true;

               $entry_state_error = true;

             }

           } else {

             if ($entry_state == false) {

               $error = true;

               $entry_state_error = true;

             }

           }

        }

     }

 

     if (strlen($customers_telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {

       $error = true;

       $entry_telephone_error = true;

     } else {

       $entry_telephone_error = false;

     }

 

     $check_email = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($customers_email_address) . "' and customers_id != '" . (int)$customers_id . "'");

     if (tep_db_num_rows($check_email)) {

       $error = true;

       $entry_email_address_exists = true;

     } else {

       $entry_email_address_exists = false;

     }

 

     if ($error == false) {

 

       $sql_data_array = array('customers_firstname' => $customers_firstname,

                               'customers_lastname' => $customers_lastname,

                               'customers_email_address' => $customers_email_address,

                               'customers_telephone' => $customers_telephone,

                               'customers_fax' => $customers_fax,

                               'customers_newsletter' => $customers_newsletter,

// BOF Separate Pricing per Customer

                               'customers_group_id' => $customers_group_id,

                               'customers_group_ra' => $customers_group_ra,

   'customers_payment_allowed' => $customers_payment_allowed,

   'customers_shipment_allowed' => $customers_shipment_allowed);

// EOF Separate Pricing per Customer

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

       if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($customers_dob);

 

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

 

       tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int)$customers_id . "'");

 

       if ($entry_zone_id > 0) $entry_state = '';

 

       $sql_data_array = array('entry_firstname' => $customers_firstname,

                               'entry_lastname' => $customers_lastname,

                               'entry_street_address' => $entry_street_address,

                               'entry_postcode' => $entry_postcode,

                               'entry_city' => $entry_city,

                               'entry_country_id' => $entry_country_id);

// BOF Separate Pricing Per Customer

       if (ACCOUNT_COMPANY == 'true') {

       $sql_data_array['entry_company'] = $entry_company;

        $sql_data_array['entry_company_tax_id'] = $entry_company_tax_id;

       }

// EOF Separate Pricing Per Customer

       if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $entry_suburb;

 

       if (ACCOUNT_STATE == 'true') {

         if ($entry_zone_id > 0) {

           $sql_data_array['entry_zone_id'] = $entry_zone_id;

           $sql_data_array['entry_state'] = '';

         } else {

           $sql_data_array['entry_zone_id'] = '0';

           $sql_data_array['entry_state'] = $entry_state;

         }

       }

 

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

 

       } else if ($error == true) {

         $cInfo = new objectInfo($HTTP_POST_VARS);

         $processed = true;

       }

 

       break;

     case 'deleteconfirm':

       $customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);

 

       if (isset($HTTP_POST_VARS['delete_reviews']) && ($HTTP_POST_VARS['delete_reviews'] == 'on')) {

         $reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers_id . "'");

         while ($reviews = tep_db_fetch_array($reviews_query)) {

           tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$reviews['reviews_id'] . "'");

         }

 

         tep_db_query("delete from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers_id . "'");

       } else {

         tep_db_query("update " . TABLE_REVIEWS . " set customers_id = null where customers_id = '" . (int)$customers_id . "'");

       }

// BOF Separate Pricing Per Customer

// Once all customers with a specific customers_group_id have been deleted from

// the table customers, the next time a customer is deleted, all entries in the table products_groups

// that have the (now apparently obsolete) customers_group_id will be deleted!

// If you don't want that, leave this section out, or comment it out

// Note that when customers groups are deleted from the table customers_groups, all the

// customers with that specific customer_group_id will be changed to customer_group_id = '0' (default/Retail)

$multiple_groups_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS_GROUPS . " ");

while ($group_ids = tep_db_fetch_array($multiple_groups_query)) {

 $multiple_customers_query = tep_db_query("select distinct customers_group_id from " . TABLE_CUSTOMERS . " where customers_group_id = " . $group_ids['customers_group_id'] . " ");

 if (!($multiple_groups = tep_db_fetch_array($multiple_customers_query))) {

   tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $group_ids['customers_group_id'] . "'");

 }

}

// EOF Separate Pricing Per Customer

       tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "'");

       tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'");

       tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customers_id . "'");

       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customers_id . "'");

       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customers_id . "'");

       tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . (int)$customers_id . "'");

 

       tep_redirect(tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action'))));

       break;

     default:

     // BOF Separate Pricing Per Customer

       $customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_company_tax_id, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_group_id,  c.customers_group_ra, c.customers_payment_allowed, c.customers_shipment_allowed, c.customers_default_address_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . (int)$HTTP_GET_VARS['cID'] . "'");

 

       $module_directory = DIR_FS_CATALOG_MODULES . 'payment/';

       $ship_module_directory = DIR_FS_CATALOG_MODULES . 'shipping/';

 

       $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));

       $directory_array = array();

       if ($dir = @dir($module_directory)) {

       while ($file = $dir->read()) {

       if (!is_dir($module_directory . $file)) {

          if (substr($file, strrpos($file, '.')) == $file_extension) {

             $directory_array[] = $file; // array of all the payment modules present in includes/modules/payment

                 }

              }

           }

       sort($directory_array);

       $dir->close();

       }

 

       $ship_directory_array = array();

       if ($dir = @dir($ship_module_directory)) {

       while ($file = $dir->read()) {

       if (!is_dir($ship_module_directory . $file)) {

          if (substr($file, strrpos($file, '.')) == $file_extension) {

             $ship_directory_array[] = $file; // array of all shipping modules present in includes/modules/shipping

               }

             }

           }

           sort($ship_directory_array);

           $dir->close();

       }

 

$existing_customers_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");

 

// EOF Separate Pricing Per Customer

       $customers = tep_db_fetch_array($customers_query);

       $cInfo = new objectInfo($customers);

// BOF Separate Pricing Per Customer

 //      $shipment_allowed = explode (";",$cInfo->customers_shipment_allowed);

// EOF Separate Pricing Per Customer

   }

 }

?>

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

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

<?php

 if ($action == 'edit' || $action == 'update') {

?>

<script language="javascript"><!--

 

function check_form() {

 var error = 0;

 var error_message = "<?php echo JS_ERROR; ?>";

 

 var customers_firstname = document.customers.customers_firstname.value;

 var customers_lastname = document.customers.customers_lastname.value;

<?php if (ACCOUNT_COMPANY == 'true') echo 'var entry_company = document.customers.entry_company.value;' . "\n"; ?>

<?php if (ACCOUNT_DOB == 'true') echo 'var customers_dob = document.customers.customers_dob.value;' . "\n"; ?>

 var customers_email_address = document.customers.customers_email_address.value;

 var entry_street_address = document.customers.entry_street_address.value;

 var entry_postcode = document.customers.entry_postcode.value;

 var entry_city = document.customers.entry_city.value;

 var customers_telephone = document.customers.customers_telephone.value;

 

<?php if (ACCOUNT_GENDER == 'true') { ?>

 if (document.customers.customers_gender[0].checked || document.customers.customers_gender[1].checked) {

 } else {

   error_message = error_message + "<?php echo JS_GENDER; ?>";

   error = 1;

 }

<?php } ?>

 

 if (customers_firstname == "" || customers_firstname.length < <?php echo ENTRY_FIRST_NAME_MIN_LENGTH; ?>) {

   error_message = error_message + "<?php echo JS_FIRST_NAME; ?>";

   error = 1;

 }

 

 if (customers_lastname == "" || customers_lastname.length < <?php echo ENTRY_LAST_NAME_MIN_LENGTH; ?>) {

   error_message = error_message + "<?php echo JS_LAST_NAME; ?>";

   error = 1;

 }

 

<?php if (ACCOUNT_DOB == 'true') { ?>

 if (customers_dob == "" || customers_dob.length < <?php echo ENTRY_DOB_MIN_LENGTH; ?>) {

   error_message = error_message + "<?php echo JS_DOB; ?>";

   error = 1;

 }

<?php } ?>

 

 if (customers_email_address == "" || customers_email_address.length < <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>) {

   error_message = error_message + "<?php echo JS_EMAIL_ADDRESS; ?>";

   error = 1;

 }

 

 if (entry_street_address == "" || entry_street_address.length < <?php echo ENTRY_STREET_ADDRESS_MIN_LENGTH; ?>) {

   error_message = error_message + "<?php echo JS_ADDRESS; ?>";

   error = 1;

 }

 

 if (entry_postcode == "" || entry_postcode.length < <?php echo ENTRY_POSTCODE_MIN_LENGTH; ?>) {

   error_message = error_message + "<?php echo JS_POST_CODE; ?>";

   error = 1;

 }

 

 if (entry_city == "" || entry_city.length < <?php echo ENTRY_CITY_MIN_LENGTH; ?>) {

   error_message = error_message + "<?php echo JS_CITY; ?>";

   error = 1;

 }

 

<?php

 if (ACCOUNT_STATE == 'true') {

?>

 if (document.customers.elements['entry_state'].type != "hidden") {

   if (document.customers.entry_state.value == '' || document.customers.entry_state.value.length < <?php echo ENTRY_STATE_MIN_LENGTH; ?> ) {

      error_message = error_message + "<?php echo JS_STATE; ?>";

      error = 1;

   }

 }

<?php

 }

?>

 

 if (document.customers.elements['entry_country_id'].type != "hidden") {

   if (document.customers.entry_country_id.value == 0) {

     error_message = error_message + "<?php echo JS_COUNTRY; ?>";

     error = 1;

   }

 }

 

 if (customers_telephone == "" || customers_telephone.length < <?php echo ENTRY_TELEPHONE_MIN_LENGTH; ?>) {

   error_message = error_message + "<?php echo JS_TELEPHONE; ?>";

   error = 1;

 }

 

 if (error == 1) {

   alert(error_message);

   return false;

 } else {

   return true;

 }

}

//--></script>

<?php

 }

?>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

 <tr>

   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

   </table></td>

<!-- body_text //-->

   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

 if ($action == 'edit' || $action == 'update') {

   $newsletter_array = array(array('id' => '1', 'text' => ENTRY_NEWSLETTER_YES),

                             array('id' => '0', 'text' => ENTRY_NEWSLETTER_NO));

?>

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <tr>

           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr><?php echo tep_draw_form('customers', FILENAME_CUSTOMERS, tep_get_all_get_params(array('action')) . 'action=update', 'post', 'onSubmit="return check_form();"') . tep_draw_hidden_field('default_address_id', $cInfo->customers_default_address_id); ?>

       <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td>

     </tr>

     <tr>

       <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">

<?php

   if (ACCOUNT_GENDER == 'true') {

?>

         <tr>

           <td class="main"><?php echo ENTRY_GENDER; ?></td>

           <td class="main">

<?php

   if ($error == true) {

     if ($entry_gender_error == true) {

       echo tep_draw_radio_field('customers_gender', 'm', false, $cInfo->customers_gender) . '  ' . MALE . '  ' . tep_draw_radio_field('customers_gender', 'f', false, $cInfo->customers_gender) . '  ' . FEMALE . ' ' . ENTRY_GENDER_ERROR;

     } else {

       echo ($cInfo->customers_gender == 'm') ? MALE : FEMALE;

       echo tep_draw_hidden_field('customers_gender');

     }

   } else {

     echo tep_draw_radio_field('customers_gender', 'm', false, $cInfo->customers_gender) . '  ' . MALE . '  ' . tep_draw_radio_field('customers_gender', 'f', false, $cInfo->customers_gender) . '  ' . FEMALE;

   }

?></td>

         </tr>

<?php

   }

?>

         <tr>

           <td class="main"><?php echo ENTRY_FIRST_NAME; ?></td>

           <td class="main">

<?php

 if ($error == true) {

   if ($entry_firstname_error == true) {

     echo tep_draw_input_field('customers_firstname', $cInfo->customers_firstname, 'maxlength="32"') . ' ' . ENTRY_FIRST_NAME_ERROR;

   } else {

     echo $cInfo->customers_firstname . tep_draw_hidden_field('customers_firstname');

   }

 } else {

   echo tep_draw_input_field('customers_firstname', $cInfo->customers_firstname, 'maxlength="32"', true);

 }

?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_LAST_NAME; ?></td>

           <td class="main">

<?php

 if ($error == true) {

   if ($entry_lastname_error == true) {

     echo tep_draw_input_field('customers_lastname', $cInfo->customers_lastname, 'maxlength="32"') . ' ' . ENTRY_LAST_NAME_ERROR;

   } else {

     echo $cInfo->customers_lastname . tep_draw_hidden_field('customers_lastname');

   }

 } else {

   echo tep_draw_input_field('customers_lastname', $cInfo->customers_lastname, 'maxlength="32"', true);

 }

?></td>

         </tr>

<?php

   if (ACCOUNT_DOB == 'true') {

?>

         <tr>

           <td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>

           <td class="main">

 

<?php

   if ($error == true) {

     if ($entry_date_of_birth_error == true) {

       echo tep_draw_input_field('customers_dob', tep_date_short($cInfo->customers_dob), 'maxlength="10"') . ' ' . ENTRY_DATE_OF_BIRTH_ERROR;

     } else {

       echo $cInfo->customers_dob . tep_draw_hidden_field('customers_dob');

     }

   } else {

     echo tep_draw_input_field('customers_dob', tep_date_short($cInfo->customers_dob), 'maxlength="10"', true);

   }

?></td>

         </tr>

<?php

   }

?>

         <tr>

           <td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>

           <td class="main">

<?php

 if ($error == true) {

   if ($entry_email_address_error == true) {

     echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"') . ' ' . ENTRY_EMAIL_ADDRESS_ERROR;

   } elseif ($entry_email_address_check_error == true) {

     echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"') . ' ' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;

   } elseif ($entry_email_address_exists == true) {

     echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"') . ' ' . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS;

   } else {

     echo $customers_email_address . tep_draw_hidden_field('customers_email_address');

   }

 } else {

   echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"', true);

 }

?></td>

         </tr>

       </table></td>

     </tr>

<?php

   if (ACCOUNT_COMPANY == 'true') {

?>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td class="formAreaTitle"><?php echo CATEGORY_COMPANY; ?></td>

     </tr>

     <tr>

       <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">

         <tr>

           <td class="main"><?php echo ENTRY_COMPANY; ?></td>

           <td class="main">

<?php

   if ($error == true) {

     if ($entry_company_error == true) {

       echo tep_draw_input_field('entry_company', $cInfo->entry_company, 'maxlength="32"') . ' ' . ENTRY_COMPANY_ERROR;

     } else {

       echo $cInfo->entry_company . tep_draw_hidden_field('entry_company');

     }

   } else {

     echo tep_draw_input_field('entry_company', $cInfo->entry_company, 'maxlength="32"');

   }

?></td>

<!-- BOF Separate Pricing Per Customer -->

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_COMPANY_TAX_ID; ?></td>

           <td class="main">

<?php

   if ($error == true) {

     if ($entry_company_tax_id_error == true) {

       echo tep_draw_input_field('entry_company_tax_id', $cInfo->entry_company_tax_id, 'maxlength="32"') . ' ' . ENTRY_COMPANY_TAX_ID_ERROR;

     } else {

       echo $cInfo->entry_company . tep_draw_hidden_field('entry_company_tax_id');

     }

   } else {

     echo tep_draw_input_field('entry_company_tax_id', $cInfo->entry_company_tax_id, 'maxlength="32"');

     }

?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CUSTOMERS_GROUP_REQUEST_AUTHENTICATION; ?></td>

           <td class="main">

<?php

   if ($error == true) {

     if ($customers_group_ra_error == true) {

       echo tep_draw_radio_field('customers_group_ra', '0', false, $cInfo->customers_group_ra) . '  ' . ENTRY_CUSTOMERS_GROUP_RA_NO . '  ' . tep_draw_radio_field('customers_group_ra', '1', false, $cInfo->customers_group_ra) . '  ' . ENTRY_CUSTOMERS_GROUP_RA_YES . ' ' . ENTRY_CUSTOMERS_GROUP_RA_ERROR;

     } else {

       echo ($cInfo->customers_group_ra == '0') ? ENTRY_CUSTOMERS_GROUP_RA_NO : ENTRY_CUSTOMERS_GROUP_RA_YES;

       echo tep_draw_hidden_field('customers_group_ra');

     }

   } else {

     echo tep_draw_radio_field('customers_group_ra', '0', false, $cInfo->customers_group_ra) . '  ' . ENTRY_CUSTOMERS_GROUP_RA_NO . '  ' . tep_draw_radio_field('customers_group_ra', '1', false, $cInfo->customers_group_ra) . '  ' . ENTRY_CUSTOMERS_GROUP_RA_YES;

   }

?></td>

         </tr>

<!-- EOF Separate Pricing Per Customer -->

         </tr>

       </table></td>

     </tr>

<?php

   }

?>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td class="formAreaTitle"><?php echo CATEGORY_ADDRESS; ?></td>

     </tr>

     <tr>

       <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">

         <tr>

           <td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td>

           <td class="main">

<?php

 if ($error == true) {

   if ($entry_street_address_error == true) {

     echo tep_draw_input_field('entry_street_address', $cInfo->entry_street_address, 'maxlength="64"') . ' ' . ENTRY_STREET_ADDRESS_ERROR;

   } else {

     echo $cInfo->entry_street_address . tep_draw_hidden_field('entry_street_address');

   }

 } else {

   echo tep_draw_input_field('entry_street_address', $cInfo->entry_street_address, 'maxlength="64"', true);

 }

?></td>

         </tr>

<?php

   if (ACCOUNT_SUBURB == 'true') {

?>

         <tr>

           <td class="main"><?php echo ENTRY_SUBURB; ?></td>

           <td class="main">

<?php

   if ($error == true) {

     if ($entry_suburb_error == true) {

       echo tep_draw_input_field('suburb', $cInfo->entry_suburb, 'maxlength="32"') . ' ' . ENTRY_SUBURB_ERROR;

     } else {

       echo $cInfo->entry_suburb . tep_draw_hidden_field('entry_suburb');

     }

   } else {

     echo tep_draw_input_field('entry_suburb', $cInfo->entry_suburb, 'maxlength="32"');

   }

?></td>

         </tr>

<?php

   }

?>

         <tr>

           <td class="main"><?php echo ENTRY_POST_CODE; ?></td>

           <td class="main">

<?php

 if ($error == true) {

   if ($entry_post_code_error == true) {

     echo tep_draw_input_field('entry_postcode', $cInfo->entry_postcode, 'maxlength="8"') . ' ' . ENTRY_POST_CODE_ERROR;

   } else {

     echo $cInfo->entry_postcode . tep_draw_hidden_field('entry_postcode');

   }

 } else {

   echo tep_draw_input_field('entry_postcode', $cInfo->entry_postcode, 'maxlength="8"', true);

 }

?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CITY; ?></td>

           <td class="main">

<?php

 if ($error == true) {

   if ($entry_city_error == true) {

     echo tep_draw_input_field('entry_city', $cInfo->entry_city, 'maxlength="32"') . ' ' . ENTRY_CITY_ERROR;

   } else {

     echo $cInfo->entry_city . tep_draw_hidden_field('entry_city');

   }

 } else {

   echo tep_draw_input_field('entry_city', $cInfo->entry_city, 'maxlength="32"', true);

 }

?></td>

         </tr>

<?php

   if (ACCOUNT_STATE == 'true') {

?>

         <tr>

           <td class="main"><?php echo ENTRY_STATE; ?></td>

           <td class="main">

<?php

   $entry_state = tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state);

   if ($error == true) {

     if ($entry_state_error == 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 = '" . tep_db_input($cInfo->entry_country_id) . "' 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('entry_state', $zones_array) . ' ' . ENTRY_STATE_ERROR;

       } else {

         echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)) . ' ' . ENTRY_STATE_ERROR;

       }

     } else {

       echo $entry_state . tep_draw_hidden_field('entry_zone_id') . tep_draw_hidden_field('entry_state');

     }

   } else {

     echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state));

   }

 

?></td>

        </tr>

<?php

   }

?>

         <tr>

           <td class="main"><?php echo ENTRY_COUNTRY; ?></td>

           <td class="main">

<?php

 if ($error == true) {

   if ($entry_country_error == true) {

     echo tep_draw_pull_down_menu('entry_country_id', tep_get_countries(), $cInfo->entry_country_id) . ' ' . ENTRY_COUNTRY_ERROR;

   } else {

     echo tep_get_country_name($cInfo->entry_country_id) . tep_draw_hidden_field('entry_country_id');

   }

 } else {

   echo tep_draw_pull_down_menu('entry_country_id', tep_get_countries(), $cInfo->entry_country_id);

 }

?></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td class="formAreaTitle"><?php echo CATEGORY_CONTACT; ?></td>

     </tr>

     <tr>

       <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">

         <tr>

           <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>

           <td class="main">

<?php

 if ($error == true) {

   if ($entry_telephone_error == true) {

     echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"') . ' ' . ENTRY_TELEPHONE_NUMBER_ERROR;

   } else {

     echo $cInfo->customers_telephone . tep_draw_hidden_field('customers_telephone');

   }

 } else {

   echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"', true);

 }

?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td>

           <td class="main">

<?php

 if ($processed == true) {

   echo $cInfo->customers_fax . tep_draw_hidden_field('customers_fax');

 } else {

   echo tep_draw_input_field('customers_fax', $cInfo->customers_fax, 'maxlength="32"');

 }

?></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td class="formAreaTitle"><?php echo CATEGORY_OPTIONS; ?></td>

     </tr>

     <tr>

       <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">

         <tr>

           <td class="main"><?php echo ENTRY_NEWSLETTER; ?></td>

           <td class="main">

<?php

 if ($processed == true) {

   if ($cInfo->customers_newsletter == '1') {

     echo ENTRY_NEWSLETTER_YES;

   } else {

     echo ENTRY_NEWSLETTER_NO;

   }

   echo tep_draw_hidden_field('customers_newsletter');

 } else {

   echo tep_draw_pull_down_menu('customers_newsletter', $newsletter_array, (($cInfo->customers_newsletter == '1') ? '1' : '0'));

 }

?></td>

         </tr>

<!--  BOF Separate Pricing per Customer -->

<tr>

 <td class="main"><?php echo ENTRY_CUSTOMERS_GROUP_NAME; ?></td>

 <?php

 if ($processed != true) {

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

 }

 } // end if ($processed != true )

?>

 <td class="main"><?php if ($processed == true) {

   echo $cInfo->customers_group_id . tep_draw_hidden_field('customers_group_id');

 } else {

 echo tep_draw_pull_down_menu('customers_group_id', $existing_customers_array, $cInfo->customers_group_id);

 } ?></td>

</tr>

<!-- EOF Separate Pricing per Customer -->

       </table></td>

     </tr>

<!-- BOF Separate Pricing per Customer -->      

     <tr>

     

Share this post


Link to post
Share on other sites
Sure, just wrap it (once $customer_group_id has been determined in the code) in:

if ($customer_group_id !=0 ) {
echo put your link here;
}

I have to put this into includes/boxes/categories.php ?

 

Then you would need to make an additional page with the items that have separate prices (with in it code before the <html> tag that looks at the customer_group_id and redirect to e.g. the index page if the customer group is not the one that is supposed to see that.

I am not sure how to do this. If it's possible - could you or other users make me an example of that additional page?

 

/MR.T

Share this post


Link to post
Share on other sites

Hi

 

First of all I haven't yet thanked JanZ for answering one of my questions concerning the display of information only for a specific group

<?php
// next line only necessary inside functions, might depend on where you put it in your code
// global $sppc_customer_group_id;
if $sppc_customer_group_id == '1') { // assuming wholesale has customer_group_id 1
echo 'This is a good seller for beginners';
}
?>

 

It worked brilliantly and I'm using it in many places on one of my sites. Works perfectly as it is. Thanx again.

 

I have one other problem bothering me, I've been at it for some time now, I would like to be able to see which customer group a customer belongs to by looking at the orders. I've tried using script from the customers.php page :

 

<td class="dataTableContent"><?php

if (strlen($customers['customers_group_name']) > 17 ) {

print ("<acronym title=\"".$customers['customers_group_name']."\"> ".substr($customers['customers_group_name'], 0, 17)." </acronym>");

} else {

echo $customers['customers_group_name'] ;

} ?php></td>

 

But as you would know better than me, that doesn't work. Any idea what would fix this.

Thanx again, and the follow up to this mod is being brilliantly done and greatly appreciated... It's just getting tough to find info in this thread now it's so long...

Share this post


Link to post
Share on other sites

I have build in my shop the Pr?ix contrieb an it works on all pages but the admin/costumers.php i became this error.

 

database_tables.php

define('TABLE_CUSTOMERS_GROUPS', DB_TABLE_PREFIX . 'customers_groups');

 

1146 - Table 'xoops.customers_groups' doesn't exist

 

select count(*) as total from es_esc_customers c left join es_esc_address_book a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id left join customers_groups cg on c.customers_group_id = cg.customers_group_id

 

 

Bug found

 

line 1048
repleace
left join customers_groups cg on c.customers_group_id
with
left join " . TABLE_CUSTOMERS_GROUPS . " cg on c.customers_group_id

Share this post


Link to post
Share on other sites
But as you would know better than me, that doesn't work.
True, the page admin/orders.php only gets its information from the table orders. You would have to look which query gets the information where you want to see the customer_group, add "customer_id, c.customer_group_id, customer_group_name to the fields it is picking up, and add " left join ".TABLE_CUSTOMERS." c using(customer_id) left join ".TABLE_CUSTOMERS_GROUPS." using(customer_group_id) " to that query.

 

Haven't tried it, so it might not be totally correct, but the idea is that the customer_id is picked up from the table orders. The customer_id makes it possible to join it with the table customers, where you pick up the customer_group_id, which makes it possible to join it with the table customers_groups to get the name of the customer group.

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

×