I plan to have a tab / accordion style where you can click to see all products (limited to 10 per page with multiple pages) or all products on the one page that are on special offer (no limits).
There are possibly ways of doing this by filter but I would really like to get it to work separately within the category.php (controller). Or better still if I could get it to work together with the current array the products use (not sure if that would be possible to differentiate).
So far I have tried cloning the products data array in the controller to try and make it work on it's own without limit - the closest I can get is where it only shows the products on special offer from the current pagination.
Here is what I've got at the moment (currently php error message: Undefined index: special - from the category.tpl if statement):
Category.php (controller)
Code: Select all
$data['specials'] = array();
$filter_specials = array(
'filter_category_id' => $category_id,
'filter_filter' => $filter,
'sort' => $sort,
'start' => ($page - 1) * $limit * 0,
'limit' => 10000
);
$specials = $this->model_catalog_product->getProducts($filter_specials);
foreach ($specials as $result) {
$data['specials'][] = array(
'product_id' => $result['product_id'],
'name' => $result['name'],
'price' => $price,
'special' => $special,
);
}
I have tried to mimic the results as result that the products use in the category.php.
Category.tpl:
Code: Select all
<?php foreach ($specials as $product) { ?>
<?php if ($product['special']) { ?>
<?php echo $product['name']; ?></h4>
<?php } ?>
<?php } ?>