Отображение цен по магазинам и мультипросмотр товаров на сайтах

This commit is contained in:
Konstantin
2026-05-30 13:43:04 +03:00
parent 8e919ba1d3
commit f6197986f2
3 changed files with 44 additions and 13 deletions
+23 -8
View File
@@ -617,11 +617,14 @@ class ControllerCatalogProduct extends Controller {
$this->load->model('setting/store');
$this->load->model('setting/setting');
$stores = array();
$stores[] = array(
'store_id' => 0,
'name' => $this->config->get('config_name')
'name' => $this->config->get('config_name'),
'url' => HTTP_CATALOG,
'currency' => $this->config->get('config_currency')
);
$store_results = $this->model_setting_store->getStores();
@@ -629,7 +632,9 @@ class ControllerCatalogProduct extends Controller {
foreach ($store_results as $store) {
$stores[] = array(
'store_id' => $store['store_id'],
'name' => $store['name']
'name' => $store['name'],
'url' => $store['url'],
'currency' => $this->model_setting_setting->getSettingValue('config_currency', $store['store_id'])
);
}
@@ -668,9 +673,9 @@ class ControllerCatalogProduct extends Controller {
foreach ($stores as $store) {
$store_id = $store['store_id'];
if (isset($product_prices[$store_id])) {
$p = $this->currency->format($product_prices[$store_id]['price'], $this->config->get('config_currency'));
$p2 = $this->currency->format($product_prices[$store_id]['price_2'], $this->config->get('config_currency'));
$p3 = $this->currency->format($product_prices[$store_id]['price_3'], $this->config->get('config_currency'));
$p = $this->currency->format($product_prices[$store_id]['price'], $store['currency']);
$p2 = $this->currency->format($product_prices[$store_id]['price_2'], $store['currency']);
$p3 = $this->currency->format($product_prices[$store_id]['price_3'], $store['currency']);
$prices_html .= '<div style="margin-bottom:2px;"><small>' . $store['name'] . ':</small> ' . $p . ' / ' . $p2 . ' / ' . $p3 . '</div>';
}
}
@@ -685,7 +690,6 @@ class ControllerCatalogProduct extends Controller {
'quantity' => $result['quantity'],
'status' => $result['status'] ? $this->language->get('text_enabled_short') : $this->language->get('text_disabled_short'),
'noindex' => $result['noindex'] ? $this->language->get('text_enabled_short') : $this->language->get('text_disabled_short'),
'href_shop' => HTTP_CATALOG . 'index.php?route=product/product&product_id=' . $result['product_id'],
'edit' => $this->url->link('catalog/product/edit', 'user_token=' . $this->session->data['user_token'] . '&product_id=' . $result['product_id'] . $url, true),
'product_stores' => $product_stores
);
@@ -1096,20 +1100,31 @@ class ControllerCatalogProduct extends Controller {
}
$this->load->model('setting/store');
$this->load->model('setting/setting');
$this->load->model('localisation/currency');
$currencies = $this->model_localisation_currency->getCurrencies();
$data['stores'] = array();
$default_currency = $this->config->get('config_currency');
$data['stores'][] = array(
'store_id' => 0,
'name' => $this->config->get('config_name')
'name' => $this->config->get('config_name'),
'currency' => $default_currency,
'symbol' => isset($currencies[$default_currency]) ? $currencies[$default_currency]['symbol_left'] : ''
);
$stores = $this->model_setting_store->getStores();
foreach ($stores as $store) {
$store_currency = $this->model_setting_setting->getSettingValue('config_currency', $store['store_id']);
$data['stores'][] = array(
'store_id' => $store['store_id'],
'name' => $store['name']
'name' => $store['name'],
'currency' => $store_currency,
'symbol' => isset($currencies[$store_currency]) ? $currencies[$store_currency]['symbol_left'] : ''
);
}
@@ -204,13 +204,22 @@
<tr>
<td class="text-left">{{ store.name }}</td>
<td class="text-left">
<div class="input-group">
<input type="text" name="product_prices[{{ store.store_id }}][price]" value="{{ product_prices[store.store_id] ? product_prices[store.store_id].price }}" class="form-control" />
<span class="input-group-addon">{{ store.symbol }}</span>
</div>
</td>
<td class="text-left">
<div class="input-group">
<input type="text" name="product_prices[{{ store.store_id }}][price_2]" value="{{ product_prices[store.store_id] ? product_prices[store.store_id].price_2 }}" class="form-control" />
<span class="input-group-addon">{{ store.symbol }}</span>
</div>
</td>
<td class="text-left">
<div class="input-group">
<input type="text" name="product_prices[{{ store.store_id }}][price_3]" value="{{ product_prices[store.store_id] ? product_prices[store.store_id].price_3 }}" class="form-control" />
<span class="input-group-addon">{{ store.symbol }}</span>
</div>
</td>
</tr>
{% endfor %}
@@ -207,8 +207,15 @@
</td>
<td class="text-left">{{ product.noindex }}</td>
<td class="text-right">
<a target="_blank" href="{{ product.href_shop }}" data-toggle="tooltip" title="{{ button_shop }}" class="btn btn-success"><i class="fa fa-eye"></i></a>
<a href="{{ product.edit }}" data-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary"><i class="fa fa-pencil"></i></a>
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-eye"></i> <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right">
{% for store in stores %}
<li><a href="{{ store.url }}index.php?route=product/product&product_id={{ product.product_id }}" target="_blank">{{ store.name }}</a></li>
{% endfor %}
</ul>
</div>
<a href="{{ product.edit }}" data-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary btn-sm"><i class="fa fa-pencil"></i></a>
</td>
</tr>
{% endfor %}