Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

could you or other users make me an example of that additional page?

You can find plenty of good tips on adding new pages in the Tips and Tricks section especially the topic Easily add new pages.

 

Before the <html> tag you could put in some code to redirect unauthorized customers "away" from that page:

<?php
    if(!tep_session_is_registered('sppc_customer_group_id')) { 
    $customer_group_id = '0';
    } else {
     $customer_group_id = $sppc_customer_group_id;
    }
    
$send_user_to = HTTP_SERVER . DIR_WS_HTTP_CATALOG ."/index.php";
if ($customer_group_id == '0') {
header("Location: ".$send_user_to.""); 
// alternatively index.php relative to document root
// for example: header("Location: /catalog/index.php");
}
?>

Link to comment
Share on other sites

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

You are right, thanks. Something for the next version. Nothing to worry about, still on the drawing table. Should contain code to exclude specific tax rates on the customer and customer group level and hopefully code to make attribute prices customer group aware (seems to work on the catalog side allready, haven't looked at the admin side of it though).

Link to comment
Share on other sites

Hello everyone!

 

I've tried to install this mod ( Seperate Pricing Per Customer 4.1.1 ) without success on my current website www.livefood.ca

 

I already have some mods installed.

 

It start to be a real pain since I'm not a programmer so I will pay the person who will install it.

If you have the time, email me at: [email protected]

 

Thank you!

Felix Bourque

Owner of LiveFood.ca

Link to comment
Share on other sites

PWA and SPPC Price Break 1.11.3

 

I have on my catalog/product_info.php PWA 0.82 insert and SPPC and now i will add Price Break 1.11.3 but i have this code :

<?php
//logic for displaying incart button or test message
if (PRICES_LOGGED_IN == 'false')
      $submit_button = tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);

if ( (PRICES_LOGGED_IN == 'true') && (!tep_session_is_registered('customer_id'))) {
     $submit_button = '<a href="' . tep_href_link(FILENAME_LOGIN, '','SSL') . '">'  . PRICES_LOGGED_IN_SUBMIT . '</a> ';
     $submit_product_quant = '';
        }  else {
     $submit_button = tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
     }
//#######################################
?>

And zhis i must do :

 

SPPC Price Break 1.11.3 mod

***REPLACE***

               <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
              
***WITH***

<!--  BOF price-break-1.11.3  <td class="main" align="right"><?php // echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); 
?></td> -->
                <td class="main" align="right">
                 <table border="0" align="right">
                   <tr><td align="center">
                     <?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>
                   </td></tr>
                   <tr><td align="center">
                     <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>
                   </td></tr>
                 </table>
               </td> <!-- EOF price-break-1.11.3 -->

Link to comment
Share on other sites

I would like to see this contribution in action. Can someone post some site that are using the contribution.

 

Can a new user automatically be given wholesale access if they enter a tax number at registration? Or do the have to be manually approved?

 

Sounds like a great contrubtion.

 

Thanks much! :thumbsup:

Link to comment
Share on other sites

I would like to see this contribution in action.  Can someone post some site that are using the contribution.

 

Can a new user automatically be given wholesale access if they enter a tax number at registration?  Or do the have to be manually approved?

 

Sounds like a great contrubtion.

 

Thanks much! :thumbsup:

 

Hi Brian,

 

I answered this question in a previous post (see below). The only problem is that the customer needs to log off and log on again for the prices to change. I haven't had much time to figure out how to fix this but i'll let you know when I've worked it out.

 

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

Link to comment
Share on other sites

SPPC is a fantastic tool. I love it, and it works great!!!

 

However, with the customer groups/prices listed in the product edit page there is a practical limit to the number of groups before the list gets very long.

 

I'm in a situation where my store may eventually have custom pricing for 1,000 customers.

 

Q: What would it take to move the admin of SPPC out of the product page so we could

 

1. Select a Group

2. Select a Product

3. Enter a price

 

 

>> Select product by ID if necessary to keep it simple but drop down would be nice.

 

Would this issue be better address by another contribution?

:(

Sam M. - Seattle

Link to comment
Share on other sites

Hi, I use Easy Populate and it's work great with SPPC 4.1, you have to adjust easy Populate, here what to do for Easy Populate :

 

Open admin/easypopulate.php and search the following lines :

 

// uncomment the customer_price and customer_group to support multi-price per product contrib
?$filelayout = array(
?'v_products_model' ?=> $iii++,
?'v_products_price' ?=> $iii++,
?'v_products_quantity' ?=> $iii++,
?'v_customer_price_1' ?=> $iii++,
?'v_customer_group_id_1' ?=> $iii++,
?'v_customer_price_2' ?=> $iii++,
?'v_customer_group_id_2' ?=> $iii++,
?'v_customer_price_3' ?=> $iii++,
?'v_customer_group_id_3' ?=> $iii++,
?'v_customer_price_4' ?=> $iii++,
?'v_customer_group_id_4' ?=> $iii++,

 

These line will be commented out.  For each customer group you have, uncomment one of the lines... If you have normal prices, and two another price like me ,uncomment group id #1 and #2 and #3.

 

After that, a little lower, you can find the text file about sql data.  It looks like this :

 

// and insert the new record
? if ($v_customer_price_1 != ''){
? ?$result = tep_db_query('
? ? ? INSERT INTO
? ? ? ?'.TABLE_PRODUCTS_GROUPS.'
? ? ? VALUES
? ? ? (
? ? ? ?' . $v_customer_group_id_1 . ',
? ? ? ?' . $v_customer_price_1 . ',
? ? ? ?' . $v_products_id . ',
? ? ? ?' . $v_products_price .'
? ? ? ?)'
? ? ? );
? }
? if ($v_customer_price_2 != ''){
? ?$result = tep_db_query('
? ? ? INSERT INTO
? ? ? ?'.TABLE_PRODUCTS_GROUPS.'
? ? ? VALUES
? ? ? (
? ? ? ?' . $v_customer_group_id_2 . ',
? ? ? ?' . $v_customer_price_2 . ',
? ? ? ?' . $v_products_id . ',
? ? ? ?' . $v_products_price . '
? ? ? ?)'
? ? ? );
? }
? if ($v_customer_price_3 != ''){
? ?$result = tep_db_query('
? ? ? INSERT INTO
? ? ? ?'.TABLE_PRODUCTS_GROUPS.'
? ? ? VALUES
? ? ? (
? ? ? ?' . $v_customer_group_id_3 . ',
? ? ? ?' . $v_customer_price_3 . ',
? ? ? ?' . $v_products_id . ',
? ? ? ?' . $v_products_price . '
? ? ? ?)'
? ? ? );
? }
? if ($v_customer_price_4 != ''){
? ?$result = tep_db_query('
? ? ? INSERT INTO
? ? ? ?'.TABLE_PRODUCTS_GROUPS.'
? ? ? VALUES
? ? ? (
? ? ? ?' . $v_customer_group_id_4 . ',
? ? ? ?' . $v_customer_price_4 . ',
? ? ? ?' . $v_products_id . ',
? ? ? ?' . $v_products_price . '
? ? ? ?)'
? ? ? );
? }

?}

 

The line  ' . $v_products_price . '  is not needed. Erase that whole line. I don't know why commenting the line won't work...but it won't.

 

Anyway, the line above the one you just erased has a comma at the end of it. Erase the comma so that sql knows to start another line.

 

That's it and it work like a charm.  :rolleyes:

 

Just upload your excel file in admin panel via Easy Populate.

 

 

this worked great. cheers. :thumbsup:

Link to comment
Share on other sites

I have insert in my store SPPC and now i will ad Hide products for SPPC.

But i have a big problem, this is my includes/column_right ( i have infobox-admin-contrieb)

 

<?php
/*
$Id: column_right.php,v 1.1.1.1 2004/03/04 23:40:37 ccwjr Exp $

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

Copyright (c) 2002 osCommerce

Released under the GNU General Public License
*/

$column_query = tep_db_query('select display_in_column as cfgcol, infobox_file_name as cfgtitle, infobox_display as cfgvalue, infobox_define as cfgkey, box_heading, box_template, box_heading_font_color from ' . TABLE_INFOBOX_CONFIGURATION . ' where template_id = ' . TEMPLATE_ID . ' and infobox_display = "yes" and display_in_column = "right" order by location');
while ($column = tep_db_fetch_array($column_query)) {

if ( file_exists(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/boxes/' . $column['cfgtitle'])) {

define($column['cfgkey'],$column['box_heading']);
$infobox_define = $column['box_heading'];
$infobox_template = $column['box_template'];
$font_color = $column['box_heading_font_color'];
$infobox_class = $column['box_template'];
require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/boxes/' . $column['cfgtitle']);
}
}
?>

 

and this i must do, but i have not this code .

 

catalog/includes/column_right.php

Line 3

***AFTER***

$Id: column_right.php,v 1.17 2003/06/09 22:06:41 hpdl Exp $

***ADD***

adapted for Separate Pricing Per Customer v4.1, Hide products from groups mod 2005/03/30

Line 15-41

***REPLACE***

if (isset($HTTP_GET_VARS['products_id'])) include(DIR_WS_BOXES . 'manufacturer_info.php');

if (tep_session_is_registered('customer_id')) include(DIR_WS_BOXES . 'order_history.php');

if (isset($HTTP_GET_VARS['products_id'])) {
  if (tep_session_is_registered('customer_id')) {
    $check_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "' and global_product_notifications = '1'");
    $check = tep_db_fetch_array($check_query);
    if ($check['count'] > 0) {
      include(DIR_WS_BOXES . 'best_sellers.php');
    } else {
      include(DIR_WS_BOXES . 'product_notifications.php');
    }
  } else {
    include(DIR_WS_BOXES . 'product_notifications.php');
  }
} else {
  include(DIR_WS_BOXES . 'best_sellers.php');
}

if (isset($HTTP_GET_VARS['products_id'])) {
  if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');
} else {
  include(DIR_WS_BOXES . 'specials.php');
}

require(DIR_WS_BOXES . 'reviews.php');

 

with this code

 

// BOF Separate Pricing Per Customer v4.1, Hide products from groups mod

if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
 $customer_group_id = $sppc_customer_group_id;
}

