Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Product Sort Order


Mark Russell

Recommended Posts

Product Sort v1.5a

 

Line 64 of catalog/admin/product_sorter.php

 

is :

 

while (list($key, $value) = each($sort_order_update)) {

 

Should be :

 

 

while (list($key, $value) = each($HTTP_POST_VARS['sort_order_update'])) {

 

 

Great contribution even if it took a while.

------------------------------------------------------------------------

The first panacea for a mismanaged nation is inflation

of the currency; the second is war. Both bring a
temporary prosperity; both bring permanent ruin.
Ernest Hemingway
------------------------------------------------------------------------

Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 106
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

To anybody who is gearing up to install this contribution, it works great!

 

However, here is a tidbit for installing 1.5 that might save you some debugging time.

 

Before installing 1.5, you need to unzip 1.4 (it's included in the 1.5 download) and install that FIRST. I missed this part on my first install.

 

You need 1.4 working before installing 1.5. 1.5 alone doesn't break anything, but it doesn't work, because it is looking for 1.4.

 

Also, once you have 1.4 installed correctly, I don't think the SQL commands listed in the Contributions for 1.5 on 22 Aug 2005 are necessary. I might be wrong about that, but I got a duplicate error when I tried to install it. So I left it out and the contribution seems to work.

 

I hope this saves somebody some time and frustration!

 

Janet

Link to comment
Share on other sites

I have one more problem to this...

 

One category has 38 products in it... so there is 2 pages of items.  When i click on the next page or #2 for second page... it sorts it by product alphabeticly.  Can someone help me fix this...

 

Look at my contributions, you'll find another contribution that implements sort order in a different way (not mine by the way, just made an update). add the changes for index.php that should fix this problem.

 

I'm thinking that these two contributions should be combined to take the best bits from each!

Light, in the absence of eyes, illuminates nothing.

Link to comment
Share on other sites

Hi, I have a problem.

When I try to display the Product Sort Order column (in Admin/Product Listing), I find this error message:

 

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /web/htdocs/www.piccolalibreria.it/home/site/admin/configuration.php(125) : eval()'d code on line 1

 

Is there who can help me?

I thanks in advance.

gersio

Link to comment
Share on other sites

I seem to have a problem with this contrib. I have the column listing contrib installed also.

 

(I didn't change anything on the product listing file) It works fine but when I don't enter any sort number, the products just shows at random. And sometimes it will show on the next page.

 

Is there a way to make it sort by number and if they don't have numbers, to show alphabetically?

Link to comment
Share on other sites

I just installed the latest 1.5b version and it seems to be working fine, apart from one major glitch: When I open the product sorter in the admin area, all products within categories are displayed correctly. I have some products, however, that they have not been entered in a category. For these products (that is, in the top level) I don't see anything, I see a blank page (they are not displayed). The contrib works perfectly with any product that is inside a subcategory.

 

Has anyone noticed the same?

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

OK, I can't wait for this to work. Great, extensive work! Thank you!

 

I do, of course, have a problem:

 

My store uses a different contribution for the layout of products per category. Instead of having 1 product per line working your way down-I have 3 products across & then down.

 

That being said, my catalog/includes/modules/product_listing.php file is completely different & I cannot figure out how to make these 2 contributions work together.

 

I would love to hear from someone who could help me. I would have posted my file contents, but that would be extensive, so I will gladly email someone if they could help.

 

The product layout can be viewed here: www.allstarsportsshop.com/index.php?cPath=1_31

 

Thanks again!

 

C

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

Great contribution but i do have one problem

it is working in my catalog but in the admin it still sort by productname

this is really confusing

it should sort by sort order

maybe i made a mistake or it should not sort by order

 

can someone help me with this or tell me where i can change so it's going to sort by "sort order"

 

many thanks

Link to comment
Share on other sites

  • 2 weeks later...

Perhaps someone can help me find out why each time I go to edit a product, I need to re-enter the sort order number in the text box (before I forget it). I must have missed something in the installation, but I don't know what it is.

 

 

 

Any ideas?

I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Link to comment
Share on other sites

  • 4 weeks later...

Hi!

I have this grate addon installed but there is one problem. If there is a large number of products listed under the same sorting number they are not sorted in alphabetical order. For example is i have 20 products which have the sort order1 they are not listed alphabetically "inside" that number.

 

Is there a fix availabla for this?

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

once again the 1054 error

 

im using this contribution on MySQL 5.0.21 and came across that error.

 

i found a solution here:

http://www.issociate.de/board/post/304577/...lause'.html

 

but it was quite a hazzle to find the right query as the errorsource

so id like to share the solution

 

change in the readme Product Sort v1.4 following lines (for the catalog/index.php):

 

>>> FIND THIS:

 

}

} else {

// show the products in a given categorie

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

[...]

 

>>> REPLACE THE LAST 4 LINES OF THE ABOVE:

 

$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, " .

[...]

 

>>> WITH THESE 4 LINES:

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, p.products_sort_order, 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

//mySQL 5 BUGFIX

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, p.products_sort_order , 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 INNER JOIN " . 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 . "'";

//BUG end

 

hope it works (in my case it does)

hope it helps

Link to comment
Share on other sites

Did anyone ever resolve Jack_mcs and algar423's problem with this contrib not working? I installed it without any PHP errors, the "Sort order" boxes show, but changing that number has no effect on the products display...

 

Please help... :(

 

JP

Link to comment
Share on other sites

  • 3 weeks later...

Nice Contribution but I have a quick question. From the instruction 1.4 below:

 

>>> REPLACE THE LAST 2 LINES OF THE ABOVE:

	  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
  $listing_sql .= " order by pd.products_name";

>>> WITH THESE 2 LINES:

	  $HTTP_GET_VARS['sort'] = 'products_sort_order';
	  $listing_sql .= "order by p.products_sort_order asc";

 

This code essentially replaces sorting the products from name to sort order. I was wondering if there was a way to test sort order so that if I have not applied any values to "sort order" then it will sort by product name.

Shade and Sweet Water

Chris Czerniak

Link to comment
Share on other sites

Figured it out. Quick and simple change to the above instructions for anyone who wants to organize by product sort as default but then organize by product name.

 

>>> REPLACE THE LAST 2 LINES OF THE ABOVE:

	  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
  $listing_sql .= " order by pd.products_name";

>>> WITH THESE 2 LINES:

	  $HTTP_GET_VARS['sort'] = 'products_sort_order';
	  $listing_sql .= "order by p.products_sort_order asc, pd.products_name";

Shade and Sweet Water

Chris Czerniak

Link to comment
Share on other sites

Great contrib, and v1.6 seemed to install ok on a fresh test install.

 

I'ld also like to make it so it applies to the front page aswell, in the same way as Helohelo wanted (above). Is there any reason the code added to the catagory pages can't be added to the front page code? If this is possible then what code and where?

Link to comment
Share on other sites

  • 4 months later...

I just installed Product Sort v1.6 yesterday and all appears to be working thus far (amazingly with how heavily modified I have things at the moment!).

 

I do have one area I could use some help with though. I have the Dyanmenu contribution installed and have it tweaked to show the products as well as the categories. I would like to sort the products in the menu with the new p.products_sort_order - but I have not been able to seem to accomplish this.

 

The only file I should need to mess with is the includes/boxes/dm_categories.php file.

 

I did change the query to include the sort by p.products_sort_order but that alone does not seem to be enough to accomplish it.

 

Here is the current query:

$result = tep_db_query('select c.categories_id, c.sort_order, cd.categories_id, cd.categories_name, c.parent_id, p.products_id, p.products_master_status, p.products_sort_order, pd.products_id, pd.products_name from ' . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . ' cd, ' . TABLE_PRODUCTS . ' p, ' . TABLE_PRODUCTS_DESCRIPTION . ' pd where c.categories_id = cd.categories_id and p.products_id = pd.products_id and p.products_master_status = 1 and cd.language_id="' . (int)$languages_id .'" and find_in_set("' . $customer_group_id . '", categories_hide_from_groups) = 0 '.$parent_query.' order by sort_order, cd.categories_name, p.products_sort_order asc, pd.products_name');

 

Here is the code that adds the products to the menu:

$products_in_category_query = tep_products_in_category($key);

while ($products_in_category = tep_db_fetch_array($products_in_category_query)) {

$product_id_h = 'products_id='.$products_in_category ['product_id'];
$product_name_h = $products_in_category ['product'];

if ($GLOBALS['products_id'] == $products_in_category ['product_id']) {
$that_expanded = '1';
$that_selected = 'dmselected';
} else {
$that_expanded = '';
$that_selected = '';
}

if ($menu_use_titles) {
$that_title = $product_name_h;
} else {
$that_title = '';
}

$output .= str_repeat(".", $level+2).'|'.$product_name_h.'|'.tep_href_link(FILENAME_PRODUCT_INFO, $product_id_h).'|'.$that_title.'|'.$menu_icon_file.'|'.$that_selected.'|'.$that_expanded."\n";
}

 

Does anyone see a way to incorporate the Product Sort into this? My guess is that I need to somehow incorporate the

if ( (!isset($HTTP_GET_VARS

bit of code (like in the catalog/index.php page) into the code that adds the product to the menu - but I'm not well enough versed in PHP to easily see how to tweak it for this particular script.

 

Any thoughts are greatly appreciated :)

~Tracy
 

Link to comment
Share on other sites

I just installed Product Sort v1.6 yesterday and all appears to be working thus far (amazingly with how heavily modified I have things at the moment!).

 

I do have one area I could use some help with though. I have the Dyanmenu contribution installed and have it tweaked to show the products as well as the categories. I would like to sort the products in the menu with the new p.products_sort_order - but I have not been able to seem to accomplish this.

 

The only file I should need to mess with is the includes/boxes/dm_categories.php file.

 

I did change the query to include the sort by p.products_sort_order but that alone does not seem to be enough to accomplish it.

 

I found it! In includes/functions/general.php there is a bit of script for the Dynamenu in order to have it show products as well as categories. There were two product queries in there that I changed to sort by to p.products_sort_order asc, pd.products_name and now all is working as intended :thumbsup:

~Tracy
 

Link to comment
Share on other sites

  • 2 months later...

Seems a greate contribution but got Error from sql query

 

SQL query:

 

INSERT INTO configuration( configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function )

VALUES ( 263, 'Display Product Sort Order', 'PRODUCT_SORT_ORDER', '0', 'Do you want to display the Product Sort Order column?', 8, 29, '', '', NULL , NULL ) ;

 

MySQL said:

 

#1062 - Duplicate entry '263' for key 1

 

Please help to solve

Thanks

 

Sergei

PS. Sorry, I'm very beginer in sql, this is first time I run sql query

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...