Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Передача переменной в twig шаблон


prukon
 Share

Recommended Posts

Добрый гдень. 

Есть шаблон product.twig

В этом шаблоне используется переменная  stock_status

В этом можно легко убедится. Я это гделаю вот ик (вижу на экране значение переменной):

<pre>

{{stock_status}}

</pre>

 

Есть икже шаблон category.twig

В этом шаблоне НЕ используется переменная  stock_status

В этом я убеждаюсь, вызывая код выше (вижу пустоту).

 

Пожалуйси подскажите, в каком файле выполняется передача переменной в конкретный шаблон? Мне надо в шаблон category.twig передать эту переменную. 

Заранее спасипотому что.

 

Link to comment
Share on other sites


3 часа назад, chukcha сказал:

контроллер product/category
$data['products']

 

 

В контроле встретил вот икой перепотому чтор:

 

			foreach ($results as $result) {
				if ($result['image']) {
					$image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
				} else {
					$image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
				}

				if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
					$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
				} else {
					$price = false;
				}

				if ((float)$result['special']) {
					$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
				} else {
					$special = false;
				}

				if ($this->config->get('config_tax')) {
					$tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']);
				} else {
					$tax = false;
				}

				if ($this->config->get('config_review_status')) {
					$rating = (int)$result['rating'];
				} else {
					$rating = false;
				}

				$data['products'][] = array(
					'product_id'    => $result['product_id'],
					'thumb'         => $image,
					'name'          => $result['name'],
					'description'   => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'         => $price,
					'special'       => $special,
					'tax'           => $tax,
					'minimum'       => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'        => $result['rating'],
					'href'          => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)

                    //мой код
                    'stock_status'  =>???;
                    //мой код
                );
			}

 

Подскажите, что мне нужно записать между моим комменирием, чтобы в twig шаблон передать {{stock_status}} ?

Link to comment
Share on other sites


'href'        => $this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url),
					'stock_status' => $result['stock_status']

Специально захватил строчку с href, т.к. в конэто Вы забыли запятую.

 

В шаблоне: {{ product.stock_status}}

Link to comment
Share on other sites


8 часов назад, PeterStudio сказал:
'href'        => $this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url),
					'stock_status' => $result['stock_status']

Специально захватил строчку с href, т.к. в конэто Вы забыли запятую.

 

В шаблоне: {{ product.stock_status}}

К сожнонию не помогло. 

 

Контроллер.

