Sorting

Tata55

Avatar: Tata55

2014-01-17 12:05

I am testing the QuickCart (6). Adding new field was not that difficult. But I need also sorting of products with their new added value (color). How to do this? The products are sorted after chosing the sorting after the color, but they are not shown correctly.
E.g.: I used the numbers of colors. When I sort the products, they come on the site like 01,01,02,03,02,03

» Quick.Cart v6.x

Tata

Tata55

Avatar: Tata55

2014-01-17 12:22

One more try - colors after alphabet.
Here is the result: http://prntscr.com/2k25yt

Tata

Tata55

Avatar: Tata55

2014-01-17 12:33

Pardon, but one more question: How to make it to have a dropdown list in added fields instead of a text field. It would be much more comfortable to choose from pre-defined values than write each one into the text field. It would be also nice to have the "sort" links styled, so that the chosen sorting parameter would be e.g. highlighted.

Tata

boboo

Avatar: boboo

2014-01-17 15:52

to highlight the sorting option in products list:
create a format for "selsort" class in the style.css.
E.g.

.selsort{color:blue;}


In the listProducts function in core/products.php find the:

<a href="'.$sSortingLink.'sSort=">'.$lang['Default'].'</a>


and the following with sSort=name and sSort=price
Change in the three lines

a href


to:
1.

class="'.(((isset($GLOBALS['sSort'])&&$GLOBALS['sSort']=='')||!isset($GLOBALS['sSort']))?'selsort':null).'" href


2.

class="'.(((isset($GLOBALS['sSort'])&&$GLOBALS['sSort']=='name'))?'selsort':null).'" href


3.

class="'.(((isset($GLOBALS['sSort'])&&$GLOBALS['sSort']=='price'))?'selsort':null).'" href

boboo :-)

Tata55

Avatar: Tata55

2014-01-17 21:40

Someething is wrong.
Stylesheet has the required class.
The products.php has this code now.
[code] <div><a href="'.$sSortingLink.'sSort=">'.$lang['Default'].'</a></div>|
<div><a class="'.(((isset($GLOBALS['sSort'])&&$GLOBALS['sSort']=='')||!isset($GLOBALS['sSort']))?'selsort':null).'" ="'.$sSortingLink.'sSort=name">'.$lang['Name'].'</a></div>|
<div>< a class="'.(((isset($GLOBALS['sSort'])&&$GLOBALS['sSort']=='price'))?'selsort':null).'" href ="'.$sSortingLink.'sSort=price">'.$lang['Price'].'</a></div>|
<div>< a class="'.(((isset($GLOBALS['sSort'])&&$GLOBALS['sSort']=='color'))?'selsort':null).'" href ="'.$sSortingLink.'sSort=color">'.$lang['Product_field'].'</a></div>
[/code]
But nothing has changed.
And the sorting with the added attribute (color) doesn't work either.

Tata

Tata55

Avatar: Tata55

2014-01-17 23:44

I made a mistake. Thanks a lot, boboo, it works (I mean the highlighting). But with the sorting goes it still wrong. Aorting by name and price is OK, but the colors are missorted.

Tata

boboo

Avatar: boboo

2014-01-18 07:21

Did you add the 'color' in the sortProducts function in core/products/php, as a next elseIf statement?
Is there the sSort=color in the address line ($GET) when you click on sort by: 'color' ?

boboo :-)

boboo

Avatar: boboo

2014-01-18 07:24

OK, the second question is needless :-)
I see it in your code lines above :-)

boboo :-)

Back to top
about us | contact