global $hide_product; // is set in application_top.php

if (isset($HTTP_GET_VARS['products_id']) && $hide_product == false) include(DIR_WS_BOXES . 'manufacturer_info.php');

if (tep_session_is_registered('customer_id')) include(DIR_WS_BOXES . 'order_history.php');

if (isset($HTTP_GET_VARS['products_id'])) {
  if (tep_session_is_registered('customer_id')) {
   $check_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "' and global_product_notifications = '1'");
    $check = tep_db_fetch_array($check_query);
   if ($check['count'] > 0) {
      include(DIR_WS_BOXES . 'best_sellers.php');
   } else {
      (($hide_product == false )? include(DIR_WS_BOXES . 'product_notifications.php') : '');
   }
  } else {
    (($hide_product == false)? include(DIR_WS_BOXES . 'product_notifications.php') : '');
  }
} else {
 include(DIR_WS_BOXES . 'best_sellers.php');
}

if (isset($HTTP_GET_VARS['products_id'])) {
  if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND && $hide_product == false) { include(DIR_WS_BOXES . 'tell_a_friend.php');
} // end if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND && $hide_product == false)
} else {
  include(DIR_WS_BOXES . 'specials.php');
} // end if (isset($HTTP_GET_VARS['products_id']))

if ($hide_product == false) {
require(DIR_WS_BOXES . 'reviews.php');
}
// EOF Separate Pricing Per Customer v4.1, Hide products from groups mod

Link to comment
Share on other sites

Ummm i am probably asking the same question as someone else but due to time restrictions i cannot read every post on the forums here (sorry)

 

I have installed sppc and then 'hide products' ... my problem is that when i install 'hide products' the group section drop down box for the customer disappears ... then when i reinstall sppc the groups section reappears however the hide pricing section in categories is overwritten.

 

ummm can someone help with an answer to this please ??

 

Thanks in advance

Link to comment
Share on other sites

Ummm i am probably asking the same question as someone else but due to time restrictions i cannot read every post on the forums here (sorry)

 

I have installed sppc and then 'hide products' ... my problem is that when i install 'hide products' the group section drop down box for the customer disappears ... then when i reinstall sppc the groups section reappears however the hide pricing section in categories is overwritten.

 

ummm can someone help with an answer to this please ??

 

Thanks in advance

 

Sorry i have sorted it now.

 

Seems i reinstalled both contribs (twice) and now i have funtionality.

 

One question however if i may

Is there a way to hide actual categories from customers in the menu on the front page of my store via a login? (the same way as hiding products)

 

Thanks in advance

Link to comment
Share on other sites

Is there a way to hide actual categories from customers in the menu on the front page of my store via a login? (the same way as hiding products)
Not that I'm aware of. The only thing you can do is to hide all products, but then the category still shows in the front and advanced_search.php pages.

 

There is a hack around that. Say you want to hide category 3, 7, and 8 from retail customers:

Code starting around line 108 in includes/boxes/categories.php

  new infoBoxHeading($info_box_contents, true, false);

 $categories_string = '';
 $tree = array();
// BOF Hide certain categories for specific customer groups  
    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;
    }
  
if ($customer_group_id == '0') {
$additional_constraint = " and c.categories_id NOT IN (3 , 7, 8) ";
} else { 
$additional_constraint = '';
}

 $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' " . $additional_constraint . " order by sort_order, cd.categories_name"); 

