Jump to content

AGIBBS

Members
  • Content count

    19
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Adam
  1. AGIBBS

    Seperate Pricing Per Customer v3.5

    @@14steve14 thanks for the advice. Have you had any issues after install with the price not showing up on the product listing and search pages but it shows up ok in the product info page. All defaults are set to GPB?? Any ideas?? Thanks,
  2. AGIBBS

    Seperate Pricing Per Customer v3.5

    Sorted that part onto the next.....
  3. AGIBBS

    Seperate Pricing Per Customer v3.5

    Combining QPBPP with SPPC I really need some help with this one folks!! I have installed SPPC 4.2 with OSC 2.3.1 and every thing seems to work fine, I am now trying to install QPBPP with it as well but every time I upload the file admin/categories.php I get a blank page. I've noticed that some of the code mentioned in the install file do not exist in the file I am editing. Here are the lines that do not exist... <script language="javascript" src="includes/general.js"></script> // BOF Separate Pricing per Customer if (is_array($value)) { while (list($k, $v) = each($value)) { echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v))); } } else { // EOF Separate Pricing per Customer Thanks in advance.
  4. AGIBBS

    Seperate Pricing Per Customer v3.5

    Not all code added I thought I had sussed it but I haven't. Any one who can help with this one file it would really help!! Thanks, :)
  5. AGIBBS

    Seperate Pricing Per Customer v3.5

    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_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' => (int)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 QPBPP for SPPC 'products_qty_blocks' => (($i = (int)tep_db_prepare_input($_POST['products_qty_blocks'][0])) < 1) ? 1 : $i, 'products_min_order_qty' => (($min_i = (int)tep_db_prepare_input($_POST['products_min_order_qty'][0])) < 1) ? 1 : $min_i, // EOF QPBPP for SPPC 'products_date_available' => $products_date_available, 'products_weight' => (float)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' => (int)tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id'])); $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $sql_data_array['products_image'] = tep_db_prepare_input($products_image->filename); } 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(); 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 . "'"); // BOF QPBPP for SPPC // BOF entries in products_groups $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, products_qty_blocks, products_min_order_qty 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); // set default values for quantity blocks and min order quantity $pg_products_qty_blocks = 1; $pg_products_min_order_qty = 1; $delete_row_from_pg = false; if (isset($_POST['products_qty_blocks'][$customers_group['customers_group_id']]) && (int)$_POST['products_qty_blocks'][$customers_group['customers_group_id']] > 1) { $pg_products_qty_blocks = (int)$_POST['products_qty_blocks'][$customers_group['customers_group_id']]; } if (isset($_POST['products_min_order_qty'][$customers_group['customers_group_id']]) && (int)$_POST['products_min_order_qty'][$customers_group['customers_group_id']] > 1) { $pg_products_min_order_qty = (int)$_POST['products_min_order_qty'][$customers_group['customers_group_id']]; } if ($_POST['sppcprice'][$customers_group['customers_group_id']] == '' && $pg_products_qty_blocks == 1 && $pg_products_min_order_qty == 1) { $delete_row_from_pg = true; // no need to have default values for qty blocks and min order qty in the table } if ($_POST['sppcprice'][$customers_group['customers_group_id']] == '') { $pg_cg_group_price = 'null'; } else { $pg_cg_group_price = "'" . (float)$_POST['sppcprice'][$customers_group['customers_group_id']] . "'"; } if (tep_db_num_rows($attributes_query) > 0 && $delete_row_from_pg == false) { // there is already a row inserted in products_groups, update instead of insert if ($_POST['sppcoption'][$customers_group['customers_group_id']]) { // this is checking if the check box is checked tep_db_query("update " . TABLE_PRODUCTS_GROUPS . " set customers_group_price = " . $pg_cg_group_price . ", products_qty_blocks = " . $pg_products_qty_blocks . ", products_min_order_qty = " . $pg_products_min_order_qty . " where customers_group_id = '" . $attributes['customers_group_id'] . "' and products_id = '" . $products_id . "'"); } else { tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $customers_group['customers_group_id'] . "' and products_id = '" . $products_id . "'"); } } elseif (tep_db_num_rows($attributes_query) > 0 && $delete_row_from_pg == true) { tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $customers_group['customers_group_id'] . "' and products_id = '" . $products_id . "'"); } elseif (($_POST['sppcoption'][$customers_group['customers_group_id']]) && $delete_row_from_pg == false) { tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " (products_id, customers_group_id, customers_group_price, products_qty_blocks, products_min_order_qty) values ('" . $products_id . "', '" . $customers_group['customers_group_id'] . "', " . $pg_cg_group_price . ", " . $pg_products_qty_blocks . ", " . $pg_products_min_order_qty . ")"); } } // end while ($customers_group = tep_db_fetch_array($customers_group_query)) // EOF entries in products_groups // BOF entries in products_to_discount_categories foreach ($_POST['discount_categories_id'] as $dc_cg_id => $dc_id) { $current_discount_category = (int)$_POST['current_discount_cat_id'][$dc_cg_id]; $new_discount_category = (int)$dc_id; $discount_category_result = qpbpp_insert_update_discount_cats($products_id, $current_discount_category, $new_discount_category, $dc_cg_id); if ($discount_category_result == false) { $messageStack->add_session(ERROR_UPDATE_INSERT_DISCOUNT_CATEGORY, 'error'); } } // end foreach ($_POST['discount_categories_id'] as $dc_cg_id => $dc_id // EOF entries in products_to_discount_categories // BOF entries in products_price_break foreach ($_POST['products_price_break'] as $pbb_cg_id => $price_break_array) { foreach ($price_break_array as $key1 => $products_price) { $pb_action = 'insert'; // re-set default to insert $where_clause = ''; if (isset($_POST['products_delete'][$pbb_cg_id][$key1]) && $_POST['products_delete'][$pbb_cg_id][$key1] == 'y' && isset($_POST['products_price_break_id'][$pbb_cg_id][$key1])) { $delete_from_ppb_array[] = (int)$_POST['products_price_break_id'][$pbb_cg_id][$key1]; continue; } if (!tep_not_null($products_price)) { continue; // if price is empty this price break is unused } elseif (!tep_not_null($_POST['products_qty'][$pbb_cg_id][$key1])) { continue; // if qty is not entered we will not update or insert this in the table } else { $sql_price_break_data_array = array( 'products_id' => (int)$products_id, 'products_price' => (float)$products_price, 'products_qty' => (int)$_POST['products_qty'][$pbb_cg_id][$key1], 'customers_group_id' => $pbb_cg_id ); if (isset($_POST['products_price_break_id'][$pbb_cg_id][$key1]) && (int)$_POST['products_price_break_id'][$pbb_cg_id][$key1] > 0) { $pb_action = 'update'; $where_clause = " products_price_break_id = '" . (int)$_POST['products_price_break_id'][$pbb_cg_id][$key1] . "'"; } tep_db_perform(TABLE_PRODUCTS_PRICE_BREAK, $sql_price_break_data_array, $pb_action, $where_clause); } // end if/else (!tep_not_null($products_price)) } // end foreach ($price_break_array as $key1 => $products_price) } // end foreach ($_POST['products_price_break'] as $pbb_cg_id => $price_break_array) // delete the unwanted price breaks using their products_price_break_id's if (isset($delete_from_ppb_array) && sizeof($delete_from_ppb_array > 0) && tep_not_null($delete_from_ppb_array[0])) { tep_db_query("delete from " . TABLE_PRODUCTS_PRICE_BREAK . " where products_price_break_id in (" . implode(',', $delete_from_ppb_array) . ")"); } // EOF entries in products_price_break // EOF QPBPP for SPPC } $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])); 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 . "'"); } } $pi_sort_order = 0; $piArray = array(0); foreach ($HTTP_POST_FILES as $key => $value) { // Update existing large product images if (preg_match('/^products_image_large_([0-9]+)$/', $key, $matches)) { $pi_sort_order++; $sql_data_array = array('htmlcontent' => tep_db_prepare_input($HTTP_POST_VARS['products_image_htmlcontent_' . $matches[1]]), 'sort_order' => $pi_sort_order); $t = new upload($key); $t->set_destination(DIR_FS_CATALOG_IMAGES); if ($t->parse() && $t->save()) { $sql_data_array['image'] = tep_db_prepare_input($t->filename); } tep_db_perform(TABLE_PRODUCTS_IMAGES, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and id = '" . (int)$matches[1] . "'"); $piArray[] = (int)$matches[1]; } elseif (preg_match('/^products_image_large_new_([0-9]+)$/', $key, $matches)) { // Insert new large product images $sql_data_array = array('products_id' => (int)$products_id, 'htmlcontent' => tep_db_prepare_input($HTTP_POST_VARS['products_image_htmlcontent_new_' . $matches[1]]));
  6. AGIBBS

    Seperate Pricing Per Customer v3.5

    I'm having to pot my code in seperate replies as its too long for an all in one hit... 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']; // 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 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 QPBPP for SPPC tep_db_query("delete from " . TABLE_PRODUCTS_PRICE_BREAK . " where products_id = '" . (int)$product_id . "'"); // EOF QPBPP for SPPC $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'); } 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'); }
  7. AGIBBS

    Seperate Pricing Per Customer v3.5

    @@14steve14 Hi Steve, I have tried this install as mentioned and can not get the catalog/admin/categories.php to work no matter how I do it with or without the optional javascript as stated at the end of the files edit. I have also noticed a couple of lines mentioned in the instructions which do not exist so maybe this is where I'm going wrong?? I have included my categories.php for any to look at and hopefully point me in the right direction. Thanks in advance. 1. <script language="javascript" src="includes/general.js"></script> 2. // BOF Separate Pricing per Customer if (is_array($value)) { while (list($k, $v) = each($value)) { echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v))); } } else { // EOF Separate Pricing per Customer <?php /* $Id$ adapted for Separate Pricing Per Customer v4.2 2007/08/05, QPBPP for SPPC v2.0 2008/11/23 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); // BOF QPBPP for SPPC // include the admin version of price formatter for the price breaks contribution require(DIR_WS_CLASSES . 'PriceFormatterAdmin.php'); $pf = new PriceFormatter; // EOF QPBPP for SPPC $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 'insert_category': case 'update_category': if (isset($HTTP_POST_VARS['categories_id'])) $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']); $sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']); $sql_data_array = array('sort_order' => (int)$sort_order); 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); 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 ($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'] . "'"); } } $categories_image = new upload('categories_image'); $categories_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($categories_image->parse() && $categories_image->save()) { tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' 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=' . $cPath . '&cID=' . $categories_id)); break; case 'delete_category_confirm':
  8. AGIBBS

    Seperate Pricing Per Customer v3.5

    Hi Steve, Many thanks for the reply, I will give it a go and see it turns out.
  9. AGIBBS

    Seperate Pricing Per Customer v3.5

    Hi, I have OSCommerce v2.3.1 with SPPC v4.2.2.2 installed and want the quantity price break addon installed as well. The version for SPPC 4.2.2 is v2 however it is not compatible with OSCommerce v2.3.1. Does any body have any new mods for v2.3.1 yet??? Thanks in advance
  10. AGIBBS

    Quantity Price Breaks

    Hi firstly I am a complete newbie to OSC so allow for errors:/ Can some one please tell me if this updated add-on can be used with products which have 2 attributes ie. size and colour and can it be used along side the QTPro??? Also is there a working site with it working, so I can have a peak. Thanks in advance A
  11. Hi, Has any one contributed a plugin or got an edit where I can have product attributes of size and colour but with multiple price levels?? like this site .... http://isenterprises.co.uk/product/F62216M/view I have th QTPro installed for a drop down but this only works with a size/colour combo. If any one can help it will be very much appreciated:)
×