Спойлер
<?php
class ControllerProductCategory extends Controller {
	public function index() {
		$this->load->language('product/category');

		$this->load->model('catalog/category');

		$this->load->model('catalog/product');

		$this->load->model('tool/image');

		if (isset($this->request->get['filter'])) {
			$filter = $this->request->get['filter'];
		} else {
			$filter = '';
		}

		if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'p.sort_order';
		}

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'ASC';
		}

		if (isset($this->request->get['page'])) {
			$page = $this->request->get['page'];
		} else {
			$page = 1;
		}

		if (isset($this->request->get['limit'])) {
			$limit = (int)$this->request->get['limit'];
		} else {
			$limit = $this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit');
		}

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/home')
		);

		if (isset($this->request->get['path'])) {
			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			$path = '';

			$parts = explode('_', (string)$this->request->get['path']);

			$category_id = (int)array_pop($parts);

			foreach ($parts as $path_id) {
				if (!$path) {
					$path = (int)$path_id;
				} else {
					$path .= '_' . (int)$path_id;
				}

				$category_info = $this->model_catalog_category->getCategory($path_id);

				if ($category_info) {
					$data['breadcrumbs'][] = array(
						'text' => $category_info['name'],
						'href' => $this->url->link('product/category', 'path=' . $path . $url)
					);
				}
			}
		} else {
			$category_id = 0;
		}

		$category_info = $this->model_catalog_category->getCategory($category_id);

		if ($category_info) {
			$this->document->setTitle($category_info['meta_title']);
			$this->document->setDescription($category_info['meta_description']);
			$this->document->setKeywords($category_info['meta_keyword']);

			$data['heading_title'] = $category_info['name'];

			$data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0));

			// Set the last category breadcrumb
			$data['breadcrumbs'][] = array(
				'text' => $category_info['name'],
				'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'])
			);

			if ($category_info['image']) {
				$data['thumb'] = $this->model_tool_image->resize($category_info['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'));
			} else {
				$data['thumb'] = '';
			}

			$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
			$data['compare'] = $this->url->link('product/compare');

			$url = '';

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			$data['categories'] = array();

			$results = $this->model_catalog_category->getCategories($category_id);

			foreach ($results as $result) {
				$filter_data = array(
					'filter_category_id'  => $result['category_id'],
					'filter_sub_category' => true
				);

				$data['categories'][] = array(
					'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
					'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);
			}

			$data['products'] = array();

			$filter_data = array(
				'filter_category_id' => $category_id,
				'filter_filter'      => $filter,
				'sort'               => $sort,
				'order'              => $order,
				'start'              => ($page - 1) * $limit,
				'limit'              => $limit
			);

			$product_total = $this->model_catalog_product->getTotalProducts($filter_data);

			$results = $this->model_catalog_product->getProducts($filter_data);

			foreach ($results as $result) {
				if ($result['image']) {
					$image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
				} else {
					$image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
				}

				if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
					$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
				} else {
					$price = false;
				}

				if ((float)$result['special']) {
					$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
				} else {
					$special = false;
				}

				if ($this->config->get('config_tax')) {
					$tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']);
				} else {
					$tax = false;
				}

				if ($this->config->get('config_review_status')) {
					$rating = (int)$result['rating'];
				} else {
					$rating = false;
				}

				$data['products'][] = array(
					'product_id'  => $result['product_id'],
					'thumb'       => $image,
					'name'        => $result['name'],
					'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'tax'         => $tax,
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $result['rating'],
					'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url),
                    'stock_status' => $result['stock_status']

                );
			}

			$url = '';

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			$data['sorts'] = array();

			$data['sorts'][] = array(
				'text'  => $this->language->get('text_default'),
				'value' => 'p.sort_order-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url)
			);

			$data['sorts'][] = array(
				'text'  => $this->language->get('text_name_asc'),
				'value' => 'pd.name-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url)
			);

			$data['sorts'][] = array(
				'text'  => $this->language->get('text_name_desc'),
				'value' => 'pd.name-DESC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url)
			);

			$data['sorts'][] = array(
				'text'  => $this->language->get('text_price_asc'),
				'value' => 'p.price-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url)
			);

			$data['sorts'][] = array(
				'text'  => $this->language->get('text_price_desc'),
				'value' => 'p.price-DESC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url)
			);

			if ($this->config->get('config_review_status')) {
				$data['sorts'][] = array(
					'text'  => $this->language->get('text_rating_desc'),
					'value' => 'rating-DESC',
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url)
				);

				$data['sorts'][] = array(
					'text'  => $this->language->get('text_rating_asc'),
					'value' => 'rating-ASC',
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url)
				);
			}

			$data['sorts'][] = array(
				'text'  => $this->language->get('text_model_asc'),
				'value' => 'p.model-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url)
			);

			$data['sorts'][] = array(
				'text'  => $this->language->get('text_model_desc'),
				'value' => 'p.model-DESC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url)
			);

			$url = '';

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			$data['limits'] = array();

			$limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100));

			sort($limits);

			foreach($limits as $value) {
				$data['limits'][] = array(
					'text'  => $value,
					'value' => $value,
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value)
				);
			}

			$url = '';

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			$pagination = new Pagination();
			$pagination->total = $product_total;
			$pagination->page = $page;
			$pagination->limit = $limit;
			$pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}');

			$data['pagination'] = $pagination->render();

			$data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));

			// http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html
			if ($page == 1) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical');
			} else {
				$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical');
			}
			
			if ($page > 1) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev');
			}

			if ($limit && ceil($product_total / $limit) > $page) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next');
			}

			$data['sort'] = $sort;
			$data['order'] = $order;
			$data['limit'] = $limit;

			$data['continue'] = $this->url->link('common/home');

			$data['column_left'] = $this->load->controller('common/column_left');
			$data['column_right'] = $this->load->controller('common/column_right');
			$data['content_top'] = $this->load->controller('common/content_top');
			$data['content_bottom'] = $this->load->controller('common/content_bottom');
			$data['footer'] = $this->load->controller('common/footer');
			$data['header'] = $this->load->controller('common/header');

			$this->response->setOutput($this->load->view('product/category', $data));
		} else {
			$url = '';

			if (isset($this->request->get['path'])) {
				$url .= '&path=' . $this->request->get['path'];
			}

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			$data['breadcrumbs'][] = array(
				'text' => $this->language->get('text_error'),
				'href' => $this->url->link('product/category', $url)
			);

			$this->document->setTitle($this->language->get('text_error'));

			$data['continue'] = $this->url->link('common/home');

			$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');

			$data['column_left'] = $this->load->controller('common/column_left');
			$data['column_right'] = $this->load->controller('common/column_right');
			$data['content_top'] = $this->load->controller('common/content_top');
			$data['content_bottom'] = $this->load->controller('common/content_bottom');
			$data['footer'] = $this->load->controller('common/footer');
			$data['header'] = $this->load->controller('common/header');

			$this->response->setOutput($this->load->view('error/not_found', $data));
		}
	}
}

 

 

 

