Am new in Opencart I need an If then statement that will load a different .tpl paged depend on category_id.
I tried but showing error like
Parse error: syntax error, unexpected 'if' (T_IF), expecting ')' in D:\xampp\htdocs\ramesh\lmw\catalog\controller\product\sub_category.php on line 28
This is my code
sub_category.php
foreach ($category_info as $result) {
$data['categories'][] = array(
'name' => $result['name'],
'parent_id' => $result['parent_id'],
'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height')),
'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..',
#'href' => $this->url->link('product/filter', '&category_id=' . $result['category_id'])
#'href' => $this->url->link('product/sub_category')
if($result['category_id'] == 24)
{
'href' => $this->url->link('product/transmission', 'sub_category_id='.$result['parent_id'].'&category_id=' . $result['category_id'])
}
else
{
'href' => $this->url->link('product/filter', 'sub_category_id='.$result['parent_id'].'&category_id=' . $result['category_id'])
}
);
}
Aucun commentaire:
Enregistrer un commentaire