Добрый день. Установил модуль продавцов. Но никак не могу разобраться, хочу вывести в категории вместо товаров, продавцов у которых есть товары в данной категории. Но там вообще жуть...)
Подскажите пожалуйста, как вывести хотя бы Информацию о продавце. Код которые выводит информацию на странице продукта:
<operation>
<search position="after"><![CDATA[
if ($product_info) {
]]></search>
<add><![CDATA[
$this->document->addScript('catalog/view/javascript/dialog-sellercontact.js');
$this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/multiseller.css');
$data = array_merge($data, $this->load->language('multiseller/multiseller'));
$this->load->model('localisation/country');
$this->load->model('localisation/zone');
$this->load->model('tool/image');
$seller_id = $this->MsLoader->MsProduct->getSellerId($this->request->get['product_id']);
$seller = $this->MsLoader->MsSeller->getSeller($seller_id);
if (!$seller) {
$data['seller'] = NULL;
} else {
$data['seller'] = array();
if (!empty($seller['ms.avatar'])) {
$data['seller']['thumb'] = $this->MsLoader->MsFile->resizeImage($seller['ms.avatar'], $this->config->get('msconf_seller_avatar_product_page_image_width'), $this->config->get('msconf_seller_avatar_product_page_image_height'));
} else {
$data['seller']['thumb'] = $this->MsLoader->MsFile->resizeImage('ms_no_image.jpg', $this->config->get('msconf_seller_avatar_product_page_image_width'), $this->config->get('msconf_seller_avatar_product_page_image_height'));
}
$country = $this->model_localisation_country->getCountry($seller['ms.country_id']);
if (!empty($country)) {
$data['seller']['country'] = $country['name'];
} else {
$data['seller']['country'] = NULL;
}
$zone = $this->model_localisation_zone->getZone($seller['ms.zone_id']);
if (!empty($zone)) {
$data['seller']['zone'] = $zone['name'];
} else {
$data['seller']['zone'] = NULL;
}
if (!empty($seller['ms.company'])) {
$data['seller']['company'] = $seller['ms.company'];
} else {
$data['seller']['company'] = NULL;
}
if (!empty($seller['ms.website'])) {
$data['seller']['website'] = $seller['ms.website'];
} else {
$data['seller']['website'] = NULL;
}
$data['seller']['nickname'] = $seller['ms.nickname'];
$data['seller']['seller_id'] = $seller['seller_id'];
$data['seller']['href'] = $this->url->link('seller/catalog-seller/profile', 'seller_id=' . $seller['seller_id']);
$data['seller']['total_sales'] = $this->MsLoader->MsSeller->getSalesForSeller($seller['seller_id']);
$data['seller']['total_products'] = $this->MsLoader->MsProduct->getTotalProducts(array(
'seller_id' => $seller['seller_id'],
'product_status' => array(MsProduct::STATUS_ACTIVE)
));
$data['contactForm'] = $this->MsLoader->MsHelper->renderPmDialog($data);
}
$data['ms_product_attributes'] = $this->MsLoader->MsAttribute->getProductAttributes($this->request->get['product_id'], array('multilang' => 0, 'attribute_type'=> array(MsAttribute::TYPE_TEXT, MsAttribute::TYPE_TEXTAREA, MsAttribute::TYPE_DATE, MsAttribute::TYPE_DATETIME, MsAttribute::TYPE_TIME), 'mavd.language_id' => 0));
$data['ms_product_attributes'] = array_merge($data['ms_product_attributes'], $this->MsLoader->MsAttribute->getProductAttributes($this->request->get['product_id'], (array())));
]]></add>
</operation>
и это в тпл:
<?php if (isset($seller) && !empty($seller)) { ?>
<hr />
<div class="ms-sellerprofile description">
<h3><?php echo $ms_catalog_product_sellerinfo; ?></h3>
<div class="seller-data">
<div class="avatar-box">
<a href="<?php echo $seller['href']; ?>"><img src="<?php echo $seller['thumb']; ?>" /></a>
</div>
<div class="info-box">
<ul class="list-unstyled">
<li><a class="nickname" style="text-decoration: none" href="<?php echo $seller['href']; ?>"><b><?php echo $seller['nickname']; ?></b></a></li>
<?php if ($seller['country']) { ?>
<li><?php echo $ms_catalog_seller_profile_country; ?></b> <?php echo $seller['country']; ?></li>
<?php } ?>
<?php if ($seller['zone']) { ?>
<li><?php echo $ms_catalog_seller_profile_zone; ?></b> <?php echo $seller['zone']; ?></li>
<?php } ?>
<?php if ($seller['company']) { ?>
<li><?php echo $ms_catalog_seller_profile_company; ?></b> <?php echo $seller['company']; ?></li>
<?php } ?>
<?php if ($seller['website']) { ?>
<li><?php echo $ms_catalog_seller_profile_website; ?></b> <?php echo $seller['website']; ?></li>
<?php } ?>
<li><?php echo $ms_catalog_seller_profile_totalsales; ?></b> <?php echo $seller['total_sales']; ?></li>
<li><?php echo $ms_catalog_seller_profile_totalproducts; ?></b> <?php echo $seller['total_products']; ?></li>
<?php if ($this->config->get('mmess_conf_enable') || $this->config->get('msconf_enable_private_messaging') == 2) { ?>
<?php if ((!$this->customer->getId()) || ($this->customer->getId() != $seller['seller_id'])) { ?>
<?php echo $contactForm; ?>
<div class="contact">
<?php if ($this->customer->getId()) { ?>
<div class="button-group">
<button type="button" class="btn btn-default btn-block ms-sellercontact" data-toggle="modal" data-target="#contactDialog"><span><?php echo $ms_catalog_product_contact; ?></span></button>
</div>
<?php } else { ?>
<?php echo sprintf($this->language->get('ms_sellercontact_signin'), $this->url->link('account/login', '', 'SSL'), $seller['nickname']); ?>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
</ul>
</div>
</div>
<!-- end sellerinfo -->
</div>
<hr />
<!-- end seller block -->
<?php } ?>
как это в контроллер категории прикрутить то?
и еще в модель продукта код:
<operation>
<search position="before" index="1" offset="2"><![CDATA[
ddddreturn $query->row['total'];
]]></search>
<add><![CDATA[
$sql_disable = "SELECT p.product_id as 'product_id'";
/* Filters */
if (!empty($data['filter_category_id'])) {
if (!empty($data['filter_sub_category'])) {
$sql_disable .= " FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (cp.category_id = p2c.category_id)";
} else {
$sql_disable .= " FROM " . DB_PREFIX . "product_to_category p2c";
}
if (!empty($data['filter_filter'])) {
$sql_disable .= " LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) LEFT JOIN " . DB_PREFIX . "product p ON (pf.product_id = p.product_id)";
} else {
$sql_disable .= " LEFT JOIN " . DB_PREFIX . "product p ON (p2c.product_id = p.product_id)";
}
} else {
$sql_disable .= " FROM " . DB_PREFIX . "product p";
}
$sql_disable .= " LEFT JOIN `" . DB_PREFIX . "ms_product` mp ON (p.product_id = mp.product_id)";
$sql_disable .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
if (!empty($data['filter_category_id'])) {
if (!empty($data['filter_sub_category'])) {
$sql_disable .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";
} else {
$sql_disable .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";
}
if (!empty($data['filter_filter'])) {
$implode = array();
$filters = explode(',', $data['filter_filter']);
foreach ($filters as $filter_id) {
$implode[] = (int)$filter_id;
}
$sql_disable .= " AND pf.filter_id IN (" . implode(',', $implode) . ")";
}
}
if (!empty($data['filter_name']) || !empty($data['filter_tag'])) {
$sql_disable .= " AND (";
if (!empty($data['filter_name'])) {
$implode = array();
$words = explode(' ', trim(preg_replace('/\s\s+/', ' ', $data['filter_name'])));
foreach ($words as $word) {
$implode[] = "pd.name LIKE '%" . $this->db->escape($word) . "%'";
}
if ($implode) {
$sql_disable .= " " . implode(" AND ", $implode) . "";
}
if (!empty($data['filter_description'])) {
$sql_disable .= " OR pd.description LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
}
}
if (!empty($data['filter_name']) && !empty($data['filter_tag'])) {
$sql_disable .= " OR ";
}
if (!empty($data['filter_tag'])) {
$sql_disable .= "pd.tag LIKE '%" . $this->db->escape(utf8_strtolower($data['filter_tag'])) . "%'";
}
if (!empty($data['filter_name'])) {
$sql_disable .= " OR LCASE(p.model) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
}
if (!empty($data['filter_name'])) {
$sql_disable .= " OR LCASE(p.sku) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
}
if (!empty($data['filter_name'])) {
$sql_disable .= " OR LCASE(p.upc) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
}
if (!empty($data['filter_name'])) {
$sql_disable .= " OR LCASE(p.ean) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
}
if (!empty($data['filter_name'])) {
$sql_disable .= " OR LCASE(p.jan) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
}
if (!empty($data['filter_name'])) {
$sql_disable .= " OR LCASE(p.isbn) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
}
if (!empty($data['filter_name'])) {
$sql_disable .= " OR LCASE(p.mpn) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
}
$sql_disable .= ")";
}
if (!empty($data['filter_manufacturer_id'])) {
$sql_disable .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";
}
$this->language->load('multiseller/multiseller');
$sql_disable .= " AND mp.list_until < NOW() AND p.status = 1";
$res_disable = $this->db->query($sql_disable);
if ($res_disable->num_rows) {
foreach ($res_disable->rows as $product) {
$this->MsLoader->MsProduct->changeStatus((int)$product['product_id'], MsProduct::STATUS_DISABLED);
$this->MsLoader->MsProduct->disapprove((int)$product['product_id']);
$seller_id = $this->MsLoader->MsProduct->getSellerId((int)$product['product_id']);
$mail = array(
'recipients' => $this->MsLoader->MsSeller->getSellerEmail($seller_id),
'addressee' => $this->MsLoader->MsSeller->getSellerName($seller_id),
'seller_id' => $seller_id,
'product_id' => (int)$product['product_id']
);
$this->MsLoader->MsMail->sendMail(MsMail::SMT_REMIND_LISTING, $mail);
}
}
]]></add>
</operation>
Заранее спасибо за потраченное время.