Strange behaviour

2 posts by 2 authors in: Forums > CMS Builder
Last Post: May 13, 2013   (RSS)

By samsam - May 10, 2013 - edited: May 11, 2013

Hi

We managed to display in the backend a conditional that is built to do the following

A product editor that has Title, ..., Related products

Each product title is made of 2 letters + dash sign, such as AW-225F, AW-DfFF555, FB-FDFD5S, FB-SD2858...

Because there are 3K+ products, and we will always relate products within the same group of products starting with the same 2 letters

so in the related products multi record, we don't want to see the 3K products but just those who start with the same 2 letters as the current product title, and then be able to select multiple products from the narrowed down list.

Here is the code that we came up with that works!

SELECT num, title
FROM `<?php echo $TABLE_PREFIX ?>products`
<?php 
if($ESCAPED_FILTER_VALUE){ 
$value = $ESCAPED_FILTER_VALUE; 
$type = substr($value,0,2); ?>
WHERE title LIKE '<?php echo $type; ?>%'
<?php } ?>

Everything works fine, when editing a product, it only shows in the related products field the products that start with the same 2 letters, but VERY STRANGE, the entire website takes 30sec and more to load - If we remove the code above, the website acts fine.

Are we doing anything wrong?

Attaching a screenshot

Thanks so much!

Attachments:

related_001.png 61K