manix Posted February 16, 2004 Share Posted February 16, 2004 ipalbicke Further to my earlier post. You can change the line code in includes/modules/featured.php that says order by rand() DESC limit as the code is it randomly selects the products, you can change this to say order by p.products_date_added DESC limit this will set the order fixed and by date added OR order by p.products_id DESC limit this will set the order by product id you could also do by manufacturer etc and have ascending instead of descending Can you sort it by date available?? John :-) Quote Where is the anykey?? Link to comment Share on other sites More sharing options...
domaky Posted March 15, 2004 Share Posted March 15, 2004 Hello :-) First of all: Thank you Emilio for the tremendous work on this contribution, thank you who have posted before, it was a great help in fixing things. There are still a few things remaining to be fixed, and I cannot find the places where I got stuck. The first page shows totally empty where the items should be displayed. http://www.topelwines.com/order/ When I look at the source code I see <tr> <td></td> </tr> where in fact the featured items should be called by <tr> <td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td> </tr> in the index.php file I tried to find out what should be happening with FILENAME_FEATURED, but must admit defeat :-( I would greatly appreciate any help with this. Greetings, :: doris Quote Link to comment Share on other sites More sharing options...
domaky Posted March 15, 2004 Share Posted March 15, 2004 One more problem... When I try to edit the products the upper part of the page shows ok down to "Products Price (Gross):", but where the description used to be I get an error message ? 1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where products_id = '28' and language_id = '1'' at line 1select products_short fromproducts_description where products_id = '28' and language_id = '1' [TEP STOP] What did I do wrong and how can I fix this? Thanks a huge bunch for all help :-) ::Dd Quote Link to comment Share on other sites More sharing options...
domaky Posted March 15, 2004 Share Posted March 15, 2004 I found the problem with the sql error message: There was a space missing between from and products_description in products_short fromproducts_description This is set in admin/includes/funtions/general.php around line 516. Greetings, :: doris Quote Link to comment Share on other sites More sharing options...
Farrukh Posted March 30, 2004 Share Posted March 30, 2004 Download the whole package with updated readme.txt file and some other minor commits. http://www.oscommerce.com/community/contributions,505 Quote Link to comment Share on other sites More sharing options...
241 Posted March 30, 2004 Share Posted March 30, 2004 (edited) Farrukh Minor miss in the admin/categories file maybe include for the next update this is the line with the missing F so that you get eaturedstatus <td class="main">Featured <?php echo TEXT_PRODUCTS_STATUS; ?></td> and this one <td class="main">Featured until <?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td> so that you know what the date is, you maybe dont need the second line I have mine so that I have the date available from and the expiry date The first line is from one of my earlier posts in reply to requests, but does not seem to have been addressed in any of the updates that you have done, this may have been due to lack of time or it being a monor niggle and not a code breaking issue which is completely understandable, get the code to work and the code bugs ironed out then deal with the minor niggles. Have you thought about using the buy now buton in place of the buy now text Edited March 30, 2004 by 241 Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
Farrukh Posted March 30, 2004 Share Posted March 30, 2004 I have updated the readme file again and included so more steps. I have also included a seperate readme file for making changesin admin/categories.php file Note: I have installed it in SEC and it works fine for me uptil now . Quote Link to comment Share on other sites More sharing options...
241 Posted March 30, 2004 Share Posted March 30, 2004 Hi Farrukh here is the line #514 of admin/categories taken from your latest update in contributions <td class="main">eatred<?php echo TEXT_PRODUCTS_STATUS; ?></td> as you can see it is missing the F and a space as posted earlier. My post is not for me but for those whom wish to use your contribution. I have the contribution all be it a modified version to be the way I want it. I have it working on a 2.2MS2 and a SEC with no issues as any that I did have I resolved. There is nothing functionally wrong with the contribution that I am using now that I have ironed out the bugs, as I say it is a minor issue and was posted more for the benefit of others. I also posted about how to make changes to the code to allow a fixed and ordered presentation of featured products instead of the random selection, you may want to concider placing a line or two in the readme as an extra or to work in to the admin side as a selection for people to be able to choose to show random products or fixed by product name or product id or category or price Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
Farrukh Posted March 30, 2004 Share Posted March 30, 2004 If its in the categories file in the package, then its the one i have not touched since i made direct changes in my cart and as you can see from the snapshot , everything is fine. I might try to set the random or product_id etc. if i get enough time to do it. Quote Link to comment Share on other sites More sharing options...
maz Posted March 31, 2004 Share Posted March 31, 2004 Hi Farrukh Many thanks for your 'clarification' of the categories.php file. Without this help I, like many others, would still be struggling with this excellent contribution. Everything works perfectly, However I still have major one problem. The status buttons on the categories.php page are just not working. (The original 'product status' bottons on the left work fine). I can only activate and deactivate a featured product from the product description page. I have reinstalled about six times. Checked all other admin files, everything seems to be ok, except the status buttons. They seem to be permanantly on red. If the row is highlighted, Clicking the red takes me to the product page (for example: catalog/admin/categories.php?cPath=3_13&pID=8&action=new_product_preview&read=only) Holding the mouse over the red button gives text saying 'inactive'. ALL THE TIME. And holding over the green button gives the following path in the window header: ../catalog/admin/categories.php?action=setflag_featured&flag=1&pID=16&cpath3_13 (obviously paths chage for each product) Clicking the green button shows the same page again, but in the browser window the path shows: http://www.justgiftsandtoys.com/catalog/ad...ath=3_13&pID=16. (The ID=16 changes for each product). BUT THE GREEN BUTTON REMAINS DIMMED, AND ONLY THE RED BUTTON STAYS ON. Any help or advice would be appreciated. Many thaks Maz Here is my complete categories.php file showing your instructions in place ..... <?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 (c) 2003 osCommerce Released under the GNU General Public License*/ 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'])); // MAZ BOF cieto Featured Products 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;// MAZ EOF cieto Featured Productsbreak; 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 ($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 . "'"); } 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']), //MAZ BOF Ezier NewFields 'products_retail_price' => tep_db_prepare_input($HTTP_POST_VARS['products_retail_price']), //MAZ EOF EZIER NEW FIELDS 'products_date_available' => $products_date_available, 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']), //BOF CIETO FEATURED 'products_featured' => tep_db_prepare_input($HTTP_POST_VARS['products_featured']), //EOF CIETO 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]), //MAZ BOF CIETO FEATURED 'products_short' => tep_db_prepare_input($HTTP_POST_VARS['products_short'][$language_id]), //MAZ EOF CIETO FEATURED 'products_info' => tep_db_prepare_input($HTTP_POST_VARS['products_info'][$language_id]), //MAZ ADDED SHORT DESCRIPTION '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_retail_price, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $product = tep_db_fetch_array($product_query); tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_retail_price, products_price, products_date_added, products_date_available, products_weight, products_featured, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')"); //MAZ CIETO FEATURES ADDED products_featured, $dup_products_id = tep_db_insert_id(); $description_query = tep_db_query("select language_id, products_name, products_info, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'"); //MAZ ADDED products_info FOR SHORT DESCRIPTION while ($description = tep_db_fetch_array($description_query)) { tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_info, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_info']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')"); //MAZ ADDED products_info and ALSO . tep_db_input($description['products_info']) . FOR SHORT DESCRIPTION } 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':// 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'] : ''); } break;//MAZ BOF ADDITIONAL IMAGES case 'add_images': $additional_images_id = tep_db_prepare_input($HTTP_POST_VARS['additional_images_id']); $back_page = $HTTP_GET_VARS['pID']; $sql_data_array = array('products_id' => tep_db_prepare_input($HTTP_POST_VARS['products_id']), 'images_description' => tep_db_prepare_input($HTTP_POST_VARS['images_description']), 'medium_images' => (($HTTP_POST_VARS['medium_images'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['medium_images'])), 'popup_images' => (($HTTP_POST_VARS['popup_images'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['popup_images']))); tep_db_perform(TABLE_ADDITIONAL_IMAGES, $sql_data_array); $additional_images_id = tep_db_insert_id(); if ( ($medium_images != 'none') && ($medium_images != '') ) { tep_db_query("update " . TABLE_ADDITIONAL_IMAGES . " set medium_images = '" . $medium_images_name . "' where additional_images_id = '" . tep_db_input($additional_images_id) . "'"); $image_location = DIR_FS_CATALOG_IMAGES . $medium_images_name; copy($medium_images, $image_location); } if ( ($popup_images != 'none') && ($popup_images != '') ) { tep_db_query("update " . TABLE_ADDITIONAL_IMAGES . " set popup_images = '" . $popup_images_name . "' where additional_images_id = '" . tep_db_input($additional_images_id) . "'"); $image_location = DIR_FS_CATALOG_IMAGES . $popup_images_name; copy($popup_images, $image_location); } else { tep_db_query("update " . TABLE_ADDITIONAL_IMAGES . " set popup_images = '" . $medium_images_name . "' where additional_images_id = '" . tep_db_input($additional_images_id) . "'"); } tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath)); break; case 'del_images': $additional_images_id = tep_db_prepare_input($HTTP_GET_VARS['pID']); if ( ($HTTP_POST_VARS['products_id']) && (is_array($HTTP_POST_VARS['additional_images_id'])) ) { $product_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']); $additional_images_id = $HTTP_POST_VARS['additional_images_id']; for ($i=0; $i<sizeof($additional_images_id); $i++) { tep_db_query("delete from " . TABLE_ADDITIONAL_IMAGES . " where additional_images_id = '" . tep_db_input($additional_images_id[$i]) . "'"); } } //tep_db_query("delete from " . TABLE_ADDITIONAL_IMAGES . " where additional_images_id = '" . $HTTP_POST_VARS['additional_images_id'] . "'"); tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id)); break;//MAZ EOF ADDITIONAL IMAGES } } // 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></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' => '', //MAZ CIETO FEATURED 'products_info' => '', //MAZ ADDED SHORT DESCRIPTION 'products_description' => '', 'products_url' => '', 'products_id' => '', 'products_quantity' => '', 'products_model' => '', 'products_image' => '', 'products_price' => '', 'products_weight' => '', 'products_date_added' => '', 'products_last_modified' => '', 'products_date_available' => '', 'products_featured' => '', //MAZ CIETO 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_retail_price, 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 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 . "'"); //MAZ CIETA FEATURED $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']; //MAZ CIETO FEATURED $products_info = $HTTP_POST_VARS['products_info']; //MAZ ADDED SHORT DESCRIPTION $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; } //MAZ BOF CIETO FEATURED if (!isset($pInfo->products_featured)) $pInfo->products_featured = '0'; switch ($pInfo->products_featured) { case '0': $in_f_status = false; $out_f_status = true; break; case '1': default: $in_f_status = true; $out_f_status = false; }//MAZ EOF CIETO FEATURED?><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><!-- MAZ BOF CIETO FEATURED --><script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script><script language="JavaScript"><!-- var FeaturedUntil = new ctlSpiffyCalendarBox("FeaturedUntil", "new_product", "products_featured_until","btnDate1","<?php echo $pInfo->products_featured_until; ?>", scBTNMODE_CUSTOMBLUE);//--></script><!-- MAZ EOF CIETO FEATURED --><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> <!-- MAZ BOF CIETO FEATURED --> <td class="main"><?php echo TEXT_PRODUCTS_FEATURED; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_featured', '1', $in_f_status) . ' ' . TEXT_PRODUCT_YES . ' ' . tep_draw_radio_field('products_featured', '0', $out_f_status) . ' ' . TEXT_PRODUCT_NO; ?></td> </tr> <tr><!-- MAZ EOF FEATURED --> <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> <!-- MAZ BOF CIETO FEATURED --> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main">Featured Until <?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">FeaturedUntil.writeControl(); FeaturedUntil.dateFormat="yyyy-MM-dd";</script></td> </tr><!-- MAZ EOF CIETO FEATURED --> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $pInfo->manufacturers_id); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr><?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) {?> <tr> <td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td> <td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? $products_name[$languages[$i]['id']] : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td> </tr><?php }?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr bgcolor="#ebebff"> <td class="main"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateGross()"'); ?></td> </tr> <tr bgcolor="#ebebff"> <td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td> </tr> <!-- MAZ BOF EZIER NEW FIELDS --> <tr> <td class="main"><?php echo TEXT_PRODUCTS_RETAIL_PRICE; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_retail_price', $pInfo->products_retail_price); ?></td> </tr><!-- MAZ EOF EZIER NEW FIELDS --> <tr bgcolor="#ebebff"> <td class="main"><?php echo TEXT_PRODUCTS_PRICE_GROSS; ?></td> <td class="main"><?php echo tep_draw_separator Quote Link to comment Share on other sites More sharing options...
maz Posted March 31, 2004 Share Posted March 31, 2004 At last, I found the problem. (Only applies to the excellent categories.php instructions posted by Farrukh). In admin/categories.php around line 1055 find $products_count = 0; if (isset($HTTP_GET_VARS['search'])) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_retail_price, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name"); } else { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_retail_price, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name"); } while ($products = tep_db_fetch_array($products_query)) { $products_count++; $rows++; Replace with $products_count = 0; if (isset($HTTP_GET_VARS['search'])) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_retail_price, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_featured, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name"); } else { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_retail_price, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_featured from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name"); } while ($products = tep_db_fetch_array($products_query)) { $products_count++; $rows++; //I JUST ADDED p.products_featured WHICH WAS NOT IN THE INSTRUCTIONS. (unless I missed them :blink: ). The database calls to establish whether or not the featured product was flagged were missing. I just added p.products_featured in the sql call, and the red and green buttons are now working as they should. Hope this helps. Quote Link to comment Share on other sites More sharing options...
emiliano Posted March 31, 2004 Author Share Posted March 31, 2004 Hello :) Thanks Farrukh for your help to everyone using this contribution! cheers emiliano ps: i'll be back! Quote patagonia, argentina Link to comment Share on other sites More sharing options...
241 Posted March 31, 2004 Share Posted March 31, 2004 maz you also have missplaced a break; in admin/categories tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID'])); break; // MAZ EOF cieto Featured Products break; case 'insert_category' the break; after your // MAZ EOF should appear befor your comment MAZ BOF Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
Farrukh Posted April 2, 2004 Share Posted April 2, 2004 Thanks maz for pointing out the bug. I have also fixed a bug which arose when one tries to duplicate a product. download the updated file Quote Link to comment Share on other sites More sharing options...
maz Posted May 12, 2004 Share Posted May 12, 2004 Hi Farrukh The latest download zip file seems corrupt. Wont open (end of file error). Also, if this is a complete fresh install, would you be kind enough to point out the exact code change to correct the 'duplicate' bug. Sorry for the inconvenience, but its difficult for me to do a fresh install on each of about six shops. Many thanks. Maz Quote Link to comment Share on other sites More sharing options...
Guest Posted May 27, 2004 Share Posted May 27, 2004 I install this script but don't work :-( When I add any of product to featured list, on homesite (oscommerce) don't have any record (blank site). Could sombody help me? If yes, please send me the all files and database (structure) to runing this script (eg. admin/categories.php and other). My homepage for this project: www.brojas.wilgnet.gliwice.pl/sklep Thank you very much P.S. sorry for my English Quote Link to comment Share on other sites More sharing options...
jjanguda Posted June 21, 2004 Share Posted June 21, 2004 This is quite similar contribution which I have been looking for... I want to do like this.. using this contribution.. Any idea? Quote Link to comment Share on other sites More sharing options...
Guest Posted June 22, 2004 Share Posted June 22, 2004 Hi, could anyone "upgrade" this great contribution to make it work with the new MS3 version of osCommerce v2.2? The price can't be displayed correctly and the Buy It Now button don't work under MS3. Any help is appreciated. Thanks! Quote Link to comment Share on other sites More sharing options...
jjanguda Posted June 27, 2004 Share Posted June 27, 2004 anyone has an idea about the picture that I posted above? appreciate for any help. Quote Link to comment Share on other sites More sharing options...
mbell Posted July 7, 2004 Share Posted July 7, 2004 I know this contribution was created to replace the New Products infobox but is it possible to have both the Featured Product and New Products appear on the main page at the same time? Basically, I'd like to have one featured product a week, but I'd like the New Products infobox to be available underneath the Featured Product. The order would be Welcome message, then featured product, then new products, the upcoming products. Thank you for any help you can offer! Quote Link to comment Share on other sites More sharing options...
241 Posted July 7, 2004 Share Posted July 7, 2004 I know this contribution was created to replace the New Products infobox but is it possible to have both the Featured Product and New Products appear on the main page at the same time? Basically, I'd like to have one featured product a week, but I'd like the New Products infobox to be available underneath the Featured Product. The order would be Welcome message, then featured product, then new products, the upcoming products. Thank you for any help you can offer! yes all you have to do is to create a new table row and table cell for the new products so where you have now the two instances of <tr> <td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td> </tr> change it to read <tr> <td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td> </tr> you can miss out the <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> if you do not want the seperator. Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
241 Posted July 7, 2004 Share Posted July 7, 2004 anyone has an idea about the picture that I posted above? appreciate for any help. This is simple manipulation of the code for the layout in featured_products.php Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
mbell Posted July 8, 2004 Share Posted July 8, 2004 Steve, thanks so much for the help. Code worked wonderfully! Quote Link to comment Share on other sites More sharing options...
chris379 Posted July 11, 2004 Share Posted July 11, 2004 Hi I have just installed the featured products contribution and I like it very much. :D I have a question regarding the Admin section: My only problem is that I want to show more fields than just the "products_name" field in the drop-down list, if I enter a new featured product. It would be nice if the drop-down also shows the "products_model" and the "products_weight" for example. Has anyone an idea? Quote Link to comment Share on other sites More sharing options...
martinmacca Posted July 20, 2004 Share Posted July 20, 2004 All seems to be working except the main page. For some reason ive constantly got "whats new here" at the top of my index page, and the featured products seem to be moving all over the page when refreshed, i.e. sometimes the columns are out of proportion making some products out of line or squashed to the side or below. Examples shown below of some of the different layouts-also notice the whats new at the top Where have i gone wrong ? :blink: 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.