cc5 where statement

Filter products in CC5 using multiple NOT LIKE conditions.

Overview

The issue occurs because the CC5 where statement syntax does not directly support multiple NOT LIKE conditions on the same column when using the standard array format.
Use the colon syntax to write a full, explicit SQL WHERE clause that combines all the necessary conditions, including the multiple NOT LIKE statements.

Answered
md mduda 09 Jul, 2017
I've re-read the FAQ's on where statements. I've tried multiple ways to get data to show properly.

Using the below - the where properly captures the "published" and "auction" fields. but the fields with NOT LIKE still are displayed. Is there a different way I need to put this in CC5?

<?php
return array ( 'p.product_published ' => '1', 
'p.product_auction' => '0', 
'p.product_code NOT LIKE' => '%Watch%',
'p.product_code NOT LIKE' => '%PTA_Membership%', 
'p.product_code NOT LIKE' => '%Marquee%', 
'p.product_code NOT LIKE' => '%Donation%' ) ;
?>


Can't seem to do an "OR", so tried to create a string with "NOT LIKE" OR, and this doesn't work either.

<?php
$nonapparel = array ('Watch', 'Membership', 'Marquee', 'Bundle', 'Donation');

return array ( 'p.product_published ' => '1', 
'p.product_auction' => '0', 
'p.product_code NOT LIKE' => '%'.$nonapparel.'%'  ) ;

?>
Gr GreyHead 10 Jul, 2017
Answer
Hi mduda,

I suggest that you use the 'colon :' syntax from the FAQ and spell out the query that you want to use in full.

Bob
md mduda 10 Jul, 2017
That did the trick. Thanks Bob.
This topic is locked and no more replies can be posted.