1

ORIGINAL POST Comment ajouter des conditions ET OU ET dans une collection de produits?

comment pourrais filtrer une collection de produit par: (attribut A : condition A And attribut A : condition B) OR (attribut B : condition C And attribut B : condition D)


TRANSLATION how can I filter a product collection by (attribut A : condition A And attribut A : condition B) OR (attribut B : condition C And attribut B : condition D)

0

FR: Tu peux essayer le code ci dessous (c'est la meme solution que j'ai donne a ton premier post How to fusion an AND et OR filter/condition in Magento? sur le meme sujet):

EN: you can try the code below (it's the same solution that I gave for your first post How to fusion an AND et OR filter/condition in Magento? on the same topic)

$collection->addFieldToFilter(
    ['created_at', 'updated_at'], // the field names
    [ // the conditions
        [ // the conditions for 'created_at' (first field)
            ['from' => $from],
            ['to' => $to]
        ],
        [ // the conditions for 'updated_at' (second field)
            ['from' => $from],
            ['to' => $to]
        ],
    ]
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.