/* $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."'  order by sort_order, cd.categories_name"); */

 while ($categories = tep_db_fetch_array($categories_query))  {
   $tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                               'parent' => $categories['parent_id'],
                                               'level' => 0,
                                               'path' => $categories['categories_id'],
                                               'next_id' => false);

   if (isset($parent_id)) {
     $tree[$parent_id]['next_id'] = $categories['categories_id'];
   }

   $parent_id = $categories['categories_id'];

   if (!isset($first_element)) {
     $first_element = $categories['categories_id'];
   }
 }

 //------------------------
 if (tep_not_null($cPath)) {
   $new_path = '';
   reset($cPath_array);
   while (list($key, $value) = each($cPath_array)) {
     unset($parent_id);
     unset($first_id);
/*      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); */

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' " . $additional_constraint . " order by sort_order, cd.categories_name");
// EOF Hide certain categories for specific customer groups

Additionally you should avoid showing the category in the drop down menu in advanced_search.php. For this you need to change the function tep_get_categories in includes/functions/general.php (starts around line 503).

  function tep_get_categories($categories_array = '', $parent_id = '0', $indent = '') {
   global $languages_id;
// Hide certain categories from specific customer groups
// BOF Separate Pricing 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;
 }

   if (!is_array($categories_array)) $categories_array = array();

/*   $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); */
if ($customer_group_id == '0') {
$additional_constraint = " and c.categories_id NOT IN (3, 7, 8) ";
} else {
$additional_constraint = '';
}
       $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' " . $additional_constraint . " order by sort_order, cd.categories_name"); 
// EOF Hide certain categories from specific customer groups
   while ($categories = tep_db_fetch_array($categories_query)) {

Link to comment
Share on other sites

Not that I'm aware of. The only thing you can do is to hide all products, but then the category still shows in the front and advanced_search.php pages.

 

There is a hack around that. Say you want to hide category 3, 7, and 8 from retail customers:

Code starting around line 108 in includes/boxes/categories.php

 ?new infoBoxHeading($info_box_contents, true, false);

?$categories_string = '';
?$tree = array();
// BOF Hide certain categories for specific customer groups ?
? ? 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;
? ? }
? 
if ($customer_group_id == '0') {
$additional_constraint = " and c.categories_id NOT IN (3 , 7, 8) ";
} else { 
$additional_constraint = '';
}

?$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' " . $additional_constraint . " order by sort_order, cd.categories_name"); 

/* $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' ?order by sort_order, cd.categories_name"); */

?while ($categories = tep_db_fetch_array($categories_query)) ?{
? ?$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'parent' => $categories['parent_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'level' => 0,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'path' => $categories['categories_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'next_id' => false);

? ?if (isset($parent_id)) {
? ? ?$tree[$parent_id]['next_id'] = $categories['categories_id'];
? ?}

? ?$parent_id = $categories['categories_id'];

? ?if (!isset($first_element)) {
? ? ?$first_element = $categories['categories_id'];
? ?}
?}

?//------------------------
?if (tep_not_null($cPath)) {
? ?$new_path = '';
? ?reset($cPath_array);
? ?while (list($key, $value) = each($cPath_array)) {
? ? ?unset($parent_id);
? ? ?unset($first_id);
/* ? ? ?$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); */

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' " . $additional_constraint . " order by sort_order, cd.categories_name");
// EOF Hide certain categories for specific customer groups

Additionally you should avoid showing the category in the drop down menu in advanced_search.php. For this you need to change the function tep_get_categories in includes/functions/general.php (starts around line 503).

 ?function tep_get_categories($categories_array = '', $parent_id = '0', $indent = '') {
? ?global $languages_id;
// Hide certain categories from specific customer groups
// BOF Separate Pricing 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;
?}

? ?if (!is_array($categories_array)) $categories_array = array();

/* ? $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); */
if ($customer_group_id == '0') {
$additional_constraint = " and c.categories_id NOT IN (3, 7, 8) ";
} else {
$additional_constraint = '';
}
? ? ? ?$categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' " . $additional_constraint . " order by sort_order, cd.categories_name"); 
// EOF Hide certain categories from specific customer groups
? ?while ($categories = tep_db_fetch_array($categories_query)) {

 

Hey thanks Jan I will try this tonight and let you know how it goes :)

Link to comment
Share on other sites

Hey thanks Jan I will try this tonight and let you know how it goes :)

 

Jan the above code is that a replacement or do i add the code in?

 

I have tried both ways

 

when added i get:

Parse error: parse error, unexpected $ in /var/www/html/ffs/catalog/includes/boxes/categories.php on line 191

 

when i tried to replace the code (although i am not sure i have put it in the right spot i get the same error only on ine 102 or there abouts.

 

thanks in advance

Link to comment
Share on other sites

Jan the above code is that a replacement or do i add the code in?
A bit of both: find in your original code where the beginning of the new piece is (starts in the new code with // BOF Hide etc. so look before that) and the end of the new code and replace that part with the new code in between // BOF and // EOF.

 

when added i get:

Parse error: parse error, unexpected $ in /var/www/html/ffs/catalog/includes/boxes/categories.php on line 191

I have noticed on numerous occasions that when I copy and paste code from a webpage I get the strangest errors (like that e.g.). I finally found out that in the white space there are unicode characters that cause errors in PHP.

I don't know if this is the case with you, but on a Mac I now paste it in TextWrangler first and convert it to ASCII before adding the code in pages.

On a PC it seems to help to paste it in Notepad, that also gets rid of those invisible characters.

Link to comment
Share on other sites

A bit of both: find in your original code where the beginning of the new piece is (starts in the new code with // BOF Hide etc. so look before that) and the end of the new code and replace that part with the new code in between // BOF and // EOF.

 

I have noticed on numerous occasions that when I copy and paste code from a webpage I get the strangest errors (like that e.g.). I finally found out that in the white space there are unicode characters that cause errors in PHP.

I don't know if this is the case with you, but on a Mac I now paste it in TextWrangler first and convert it to ASCII before adding the code in pages.

On a PC it seems to help to paste it in Notepad, that also gets rid of those invisible characters.

 

Hi Jan

 

Gotta love those invisible characters eh! ..... haha i used notepad and all works without error now (thank you!) ..... just another question if i may.

 

Does this only hide categories for retail only? ..... i mean i have numberous categories for clients (they are in competition with each other) and i do not want to display certain categories as this will prove detremental.

 

Can i add code to say:

customer id = 0 then show (or hide) categories 2, 7, 8

customer id = 1 then show (or hide) categories 1, 3, 7, 8

customer id = 2 then show (or hide) categories 1, 2, 3, 7, 8 etc etc?

 

Thanks again in advance! :thumbsup:

Link to comment
Share on other sites

Does this only hide categories for retail only? ..... i mean i have numberous categories for clients (they are in competition with each other) and i do not want to display certain categories as this will prove detremental.

 

Can i add code to say:

customer id = 0 then show (or hide) categories 2, 7, 8

customer id = 1 then show (or hide) categories 1, 3, 7, 8

customer id = 2 then show (or hide)  categories 1, 2, 3, 7, 8 etc etc?

No, you can use it for other groups too. Be sure to make all products in that category hidden also. Then just elaborate on the code a bit more. Like:

 if ($customer_group_id == '0') {
$additional_constraint = " and c.categories_id NOT IN (2 , 7, 8) ";
} elseif ($customer_group_id == '1') {
$additional_constraint = " and c.categories_id NOT IN (1, 3 , 7, 8) ";
} elseif ($customer_group_id == '2') {
$additional_constraint = " and c.categories_id NOT IN (1, 2, 3 , 7, 8) ";
} else { 
$additional_constraint = '';
}

Link to comment
Share on other sites

Hi guys, I'd like to know if this mod is good for a reseller's program?

 

My client wants to create stores for resellers where for each of them will have his own list of products and template files.

 

Alain Lauzon

Link to comment
Share on other sites

$$ for Programmer - Custom Pricing Project

I've been using SPPC, but my site needs to support an unlimited number of custom price groups (100s) so adding the custom price to the product page isn't going to be practical. If you are interested in bidding this modification, please contact me at [email protected]

 

Project Goals: Provide custom pricing and simple administration for an unlimited number of customer groups.

 

Project timeline: Urgent. My butt is on the line. Time is a factor.

 

Admin Functions

View/Edit custom Prices for a Group

Select a Group

1. Display table of all Custom Priced Products for that group

Page Info: Customer Group Name, Customer Name.

Table Columns: Product ID, Product Name, Normal price, Custom price, Button-Edit, Button-Remove

Function: Edit Prices

Function: Delete products from table.

 

Add Products with Custom Price

Function: Select a Product to add to list by product ID or product drop down.

Function: Enter a price

Product is added to above list of products for that group.

 

NOTE: I like the SPPC contribution because it carries the custom price through the site. However, if necessary, we can do a new stand alone modification that only displays the custom prices on one page.

Sam M. - Seattle

Link to comment
Share on other sites

I have just installed sppc 4.11, i used winmerge to make sure i merged the required files properly, the shop seems to be working OSC 2.2 MS2, but as soon as i go to the admin page i get:

 

Fatal error: Call to undefined function: tep_get_languages() in /home/hrhsteph/public_html/catalog/admin/index.php on line 58

 

The strange thing is that /catalog/admin/index.php is a file which is not modified by this contribution.

 

Also i cannot find the function tep_get_languages(), it is called in other files so i would have expected the error elsewhere...

 

Can anyone help please...

Link to comment
Share on other sites

Also i cannot find the function tep_get_languages(), it is called in other files so i would have
This function is defined in admin/includes/functions/general.php which is changed by SPPC. Try using the file that was included in the contribution (after backing up your own file of course) and see if the error goes away.
Link to comment
Share on other sites

This function is defined in admin/includes/functions/general.php which is changed by SPPC. Try using the file that was included in the contribution (after backing up your own file of course) and see if the error goes away.

 

Thanks that fixed it, i pasted the wrong general.php file to my website! Or should i say i left the original one on the website....

Link to comment
Share on other sites

Hello again, I have been trying to install the Quantity Price Breaks contribution to a mirror/ working area of my store. I seem to be stuck on the admin side and my categories.php page is not loading. I also have Small, Medium, & Large Images, Header Tags, and Category Descriptions installed, so I have a lot of edits to this php page. I've done it using Compare and Merge and by hand, but still get a blank page. (My isp doesn't let me see the error logs, so I'm working blind!).

 

I'm including my admin/categories.php page below. If somebody sees where I've gone wrong, or perhaps there's another file I should be concentrating on, I would appreciate the guidance.

 

Also, a bit off topic, I have tried creating a local copy, but ran into trouble because of the Register Globals Patch on my computer... perhaps there's a way to make my local server have the same configuration?

 

Thanks! :rolleyes:

Janet

 

<?php

/*

  $Id: categories.php,v 1.146-1 2003/08/04 14:40:27 Strider Exp $

  $Id: categories.php,v 1.146 2003/07/11 14:40:27 hpdl Exp $

  adapted for Separate Pricing Per Customer v4, Price Break 1.11.3 mod 2005/03/19

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2003 osCommerce

 

  Released under the GNU General Public License

*/

 

  require('includes/application_top.php');

  require('includes/functions/categories_description.php');

 

  require(DIR_WS_CLASSES . 'currencies.php');

  $currencies = new currencies();

 

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

 

  if (tep_not_null($action)) {

    switch ($action) {

      case 'setflag':

        if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {

          if (isset($HTTP_GET_VARS['pID'])) {

            tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);

          }

 

          if (USE_CACHE == 'true') {

            tep_reset_cache_block('categories');

            tep_reset_cache_block('also_purchased');

          }

        }

 

        tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID']));

        break;

  case 'new_category':

      case 'edit_category':

        if (ALLOW_CATEGORY_DESCRIPTIONS == 'true')

          $HTTP_GET_VARS['action']=$HTTP_GET_VARS['action'] . '_ACD';

        break;

      case 'insert_category':

      case 'update_category':

  if ( ($HTTP_POST_VARS['edit_x']) || ($HTTP_POST_VARS['edit_y']) ) {

          $HTTP_GET_VARS['action'] = 'edit_category_ACD';

        } else {

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

    if ($categories_id == '') {

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

          }

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

 

          $sql_data_array = array('sort_order' => $sort_order);

    //begin Header Tags Controller

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

    $htc_title_data = array('category_head_title_tag' => $htc_title);

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

    $htc_desc_data = array('category_head_desc_tag' => $htc_desc);

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

    $htc_keywords_data = array('category_head_keywords_tag' => $htc_keywords);

    //end Header Tags Controller 

 

        if ($action == 'insert_category') {

          $insert_sql_data = array('parent_id' => $current_category_id,

                                  'date_added' => 'now()');

 

          $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

  //begin Header Tags Controller

    $sql_data_array = array_merge($sql_data_array, $htc_title_data);

    $sql_data_array = array_merge($sql_data_array, $htc_desc_data);

    $sql_data_array = array_merge($sql_data_array, $htc_keywords_data);

    //end Header Tags Controller

 

          tep_db_perform(TABLE_CATEGORIES, $sql_data_array);

 

          $categories_id = tep_db_insert_id();

        } elseif ($action == 'update_category') {

          $update_sql_data = array('last_modified' => 'now()');

 

          $sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

          tep_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "'");

        }

 

        $languages = tep_get_languages();

        for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

          $categories_name_array = $HTTP_POST_VARS['categories_name'];

 

          $language_id = $languages[$i]['id'];

 

            $sql_data_array = array('categories_name' => tep_db_prepare_input($categories_name_array[$language_id]));

  if (ALLOW_CATEGORY_DESCRIPTIONS == 'true') {

              $sql_data_array = array('categories_name' => tep_db_prepare_input($HTTP_POST_VARS['categories_name'][$language_id]),

                                      'categories_heading_title' => tep_db_prepare_input($HTTP_POST_VARS['categories_heading_title'][$language_id]),

                                      'categories_description' => tep_db_prepare_input($HTTP_POST_VARS['categories_description'][$language_id]));

            }

 

          if ($action == 'insert_category') {

            $insert_sql_data = array('categories_id' => $categories_id,

                                    'language_id' => $languages[$i]['id']);

 

            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

              tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);

            } elseif ($action == 'update_category') {

              tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");

            }

          }

 

          if (ALLOW_CATEGORY_DESCRIPTIONS == 'true') {

            tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $HTTP_POST_VARS['categories_image'] . "' where categories_id = '" .  tep_db_input($categories_id) . "'");

            $categories_image = '';

      } else {

        if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES)) {

          tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");

        }

  //begin Header Tags Controller

    tep_db_query("update " . TABLE_CATEGORIES . " set category_head_title_tag = '" . $htc_title . "' where categories_id = '" . (int)$categories_id . "'");

    tep_db_query("update " . TABLE_CATEGORIES . " set category_head_desc_tag = '" . $htc_desc . "' where categories_id = '" . (int)$categories_id . "'");

    tep_db_query("update " . TABLE_CATEGORIES . " set category_head_keywords_tag = '" . $htc_keywords . "' where categories_id = '" . (int)$categories_id . "'");

    //end Header Tags Controller

      }

 

        if (USE_CACHE == 'true') {

          tep_reset_cache_block('categories');

          tep_reset_cache_block('also_purchased');

        }

 

          tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));

        }

  break;

      case 'delete_category_confirm':

        if (isset($HTTP_POST_VARS['categories_id'])) {

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

 

          $categories = tep_get_category_tree($categories_id, '', '0', '', true);

          $products = array();

          $products_delete = array();

 

          for ($i=0, $n=sizeof($categories); $i<$n; $i++) {

            $product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$categories[$i]['id'] . "'");

 

            while ($product_ids = tep_db_fetch_array($product_ids_query)) {

              $products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];

            }

          }

 

          reset($products);

          while (list($key, $value) = each($products)) {

            $category_ids = '';

 

            for ($i=0, $n=sizeof($value['categories']); $i<$n; $i++) {

              $category_ids .= "'" . (int)$value['categories'][$i] . "', ";

            }

            $category_ids = substr($category_ids, 0, -2);

 

            $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$key . "' and categories_id not in (" . $category_ids . ")");

            $check = tep_db_fetch_array($check_query);

            if ($check['total'] < '1') {

              $products_delete[$key] = $key;

            }

          }

 