Шаблон (без pre тоже ничего не выводит)

Спойлер
{{ header }}
<div id="product-category" class="container">
	<ul class="breadcrumb">
		{% for breadcrumb in breadcrumbs %}
			<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
		{% endfor %}
	</ul>
	<div>
	{% if thumb or description %}
		<div class="row">
			{% if thumb %}
				<div class="col-sm-4">
					<span id="image-category" class="image-category"><img src="{{ thumb }}" alt="{{ heading_title }}" title="{{ heading_title }}" class="img-thumbnail" /></span>
				</div>
			{% endif %}
			{% if description %}
				<div id="description-category" class="description description-category {{ thumb ? 'col-sm-8' : 'col-sm-12' }}">
					<div class="description-category__cont">
						<h2>{{ heading_title }}</h2>

						{{ description }} 
					</div>
					<div class="description-category__links" style="margin-top: 40px;">
						<a href="#" class="link show-desc" data-text-open="{{ text_data_open }}" data-text-close="{{ text_data_close }}">{{ text_data_open }}</a>
					</div>
				</div>
			{% endif %}
		</div>
	{% endif %}
	{% if (categories) %}
		<h3>{{ text_refine }}</h3>
		<div class="row">
			<ul class="box-subcat">
				{% for category in categories %}
					<li class="col-sm-3">
						<div class="thumb">
							{% if (category['thumb']) %}
								<div class="image">
									<a href="{{ category['href'] }}">
										<img width="{{ thumb_width }}" height="{{ thumb_height }}" src="{{ category['thumb'] }}" alt="{{ category['name'] }}" />
									</a>
								</div>
							{% endif %}
							<div class="name subcatname">
								<a href="{{ category['href'] }}">{{ category['name'] }}</a>
							</div>
						</div>
					</li>
				{% endfor %}
			</ul>
		</div>
	{% endif %}
	</div>
	<div class="row">
		{{ column_left }}
		{% if column_left and column_right %}
			{%set class = 'col-sm-6' %}
		{% elseif column_left or column_right %}
			{%set class = 'col-sm-9' %}
		{% else %}
			{%set class = 'col-sm-12' %}
		{% endif %}
		<div id="content" class="{{ class }}">
			{{ content_top }}
			{% if products %}
				<div class="product-filter clearfix">
					<div class="product-filter_elem">
						<div class="button-view">						
							<button type="button" id="grid-view" data-toggle="tooltip" title="{{ button_grid }}"><i class="material-design-two375"></i></button>
							<button type="button" id="list-view" data-toggle="tooltip" title="{{ button_list }}"><i class="material-design-view12"></i></button>
						</div>
					</div>
					<div class="product-filter_elem sort">
						<label class="control-label"  for="input-sort">
							{{ text_sort }}
						</label>
						<select id="input-sort" onchange="location = this.value;">
							{% for sorts in sorts %}
								{% if sorts.value == '%s-%s'|format(sort, order) %}
									<option value="{{ sorts['href'] }}" selected="selected">
										{{ sorts['text'] }}
									</option>
								{% else %}
									<option value="{{ sorts['href'] }}">
										{{ sorts['text'] }}
									</option>
								{% endif %}
							{% endfor %}
						</select>
					</div>
					<div class="product-filter_elem show pull-right">
						<label class="control-label"  for="input-limit">
							{{ text_limit }}
						</label>
						<select id="input-limit" onchange="location = this.value;">
							{% for limits in limits %}
								{% if (limits['value'] == limit) %}
									<option value="{{ limits['href'] }}" selected="selected">
										{{ limits['text'] }}
									</option>
								{% else %}
									<option value="{{ limits['href'] }}">
										{{ limits['text'] }}
									</option>
								{% endif %}
							{% endfor %}
						</select>
					</div>
					
				</div>
				<div class="row">
					{%set option_index = 5000 %}
					{% for product in products %}
						<div class="product-layout product-list">
							<div class="product-thumb transition {% if product.options and product.options|length <= 3 %} {{ 'options' }} {% endif %}">
								{% if product.options and product.options|length <= 3 %}
									<div class="product-option-wrap">
										<div class="product-options form-horizontal">
											<div class="options">
												<a class="ajax-overlay_close" href='#'></a>
												<input type="text" name="product_id" value="{{ product.product_id }}" class="form-control hidden"/>
												<h3>{{ text_option }}</h3>
												{% for option in product.options %}
													{% if option.type == 'select' %}
														<div class="form-group{% if option.required %} required {% endif %}">
															<label class="control-label col-sm-12"  for="input-option{{ option.product_option_id ~ module ~ option_index }}">
																{{ option.name }}
															</label>
															<div class="col-sm-12">
																<select name="option[{{ option.product_option_id }}]" id="input-option{{ option.product_option_id ~ module ~ option_index }}" class="form-control">
																	<option value="">{{ text_select }}</option>
																	{% for option_value in option.product_option_value %}
																		<option value="{{ option_value.product_option_value_id }}">{{ option_value.name }}
																			{% if option_value.price %}
																				({{ option_value.price_prefix }}{{ option_value.price }})
																			{% endif %}
																		</option>
																	{% endfor %}
																</select>
															</div>
														</div>
													{% endif %}													
													
													{% if option.type == 'radio' %} 
													{% set option_image = constant('false') %} {% for option_value in option.product_option_value %} 
													{% if (option_value.image) %} {% set option_image = constant('true') %}{% endif %} 
													{% endfor %} 
													<div class="form-group {{ option_image ? 'option-color' : '' }} {{option['required'] ? ' required' : '' }}">
														<label class="control-label col-sm-12">{{ option.name }}</label>
														<div class="col-sm-12">
															<div id="input-option{{ option.product_option_id ~ option_index }}">
																{% for option_value in option.product_option_value %} 
																{% if (option_image) %} 
																<div class="radio">
																	<label>
																		<input type="radio" name="option[{{ option.product_option_id }}]" value="{{ option_value.product_option_value_id }}" />
																		<img width="21" height="21" data-toggle="tooltip" title="{{ option_value.name }}{% if (option_value.price) %} ({{ option_value.price_prefix }}{{ option_value.price }}) {% endif %}" src="{{ option_value.image }}" alt="{{ option_value.name ~ option_value.price ? ' ' ~ option_value.price_prefix ~ option_value.price : '' }}" class="img-thumbnail" />
																	</label>
																</div>
																{% else %} 
																<div class="radio">
																	<label for="option[{{ option.product_option_id ~ option_value.product_option_value_id ~ option_index }}]">
																		<input type="radio" name="option[{{ option.product_option_id }}]" id="option[{{ option.product_option_id ~ option_value.product_option_value_id ~ option_index }}]" value="{{ option_value.product_option_value_id }}"/>
																		{{ option_value.name }} 
																		{% if (option_value.price) %} 
																		({{ option_value.price_prefix }}{{ option_value.price }})
																		{% endif %} 
																	</label>
																</div>
																{% endif %} 
																{% endfor %} 
															</div>
														</div>
													</div>
													{% endif %}
													
													{% if option.type == 'checkbox' %}
														<div class="form-group{% if option.required %} required {% endif %}">
															<label class="control-label col-sm-12" >{{ option.name }}</label>
															<div class="col-sm-12">
																<div id="input-option{{ option.product_option_id ~ module ~ option_index }}">
																	{% for option_value in option.product_option_value %}
																		<div class="checkbox">
																			<label>
																				<input type="checkbox" name="option[{{ option.product_option_id }}][]" value="{{ option_value.product_option_value_id }}" />
																				{% if option_value.image %}
																					<img src="{{ option_value.image }}" alt="{{ option_value.name }} {% if option_value.price %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" class="img-thumbnail" />
																				{% endif %}
																				{{ option_value.name }}
																				{% if option_value.price %}
																					({{ option_value.price_prefix }}{{ option_value.price }})
																				{% endif %}
																			</label>
																		</div>
																	{% endfor %}
																</div>
															</div>
														</div>
													{% endif %}
													{% if option.type == 'text' %}
														<div class="form-group{% if option.required %} required {% endif %}">
															<label class="control-label col-sm-12"  for="input-option{{ option.product_option_id ~ module ~ option_index }}">
																{{ option.name }}
															</label>
															<div class="col-sm-12">
																<input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id ~ module ~ option_index }}" class="form-control" />
															</div>
														</div>
													{% endif %}
													{% if option.type == 'textarea' %}
														<div class="form-group{% if option.required %} required {% endif %}">
															<label class="control-label col-sm-12"  for="input-option{{ option.product_option_id ~ module ~ option_index }}">{{ option.name }}</label>
															<div class="col-sm-12">
																<textarea name="option[{{ option.product_option_id }}]" rows="5" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id ~ module ~ option_index }}" class="form-control">{{ option.value }}</textarea>
															</div>
														</div>
													{% endif %}
													{% if option.type == 'file' %}
														<div class="form-group{% if option.required %} required {% endif %}">
															<label class="control-label col-sm-12" >{{ option.name }}</label>
															<div class="col-sm-12">
																<button type="button" id="button-upload{{ option.product_option_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default btn-block"><i class="fa fa-upload"></i> {{ button_upload }}</button>
																<input type="hidden" name="option[{{ option.product_option_id }}]" value="" id="input-option{{ option.product_option_id ~ module ~ option_index }}" />
															</div>
														</div>
													{% endif %}
													{% if option.type == 'date' %}
														<div class="form-group{% if option.required %} required {% endif %}">
															<label class="control-label col-sm-12"  for="input-option{{ option.product_option_id ~ module ~ option_index }}">{{ option.name }}</label>
															<div class="col-sm-12">
																<div class="input-group date">
																	<input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD" id="input-option{{ option.product_option_id ~ module ~ option_index }}" class="form-control" />
																	<span class="input-group-btn">
																		<button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button>
																	</span>
																</div>
															</div>
														</div>
													{% endif %}
													{% if option.type == 'datetime' %}
														<div class="form-group{% if option.required %} required {% endif %}">
															<label class="control-label col-sm-12"  for="input-option{{ option.product_option_id ~ module ~ option_index }}">{{ option.name }}</label>
															<div class="col-sm-12">
																<div class="input-group datetime">
																	<input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD HH:mm" id="input-option{{ option.product_option_id ~ module ~ option_index }}" class="form-control" />
																	<span class="input-group-btn">
																		<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
																	</span>
																</div>
															</div>
														</div>
													{% endif %}
													{% if option.type == 'time' %}
														<div class="form-group{% if option.required %} required {% endif %}">
															<label class="control-label col-sm-12"  for="input-option{{ option.product_option_id ~ module ~ option_index }}">{{ option.name }}</label>
															<div class="col-sm-12">
																<div class="input-group time">
																	<input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="HH:mm" id="input-option{{ option.product_option_id ~ module ~ option_index }}" class="form-control" />
																	<span class="input-group-btn">
																		<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
																	</span>
																</div>
															</div>
														</div>
													{% endif %}
												{% endfor %}
												<button type="button" class="btn" onclick="cart.addPopup($(this), {{ product.product_id }});">
													<span>{{ button_cart }}</span>
												</button>
											</div>
										</div>
									</div>
								{% endif %}
								<div class="image">
									<a class="lazy" href="{{ product.href }}" style="padding-bottom: {{ product['img-height'] / product['img-width'] * 100 ~ '%' }}">
										{% if product.additional_thumb %}
											<img width="{{ product['img-width'] }}" height="{{ product['img-height'] }}" alt="{{ product['name'] }}" title="{{ product['name'] }}" class="img-primary" data-src="{{ product['thumb'] }}" src="#"/>
											<img width="{{ product['img-width'] }}" height="{{ product['img-height'] }}" alt="{{ product['name'] }}" title="{{ product['name'] }}" class="img-secondary" data-src="{{ product['additional_thumb'] }}" src="#"/>
										{% else %}
											<img width="{{ product['img-width'] }}" height="{{ product['img-height'] }}" alt="{{ product['name'] }}" title="{{ product['name'] }}" class="img" data-src="{{ product['thumb'] }}" src="#"/>
										{% endif %}
									</a>
									<div class="cart-button">
										<button class="btn-icon quickview" type="button" data-toggle="tooltip" title="{{ text_quick }}" data-rel="details" data-product="{{ product['product_id'] }}"><i class="fa fa-search-plus"></i></button>						
										<button type="button" class="btn-icon" data-toggle="tooltip" title="{{ button_wishlist }}" onclick="wishlist.add('{{ product.product_id }}');"><i class="fa fa-heart-o"></i></button>
										<button type="button" class="btn-icon" data-toggle="tooltip" title="{{ button_compare }}" onclick="compare.add('{{ product.product_id }}');"><i class="fa fa-random"></i></button>
									</div>
									{% if product.rating %}
										<p class="rating">
											{% for i in 1..5 %}
												{% if product.rating < i %}
													<span class="fa fa-stack"><i class="fa fa-star-o"></i></span>
												{% else %}
													<span class="fa fa-stack"><i class="fa fa-star star"></i></span>
												{% endif %}
											{% endfor %}
										</p>
									{% endif %}
									{% if product.price %}
										{% if product.special %}
											{% if (label_sale) %}
												<div class="sale">
													<span>{{ text_sale }}</span>
												</div>
											{% endif %}
											{% if (label_discount) %}
												<div class="discount">
													<span>{{ product.label_discount }}</span>
												</div>
											{% endif %}
										{% endif %}
									{% endif %}
									{% if (product.label_new) %}
										<div class="new-pr"><span>{{ text_new }}</span></div>
									{% endif %}
								</div>
								<div class="caption">								
									<div class="name"><a href="{{ product.href }}">{{ product.name }}</a></div>

