itinerant baker Posted September 12, 2006 Share Posted September 12, 2006 Great contribution, and I found it easy to install. Just a couple of things I'ld like to see added to it. It doesn't seem to affect what shows up on the front page, which is prety well the main reason I installed it. Is there any way around it or is it suposed to do this already? It would be good if you could also enter the sort order as you where adding/editing the product from the add/edit product pages aswell as from the catagory page, it would save a few page clicks if it could be done on one page. I'ld also like to see a way of reversing the order so I could use dates as part of the sort code. My main gripe is the lack of front page integration, so if anyone knows how to solve this it would be much apreciated. Quote Link to comment Share on other sites More sharing options...
itinerant baker Posted September 19, 2006 Share Posted September 19, 2006 I am getting a weird problem after installing this contribution. For some reason there is an extra column showing in the product listing. I have two "Buy Now" buttons showing, but when i remove the "Buy Now" feature, it shows two price listing columns so it looks like it's duplicating the last column. When I revert to a backup database it fixes the problem, but the sort doesn't work and when I take out this line of code.. //sort order $define_list = array('PRODUCT_LIST_SORT_ORDER' => PRODUCT_LIST_SORT_ORDER, 'PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, //end sort order ..and replace it with the original, it fixes the problem, but again the sort doesn't work. I am at a loss as to why this is happening.. :( Is anyone else having this problem? This contribution is exactly what I am looking for so i don't want to uninstall it. Here is a screenshot of the problem.. I'm getting this aswell. Incidently the code above is in the catalog index.php file if that jogs anyones memory, though I'm not sure if that's where the problem is. Where abouts is the table in question laid out? Looks like I'll have to have this good contrib off untill this is sorted. :angry: When I installed it on a test install I noticed a line of code entered that was identical to the one that followed it, so iirc I commented out one of them and it seemed to work ok - but I can't remember where it was (may even have been another contrib!) I didn't do it on this install and I've had the above trouble. Quote Link to comment Share on other sites More sharing options...
Guest Posted December 18, 2006 Share Posted December 18, 2006 This is an excellent contribution. Thanks! :) Quote Link to comment Share on other sites More sharing options...
dp1726 Posted April 4, 2007 Share Posted April 4, 2007 Im trying to get this to work. but I have a slight problem Parse error: syntax error, unexpected T_CASE in /home/.devi/xxxxxx/dpglassblowing.com/catalog/admin/categories.php on line 23 as I know little of code I.m lost line 23 is case beginsort //sort order case 'beginsort': $sorting = true; break; tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_POST_VARS['cPath'])); case 'setsortorder': for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) { tep_set_product_sort_order($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['sortorder'][$i]); } $sorting = false; tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_POST_VARS['cPath'])); break; //end sort order switch ($action) anybody have any Ideas what to look for. Dave Quote Link to comment Share on other sites More sharing options...
dp1726 Posted April 6, 2007 Share Posted April 6, 2007 I got it to work. Great contribution. I had two problems Somewhere in the code there was a > missing. If I can remember where I post it. Also if you ger the famous Cannot send header stuff I went back and removed the empty white space between the lines. this solved the problem. The only problem I have that I can live with is in my admin section it list TABLE_HEADING_SORT_ORDER with all the _ _ _ in place. someday when I get real bored I"ll look for it. Thank You Dave Quote Link to comment Share on other sites More sharing options...
voojoo Posted June 21, 2007 Share Posted June 21, 2007 i would like to thanks Beer Monster (author of this contribution) and all of you guys to provide this GREAT information, even i dont know about SQL and phpMyAdmin (at all) - but i can install it without ANY PROBLEM ! thanks again :thumbsup: some of my snap shot may help others who dont know any of database and phpMyAdmin (as me) how to copy/paste SQL statements into your phpMyAdmin 1. open you phpMyAdmin 2. select your Database 3. press SQL tab 4. Copy this code into text box ALTER TABLE products ADD products_sort_order INT( 4 ) DEFAULT '0' NOT NULL; INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('', 'PRODUCT_LIST_SORT_ORDER', '6', '', '0', '', now()); 5. Press Go , That's all you need to do with your phpMyAdmin others part >> i know you guys can do it by yourself Thanks again Brian (aka Beer Monster) Quote Link to comment Share on other sites More sharing options...
Guest Posted June 23, 2007 Share Posted June 23, 2007 I'm getting this aswell. Incidently the code above is in the catalog index.php file if that jogs anyones memory, though I'm not sure if that's where the problem is. Where abouts is the table in question laid out? Looks like I'll have to have this good contrib off untill this is sorted. :angry: When I installed it on a test install I noticed a line of code entered that was identical to the one that followed it, so iirc I commented out one of them and it seemed to work ok - but I can't remember where it was (may even have been another contrib!) I didn't do it on this install and I've had the above trouble. Has anyone fixed this problem? I have the same problem with 2 buy now buttons :( Quote Link to comment Share on other sites More sharing options...
Guest Posted June 23, 2007 Share Posted June 23, 2007 Has anyone fixed this problem? I have the same problem with 2 buy now buttons :( I found the problem, I tried to install the changes in product_listing again, and that helped. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 11, 2007 Share Posted July 11, 2007 (edited) Hi, I installed this contribution today and I have allllllllmost got it working. Sadly, this is what my admin>category/products looks like right now: no products listed within their categories. All the products are still there (show up on the website) but they aren't listed here. I am able to add new products but, again, they aren't listed here once they have been added. Here is what it looks like when I click the 'sort order' button: same deal, no product listings. I have gone through each phase of the install instructions and all the appropriate bits appear to be where they are supposed to be in my files. Obviously, I have missed something somewhere - anyone have any ideas where? Thanks in advance! :o) Hi all, I have this same problem, no products showing up, Does anyone have any ideas, before I have to redo from the shop from scratch again? I have been checking all the code for hours with no avail, thanks in advance for any assistance offered...jeff Edited July 11, 2007 by GULFBALL Quote Link to comment Share on other sites More sharing options...
Guest Posted July 11, 2007 Share Posted July 11, 2007 Hi all, I have this same problem, no products showing up, Does anyone have any ideas, before I have to redo from the shop from scratch again? I have been checking all the code for hours with no avail, thanks in advance for any assistance offered...jeff Quote Link to comment Share on other sites More sharing options...
cjpopp Posted July 26, 2007 Share Posted July 26, 2007 Just did the install... every thing shows up BUT I can't enter numbers - they are blued out. How do you place a order number? Is there something I might have done wrong? If so, where should I look? Quote Link to comment Share on other sites More sharing options...
AZWheeler Posted November 27, 2007 Share Posted November 27, 2007 Hello, Very nice contribution. Thank you. I was hoping someone will be able to help me in regards to an issue I am having with the code in my index.php file in reference to this contribution. All items on the contribution have been added/replaced/etc., except for two sections of code on my index.php file that cannot be found for some reason. The two steps are: Line 201 Replace if ($column_list[$i] == 'PRODUCT_LIST_NAME') { <<<------------------Cannot find this chunk of code in my index.php file nor the entire site $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; With //sort order if ($column_list[$i] == 'PRODUCT_LIST_SORT_ORDER') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_sort_order, pd.products_name"; break; } elseif ($column_list[$i] == 'PRODUCT_LIST_NAME' && PRODUCT_LIST_SORT_ORDER==0) { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; //end sort order ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Line 218 After switch ($column_list[$sort_col-1]) { <<<<<----------------------- Cannot find this chunk of code either. Add //sort order case 'PRODUCT_LIST_SORT_ORDER': $listing_sql .= "p.products_sort_order , pd.products_name " . ($sort_order == 'a' ? 'asc' : ''); break; //end sort order ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ MY INDEX.PHP FILE <?php /* $Id: index.php,v 1.2 2004/03/09 19:56:29 ccwjr Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ if($cPath == ""){ $in_index_yes = "yes"; }else{ $in_index_yes = "no"; } require('includes/application_top.php'); // the following cPath references come from application_top.php $category_depth = 'top'; if (isset($cPath) && tep_not_null($cPath)) { $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'"); $cateqories_products = tep_db_fetch_array($categories_products_query); if ($cateqories_products['total'] > 0) { $category_depth = 'products'; // display products } else { $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'"); $category_parent = tep_db_fetch_array($category_parent_query); if ($category_parent['total'] > 0) { $category_depth = 'nested'; // navigate through the categories } else { $category_depth = 'products'; // category has no products, but display the 'no products' message } } } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT); if ($category_depth == 'nested') { //Code change for Categories Description 1.5 // $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); //Changed to the following $category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . $languages_id . "'"); //End Categories Description 1.5 $category = tep_db_fetch_array($category_query); $content = CONTENT_INDEX_NESTED; } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) { // create column list //sort order $define_list = array('PRODUCT_LIST_SORT_ORDER' => PRODUCT_LIST_SORT_ORDER, 'PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, //end sort order 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); $column_list = array(); reset($define_list); while (list($key, $value) = each($define_list)) { if ($value > 0) $column_list[] = $key; } // Eversun mod for sppc and qty price breaks if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // this will build the table with specials prices for the retail group or update it if needed // this function should have been added to includes/functions/database.php if ($customer_group_id == '0') { tep_db_check_age_specials_retail_table(); } $status_product_prices_table = false; $status_need_to_get_prices = false; // find out if sorting by price has been requested if ( (isset($HTTP_GET_VARS['sort'])) && (ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) && (substr($HTTP_GET_VARS['sort'], 0, 1) <= sizeof($column_list)) && $customer_group_id != '0' ){ $_sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') { $status_need_to_get_prices = true; } } if ($status_need_to_get_prices == true && $customer_group_id != '0') { $product_prices_table = TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id; // the table with product prices for a particular customer group is re-built only a number of times per hour // (setting in /includes/database_tables.php called MAXIMUM_DELAY_UPDATE_PG_PRICES_TABLE, in minutes) // to trigger the update the next function is called (new function that should have been // added to includes/functions/database.php) tep_db_check_age_products_group_prices_cg_table($customer_group_id); $status_product_prices_table = true; } // end if ($status_need_to_get_prices == true && $customer_group_id != '0') // Eversun mod end for sppc and qty price breaks $select_column_list = ''; for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { //sort order case 'PRODUCT_LIST_SORT_ORDER': $select_column_list .= 'p.products_sort_order, '; break; //end sort order case 'PRODUCT_LIST_MODEL': $select_column_list .= 'p.products_model, '; break; case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, '; break; case 'PRODUCT_LIST_MANUFACTURER': $select_column_list .= 'm.manufacturers_name, '; break; case 'PRODUCT_LIST_QUANTITY': $select_column_list .= 'p.products_quantity, '; break; case 'PRODUCT_LIST_IMAGE': $select_column_list .= 'p.products_image, '; break; case 'PRODUCT_LIST_WEIGHT': $select_column_list .= 'p.products_weight, '; break; } } // Get the category name and description $category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); $category = tep_db_fetch_array($category_query); // show the products of a specified manufacturer if (isset($HTTP_GET_VARS['manufacturers_id'])) { if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only a specific category //Eversun mod for sppc and qty price breaks /* $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"; } } else { // show the products in a given categorie if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; */ if ($status_product_prices_table == true) { $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from (" . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id)), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'"; } else { // either retail or no need to get correct special prices $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id)), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'"; } // end else { // either retail... } else { // We show them all if ($status_product_prices_table == true) { $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from (" . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id)), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"; } else { // either retail or no need to get correct special prices $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id)), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"; } // end else { // either retail... } } else { // show the products in a given categorie if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only specific catgeory; if ($status_product_prices_table == true) { $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from (" . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id)), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // either retail or no need to get correct special prices $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id)), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } // end else { // either retail... } else { // We show them all if ($status_product_prices_table == true) { $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from (" . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id)) left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // either retail or no need to get correct special prices $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id)) left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } // end else { // either retail... // Eversun mod for sppc and qty price breaks } } if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { $sort_column = CATEGORIES_SORT_ORDER; $sort_order = 'a'; } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_column = $column_list[$sort_col-1]; $sort_order = substr($HTTP_GET_VARS['sort'], 1); } $listing_sql .= ' order by '; switch ($sort_column) { case 'PRODUCT_LIST_MODEL': $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MANUFACTURER': $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $listing_sql .= "pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; } $content = CONTENT_INDEX_PRODUCTS; } else { // default page $content = CONTENT_INDEX_DEFAULT; } require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> All of the input fields/buttons/etc. from the contribution are installed and show up just fine in Admin; however, when changing the sort order nothing happens to the product listing order and I believe the reasons are becuase these two (see above) sections of code are missing. Pasted above is a copy of my index.php file. I was hoping someone would be able to point out where I should paste these remaining sections of code into the index.php file. I apologize for the long post but I am ripping my hair out at this point. Thank you for your help. Chad Quote Link to comment Share on other sites More sharing options...
Guest Posted December 1, 2007 Share Posted December 1, 2007 I am trying to get this contribution to work with the "Our Products" Contribution http://addons.oscommerce.com/info/4770 Everything installs fine but the products are not showing up in order when I change them. Any ideas on what files I need to alter in the "our products" contribution to make this work. or is it in this contribution?? Quote Link to comment Share on other sites More sharing options...
leveera Posted December 4, 2007 Share Posted December 4, 2007 Fine contribution but thete is a problem with mulitlanguage shops. (I didn't install a sort_order_categories) If to switch language in subcategories it gives error 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 'p.products_sort_order , pd.products_name asc' at line 1 select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '35'p.products_sort_order , pd.products_name asc Any way to fix it? Thanks Sergei Quote Link to comment Share on other sites More sharing options...
Beer Monster Posted December 7, 2007 Author Share Posted December 7, 2007 Fine contribution but thete is a problem with mulitlanguage shops. (I didn't install a sort_order_categories) If to switch language in subcategories it gives error 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 'p.products_sort_order , pd.products_name asc' at line 1 select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '35'p.products_sort_order , pd.products_name asc Any way to fix it? Thanks Sergei Are you sure it's THIS sort contribution you are using. The SQL above does not match anything in this contribution. Nevertheless, you are missing the words ORDER BY p2c.categories_id = '35'p.products_sort_order , pd.products_name asc should be p2c.categories_id = '35' order by p.products_sort_order , pd.products_name asc and there should be a semicolon at the end of any SQL statement. Quote Light, in the absence of eyes, illuminates nothing. Link to comment Share on other sites More sharing options...
leveera Posted December 10, 2007 Share Posted December 10, 2007 Are you sure it's THIS sort contribution you are using. The SQL above does not match anything in this contribution. Nevertheless, you are missing the words ORDER BY p2c.categories_id = '35'p.products_sort_order , pd.products_name asc should be p2c.categories_id = '35' order by p.products_sort_order , pd.products_name asc and there should be a semicolon at the end of any SQL statement. Now, not sure that the SQL error reason was the contribution. I noted the error after its install so it was first think about. Searced my index.php and found that it has folllowing mods if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) ... I changed it to orig if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]', $HTTP_GET_VARS['sort'])) ... But reason of error is here Missed $listing_sql .= ' order by '; but } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_order = substr($HTTP_GET_VARS['sort'], 1); switch ($column_list[$sort_col-1]) { //sort order case 'PRODUCT_LIST_SORT_ORDER': $listing_sql .= "p.products_sort_order , pd.products_name " . ($sort_order == 'a' ? 'asc' : ''); break; //end sort order case 'PRODUCT_LIST_MODEL': $listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MANUFACTURER': $listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $listing_sql .= " order by pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; } } So, solution is either to modify //sort order case 'PRODUCT_LIST_SORT_ORDER': $listing_sql .= "order by p.products_sort_order , pd.products_name " . ($sort_order == 'a' ? 'asc' : ''); break; //end sort order or to restore $listing_sql .= ' order by '; and remove "order by" from every line Error is gone Quote Link to comment Share on other sites More sharing options...
Beer Monster Posted December 10, 2007 Author Share Posted December 10, 2007 Now, not sure that the SQL error reason was the contribution. I noted the error after its install so it was first think about.Searced my index.php and found that it has folllowing mods } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_order = substr($HTTP_GET_VARS['sort'], 1); [b] $listing_sql .= ' order by ';[/b] switch ($column_list[$sort_col-1]) { case 'PRODUCT_LIST_MODEL': $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MANUFACTURER': $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $listing_sql .= "pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; } } Quote Light, in the absence of eyes, illuminates nothing. Link to comment Share on other sites More sharing options...
leveera Posted December 11, 2007 Share Posted December 11, 2007 Thanks for support! It is exactly that I did Sergei Should look like this: } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_order = substr($HTTP_GET_VARS['sort'], 1); [b] $listing_sql .= ' order by ';[/b] switch ($column_list[$sort_col-1]) { case 'PRODUCT_LIST_MODEL': $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MANUFACTURER': $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $listing_sql .= "pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; } } Quote Link to comment Share on other sites More sharing options...
chuckh2d Posted December 12, 2007 Share Posted December 12, 2007 Should look like this: ... Just in case this helps anyone. I installed Sort Order 1_2_3 carefully and was able to use the "back end" features, but like several others I was not seeing any change in my front-end displays. I think I made Beer Monster's "order by" fix to index.php and nothing changed.(but see below) I removed the database changes (which I had done directly) and re-did them by pasting the text commands into my SQL window (I feel stupid but thanks for showing me that trick) -and still nothing changed. Then I went back to the product list and hit the "Sort Order" button again. I was a litle surprised to see that that zeroed out my previous sequence, but after I re-entered a fresh sort-sequence, and hit save sort order... voila, the sequence is now correct at the front end of my site. UNFORTUNATELY: Every time a customer tried to get to a second page of products under any of my site's categories, there was an SQL error message: - 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 'order by p.products_sort_order , pd.products_name asc limit 20, select p.products_image, pd.products_name, p.products_sort_order, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '33' order by order by p.products_sort_order , pd.products_name asc limit 20, 20 It certainly looked as if the problem was my addition of "order by" to the line $listing_sql .= "p.products_sort_order , pd.products_name " . ($sort_order == 'a' ? 'asc' : ''); ..so I took it out again (reverting to the original Sort Order 1_2_3 contribution). And now everything (at last) works fine. Potential moral of this story --if you don't see a proper sort order on your front end-- before you go looking for installation errors, try erasing, re-entering and re-saving your sequence. Thanks much for the contribution. It certainly beats my antique SQL-ophobic workaround from '03 (=inserting invisible numbers before every product name ;o) Quote Link to comment Share on other sites More sharing options...
Beer Monster Posted December 13, 2007 Author Share Posted December 13, 2007 Potential moral of this story --if you don't see a proper sort order on your front end-- before you go looking for installation errors, try erasing, re-entering and re-saving your sequence. Thanks much for the contribution. It certainly beats my antique SQL-ophobic workaround from '03 (=inserting invisible numbers before every product name ;o) I'm glad you got it to work. It's amazing how difficult it is to predict what kind of problems people are going to have when you are creating a contribution. I remember going through the instructions for this on a vanilla install to make sure it worked perfectly before uploading it but of course everyones e-shop is unique in some way, so there are always new and unexpected problems. Thankfully most of these problems can be fixed with a bit of perseverence. It takes a lot of effort to turn a modification into good quality contribution that others can use but positive feedback makes it worthwhile! Quote Light, in the absence of eyes, illuminates nothing. Link to comment Share on other sites More sharing options...
travellikesound Posted December 15, 2007 Share Posted December 15, 2007 Ok, i just added this and uploaded. When i clicked on the category option in the admin panel to test it out i get this error: Parse error: syntax error, unexpected T_FUNCTION in /home/punkbaby/public_html/shop/admin/includes/functions/general.php on line 1314 I've double checked on the general.php page and everything is copied right. What else could be the problem? One thought on what could be an issue: This was my first time making changes to the database in myphpadmin. I didn't know the 2 items for the database changes were to be added together so i did them each separate. Is that a problem? If so, how do i fix it. Any other thoughts on what I might be doing wrong here? Quote Link to comment Share on other sites More sharing options...
travellikesound Posted December 15, 2007 Share Posted December 15, 2007 Ok, that isn't it. I figured out how to delete it and redo it correctly and I'm still getting the error. Quote Link to comment Share on other sites More sharing options...
travellikesound Posted December 15, 2007 Share Posted December 15, 2007 Scratch all that. I managed to figure it out on my own. I accidentally pasted in an "add" somewhere that I wasn't supposed to. Quote Link to comment Share on other sites More sharing options...
leveera Posted December 20, 2007 Share Posted December 20, 2007 After successful application of a products sort I decided to add a categories sort. I like to say that categories sort function fine now meanwhile I lost ability to sort products. I still able to enter to product sort mode at admin/categories.php.... =beginsort and change numbers but on the save sort - new settings are not apply, no errors, it just back to "before" settings. Would be grateful for advice where to look to fix problem many thanks Sergei Quote Link to comment Share on other sites More sharing options...
webfooted Posted January 16, 2008 Share Posted January 16, 2008 Hi, this contribution looks like exactly what I need and reading through the forum I see there are many happy users. I've had a couple of goes at installing it - everything in admin looks fine and new order is shown there, however when I look at the 'public' view it's made no difference. Any suggestions? Thanks in advance 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.