// removing categories can be a lengthy process

          tep_set_time_limit(0);

          for ($i=0, $n=sizeof($categories); $i<$n; $i++) {

            tep_remove_category($categories[$i]['id']);

          }

 

          reset($products_delete);

          while (list($key) = each($products_delete)) {

            tep_remove_product($key);

          }

        }

 

        if (USE_CACHE == 'true') {

          tep_reset_cache_block('categories');

          tep_reset_cache_block('also_purchased');

        }

 

        tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));

        break;

      case 'delete_product_confirm':

        if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['product_categories']) && is_array($HTTP_POST_VARS['product_categories'])) {

          $product_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

          $product_categories = $HTTP_POST_VARS['product_categories'];

 

          for ($i=0, $n=sizeof($product_categories); $i<$n; $i++) {

            tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "' and categories_id = '" . (int)$product_categories[$i] . "'");

// BOF Separate Pricing per Customer

tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . tep_db_input($product_id) . "' ");

// EOF Separate Pricing per Customer

          }

 

          $product_categories_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");

          $product_categories = tep_db_fetch_array($product_categories_query);

 

          if ($product_categories['total'] == '0') {

            tep_remove_product($product_id);

          }

        }

 

        if (USE_CACHE == 'true') {

          tep_reset_cache_block('categories');

          tep_reset_cache_block('also_purchased');

        }

 

        //JJG calling custom function - delete product - Begin

jjg_db_attributeSets( $HTTP_POST_VARS['products_attributes_sets_id'], $products_id, $action );