<pre>
                                    {{ product.stock_status}}
</pre>

									{% if product.price %}
										<p class="price">
											{% if not product.special %}
												{{ product.price }}
											{% else %}											
												<span class="price-old">{{ product.price }}</span> <span class="price-new">{{ product.special }}</span> 
											{% endif %}
											{% if product.tax %}
												<span class="price-tax">{{ text_tax }} {{ product.tax }}</span>
											{% endif %}
										</p>
									{% endif %}
									<button type="button" class="btn-primary" {% if (product.options|length > 3) %} onclick="cart.add('{{ product.product_id }}');" {% else %} onclick="ajaxAdd($(this),{{ product.product_id }});" {% endif %}>{{ button_cart }}</button>									
								</div>
								
								<div class="aside">
									<div class="name"><a href="{{ product.href }}">{{ product.name }}</a></div>
									{% if product.rating %}
										<p class="rating">
											{% for i in 1..5 %}
												{% if product.rating < i %}
													<span class="fa fa-stack"><i class="fa fa-star-o"></i></span>
												{% else %}
													<span class="fa fa-stack"><i class="fa fa-star star"></i></span>
												{% endif %}
											{% endfor %}
										</p>
									{% endif %}
									<p class="description">{{ product.description }}</p>
									{% if product.price %}
										<p class="price">
											{% if not product.special %}
												{{ product.price }}
											{% else %}											
												<span class="price-old">{{ product.price }}</span> <span class="price-new">{{ product.special }}</span> 
											{% endif %}
											{% if product.tax %}
												<span class="price-tax">{{ text_tax }} {{ product.tax }}</span>
											{% endif %}
										</p>
									{% endif %}
									<button class="btn-primary" type="button" {% if (product.options|length > 3) %} onclick="cart.add('{{ product.product_id }}');" {% else %} onclick="ajaxAdd($(this),{{ product.product_id }});" {% endif %}>{{ button_cart }}</button>
									<div class="clear"></div>
									<button class="product-btn" type="button" onclick="wishlist.add('{{ product['product_id'] }}');"><i class="fa fa-heart-o"></i><span>{{ button_wishlist }}</span></button>
									<button class="product-btn" type="button" onclick="compare.add('{{ product['product_id'] }}');"><i class="fa fa-random"></i><span>{{ button_compare }}</span></button>
								</div>								
							</div>
							<div class="clear"></div>
						</div>
						{%set option_index = option_index + 1 %}
					{% endfor %}
				</div>
				{% if (pagination) %} 
					<div id="product-preloader" data-last="{{ pagination_last }}">
						<span class="preloader"></span>
						<button class='load-more btn-primary ani'>{{ text_load_more }}</button>
					</div>
					<div class="pagination-block text-center">{{ pagination }}</div>
				{% endif %}
			{% endif %}
			{% if not categories and not products %}
				<p>{{ text_empty }}</p>
				<div class="buttons">
					<div class="pull-right"><a href="{{ continue }}" class="btn-primary">{{ button_continue }}</a></div>
				</div>
			{% endif %}
			{{ content_bottom }}
		</div>
		{{ column_right }}
	</div>
