cdamianou Posted April 16, 2004 Share Posted April 16, 2004 Update to my querys. Its the following i do not understand 1) add 'products_bundle' => '', after $parameters = array('products_name' => '', (line 358) 2) insert "p.products_bundle," into the SQL query one line below this one (LINE 377) if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) { so the whole line shoud be: $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, 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, p.products_bundle 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 . "'"); 3) add if (isset($pInfo->products_bundle) && $pInfo->products_bundle == "yes") { // this product is a bundle so get contents data $bundle_query = tep_db_query("SELECT products_bundles.subproduct_id, products_bundles.subproduct_qty, products_description.products_name FROM products_description INNER JOIN products_bundles ON products_bundles.subproduct_id=products_description.products_id WHERE products_bundles.bundle_id = " . $pInfo->products_id . " and language_id = '" . (int)$languages_id . "'"); while ($bundle_contents = tep_db_fetch_array($bundle_query)) { $bundle_array[] = array('id' => $bundle_contents['subproduct_id'], 'qty' => $bundle_contents['subproduct_qty'], 'name' => $bundle_contents['products_name']); } } ten lines lower than the above SQL query, just after the closing curly bracket "}" and before the code section starting with $manufacturers_array = array(array('id' => '', 'text' => '')); 4) add ", p.products_bundle" after p.manufacturers_id into the query on line 72, so the whole line is as follows: $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_bundle from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); 5) STEP 4 : create a table to store the bundle information. Run this SQL in your phpMyAdmin to add the table automatically. *************************************************************** CREATE TABLE `products_bundles` (`bundle_id` SMALLINT NOT NULL, `subproduct_id` SMALLINT NOT NULL, `subproduct_qty` TINYINT NOT NULL , PRIMARY KEY (`bundle_id`, `subproduct_id`)) Sorry if this is allot Thanks In Advance Quote Link to comment Share on other sites More sharing options...
a.niedermann Posted April 17, 2004 Share Posted April 17, 2004 Hi! Great mod. Unfortunately it wont work that good on my side. every time I set an bundle in the categories.php it don't save any bundle product. The only field which is getting stored is the ("yes" or blank). I checked the installation several times but I didn't found any bug yet. If you have any idea about it, please let me know Andreas Quote Link to comment Share on other sites More sharing options...
lushlongboards Posted April 19, 2004 Author Share Posted April 19, 2004 this looks like it could be something missed out while you are editing categories.php ... I don't have a server where I can test this mod against a clean copy of OSC, but it looks like CC has got it working fine with the instructions I wrote. chris Quote Link to comment Share on other sites More sharing options...
a.niedermann Posted April 19, 2004 Share Posted April 19, 2004 Hi Chris! Well, that could be! Because I have made several modifications on categories.php. My categories before the bundle modification looks like this: <?php /* $Id: categories.php,v 1.146 2003/07/11 14:40:27 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License Modify for cieto Featured Products 2.5 MS2 [email protected] */ require('includes/application_top.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 'setflag_featured': if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) { if (isset($HTTP_GET_VARS['pID'])) { tep_set_product_featured($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' => $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'] . "'"); } } if (HTML_AREA_WYSIWYG_DISABLE == 'Disable') { 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 . "'"); } } else { if (isset($HTTP_POST_VARS['categories_image']) && tep_not_null($HTTP_POST_VARS['categories_image']) && ($HTTP_POST_VARS['categories_image'] != 'none')) { tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($HTTP_POST_VARS['categories_image']) . "' 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': 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] . "'"); } $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'); } 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']), 'products_date_available' => $products_date_available, 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']), 'products_isbn' => tep_db_prepare_input($HTTP_POST_VARS['products_isbn']), 'products_versandfertig' => tep_db_prepare_input($HTTP_POST_VARS['products_versandfertig']), 'products_sonstiges' => tep_db_prepare_input($HTTP_POST_VARS['products_sonstiges']), 'products_verlag' => tep_db_prepare_input($HTTP_POST_VARS['products_verlag']), 'products_auflage' => tep_db_prepare_input($HTTP_POST_VARS['products_auflage']), 'products_autor' => tep_db_prepare_input($HTTP_POST_VARS['products_autor']), 'products_featured' => tep_db_prepare_input($HTTP_POST_VARS['products_featured']), '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']); } 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 . "'"); } $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_short' => tep_db_prepare_input($HTTP_POST_VARS['products_short'][$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 . "'"); } } 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') { $product_query = tep_db_query("SELECT products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_isbn, products_versandfertig, products_sonstiges, products_verlag, products_auflage, products_autor, 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_price, products_date_added, products_date_available, products_weight, products_isbn, products_versandfertig, products_sonstiges, products_verlag, products_auflage, products_autor, products_status, products_featured, 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_featured']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . tep_db_input($product['products_isbn']) . "', '" . tep_db_input($product['products_versandfertig']) . "', '" . tep_db_input($product['products_sonstiges']) . "', '" . tep_db_input($product['products_verlag']) . "','" . tep_db_input($product['products_auflage']) . "', '" . tep_db_input($product['products_autor']) . "','" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')"); $dup_products_id = tep_db_insert_id(); $description_query = tep_db_query("SELECT language_id, products_name, products_description, products_short, 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_short, 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_short']) . "', '" . tep_db_input($description['products_url']) . "', '0')"); } tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')"); $products_id = $dup_products_id; } if (USE_CACHE == 'true') { tep_reset_cache_block('categories'); tep_reset_cache_block('also_purchased'); } } tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id)); break; case 'new_product_preview': if (HTML_AREA_WYSIWYG_DISABLE == 'Disable') { // copy image only if modified $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $products_image_name = $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } } else { if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) { $products_image_name = $HTTP_POST_VARS['products_image']; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } } break; } } // check if the catalog image directory exists if (is_dir(DIR_FS_CATALOG_IMAGES)) { if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error'); } else { $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error'); } ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <script language="Javascript1.2"><!-- // load htmlarea // MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 - 2.2 MS2 Products Description HTML - Head _editor_url = "<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_ADMIN; ?>htmlarea/"; // URL to htmlarea files var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]); if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; } <?php if (HTML_AREA_WYSIWYG_BASIC_PD == 'Basic'){ ?> if (win_ie_ver >= 5.5) { document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_basic.js"'); document.write(' language="Javascript1.2"></scr' + 'ipt>'); } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); } <?php } else{ ?> if (win_ie_ver >= 5.5) { document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_advanced.js"'); document.write(' language="Javascript1.2"></scr' + 'ipt>'); } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); } <?php }?> // --></script> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <script language="javascript" src="includes/general.js"></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> <div id="spiffycalendar" class="text"></div> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"> <?php if ($action == 'new_product') { $parameters = array('products_name' => '', 'products_short' => '', 'products_description' => '', 'products_url' => '', 'products_id' => '', 'products_quantity' => '', 'products_model' => '', 'products_image' => '', 'products_price' => '', 'products_weight' => '', 'products_isbin' =>'', 'products_versandfertig'=>'', 'products_sonstiges'=>'', 'products_verlag'=>'', 'products_auflage'=>'', 'products_autor'=>'', 'products_date_added' => '', 'products_last_modified' => '', 'products_date_available' => '', 'products_featured' => '', 'products_status' => '', 'products_tax_class_id' => '', 'manufacturers_id' => ''); $pInfo = new objectInfo($parameters); if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) { $product_query = tep_db_query("SELECT pd.products_name, pd.products_description, pd.products_short, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_isbn, p.products_versandfertig, p.products_sonstiges, p.products_verlag, p.products_auflage, p.products_autor, 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_featured, 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_short = $HTTP_POST_VARS['products_short']; $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']); } $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; } if (!isset($pInfo->products_featured)) $pInfo->products_featured = '1'; switch ($pInfo->products_featured) { 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 class="main">Featured<?php echo TEXT_PRODUCTS_STATUS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_featured', '1', $in_status) . ' ' . TEXT_PRODUCT_AVAILABLE . ' ' . tep_draw_radio_field('products_featured', '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> <?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_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> <script language="javascript"><!-- updateGross(); //--></script> <?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) { ?> <tr> <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td> <td><table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td> <td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td> </tr> </table></td> </tr> <?php } ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></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_IMAGE; ?></td> <?php if (HTML_AREA_WYSIWYG_DISABLE == 'Disable') { ?> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('products_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?></td> <?php }else{ ?> <td class="main"><?php echo '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="main">' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' </td><td class="main">' . tep_draw_textarea_field('products_image', 'soft', '70', '2', $pInfo->products_image) . tep_draw_hidden_field('products_previous_image', $pInfo->products_image) . '</td></tr></table>'; ?></td> <?php } ?> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo 'ISBN-Nummer:'; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_isbn', $pInfo->products_isbn); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo 'Autor'; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_autor', $pInfo->products_autor); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo 'Verlag:'; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_verlag', $pInfo->products_verlag); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo 'Auflage:'; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_auflage', $pInfo->products_auflage); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo 'Sonstiges'; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_sonstiges', $pInfo->products_sonstiges); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo 'Versandfertig:'; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_versandfertig', $pInfo->products_versandfertig); ?></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_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> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <?php for ($i=0, $n= Quote Link to comment Share on other sites More sharing options...
cdamianou Posted April 19, 2004 Share Posted April 19, 2004 Hi Is their anyone willing to atempt this instelation for me? Of course you will be rewarded. Thanks in advance Quote Link to comment Share on other sites More sharing options...
lushlongboards Posted April 20, 2004 Author Share Posted April 20, 2004 Andreas - can you post your categories.php after you have modified it and I'll see if I can spot anything. chris Quote Link to comment Share on other sites More sharing options...
whoiswes Posted April 20, 2004 Share Posted April 20, 2004 Chris (and everyone else)... I installed the Bundled Products mod two days ago in the hopes it would be the answer to our problem of needing a one to many relationship between components and products. It has! Although it doesn't do everything we need it to, I have been able to mod our existing scripts so that our system is finally 100% functional. I had created a script that did basically the same thing that your mod does, but couldn't figure out how to update the shopping cart quantities to accurately reflect the current stock level of a product, based on the subproduct quantities. In other words, we wanted to limit a customer to adding ONLY the number of products we have on hand. Before I looked at your mod, I couldn't get my head wrapped around the problem, and couldn't find a way to keep a running total of what subproducts were in the cart, and the quantity remaining on each. After having a lightbulb go off, I am using some session variables as temporary containers to keep track of our subproduct quantities during the shopping process. If it sounds complicated it is, and it's taken several days of brain melting to get to this point. The reason I am telling you all of this is because installing your mod gave me the idea and allowed us to finish this particular part of the project. For that, I am incredibly thankful. My previous solution was almost exactly the same as yours but for some reason, your solution gave me the idea that worked out in the end. If anyone wants to know more, I will do what I can. Most of you could probably do a much better job than I have - I am not an expert by any means, but am learning more and more every day, even after two years of using PHP almost daily... Thanks again!!! Wes Quote Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted April 24, 2004 Share Posted April 24, 2004 Great mod. Unfortunately it wont work that good on my side.every time I set an bundle in the categories.php it don't save any bundle product. The only field which is getting stored is the ("yes" or blank). Hi, I installed this mod without too many problems yesterday. The described issue I encountered when I copied an existing bundle, when creating a bundle from scratch I have not encountered this issue. Additionally, I found the following limitations: - special prices not taken into account (fixed it) - no language support (working on this) Quote KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
Guest Posted April 25, 2004 Share Posted April 25, 2004 I installed this mod tonight and now can not edit any existing products but can add new get this error when i try to edit a product can anyone help Warning: reset(): Passed variable is not an array or object in /data/members/paid/e/a/easyinkz.co.uk/htdocs/www/admin/includes/classes/object_info.php on line 17 Warning: Variable passed to each() is not an array or object in /data/members/paid/e/a/easyinkz.co.uk/htdocs/www/admin/includes/classes/object_info.php on line 18 thanks Quote Link to comment Share on other sites More sharing options...
langers Posted April 26, 2004 Share Posted April 26, 2004 Installed this with no problems on a heavily modded site. Only problem for me is that there is no support for attributes :( Quote Link to comment Share on other sites More sharing options...
safoo Posted April 26, 2004 Share Posted April 26, 2004 (edited) I finally got around to installing this contribution. The instructions are so simple and I had no problems getting this to work without any erros on my heavily modded site. The only issue I am having is that when I go to 'edit' a bundle product in admin, the java fields for the bundles are empty and I have to re-enter the information. Shouldn't the bundle ='yes' field and the slave products hold their value when I go to edit the bundle? It creates the bundle correctly, the only issue is in editing the product. Andreas...did you correct your problem? ( I am double checking my categories.php just to make sure I didn't make any errors in copying the code) Edited April 26, 2004 by safoo Quote Link to comment Share on other sites More sharing options...
safoo Posted April 26, 2004 Share Posted April 26, 2004 (edited) Edit: Found the problem. In the categories.php, for the part where I added $product_query = tep_db_query("select pd.products_name... I had that line a few lines underneath, and not next line after the IF statement. So the old query was still being used since it was a few lines below.. Andreas, make sure that you do not have the "$product_query = tep_db_query..." twice in your code. bruyndoncx Could you share your code to have the savings shown to the customer reflect the sale price of the bundle. It still calculates using the regular price of the slave products and the specials price of the master product correct? Also, to make the bundles copy over when you duplicate a product could work if you look for the code in categories.php inside the " elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') " statement. Thanks in advance. Edited April 26, 2004 by safoo Quote Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted April 26, 2004 Share Posted April 26, 2004 My bundle code in product_info.php looks now like this - note there are some more cosmetic changes ... but special sections are flagged as "//CB" ... <!-- start bundle --> <?php if ($product_info['products_bundle'] == "yes") { $products_bundle = $product_info['products_bundle']; echo TEXT_BUNDLE_CONTENTS . "<br><table>"; $bundle_query = tep_db_query(" SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id = " . tep_get_prid($products_id) . " and language_id = '" . (int)$languages_id . "'"); while ($bundle_data = tep_db_fetch_array($bundle_query)) { if ($bundle_data['products_bundle'] == "yes") { // uncomment the following line to display subproduct qty // echo "<br>» <b>" . $bundle_data['subproduct_qty'] . " x " . $bundle_data['products_name'] . "</b>"; //echo "<br>» <b> " . $bundle_data['products_name'] . "</b>"; echo '<tr><td valign="top" class="main">» <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $bundle_data['products_id']) . '"><b><u>' . $bundle_data['products_name'] . '</u></b></a></td></tr>'; $bundle_query_nested = tep_db_query(" SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id = " . $bundle_data['products_id'] . " and language_id = '" . (int)$languages_id . "'"); while ($bundle_data_nested = tep_db_fetch_array($bundle_query_nested)) { // uncomment the following line to display subproduct qty // echo "<br><i> " . $bundle_data_nested['subproduct_qty'] . " x " . $bundle_data_nested['products_name'] . "</i>"; //echo "<br><i> " . $bundle_data_nested['products_name'] . "</i>"; echo '<tr><td valign="top" class="main"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $bundle_data_nested['products_id']) . '"><i><u>' . $bundle_data_nested['products_name'] . '</u></i></a></td></tr>'; // CB use special price if available if ($new_price = tep_get_products_special_price($bundle_data_nested['products_id'])) { $bundle_sum += $new_price*$bundle_data_nested['subproduct_qty']; } else { $bundle_sum += $bundle_data_nested['products_price']*$bundle_data_nested['subproduct_qty']; } // endof CB mod } } else { // uncomment the following line to display subproduct qty // echo "<br>» <b>" . $bundle_data['subproduct_qty'] . " x " . $bundle_data['products_name'] . "</b>"; //echo "<br>» <b> " . $bundle_data['products_name'] . "</b>"; echo '<tr><td valign="top" class="main">» <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $bundle_data['products_id']) . '"><b><u>' . $bundle_data['products_name'] . '</u></b></a></td></tr>'; // CB use special price if available if ($new_price = tep_get_products_special_price($bundle_data_nested['products_id'])) { $bundle_sum += $new_price*$bundle_data['subproduct_qty']; } else { $bundle_sum += $bundle_data['products_price']*$bundle_data['subproduct_qty']; } // endof CB mod } } // CB use special bundle price if available if ($new_price = tep_get_products_special_price($product_info['products_id'])) { $bundle_saving = $bundle_sum - $new_price; } else { $bundle_saving = $bundle_sum - $product_info['products_price']; } // endof CB mod $bundle_sum = $currencies->display_price($bundle_sum, tep_get_tax_rate($product_info['products_tax_class_id'])); $bundle_saving = $currencies->display_price($bundle_saving, tep_get_tax_rate($product_info['products_tax_class_id'])); // comment out the following line to hide the "saving" text echo '</table><p><table><tr><td class="main" align="right">' . TEXT_BUNDLE_SUM . '</td><td class="main"><span class="productPrice">' . $bundle_sum . '</span></td></tr><tr><td class="main" align="right">' . TEXT_BUNDLE_SAVINGS . '</td><td class="main"><span class="productSpecialPrice">' . $bundle_saving . '</span></td></tr></table>'; } ?> <!-- end bundle --> Also internationalized it eg languages/english/product_info.php added: define('TEXT_BUNDLE_CONTENTS', 'This product contains the following items: ');define('TEXT_BUNDLE_SUM', 'Cost of separate parts: '); define('TEXT_BUNDLE_SAVINGS', 'You save: '); Cheers Quote KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
Guest Posted April 26, 2004 Share Posted April 26, 2004 :( can anyone give me some advice with the post I posted on Apr 25 2004, 07:29 PM as i have trippled checked all my code for the instalation and can not gind anything wrong. I am starting to pull my hare out. Warning: reset(): Passed variable is not an array or object in /data/members/paid/e/a/easyinkz.co.uk/htdocs/www/admin/includes/classes/object_info.php on line 17 Any help would be appriciated Thanks in advance :( Quote Link to comment Share on other sites More sharing options...
defender39 Posted April 26, 2004 Share Posted April 26, 2004 what about images? It would be nice if a bundled product displayed the image from each of the items included... Quote Link to comment Share on other sites More sharing options...
safoo Posted April 26, 2004 Share Posted April 26, 2004 (edited) Andreas, The problem with your categories.php file was that you did not apply the change: insert "p.products_bundle," into the SQL query one line below this one (LINE 377) if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) { so the whole line shoud be: $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, 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, p.products_bundle 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 . "'"); In your code, I saw that the line after the IF statement is the OLD query. You need to add "p.products_bundle" after " p.manufacturers_id" in the query. Don't add another query, but edit the existing one. Edited April 26, 2004 by safoo Quote Link to comment Share on other sites More sharing options...
esurge Posted April 30, 2004 Share Posted April 30, 2004 Hello all. I am about to install this amazing mod. One question A list of products apperas showing what the customer is going to buy. Is there any way thoes name can become link to the actual link on the website providing even more information. Jazz Quote Link to comment Share on other sites More sharing options...
safoo Posted May 1, 2004 Share Posted May 1, 2004 esurge, Look at the code bruyndoncx posted on the previous page of this thread. She has her site display the list of items as links the customer can click on. Quote Link to comment Share on other sites More sharing options...
project_aism Posted May 1, 2004 Share Posted May 1, 2004 Nah, got a real bundle product mod here that dynamically generates bundles on the fly based on collaborative filtering techniques. No need to touch admin. Better than amazon 'Better together'. Quote Link to comment Share on other sites More sharing options...
safoo Posted May 1, 2004 Share Posted May 1, 2004 AISM, I agree with you. I was afraid it wouldn't work on my store but the code is so simple! I recommend that everyone install this contribution. Quote Link to comment Share on other sites More sharing options...
cdamianou Posted May 1, 2004 Share Posted May 1, 2004 Hi can someone help me please. I have ionstalled this mod, but i am getting the following error. 1054 - Unknown column 'products_bundle' in 'field list' insert into products_description (products_name, products_bundle, products_description, products_url, products_head_title_tag, products_head_desc_tag, products_head_keywords_tag, products_id, language_id) values ('test', 'e', 'hkjh', '', '', '', '', '325', '1') [TEP STOP] I cant figure out the problem. My Catalogue.php file is as follows <?php/* $Id: categories.php,v 1.9 2002/12/07 21:01:30 wilt Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 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(); // Added for Suppliers Pulldown // create an array of suppliers_name, // (when creating a new ) $suppliers_att_array = array(); $suppliers_att_query = tep_db_query("select q.suppliers_id from " . TABLE_SPG_SUPPLIERS . " q, " . TABLE_SPG_SUPPLIERS_PRODUCTS . " r where q.suppliers_id = r.spg_suppliers_id"); while ($suppliers_att = tep_db_fetch_array($suppliers_att_query)) { $suppliers_att_array[] = $suppliers_att['suppliers_id']; } //End of Suppliers Pulldown if ($HTTP_GET_VARS['action']) { switch ($HTTP_GET_VARS['action']) { case 'setflag': if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) { if ($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'])); 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 { $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); if ($HTTP_GET_VARS['action'] == 'insert_category') { $insert_sql_data = array('parent_id' => $current_category_id, 'date_added' => 'now()'); $sql_data_array = tep_array_merge($sql_data_array, $insert_sql_data); tep_db_perform(TABLE_CATEGORIES, $sql_data_array); $categories_id = tep_db_insert_id(); } elseif ($HTTP_GET_VARS['action'] == 'update_category') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = tep_array_merge($sql_data_array, $update_sql_data); tep_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', 'categories_id = \'' . $categories_id . '\''); } $languages = tep_get_languages(); for ($i=0; $i<sizeof($languages); $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 ($HTTP_GET_VARS['action'] == 'insert_category') { $insert_sql_data = array('categories_id' => $categories_id, 'language_id' => $languages[$i]['id']); $sql_data_array = tep_array_merge($sql_data_array, $insert_sql_data); tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array); } elseif ($HTTP_GET_VARS['action'] == 'update_category') { tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', 'categories_id = \'' . $categories_id . '\' and language_id = \'' . $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 { $categories_image = tep_get_uploaded_file('categories_image'); $image_directory = tep_get_local_path(DIR_FS_CATALOG_IMAGES); if (is_uploaded_file($categories_image['tmp_name'])) { tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $categories_image['name'] . "' where categories_id = '" . tep_db_input($categories_id) . "'"); tep_copy_uploaded_file($categories_image, $image_directory); } } 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 ($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; $i<sizeof($categories); $i++) { $product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . $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; $i<sizeof($value['categories']); $i++) { $category_ids .= '\'' . $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 = '" . $key . "' and categories_id not in (" . $category_ids . ")"); $check = tep_db_fetch_array($check_query); if ($check['total'] < '1') { $products_delete[$key] = $key; } } for ($i=0; $i<sizeof($categories); $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 ( ($HTTP_POST_VARS['products_id']) && (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; $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]) . "'"); } $product_categories_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . tep_db_input($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 ( ($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']); tep_db_query("update " . TABLE_CATEGORIES . " set parent_id = '" . tep_db_input($new_parent_id) . "', last_modified = now() where categories_id = '" . tep_db_input($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 = '" . tep_db_input($products_id) . "' and categories_id = '" . tep_db_input($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 = '" . tep_db_input($new_parent_id) . "' where products_id = '" . tep_db_input($products_id) . "' and categories_id = '" . $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 ( ($HTTP_POST_VARS['edit_x']) || ($HTTP_POST_VARS['edit_y']) ) { $HTTP_GET_VARS['action'] = 'new_product'; } else { $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'; if (tep_db_prepare_input($HTTP_POST_VARS['products_image'])=='Array') $HTTP_POST_VARS['products_image']=''; if (tep_db_prepare_input($HTTP_POST_VARS['products_bimage'])=='Array') $HTTP_POST_VARS['products_bimage']=''; if (tep_db_prepare_input($HTTP_POST_VARS['products_mimage'])=='Array') $HTTP_POST_VARS['products_mimage']=''; $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), 'products_bundle' => tep_db_prepare_input($HTTP_POST_VARS['products_bundle']), 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']), 'products_difficulty' => tep_db_prepare_input($HTTP_POST_VARS['products_difficulty']), 'products_requirements' => tep_db_prepare_input($HTTP_POST_VARS['products_requirements']), 'products_image' => (($HTTP_POST_VARS['products_image'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_image'])), 'products_mimage' => (($HTTP_POST_VARS['products_mimage'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_mimage'])), 'products_bimage' => (($HTTP_POST_VARS['products_bimage'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_bimage'])), 'products_subimage1' => (($HTTP_POST_VARS['products_subimage1'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_subimage1'])), 'products_bsubimage1' => (($HTTP_POST_VARS['products_bsubimage1'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_bsubimage1'])), 'products_subimage2' => (($HTTP_POST_VARS['products_subimage2'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_subimage2'])), 'products_bsubimage2' => (($HTTP_POST_VARS['products_bsubimage2'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_bsubimage2'])), 'products_subimage3' => (($HTTP_POST_VARS['products_subimage3'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_subimage3'])), 'products_bsubimage3' => (($HTTP_POST_VARS['products_bsubimage3'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_bsubimage3'])), 'products_subimage4' => (($HTTP_POST_VARS['products_subimage4'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_subimage4'])), 'products_bsubimage4' => (($HTTP_POST_VARS['products_bsubimage4'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_bsubimage4'])), 'products_subimage5' => (($HTTP_POST_VARS['products_subimage5'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_subimage5'])), 'products_bsubimage5' => (($HTTP_POST_VARS['products_bsubimage5'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_bsubimage5'])), 'products_subimage6' => (($HTTP_POST_VARS['products_subimage6'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_subimage6'])), 'products_bsubimage6' => (($HTTP_POST_VARS['products_bsubimage6'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_bsubimage6'])), 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']), 'products_cost' => tep_db_prepare_input($HTTP_POST_VARS['products_cost']), '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']), //PRODUCT_SORT_ORDER ADDED TO PREPARE INPUT 'products_sort_order' => tep_db_prepare_input($HTTP_POST_VARS['products_sort_order'])); if ($HTTP_GET_VARS['action'] == 'insert_product') { $insert_sql_data = array('products_date_added' => 'now()'); $sql_data_array = tep_array_merge($sql_data_array, $insert_sql_data); tep_db_perform(TABLE_PRODUCTS, $sql_data_array); $products_id = tep_db_insert_id(); // update bundle contents if ($HTTP_POST_VARS['products_bundle'] = "yes") { tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . $products_id . "'"); for ($i=0, $n=6; $i<$n; $i++) { if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) { tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . $products_id . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . "')"); } } } tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $products_id . "', '" . $current_category_id . "')"); tep_db_query("insert into " . TABLE_SPG_SUPPLIERS_PRODUCTS . " (spg_suppliers_id, products_id, status) values ('" . $HTTP_POST_VARS['suppliers_id'] . "', '" . $products_id . "','1')"); } elseif ($HTTP_GET_VARS['action'] == 'update_product') { tep_db_query("update " . TABLE_SPG_SUPPLIERS_PRODUCTS . " set spg_suppliers_id = " . $HTTP_POST_VARS['suppliers_id'] . " where products_id = " . $products_id); $update_sql_data = array('products_last_modified' => 'now()'); $sql_data_array = tep_array_merge($sql_data_array, $update_sql_data); tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', 'products_id = \'' . tep_db_input($products_id) . '\''); } $languages = tep_get_languages(); for ($i=0; $i<sizeof($languages); $i++) { $language_id = $languages[$i]['id']; $sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]), 'products_bundle' => tep_db_prepare_input($HTTP_POST_VARS['products_bundle'][$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 ($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 . '\''); } } // Update Product Attributes $rows = 0; $options_query = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name"); while ($options = tep_db_fetch_array($options_query)) { $values_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " p2p where pov.products_options_values_id = p2p.products_options_values_id and p2p.products_options_id = '" . $options['products_options_id'] . "' and pov.language_id = '" . $languages_id . "'"); while ($values = tep_db_fetch_array($values_query)) { $rows ++; $attributes_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $options['products_options_id'] . "' and options_values_id = '" . $values['products_options_values_id'] . "'"); if (tep_db_num_rows($attributes_query) > 0) { $attributes = tep_db_fetch_array($attributes_query); if ($HTTP_POST_VARS['option'][$rows]) { if ( ($HTTP_POST_VARS['prefix'][$rows] <> $attributes['price_prefix']) || ($HTTP_POST_VARS['price'][$rows] <> $attributes['options_values_price']) ) { tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set options_values_price = '" . $HTTP_POST_VARS['price'][$rows] . "', price_prefix = '" . $HTTP_POST_VARS['prefix'][$rows] . "' where products_attributes_id = '" . $attributes['products_attributes_id'] . "'"); } } else { tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_attributes_id = '" . $attributes['products_attributes_id'] . "'"); } } elseif ($HTTP_POST_VARS['option'][$rows]) { tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values ('', '" . $products_id . "', '" . $options['products_options_id'] . "', '" . $values['products_options_values_id'] . "', '" . $HTTP_POST_VARS['price'][$rows] . "', '" . $HTTP_POST_VARS['prefix'][$rows] . "','','')"); } } } 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 ( (tep_not_null($HTTP_POST_VARS['products_id'])) && (tep_not_null($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 ($HTTP_POST_VARS['categories_id'] != $current_category_id) { $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . tep_db_input($products_id) . "' and categories_id = '" . tep_db_input($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 ('" . tep_db_input($products_id) . "', '" . tep_db_input($categories_id) . "')"); } } else { $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error'); } } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') { //PRODUCT_SORT_ORDER ADDED TO THIS SELECT $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, 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, p.products_bundle 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_SORT_ORDER ADDED TO THIS INSERT tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_difficulty, products_requirements, products_image, p.products_mimage, p.products_bimage, p.products_subimage1, p.products_bsubimage1, p.products_subimage2, p.products_bsubimage2, p.products_subimage3, p.products_bsubimage3, p.products_subimage4, p.products_bsubimage4, p.products_subimage5, p.products_bsubimage5, p.products_subimage6, p.products_bsubimage6, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, product_sort_order) values ('" . $product['products_quantity'] . "', '" . $product['products_model'] . "', '" . $product['products_difficulty'] . "', '" . $product['products_requirements'] . "', '" . $product['products_image'] . "', '" . $product['products_mimage'] . "', '" . $product['products_bimage'] . "', '" . $product['products_price'] . "', now(), '" . $product['products_date_available'] . "', '" . $product['products_weight'] . "', '0', '" . $product['products_tax_class_id'] . "', '" . $product['manufacturers_id'] . "', '" . $product['products_sort_order'] . "')"); $dup_products_id = tep_db_insert_id(); $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 = '" . tep_db_input($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 ('" . $dup_products_id . "', '" . $description['language_id'] . "', '" . addslashes($description['products_name']) . "', '" . addslashes($description['products_description']) . "', '" . addslashes($description['products_head_title_tag']) . "', '" . addslashes($description['products_head_desc_tag']) . "', '" . addslashes($description['products_head_keywords_tag']) . "', '" . $description['products_url'] . "', '0')"); } tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $dup_products_id . "', '" . tep_db_input($categories_id) . "')"); $products_id = $dup_products_id; } if (USE_CACHE == 'true') { tep_reset_cache_block('categories'); tep_reset_cache_block('also_purchased'); } } tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id)); break; } } // check if the catalog image directory exists if (is_dir(DIR_FS_CATALOG_IMAGES)) { if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error'); } else { $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error'); } ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <script language="javascript" src="includes/general.js"></script> <script language="javascript"><!-- function popupImageWindow(url) { window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le ft=150') } //--></script> <?php if ((HTML_AREA_WYSIWYG_DISABLE == 'Enable') or (HTML_AREA_WYSIWYG_DISABLE_JPSY == 'Enable') or (HTML_AREA_WYSIWYG_DISABLE_ADDI == 'Enable')) { ?> <script language="Javascript1.2"><!-- // load htmlarea //MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.8 <head> _editor_url = "<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_ADMIN; ?>htmlarea/"; // URL to htmlarea files var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]); if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; } <?php if (HTML_AREA_WYSIWYG_BASIC_PD == 'Basic'){ ?> if (win_ie_ver >= 5.5) { document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_basic.js"'); document.write(' language="Javascript1.2"></scr' + 'ipt>'); } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); } <?php } else{ ?> if (win_ie_ver >= 5.5) { document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_advanced.js"'); document.write(' language="Javascript1.2"></scr' + 'ipt>'); } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); } <?php }?> // --></script> <?php }?> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> <div id="spiffycalendar" class="text"></div> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php //----- new_category / edit_category (when ALLOW_CATEGORY_DESCRIPTIONS is 'true') ----- if ($HTTP_GET_VARS['action'] == 'new_category_ACD' || $HTTP_GET_VARS['action'] == 'edit_category_ACD') { if ( ($HTTP_GET_VARS['cID']) && (!$HTTP_POST_VARS) ) { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $HTTP_GET_VARS['cID'] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' order by c.sort_order, cd.categories_name"); $category = tep_db_fetch_array($categories_query); $cInfo = new objectInfo($category); } elseif ($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']; $categories_url = $HTTP_POST_VARS['categories_url']; } else { $cInfo = new objectInfo(array()); } $languages = tep_get_languages(); $text_new_or_edit = ($HTTP_GET_VARS['action']=='new_category_ACD') ? TEXT_INFO_HEADING_NEW_CATEGORY : TEXT_INFO_HEADING_EDIT_CATEGORY; ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo sprintf($text_new_or_edit, 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><?php echo tep_draw_form('new_category', FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $HTTP_GET_VARS['cID'] . '&action=new_category_preview', 'post', 'enctype="multipart/form-data"'); ?> <td><table border="0" cellspacing="0" cellpadding="2"> <?php for ($i=0; $i<sizeof($languages); $i++) { ?> <tr> <td class="main"><?php echo TEXT_EDIT_CATEGORIES_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('categories_name[' . $languages[$i]['id'] . ']', (($categories_name[$languages[$i]['id']]) ? stripslashes($categories_name[$languages[$i]['id']]) : tep_get_category_name($cInfo->categories_id, $languages[$i]['id']))); ?></td> </tr> <?php } ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <?php for ($i=0; $i<sizeof($languages); $i++) { ?> <tr> <td class="main"><?php echo TEXT_EDIT_CATEGORIES_HEADING_TITLE; ?></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('categories_heading_title[' . $languages[$i]['id'] . ']', (($categories_name[$languages[$i]['id']]) ? stripslashes($categories_name[$languages[$i]['id']]) : tep_get_category_heading_title($cInfo->categories_id, $languages[$i]['id']))); ?></td> </tr> <?php } ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <?php for ($i=0; $i<sizeof($languages); $i++) { ?> <tr> <td class="main" valign="top"><?php echo TEXT_EDIT_CATEGORIES_DESCRIPTION; ?></td> <td><table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td> <td class="main"><?php echo tep_draw_textarea_field('categories_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (($categories_description[$languages[$i]['id']]) ? stripslashes($categories_description[$languages[$i]['id']]) : tep_get_category_description($cInfo->categories_id, $languages[$i]['id']))); ?></td> </tr> </table></td> </tr> <?php } ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <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> </form></tr> <?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 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, cd.categories_url, c.categories_quantity, c.categories_model, c.categories_image, c.sort_order, c.categories_weight, c.categories_date_added, c.categories_last_modified, c.categories_date_available, c.categories_status, c.manufacturers_id 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 = Quote Link to comment Share on other sites More sharing options...
cdamianou Posted May 3, 2004 Share Posted May 3, 2004 Can anyone help? Thanks Quote Link to comment Share on other sites More sharing options...
lushlongboards Posted May 3, 2004 Author Share Posted May 3, 2004 cdamianou - it looks like you have not added the extra field (products_bundle) into your products_description table. You need to do this via a database admin page. fzx5co - what version of osC are you running? safoo/aism - what's the collaborative filtering mod you're talking about? chris Quote Link to comment Share on other sites More sharing options...
cdamianou Posted May 3, 2004 Share Posted May 3, 2004 How do i add this, or whats the Query. My egnorance is showing again Quote Link to comment Share on other sites More sharing options...
cdamianou Posted May 3, 2004 Share Posted May 3, 2004 Ive added the following ALTER TABLE `yourdatabasenamehere`.`products` ADD `products_bundle` TINYTEXT NOT NULL But i get this message after the query MySQL said: #1060 - Duplicate column name 'products_bundle' Quote Link to comment Share on other sites More sharing options...
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.