v2.0.9 orderByFields some errors [FRONT-END]

Started by bytelord, August 15, 2012, 04:48:17 AM

Previous topic - Next topic

bytelord

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
(
   
  • => product_name
        [1] => `p`.`created_on`
        [2] => `p`.`product_sku`
        [3] => product_s_desc
        [4] => product_desc
        [5] => category_name
        [6] => category_description
        [7] => mf_name
        [8] => product_price
        [9] => product_special
        [10] => product_sales
        [11] => product_availability
        [12] => product_available_date
        [13] => product_height
        [14] => product_width
        [15] => product_length
        [16] => product_lwh_uom
        [17] => product_weight
        [18] => product_weight_uom
        [19] => product_in_stock
        [20] => low_stock_notification
        [21] => `p`.`modified_on`
        [22] => product_unit
        [23] => product_packaging
        [24] => `p`.`virtuemart_product_id`
        [25] => ordering
    )

    Its attached a 'p'. ' ' to 4 strings.

    After that order strings are created wrong. For example COM_VIRTUEMART_`CREATED_ON` is creating by adding a ' before the pf and after. This is happen to 4 strings. So when accessing from BE Configuration-->Product Order Settings these 4 string are appeared wrong and also if you have selected apeared wrong in the FE on category ordering or available search fields.

    Regards,

    BL
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

bytelord

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
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bytelord

i think there is an issue with editors many times when using `
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Milbo

no the ` is fine. `p`.myfield is imho correct
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bytelord

yes you have right, this should work fine, like '`p`.field' .... without ` on field ...
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

bytelord

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

bytelord

#7
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]
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Milbo

Reload it and you will see that it is sometimes something else not translated.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bytelord

#9
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]
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

bytelord

#10
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?
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bytelord

#12
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.
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!