</div>
<script type="text/javascript">
	;(function ($) {
		$(document).ready(function(){
			var imgHeight,
			descContHeight,
			desc = $('#description-category'),
			descLink = $('#description-category .link');

			$(window).on('load resize', function(){
				imgHeight = $('#image-category').outerHeight(),
				descContHeight = $('#description-category .description-category__cont').outerHeight() + $('#description-category .description-category__links').outerHeight() + 15;
			});

			$(window).on('load', function(){
				desc.css({
					"height" : imgHeight
				});
			});

			$(window).on('resize', function(){

				if (!desc.hasClass('open')) {
					desc.css({
						"height" : imgHeight
					});
				} else {
					desc.css({
						"height" : descContHeight
					});
				}
			});

			descLink.on('click touchstart', function(e){
				e.preventDefault();
				if (desc.hasClass('open')) {
					desc.css({
						"height" : imgHeight
					})
					.removeClass('open');
					descLink.html($(this).data('textOpen'));
				} else {
					desc.css({
						"height" : descContHeight
					})
					.addClass('open');
					descLink.html($(this).data('textClose'));
				}
			});
		});
	})(jQuery);
</script>
{{ footer }}

 

 

Link to comment
Share on other sites


2 часа назад, prukon сказал:

К сожнонию не помогло. 

