Hi Everyone,
I am working on a project where we need to display the number of
listings in each categories .
.ie
blue (34)
green (20)
red (12)
orange (3)
where the number in the brackets is the number of products in each
color. ie. 34 products are blue. Click blue to filter products.
What would be the correct way of doing this with a MVC model? I am
currently using a request action call in the loop but don't want to do
it this way b/c it will hog resources.
below is my view code for the color selector
<?php foreach ($colors as $color): ?>
<?php echo
$html->link($color['color']['type'],'/products/price/' .
$color['color']['id']); ?>
(<?php echo $products =
$this->requestAction('/products/
filtercount/' . $color['color']['id'],array('return'));?> )
<?php endforeach; ?>
this works but is not the correct way. I was thinking of creating a
custom global function that will give me a count.
Or can I create a helper with a database call?
any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---