//JJG calling custom function - delete product - End

 

        tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));

       

        break;

      case 'move_category_confirm':

        if (isset($HTTP_POST_VARS['categories_id']) && ($HTTP_POST_VARS['categories_id'] != $HTTP_POST_VARS['move_to_category_id'])) {

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

          $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

 

          $path = explode('_', tep_get_generated_category_path_ids($new_parent_id));

 

          if (in_array($categories_id, $path)) {

            $messageStack->add_session(ERROR_CANNOT_MOVE_CATEGORY_TO_PARENT, 'error');

 

            tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));

          } else {

            tep_db_query("update " . TABLE_CATEGORIES . " set parent_id = '" . (int)$new_parent_id . "', last_modified = now() where categories_id = '" . (int)$categories_id . "'");

 

            if (USE_CACHE == 'true') {

              tep_reset_cache_block('categories');

              tep_reset_cache_block('also_purchased');

            }

 

            tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&cID=' . $categories_id));

          }

        }

 

        break;

      case 'move_product_confirm':

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

        $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

 

        $duplicate_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$new_parent_id . "'");

        $duplicate_check = tep_db_fetch_array($duplicate_check_query);

        if ($duplicate_check['total'] < 1) tep_db_query("update " . TABLE_PRODUCTS_TO_CATEGORIES . " set categories_id = '" . (int)$new_parent_id . "' where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$current_category_id . "'");

 

        if (USE_CACHE == 'true') {

          tep_reset_cache_block('categories');

          tep_reset_cache_block('also_purchased');

        }

 

        tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&pID=' . $products_id));

        break;

      case 'insert_product':

      case 'update_product':

        if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {

          $action = 'new_product';

        } else {

          if (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);

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

 

          $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

 

          $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),

                                  'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),

                                  'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),

      //BOF Price Break 1.11.3 mod

      'products_price1' => tep_db_prepare_input($HTTP_POST_VARS['products_price1']),

                                  'products_price2' => tep_db_prepare_input($HTTP_POST_VARS['products_price2']),

                                  'products_price3' => tep_db_prepare_input($HTTP_POST_VARS['products_price3']),

                                  'products_price4' => tep_db_prepare_input($HTTP_POST_VARS['products_price4']),

                                  'products_price5' => tep_db_prepare_input($HTTP_POST_VARS['products_price5']),

                                  'products_price6' => tep_db_prepare_input($HTTP_POST_VARS['products_price6']),

                                  'products_price7' => tep_db_prepare_input($HTTP_POST_VARS['products_price7']),

                                  'products_price8' => tep_db_prepare_input($HTTP_POST_VARS['products_price8']),

                                  'products_price1_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price1_qty'])) < 0) ? 0 : $i,

                                  'products_price2_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price2_qty'])) < 0) ? 0 : $i,

                                  'products_price3_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price3_qty'])) < 0) ? 0 : $i,

                                  'products_price4_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price4_qty'])) < 0) ? 0 : $i,

                                  'products_price5_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price5_qty'])) < 0) ? 0 : $i,

                                  'products_price6_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price6_qty'])) < 0) ? 0 : $i,

                                  'products_price7_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price7_qty'])) < 0) ? 0 : $i,

                                  'products_price8_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price8_qty'])) < 0) ? 0 : $i,

                                  'products_qty_blocks' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_qty_blocks'])) < 1) ? 1 : $i,

      // EOF Price Break 1.11.3 mod

                                  'products_date_available' => $products_date_available,

                                  'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),

                                  'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),

                                  'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),

                                  'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']));

 

          if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

            $sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);

          }

// big image mod starts

//          if (isset($HTTP_POST_VARS['products_mediumimage'])) {

//          if (tep_not_null($HTTP_POST_VARS['products_mediumimage']) && ($HTTP_POST_VARS['products_mediumimage'] != 'none')) {

          if (isset($HTTP_POST_VARS['products_mediumimage']) && tep_not_null($HTTP_POST_VARS['products_mediumimage']) && ($HTTP_POST_VARS['products_mediumimage'] != 'none')) {

              $sql_data_array['products_mediumimage'] = tep_db_prepare_input($HTTP_POST_VARS['products_mediumimage']);

            }

            elseif (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

            $sql_data_array['products_mediumimage'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);

            }

 

//          if (isset($HTTP_POST_VARS['products_largeimage'])) {

//            if (tep_not_null($HTTP_POST_VARS['products_largeimage']) && ($HTTP_POST_VARS['products_largeimage'] != 'none')) {

          if (isset($HTTP_POST_VARS['products_largeimage']) && tep_not_null($HTTP_POST_VARS['products_largeimage']) && ($HTTP_POST_VARS['products_largeimage'] != 'none')) {

              $sql_data_array['products_largeimage'] = tep_db_prepare_input($HTTP_POST_VARS['products_largeimage']);

            }

            elseif (isset($HTTP_POST_VARS['products_mediumimage']) && tep_not_null($HTTP_POST_VARS['products_mediumimage']) && ($HTTP_POST_VARS['products_mediumimage'] != 'none')) {

            $sql_data_array['products_largeimage'] = tep_db_prepare_input($HTTP_POST_VARS['products_mediumimage']);

            }

            elseif (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

            $sql_data_array['products_largeimage'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);

            }

 

// big image mod ends

 

 

          if ($action == 'insert_product') {

            $insert_sql_data = array('products_date_added' => 'now()');

 

            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

            tep_db_perform(TABLE_PRODUCTS, $sql_data_array);

            $products_id = tep_db_insert_id();

           

//JJG calling custom function - insert product - Begin

      $arr_pas = array();

      $arr_pas[0] = $HTTP_POST_VARS['products_attributes_sets_id_0'];

    jjg_db_attributeSets( $arr_pas, $products_id, $action );

//JJG calling custom function - insert product - End

   

            tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");

          } elseif ($action == 'update_product') {

            $update_sql_data = array('products_last_modified' => 'now()');

 

            $sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

            tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

//JJG calling custom function - update product - Begin

$arr_pas = array();

for( $i=0; $i<$HTTP_POST_VARS["AttributeSetCount"]; $i++ ){

    $arr_pas[$i] = $HTTP_POST_VARS["products_attributes_sets_id_".$i];

}

   

jjg_db_attributeSets( $arr_pas, $products_id, $action );

 

//JJG calling custom function - update product - End

          }

  // BOF Separate Pricing Per Customer, Price Break 1.11.3 mod

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