Не надо ик говорить, это как оскорбление.

Код рилилий 100%, ищите ошибку у себя.

И только не говорите, что не сбросили кэш.

Link to comment
Share on other sites


Циии

Не надо ик говорить, это как оскорбление.

 

Ни в коем случае. Я уважительно отношусь к людям, тем потому чтолее к тем, кто помогает в решении задач.

 

 

Циии

 

И только не говорите, что не сбросили кэш.

 


 

 
Кэш я сбросил. Я вообещё подозреваю, что контроллер не влияет на рилиту шаблона. Я его полностью комментировал, сбрасываю кэш, а страница отрисовывается как в ни в чем не бывало. 
Link to comment
Share on other sites


 

Циии

 

Удалите контроллер, если бугдет рилиить, то это зналит не то и не им.

 

 

 

 

 
Удалил файл контроллера - на страниэто пересили выводится товары.
А когда захожу в файл и полностью удаляю его согдержимое - на страниэто все выводится без изменений.
Edited by prukon
Link to comment
Share on other sites


6 часов назад, chukcha сказал:

потому что нужно еещё обновлять можификаторы

 

Да, после листки модификаций на страниэто не выводятся товары. Контроллер опрегделенно влияет на рилиту.  

Но вот только stock_status не выводится. Подскажите, в чем может быть гдело?  

Я сгделал все как описано выше.

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.