VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: bytelord on August 15, 2012, 04:48:17 AM

Title: v2.0.9 orderByFields some errors [FRONT-END]
Post by: bytelord on August 15, 2012, 04:48:17 AM
Hello,

I think i find a bug in the model products when $browseOrderByFields is been produced some content of the array is wrong. After showing the debug information from models/products.php on the BE [line70: vmdebug('$browseOrderByFields',$browseOrderByFields)] returns the following results.

Array
(
   
Title: Re: v2.0.9 orderByFields errors [getValidProductFilterArray Function] [SOLVED]
Post by: bytelord on August 15, 2012, 05:08:23 AM
find the solution after a little bit more searching.

Inside administrator\components\com_virtuemart\helpers\shopfunctions.php in line 1403 the $filterArray was creating wrong string names for the function getValidProductFilterArray by attaching the `p`.`string`. I think by mistake was placed there or the developers wants to use 'p.modified_on' for example instead of '`p`.`modified_on`'.

From line 1403 to line 1410 change the following code from:
$filterArray = array('product_name', '`p`.`created_on`', '`p`.`product_sku`',
'product_s_desc', 'product_desc',
'category_name', 'category_description', 'mf_name',
'product_price', 'product_special', 'product_sales', 'product_availability', 'product_available_date',
'product_height', 'product_width', 'product_length', 'product_lwh_uom',
'product_weight', 'product_weight_uom', 'product_in_stock', 'low_stock_notification',
'`p`.`modified_on`',
'product_unit', 'product_packaging', '`p`.`virtuemart_product_id`', 'ordering');


to this:

$filterArray = array('product_name', 'created_on', 'product_sku',
'product_s_desc', 'product_desc',
'category_name', 'category_description', 'mf_name',
'product_price', 'product_special', 'product_sales', 'product_availability', 'product_available_date',
'product_height', 'product_width', 'product_length', 'product_lwh_uom',
'product_weight', 'product_weight_uom', 'product_in_stock', 'low_stock_notification',
'modified_on',
'product_unit', 'product_packaging', 'virtuemart_product_id', 'ordering');


or to this:

$filterArray = array('product_name', 'p.created_on', 'p.product_sku',
'product_s_desc', 'product_desc',
'category_name', 'category_description', 'mf_name',
'product_price', 'product_special', 'product_sales', 'product_availability', 'product_available_date',
'product_height', 'product_width', 'product_length', 'product_lwh_uom',
'product_weight', 'product_weight_uom', 'product_in_stock', 'low_stock_notification',
'p.modified_on',
'product_unit', 'product_packaging', 'p.virtuemart_product_id', 'ordering');


Hope be corrected by developers.

Thanks

BL
Title: Re: v2.0.9 orderByFields some errors [SOLVED]
Post by: Milbo on August 15, 2012, 14:23:23 PM
Okey without the ` then
Title: Re: v2.0.9 orderByFields some errors [SOLVED]
Post by: bytelord on August 15, 2012, 14:40:55 PM
i think there is an issue with editors many times when using `
Title: Re: v2.0.9 orderByFields some errors [SOLVED]
Post by: Milbo on August 15, 2012, 15:01:49 PM
no the ` is fine. `p`.myfield is imho correct
Title: Re: v2.0.9 orderByFields some errors [SOLVED]
Post by: bytelord on August 15, 2012, 21:54:24 PM
yes you have right, this should work fine, like '`p`.field' .... without ` on field ...
Title: Re: v2.0.9 orderByFields some errors [SOLVED]
Post by: bytelord on August 15, 2012, 23:19:12 PM
fixed in 2.0.9a :) thanks Milbo.
Title: Re: v2.0.9 orderByFields some errors [SOLVED]
Post by: bytelord on August 20, 2012, 16:11:01 PM
Milbo,

working with 209b and seems that the same issue hasn't resolved finally at the front-end. When expand a category and try order the url is wrong, take a look at the shot bellow.  The url is creating after all in the fe is
category/by,`p`.created_on
should be by product_created_on, somewhere miss it, i could't find it.

Again the ' issue for FE.


[attachment cleanup by admin]
Title: Re: v2.0.9 orderByFields some errors [FRONT-END]
Post by: Milbo on August 20, 2012, 16:56:25 PM
Reload it and you will see that it is sometimes something else not translated.
Title: Re: v2.0.9 orderByFields some errors [FRONT-END]
Post by: bytelord on August 20, 2012, 17:26:51 PM
sorry, my mistake, the post have no to do with the translation, the ordering is the main issue. The url parameter is  by,`p`.created_on instead of product_created_on!
its a bug somewhere, couldn't find it.

Update: Check the shot.

[attachment cleanup by admin]
Title: Re: v2.0.9 orderByFields some errors [FRONT-END]
Post by: bytelord on August 20, 2012, 18:52:54 PM
the issue is coming again from shopfunctions line 1403, when you save ordering from the be, is stored with the `p`, but why adding product (p)? It does not needed it.
the right one for ordering category/by,created_on and not product_created_on.
So i think shopfunctions in line 1403 should change to:

$filterArray = array('product_name', 'created_on', 'product_sku',
         'product_s_desc', 'product_desc',
            'category_name', 'category_description', 'mf_name',
         'product_price', 'product_special', 'product_sales', 'product_availability', 'product_available_date',
         'product_height', 'product_width', 'product_length', 'product_lwh_uom',
         'product_weight', 'product_weight_uom', 'product_in_stock', 'low_stock_notification',
          'modified_on',
            'product_unit', 'product_packaging', 'virtuemart_product_id', 'ordering');

With that changes be and fe ordering is working but i don't know is there are side affects.

Can you confirm it?
Title: Re: v2.0.9 orderByFields some errors [FRONT-END]
Post by: Milbo on August 20, 2012, 21:15:30 PM
lol no.

It took a lot of posts and time to add them. They are necessary, when you have a category in the filter. The right answer is to adjust the FE,.. removing the `p` creating the language keys.
Title: Re: v2.0.9 orderByFields some errors [FRONT-END]
Post by: bytelord on August 20, 2012, 23:22:00 PM
simple enough after all  ;D
After the first fix at 15-08 works perfect and 'p' are absolute necessary. As we discussed with Milbo was a language issue.
Using a different language on my website front with SEF enabled the COM_VIRTUEMART_CREATED_ON key was missing from my language files, as a result when sef url produced was giving the actually string 'p'.created_on because nothing was found on the translation keys. By mistake, instead i knew that the key was missing, i was trying to blame shopfunctions and searching on the wrong way.

Thanks.
Title: Re: v2.0.9 orderByFields some errors [FRONT-END]
Post by: tailer on January 13, 2013, 10:34:39 AM
http://forum.virtuemart.net/index.php?topic=110676.msg376561#msg376561