while ($customers_group = tep_db_fetch_array($customers_group_query)) // Gets all of the customers groups

  {

  $attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where ((products_id = '" . $products_id . "') && (customers_group_id = " . $customers_group['customers_group_id'] . ")) order by customers_group_id");

  $attributes = tep_db_fetch_array($attributes_query);

  if (tep_db_num_rows($attributes_query) > 0) {

    if ($HTTP_POST_VARS['sppcoption'][$customers_group['customers_group_id']]) { // this is checking if the check box is checked

      if ($attributes['customers_group_id'] == $customers_group['customers_group_id'] ) {

      $sppc_update_query = "set ";

if (isset($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= "customers_group_price = '" . $HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_qty_blocks'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_qty_blocks = '" . $HTTP_POST_VARS['sppcproducts_qty_blocks'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price1'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price1 = '" . $HTTP_POST_VARS['sppcproducts_price1'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price1_qty'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price1_qty = '" . $HTTP_POST_VARS['sppcproducts_price1_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price2'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price2 = '" . $HTTP_POST_VARS['sppcproducts_price2'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price2_qty'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price2_qty = '" . $HTTP_POST_VARS['sppcproducts_price2_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price3'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price3 = '" . $HTTP_POST_VARS['sppcproducts_price3'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price3_qty'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price3_qty = '" . $HTTP_POST_VARS['sppcproducts_price3_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price4'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price4 = '" . $HTTP_POST_VARS['sppcproducts_price4'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price4_qty'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price4_qty = '" . $HTTP_POST_VARS['sppcproducts_price4_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price5'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price5 = '" . $HTTP_POST_VARS['sppcproducts_price5'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price5_qty'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price5_qty = '" . $HTTP_POST_VARS['sppcproducts_price5_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price6'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price6 = '" . $HTTP_POST_VARS['sppcproducts_price6'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price6_qty'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price6_qty = '" . $HTTP_POST_VARS['sppcproducts_price6_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price7'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price7 = '" . $HTTP_POST_VARS['sppcproducts_price7'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price7_qty'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price7_qty = '" . $HTTP_POST_VARS['sppcproducts_price7_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price8'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price8 = '" . $HTTP_POST_VARS['sppcproducts_price8'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price8_qty'][$customers_group['customers_group_id']])) {

    $sppc_update_query .= " products_price8_qty = '" . $HTTP_POST_VARS['sppcproducts_price8_qty'][$customers_group['customers_group_id']] . "' ";

} // now we need to get rid of the last comma in the query string...

    $sppc_update_query = rtrim($sppc_update_query);

    $query_string_length = strlen($sppc_update_query);

  if (substr($sppc_update_query, -1) == ",") {

  $sppc_update_query = substr($sppc_update_query, $query_string_length-1);

  }

 

    tep_db_query("update " . TABLE_PRODUCTS_GROUPS . " " . $sppc_update_query . " where customers_group_id = '" . $attributes['customers_group_id'] . "' and products_id = '" . $products_id . "'");

    //  $attributes = tep_db_fetch_array($attributes_query);

      }

  /*    elseif (($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] == $attributes['customers_group_price'])) {

    $attributes = tep_db_fetch_array($attributes_query);

      } */

    }  else { // checkbox is unchecked

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

      $attributes = tep_db_fetch_array($attributes_query);

    }

// next } : end if (tep_db_num_rows($attributes_query) > 0)

  }

  elseif (($HTTP_POST_VARS['sppcoption'][$customers_group['customers_group_id']]) && ($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] != '')) {

      $sppc_insert_query = "set products_id = '" . $products_id . "', customers_group_id= '" . $customers_group['customers_group_id'] . "', ";

if (isset($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= "customers_group_price = '" . $HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_qty_blocks'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_qty_blocks = '" . $HTTP_POST_VARS['sppcproducts_qty_blocks'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price1'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price1 = '" . $HTTP_POST_VARS['sppcproducts_price1'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price1_qty'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price1_qty = '" . $HTTP_POST_VARS['sppcproducts_price1_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price2'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price2 = '" . $HTTP_POST_VARS['sppcproducts_price2'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price2_qty'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price2_qty = '" . $HTTP_POST_VARS['sppcproducts_price2_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price3'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price3 = '" . $HTTP_POST_VARS['sppcproducts_price3'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price3_qty'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price3_qty = '" . $HTTP_POST_VARS['sppcproducts_price3_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price4'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price4 = '" . $HTTP_POST_VARS['sppcproducts_price4'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price4_qty'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price4_qty = '" . $HTTP_POST_VARS['sppcproducts_price4_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price5'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price5 = '" . $HTTP_POST_VARS['sppcproducts_price5'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price5_qty'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price5_qty = '" . $HTTP_POST_VARS['sppcproducts_price5_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price6'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price6 = '" . $HTTP_POST_VARS['sppcproducts_price6'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price6_qty'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price6_qty = '" . $HTTP_POST_VARS['sppcproducts_price6_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price7'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price7 = '" . $HTTP_POST_VARS['sppcproducts_price7'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price7_qty'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price7_qty = '" . $HTTP_POST_VARS['sppcproducts_price7_qty'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price8'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price8 = '" . $HTTP_POST_VARS['sppcproducts_price8'][$customers_group['customers_group_id']] . "', ";

} if (isset($HTTP_POST_VARS['sppcproducts_price8_qty'][$customers_group['customers_group_id']])) {

    $sppc_insert_query .= " products_price8_qty = '" . $HTTP_POST_VARS['sppcproducts_price8_qty'][$customers_group['customers_group_id']] . "' ";

} // now we need to get rid of the last comma in the query string...

    $sppc_insert_query = rtrim($sppc_insert_query);

    $query_string_length = strlen($sppc_insert_query);

  if (substr($sppc_insert_query, -1) == ",") {

  $sppc_insert_query = substr($sppc_insert_query, $query_string_length-1);

  }

 

    tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " " . $sppc_insert_query . "");

//    $attributes = tep_db_fetch_array($attributes_query);

  } // end elseif

} // end while ($customers_group = tep_db_fetch_array($customers_group_query))

  // EOF Separate Pricing Per Customer, Price Break 1.11.3 mod

 

          $languages = tep_get_languages();

          for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

            $language_id = $languages[$i]['id'];

 

            $sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

                                    'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),

                                    'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

        // ; to , if problem - jg

$sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

                                    'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),

                                    'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]),

                                    'products_head_title_tag' => tep_db_prepare_input($HTTP_POST_VARS['products_head_title_tag'][$language_id]),

                                    'products_head_desc_tag' => tep_db_prepare_input($HTTP_POST_VARS['products_head_desc_tag'][$language_id]),

                                    'products_head_keywords_tag' => tep_db_prepare_input($HTTP_POST_VARS['products_head_keywords_tag'][$language_id])); 

 

            if ($action == 'insert_product') {

              $insert_sql_data = array('products_id' => $products_id,

                                      'language_id' => $language_id);

 

              $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

              tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);

            } elseif ($action == 'update_product') {

              tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");

            }

          }

 

          if (USE_CACHE == 'true') {

            tep_reset_cache_block('categories');

            tep_reset_cache_block('also_purchased');

          }

 

          tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

        }

        break;

      case 'copy_to_confirm':

        if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {

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

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

 

          if ($HTTP_POST_VARS['copy_as'] == 'link') {

            if ($categories_id != $current_category_id) {

              $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");

              $check = tep_db_fetch_array($check_query);

              if ($check['total'] < '1') {

                tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");

              }

            } else {

              $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');

            }

          } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') { // BOF changes for Price Break 1.11.3// big image ammended

//            $product_query = tep_db_query("select products_quantity, products_model, products_image, products_mediumimage, products_largeimage, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

//            $product = tep_db_fetch_array($product_query);

 

//            tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_mediumimage, products_largeimage, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_mediumimage']) . "', '" . tep_db_input($product['products_largeimage']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

 

            $product_query = tep_db_query("select products_quantity, products_model, products_image, products_mediumimage, products_largeimage, products_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, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

            $product = tep_db_fetch_array($product_query);

 

            tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_mediumimage, products_largeimage, products_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, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_mediumimage']) . "', '" . tep_db_input($product['products_largeimage']) . "', '" . tep_db_input($product['products_price']) . "', '" . tep_db_input($product['products_price1']) . "', '" . tep_db_input($product['products_price2']) . "', '" . tep_db_input($product['products_price3']) . "', '" . tep_db_input($product['products_price4']) . "', '" . tep_db_input($product['products_price5']) . "', '" . tep_db_input($product['products_price6']) . "', '" . tep_db_input($product['products_price7']) . "', '" . tep_db_input($product['products_price8']) .  "', '" . tep_db_input($product['products_price1_qty']) . "', '" . tep_db_input($product['products_price2_qty']) . "', '" . tep_db_input($product['products_price3_qty']) . "', '" . tep_db_input($product['products_price4_qty']) . "', '" . tep_db_input($product['products_price5_qty']) . "', '" . tep_db_input($product['products_price6_qty']) . "', '" . tep_db_input($product['products_price7_qty']) . "', '" . tep_db_input($product['products_price8_qty']) ."', '" . tep_db_input($product['products_qty_blocks']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

    // EOF changes for Price Break 1.11.3

            $dup_products_id = tep_db_insert_id();

 

// big image ammended stops

 

            $description_query = tep_db_query("select language_id, products_name, products_description, products_head_title_tag, products_head_desc_tag, products_head_keywords_tag, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");

            while ($description = tep_db_fetch_array($description_query)) {

              tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_head_title_tag, products_head_desc_tag, products_head_keywords_tag, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_head_title_tag']) . "', '" . tep_db_input($description['products_head_desc_tag']) . "', '" . tep_db_input($description['product

Link to comment
Share on other sites

Here is the rest of the categories.php file:

 

Thanks, Janet

 

        <tr>

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

          </tr>

          <tr>

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

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('categories_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $cInfo->categories_image . tep_draw_hidden_field('categories_previous_image', $cInfo->categories_image); ?></td>

          </tr>

          <tr>

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

          </tr>

          <tr>

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

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'); ?></td>

          </tr>

          <tr>

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

          </tr>

        </table></td>

      </tr>

      <tr>

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

      </tr>

      <tr>

        <td class="main" align="right"><?php echo tep_draw_hidden_field('categories_date_added', (($cInfo->date_added) ? $cInfo->date_added : date('Y-m-d'))) . tep_draw_hidden_field('parent_id', $cInfo->parent_id) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '  <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $HTTP_GET_VARS['cID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>

      </tr></form>

<?php

 

  //----- new_category_preview (active when ALLOW_CATEGORY_DESCRIPTIONS is 'true') -----

  } elseif ($HTTP_GET_VARS['action'] == 'new_category_preview') {

    if ($HTTP_POST_VARS) {

      $cInfo = new objectInfo($HTTP_POST_VARS);

      $categories_name = $HTTP_POST_VARS['categories_name'];

      $categories_heading_title = $HTTP_POST_VARS['categories_heading_title'];

      $categories_description = $HTTP_POST_VARS['categories_description'];

 

// copy image only if modified

        $categories_image = new upload('categories_image');

        $categories_image->set_destination(DIR_FS_CATALOG_IMAGES);

        if ($categories_image->parse() && $categories_image->save()) {

          $categories_image_name = $categories_image->filename;

        } else {

        $categories_image_name = $HTTP_POST_VARS['categories_previous_image'];

      }

#    if ( ($categories_image != 'none') && ($categories_image != '') ) {

#      $image_location = DIR_FS_CATALOG_IMAGES . $categories_image_name;

#      if (file_exists($image_location)) @unlink($image_location);

#      copy($categories_image, $image_location);

#    } else {

#      $categories_image_name = $HTTP_POST_VARS['categories_previous_image'];

#    }

    } else {

      $category_query = tep_db_query("select c.categories_id, cd.language_id, cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and c.categories_id = '" . $HTTP_GET_VARS['cID'] . "'");

      $category = tep_db_fetch_array($category_query);

 

 

      $cInfo = new objectInfo($category);

      $categories_image_name = $cInfo->categories_image;

    }

 

    $form_action = ($HTTP_GET_VARS['cID']) ? 'update_category' : 'insert_category';

 

    echo tep_draw_form($form_action, FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $HTTP_GET_VARS['cID'] . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

 

    $languages = tep_get_languages();

    for ($i=0; $i<sizeof($languages); $i++) {

      if ($HTTP_GET_VARS['read'] == 'only') {

        $cInfo->categories_name = tep_get_category_name($cInfo->categories_id, $languages[$i]['id']);

        $cInfo->categories_heading_title = tep_get_category_heading_title($cInfo->categories_id, $languages[$i]['id']);

        $cInfo->categories_description = tep_get_category_description($cInfo->categories_id, $languages[$i]['id']);

      } else {

        $cInfo->categories_name = tep_db_prepare_input($categories_name[$languages[$i]['id']]);

        $cInfo->categories_heading_title = tep_db_prepare_input($categories_heading_title[$languages[$i]['id']]);

        $cInfo->categories_description = tep_db_prepare_input($categories_description[$languages[$i]['id']]);

      }

?>

      <tr>

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

          <tr>

            <td class="pageHeading"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . $cInfo->categories_heading_title; ?></td>

          </tr>

        </table></td>

      </tr>

      <tr>

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

      </tr>

      <tr>

        <td class="main"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . $categories_image_name, $cInfo->categories_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . $cInfo->categories_description; ?></td>

      </tr>

 

<?php

    }

    if ($HTTP_GET_VARS['read'] == 'only') {

      if ($HTTP_GET_VARS['origin']) {

        $pos_params = strpos($HTTP_GET_VARS['origin'], '?', 0);

        if ($pos_params != false) {

          $back_url = substr($HTTP_GET_VARS['origin'], 0, $pos_params);

          $back_url_params = substr($HTTP_GET_VARS['origin'], $pos_params + 1);

        } else {

          $back_url = $HTTP_GET_VARS['origin'];

          $back_url_params = '';

        }

      } else {

        $back_url = FILENAME_CATEGORIES;

        $back_url_params = 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id;

      }

?>

      <tr>

        <td align="right"><?php echo '<a href="' . tep_href_link($back_url, $back_url_params, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

      </tr>

<?php

    } else {

?>

      <tr>

        <td align="right" class="smallText">

<?php

/* Re-Post all POST'ed variables */

      reset($HTTP_POST_VARS);

      while (list($key, $value) = each($HTTP_POST_VARS)) {

        if (!is_array($HTTP_POST_VARS[$key])) {

          echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));

        }

      }

      $languages = tep_get_languages();

      for ($i=0; $i<sizeof($languages); $i++) {

        echo tep_draw_hidden_field('categories_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($categories_name[$languages[$i]['id']])));

        echo tep_draw_hidden_field('categories_heading_title[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($categories_heading_title[$languages[$i]['id']])));

        echo tep_draw_hidden_field('categories_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($categories_description[$languages[$i]['id']])));

      }

      echo tep_draw_hidden_field('X_categories_image', stripslashes($categories_image_name));

      echo tep_draw_hidden_field('categories_image', stripslashes($categories_image_name));

 

      echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '  ';

 

      if ($HTTP_GET_VARS['cID']) {

        echo tep_image_submit('button_update.gif', IMAGE_UPDATE);

      } else {

        echo tep_image_submit('button_insert.gif', IMAGE_INSERT);

      }

      echo '  <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $HTTP_GET_VARS['cID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';

?></td>

      </tr></form>

<?php

    }

  } elseif ($action == 'new_product') { // changed for Price Break 1.11.3

    $parameters = array('products_name' => '',

                      'products_description' => '',

                      'products_url' => '',

                      'products_id' => '',

                      'products_quantity' => '',

                      'products_model' => '',

                      'products_image' => '',

// big image begins

                      'products_mediumimage' => '',

                      'products_largeimage' => '',

// big image ends

                      'products_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' => '',

                      'products_weight' => '',

                      'products_date_added' => '',

                      'products_last_modified' => '',

                      'products_date_available' => '',

                      'products_status' => '',

                      'products_tax_class_id' => '',

                      'manufacturers_id' => '');

 

    $pInfo = new objectInfo($parameters);

 

    if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {// product_query changed for Price Break 1.11.3

// Edited for Header Tags

// big image amended

      $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag,  pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_mediumimage, p.products_largeimage, p.products_price, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

      $product = tep_db_fetch_array($product_query);

     

 

      $pInfo->objectInfo($product);

    } elseif (tep_not_null($HTTP_POST_VARS)) {

      $pInfo->objectInfo($HTTP_POST_VARS);

      $products_name = $HTTP_POST_VARS['products_name'];

      $products_description = $HTTP_POST_VARS['products_description'];

      $products_url = $HTTP_POST_VARS['products_url'];

    }

 

    $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));

    $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");

    while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {

      $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],

                                    'text' => $manufacturers['manufacturers_name']);

    }

 

 

//JJG building attributes array - Begin

    $attribute_sets_array = array(array('id' => '', 'text' => TEXT_NONE));

    $attribute_sets_query = tep_db_query("select products_attributes_sets_id, products_attributes_sets_name from " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " order by products_attributes_sets_name");

    while ($attribute_sets = tep_db_fetch_array($attribute_sets_query)) {

      $attribute_sets_array[] = array('id' => $attribute_sets['products_attributes_sets_id'],

                                    'text' => $attribute_sets['products_attributes_sets_name']);

    }

//JJG building attributes array - End

 

 

    $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));

    $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");

    while ($tax_class = tep_db_fetch_array($tax_class_query)) {

      $tax_class_array[] = array('id' => $tax_class['tax_class_id'],

                                'text' => $tax_class['tax_class_title']);

    }

 

    $languages = tep_get_languages();

 

    if (!isset($pInfo->products_status)) $pInfo->products_status = '1';

    switch ($pInfo->products_status) {

      case '0': $in_status = false; $out_status = true; break;

      case '1':

      default: $in_status = true; $out_status = false;

    }

?>

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

<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>

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

  var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_product", "products_date_available","btnDate1","<?php echo $pInfo->products_date_available; ?>",scBTNMODE_CUSTOMBLUE);

//--></script>

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

var tax_rates = new Array();

<?php

    for ($i=0, $n=sizeof($tax_class_array); $i<$n; $i++) {

      if ($tax_class_array[$i]['id'] > 0) {

        echo 'tax_rates["' . $tax_class_array[$i]['id'] . '"] = ' . tep_get_tax_rate_value($tax_class_array[$i]['id']) . ';' . "\n";

      }

    }

?>

 

function doRound(x, places) {

  return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);

}

 

function getTaxRate() {

  var selected_value = document.forms["new_product"].products_tax_class_id.selectedIndex;

  var parameterVal = document.forms["new_product"].products_tax_class_id[selected_value].value;

 

  if ( (parameterVal > 0) && (tax_rates[parameterVal] > 0) ) {

    return tax_rates[parameterVal];

  } else {

    return 0;

  }

}

 

function updateGross() {

  var taxRate = getTaxRate();

  var grossValue = document.forms["new_product"].products_price.value;

 

  if (taxRate > 0) {

    grossValue = grossValue * ((taxRate / 100) + 1);

  }

 

  document.forms["new_product"].products_price_gross.value = doRound(grossValue, 4);

}

 

function updateNet() {

  var taxRate = getTaxRate();

  var netValue = document.forms["new_product"].products_price_gross.value;

 

  if (taxRate > 0) {

    netValue = netValue / ((taxRate / 100) + 1);

  }

 

  document.forms["new_product"].products_price.value = doRound(netValue, 4);

}

//--></script>

    <?php echo tep_draw_form('new_product', FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?>

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

      <tr>

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

          <tr>

            <td class="pageHeading"><?php echo sprintf(TEXT_NEW_PRODUCT, tep_output_generated_category_path($current_category_id)); ?></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>

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

          <tr>

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

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_status', '1', $in_status) . ' ' . TEXT_PRODUCT_AVAILABLE . ' ' . tep_draw_radio_field('products_status', '0', $out_status) . ' ' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td>

          </tr>

          <tr>

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

          </tr>

          <tr>

            <td class="main"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' '; ?><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>

          </tr>

          <tr>

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

          </tr>

          <tr>

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

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $pInfo->manufacturers_id); ?></td>

          </tr>

          <tr>

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

          </tr>

 

<!-- //JJG building drop down list - Begin -->

 

<?php

 

 

if( empty($pInfo->products_id) ){

 

    $iteration = 0;

 

}else{

 

            $getOptionsCount_query = tep_db_query('SELECT count(  DISTINCT options_id ) as count

            FROM  '. TABLE_PRODUCTS_ATTRIBUTES .'

            WHERE  `products_id`  ='.$pInfo->products_id);

 

 

    $arr_getOptionsCount = tep_db_fetch_array($getOptionsCount_query);

 

    $arr_pas_id = jjg_db_getAttributeSetId($pInfo->products_id, $action);

    if( !empty($arr_pas_id) ){

 

        $iteration = $arr_getOptionsCount['count'];

   

    }

}

 

for($i=0; $i<=$iteration; $i++){

?>

          <tr>

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

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('products_attributes_sets_id_'.$i, $attribute_sets_array, $arr_pas_id[$i] ); ?></td>

          </tr>

<?php

}

?>

          <tr>

            <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?>

            <?php echo tep_draw_hidden_field('AttributeSetCount', $arr_getOptionsCount['count']+1); ?>

            </td>

          </tr>

<!-- //JJG building drop down list - End -->

<?php

    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

          <tr>

            <td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>

            <td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? $products_name[$languages[$i]['id']] : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>

          </tr>

<?php

    }

?>

          <tr>

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

          </tr>

          <tr bgcolor="#ebebff">

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

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateGross()"'); ?></td>

          </tr>

          <tr bgcolor="#ebebff">

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

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>

          </tr>

          <tr bgcolor="#ebebff">

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

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price_gross', $pInfo->products_price, 'OnKeyUp="updateNet()"'); ?></td>

          </tr>

          <tr>

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

          </tr>

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

updateGross();

//--></script>

<!-- BOF Price Break 1.11.3 Retail -->

<?php $name_retail_query = tep_db_query("select customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '0'");

$name_retail = tep_db_fetch_array($name_retail_query);

?>

          <tr bgcolor="#ebebff">

            <td class="main" colspan="2"><strong><?php echo $name_retail['customers_group_name'] ?>:</strong></td>

          </tr>

          <tr>

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

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_qty_blocks', $pInfo->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 echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price1', $pInfo->products_price1, 'size="10"'); ?></td>

            <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE1_QTY; ?></td>

            <td class="main" align="left"><?php echo tep_draw_input_field('products_price1_qty', $pInfo->products_price1_qty, 'size="10"'); ?></td>

            </tr></table></td>

          </tr>

          <tr>

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

            <td colspan="3" align="left"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>

            <td class="main" align="left"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price2', $pInfo->products_price2, 'size="10"'); ?></td>

            <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE2_QTY; ?></td>

            <td class="main" align="left"><?php echo tep_draw_input_field('products_price2_qty', $pInfo->products_price2_qty, 'size="10"'); ?></td>

            </tr></table></td>

          </tr>

          <tr>

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

            <td colspan="3" align="left"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>

            <td class="main" align="left"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price3', $pInfo->products_price3, 'size="10"'); ?></td>

            <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE3_QTY; ?></td>

            <td class="main" align="left"><?php echo tep_draw_input_field('products_price3_qty', $pInfo->products_price3_qty, 'size="10"'); ?></td>

            </tr></table></td>

          </tr>

          <tr>

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

            <td colspan="3" align="left"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>

            <td class="main" align="left"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price4', $pInfo->products_price4, 'size="10"'); ?></td>

            <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE4_QTY; ?></td>

            <td class="main" align="left"><?php echo tep_draw_input_field('products_price4_qty', $pInfo->products_price4_qty, 'size="10"'); ?></td>

            </tr></table></td>

          </tr>

          <tr>

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

            <td colspan="3" align="left"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>

            <td class="main" align="left"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price5', $pInfo->products_price5, 'size="10"'); ?></td>

            <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE5_QTY; ?></td>

            <td class="main" align="left"><?php echo tep_draw_input_field('products_price5_qty', $pInfo->products_price5_qty, 'size="10"'); ?></td>

            </tr></table></td>

          </tr>

          <tr>

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

            <td colspan="3" align="left"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>

            <td class="main" align="left"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price6', $pInfo->products_price6, 'size="10"'); ?></td>

            <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE6_QTY; ?></td>

            <td class="main" align="left"><?php echo tep_draw_input_field('products_price6_qty', $pInfo->products_price6_qty, 'size="10"'); ?></td>

            </tr></table></td>

          </tr>

          <tr>

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

            <td colspan="3" align="left"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>

            <td class="main" align="left"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price7', $pInfo->products_price7, 'size="10"'); ?></td>

            <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE7_QTY; ?></td>

            <td class="main" align="left"><?php echo tep_draw_input_field('products_price7_qty', $pInfo->products_price7_qty, 'size="10"'); ?></td>

            </tr></table></td>

          </tr>

          <tr>

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

            <td colspan="3" align="left"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr>

            <td class="main" align="left"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price8', $pInfo->products_price8, 'size="10"'); ?></td>

            <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE8_QTY; ?></td>

            <td class="main" align="left"><?php echo tep_draw_input_field('products_price8_qty', $pInfo->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>

<!-- EOF Price Break 1.11.3 Retail -->

 

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

<?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&quot

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...