Guest Posted May 15, 2003 Posted May 15, 2003 I have found that adding the portion of the Seperate Pricing mod (to the Loaded 5 version) in admincategories.php causes two strange behaviors. First, whenever you create a new product or update an existing product the "seperate price" (in my case Wholesale) will get set to 0.0000 whether or not you put anything in the textbox. The second is if there are attributes available the very first attribute will always get set even if not checked...please, any help??!?!? admin/categories.php Around line 135 After: for ($i=0; $i<sizeof($product_categories); $i++) { tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . tep_db_input($product_id) . "' and categories_id = '" . tep_db_input($product_categories[$i]) . "'"); } Add: tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . tep_db_input($product_id) . "' "); Around line 230 After: if ($HTTP_GET_VARS['action'] == 'insert_product') { $insert_sql_data = array('products_id' => $products_id, 'language_id' => $language_id); $sql_data_array = tep_array_merge($sql_data_array, $insert_sql_data); tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array); } elseif ($HTTP_GET_VARS['action'] == 'update_product') { tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', 'products_id = '' . tep_db_input($products_id) . '' and language_id = '' . $language_id . '''); } } Add: $customers_group_query = tep_db_query("select distinct customers_group_id, customers_group_name from " . TABLE_CUSTOMERS . " 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['option'][$customers_group['customers_group_id']]) {// this is checking if the check box is checked if ( ($HTTP_POST_VARS['price'][$customers_group['customers_group_id']] <> $attributes['customers_group_price']) && ($attributes['customers_group_id'] == $customers_group['customers_group_id']) ) { tep_db_query("update " . TABLE_PRODUCTS_GROUPS . " set customers_group_price = '" . $HTTP_POST_VARS['price'][$customers_group['customers_group_id']] . "', products_price = '" . $HTTP_POST_VARS['products_price'] . "' where customers_group_id = '" . $attributes['customers_group_id'] . "' and products_id = '" . $products_id . "'"); $attributes = tep_db_fetch_array($attributes_query); } elseif (($HTTP_POST_VARS['price'][$customers_group['customers_group_id']] == $attributes['customers_group_price'])) { $attributes = tep_db_fetch_array($attributes_query); } } else { 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); } } elseif (($HTTP_POST_VARS['option'][$customers_group['customers_group_id']]) && ($HTTP_POST_VARS['price'][$customers_group['customers_group_id']] != '')) { tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " (products_id, products_price, customers_group_id, customers_group_price) values ('" . $products_id . "', '" . $HTTP_POST_VARS['products_price'] . "', '" . $customers_group['customers_group_id'] . "', '" . $HTTP_POST_VARS['price'][$customers_group['customers_group_id']] . "')"); $attributes = tep_db_fetch_array($attributes_query); } } Around line 507 After: <tr> <td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td> </tr> </table></td> </tr> <tr> Add: <td><table border="0" cellspacing="0" cellpadding="2"> <tr valign="top"> <?php $customers_group_query = tep_db_query("select distinct customers_group_id, customers_group_name from " . TABLE_CUSTOMERS . " where customers_group_id != '" . 0 . "' order by customers_group_id"); $header = false; while ($customers_group = tep_db_fetch_array($customers_group_query)) { if (!$header) { $header = true; ?> <td><table border="0" cellpadding="0" cellspacing="0"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent" colspan="3"><?php echo $options['products_options_name']; ?></td> </tr> <?php } if (tep_db_num_rows($customers_group_query) > 0) { $attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $pInfo->products_id . "' and customers_group_id = '" . $customers_group['customers_group_id'] . "' order by customers_group_id"); } else { $attributes = array('customers_group_id' => 'new'); } ?> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo tep_draw_checkbox_field('option[' . $customers_group['customers_group_id'] . ']', 'option[' . $customers_group['customers_group_id'] . ']', true) . ' ' . $customers_group['customers_group_name']; ?> </td> <td class="dataTableContent"><?php if ($attributes = tep_db_fetch_array($attributes_query)) { echo tep_draw_input_field('price[' . $customers_group['customers_group_id'] . ']', $attributes['customers_group_price'], 'size="7"'); } else { echo tep_draw_input_field('price[' . $customers_group['customers_group_id'] . ']', '', 'size="7"'); } ?></td> </tr> <?php } if ($header) { ?> </table></td> <?php } ?> </tr> </table></td> </tr> Around line 690 Replace: if (!is_array($HTTP_POST_VARS[$key])) { With: if (is_array($value)) { while (list($k, $v) = each($value)) { echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v))); } } else { A few lines after, delete: } $languages = tep_get_languages(); for ($i=0; $i<sizeof($languages); $i++) { echo tep_draw_hidden_field('products_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_name[$languages[$i]['id']]))); echo tep_draw_hidden_field('products_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_description[$languages[$i]['id']]))); echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']]))); (i have searched and searched with no luck...) Jesse Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.