Tuesday, June 26, 2012

Filter by product properties with paginate...

In category I show products list with paginate:
var $paginate = array(
    'Product' => array(
        'limit' => 10,
        'order' => array(
            'Product.instock' => 'desc',
            'Product.title' => 'asc',
        ),
    )
);

if user choose filter than I add conditions:
$this->paginate['Product']['contain']['ProductsProperty']['conditions']['OR'] = $contain_conditions;

but this filter don't remove products from list, it remove only products properties and it looks like:
Array
(
    [0] => Array
        (
            [Product] => Array
                (
                    [id] => 42
                    ...
                ) 
 
            [ProductsProperty] => Array
                (
                )
        ) 
(
    [1] => Array
        (
            [Product] => Array
                (
                    [id] => 3
                    ...
                ) 
 
            [ProductsProperty] => Array
                (
                )
        ) 
 
 

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: