{% set text = ( key_value != 'address' ? 'value' : 'placeholder' ) ~ '=' ~ "'~value~'" %}
<div{{ (id?' id="'~id~'"')|raw }}>my div1</div>
{% set text = ( key_value != 'address' ? ('value="' ~ {{ value }} ~ '"') : '' ) %}
$text = ( $key_value != 'address' ) ? 'value="' . $value . '"' : '';
$data['categories'] = array();
$data['products_home'] = array();
$products_home = array();
$categories = $this->model_catalog_category->getCategories(0);
if ( ( isset( $this->request->request['route'] ) && $this->request->get['route'] == 'common/home' ) || $this->request->server['REQUEST_URI'] == '/' ) {
$data['is_home'] = true;
}
foreach ($categories as $category) {
$children_data = array();
if ($category['category_id'] == $data['category_id']) {
$children = $this->model_catalog_category->getCategories($category['category_id']);
foreach($children as $child) {
$filter_data = array('filter_category_id' => $child['category_id'], 'filter_sub_category' => true);
$children_data[] = array(
'category_id' => $child['category_id'],
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
}
$filter_data = array(
'filter_category_id' => $category['category_id'],
'filter_sub_category' => true
);
$data['categories'][] = array(
'category_id' => $category['category_id'],
'name' => $category['name'] . ( $this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'thumb' => $this->model_tool_image->resize( $category['image'], $this->config->get( 'theme_' . $this->config->get( 'config_theme' ) . '_image_category_width'), $this->config->get( 'theme_' . $this->config->get( 'config_theme' ) . '_image_category_height' ) ),
'children' => $children_data,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
);
if ( isset( $data['is_home'] ) ) {
$filter_data['filter_sub_category'] = false;
$products_home['category_id'][] = $category['category_id'];
$products_home['products'] = $this->model_catalog_product->getProducts( $filter_data );
}
}
if ( !empty( $products_home ) ) {
foreach ( $products_home as $product_home ) {
// echo '<pre>'; print_r($product_home); echo '</pre>';
$data['products_home'][] = array(
'category_id' => $category['category_id'],
'name' => $product_home['name'],
'href' => $this->url->link('product/product', 'product_id=' . $product_home['product_id'])
);
}
}
echo '<pre>'; print_r($products_home); echo '</pre>';
Вы кстати может знаете какой-то плагин или пример статьи, какой лучше посоветуете ?