catalog/controller/product/product.php
...
$this->load->model('account/customer_group');
$customerGroupsList = $this->model_account_customer_group->getCustomerGroups();
$this->data['wholeSpecials'] = array();
if ($this->customer->isLogged()) {
$ws_customer_group_id = $this->customer->getCustomerGroupId();
} else {
$ws_customer_group_id = $this->config->get('config_customer_group_id');
}
foreach ($customerGroupsList as $customerGroup) {
if ($customerGroup['customer_group_id'] != $ws_customer_group_id) {
$customerGroupName = $customerGroup['name'];
$wholeSpecial = $this->model_catalog_product->getWholeProductSpecialData($this->request->get['product_id'], $customerGroup['customer_group_id']);
if ($wholeSpecial) {
$this->data['wholeSpecials'][] = array(
'price' => $this->currency->format($this->tax->calculate($wholeSpecial['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))),
'customerGroup' => $customerGroupName
);
}
}
}
...catalog/model/catalog/product.php
...
public function getProductSpecials($data = array()) {
...>>
...
public function getWholeProductSpecialData($product_id, $customer_group_id_listed) {
$query = $this->db->query("SELECT `price`, `date_end`, `customer_group_id` FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$customer_group_id_listed . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY priority ASC, price ASC LIMIT 1");
if ($query->num_rows) {
return $query->row;
} else {
return FALSE;
}
}
public function getProductSpecials($data = array()) {
...
tpl
...
<?php if ($wholeSpecials) { ?>
<br />
<div class="discount">
<?php foreach ($wholeSpecials as $wholeSpecial) { ?>
<?php echo "Для группы ".$wholeSpecial['customerGroup'].": ".$wholeSpecial['price'].""; ?>
<br />
<?php } ?>
</div>
<?php } ?>
...