[Products] Sorting by field definitions does not work
[Products] Sorting by field definitions does not work
i am using products (2.7.5) and company directory (1.5.4) with CMSms 1.7.1.
I am using products with summary Template only. i added field definition "rating" with dropdown values from 1-5. they will be displayed in front and backend both.
now, i wanted products to sort the items by this value. therefore i am using the parameter sortby="f:rating" but the sort order is wrong. they are completely disordered for some reason?!
i am using the same sort parameter in company directory and well…this works perfectly! therefore i am a lil bit confused. whats wrong here?
thanks
edit: seems that it just orders by product_name instead of custom field
I am using products with summary Template only. i added field definition "rating" with dropdown values from 1-5. they will be displayed in front and backend both.
now, i wanted products to sort the items by this value. therefore i am using the parameter sortby="f:rating" but the sort order is wrong. they are completely disordered for some reason?!
i am using the same sort parameter in company directory and well…this works perfectly! therefore i am a lil bit confused. whats wrong here?
thanks
edit: seems that it just orders by product_name instead of custom field
Last edited by nicmare on Mon May 10, 2010 3:03 pm, edited 1 time in total.
Re: [Products] Sorting by field definitions does not work
i tried to spot both functions:
in company directory:
in products:
but dont know how do modify it 
in company directory:
Code: Select all
if( startswith($str,'f:') )
{
$fielddefs = $this->GetFieldDefs();
$tmp = substr($str,2);
for( $i = 0; $i < count($fielddefs); $i++ )
{
if( $fielddefs[$i]->name == $tmp )
{
$sort_fielddef = clone $fielddefs[$i];
}
}
}in products:
Code: Select all
if( startswith($tmp,'f:') )
{
$fieldname = substr($tmp,strlen('f:'));
if( isset($fielddefs[$fieldname]) )
{
$fieldid = $fielddefs[$fieldname]->id;
$as = 'FV'.$sortfield++;
$joins[] = cms_db_prefix()."module_products_fieldvals {$as} ON c.id = {$as}.product_id AND $as.fielddef_id = '{$fieldid}'";
$sortby = "{$as}.value";
}
}-
calguy1000
- Support Guru

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: [Products] Sorting by field definitions does not work
Okay, I have now spent 2 hours (one hour each) on separate occasions setting up for, and testing Products for exactly this functionality. Once just now, and another time when I received an email from a bug report. And both times I have had no problems.
I went so far as to output debugging information in the output, and checking absolutely everything. IT WORKS!!!
Attached is a screenshot of the result of calling {Products sortby='f:rating} which is a dropdown field with values from 1 to 5.
I suggest you export your products to ASCII and look at the values it outputs, this should give you a hint as to what the problem is.
I went so far as to output debugging information in the output, and checking absolutely everything. IT WORKS!!!
Attached is a screenshot of the result of calling {Products sortby='f:rating} which is a dropdown field with values from 1 to 5.
I suggest you export your products to ASCII and look at the values it outputs, this should give you a hint as to what the problem is.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: [Products] Sorting by field definitions does not work
really strange!
i use products this way:
(german names, don't wonder)
And this makes the same order like product_name (default).
here is my screenshot of the frontend where testvar is field Reihenfolge (rating):
i use products this way:
Code: Select all
{Products category="Golffilme" summarytemplate="Golffilme" sortby="f:Reihenfolge"}And this makes the same order like product_name (default).
here is my screenshot of the frontend where testvar is field Reihenfolge (rating):
Re: [Products] Sorting by field definitions does not work
Hello there,
i have problem even stranger then this one...
In the same site:
{Products category="cat1" summarytemplate="transport" sortby="f:sorting"} works
{Products category="cat3" summarytemplate="transport" sortby="f:sorting"} works
{Products category="cat4" summarytemplate="transport" sortby="f:sorting"} works
{Products category="cat2" summarytemplate="career" sortby="f:sorting"} didn't work
.......
Have cleared cache - nothing, testing in different ways nothing can help...
i have problem even stranger then this one...
In the same site:
{Products category="cat1" summarytemplate="transport" sortby="f:sorting"} works
{Products category="cat3" summarytemplate="transport" sortby="f:sorting"} works
{Products category="cat4" summarytemplate="transport" sortby="f:sorting"} works
{Products category="cat2" summarytemplate="career" sortby="f:sorting"} didn't work
.......
Have cleared cache - nothing, testing in different ways nothing can help...
Re: [Products] Sorting by field definitions does not work
I have the same problem. Whenever I try to add a custom sort, it keeps sorting on product name.
I imported all my products trough CSV import. Could this cause the problem?
I imported all my products trough CSV import. Could this cause the problem?
Re: [Products] Sorting by field definitions does not work
I have solved my problem...
Looks like problem becomes when you editing existing {Products} tag. Try to delete {Product} tag, save your page, and then enter new and full (with all options) {products} tag.
After that modify every field in your products, you need to sort and save products.
I think this is the problem with cashing.... And a little bit annoying
Looks like problem becomes when you editing existing {Products} tag. Try to delete {Product} tag, save your page, and then enter new and full (with all options) {products} tag.
After that modify every field in your products, you need to sort and save products.
I think this is the problem with cashing.... And a little bit annoying
Re: [Products] Sorting by field definitions does not work
Is there another way to re-save every product? I have the same issue but have ~800 products. I would lose to much time opening every product and resaving it.
Re: [Products] Sorting by field definitions does not work
Try to switch of cache and delete everything in cache directory (this trick didn't help for me...)
Re: [Products] Sorting by field definitions does not work
That was the first thing I tried but no lucktpsvca wrote:Try to switch of cache and delete everything in cache directory (this trick didn't help for me...)

