Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Sign Up

Подскажите что нужно изменить в Ocmod для версии 2.3


Recommended Posts

Здравствуте! Имеется мод вывода производителей в категории, но его верссия 2.1. Подскажите что нужно изменить чтоб он заработал на 2.3

<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<name>Manufacturers brands in category</name>
	<code>manufacturers-brands-in-category</code>
	<version>1.0.0</version>
	<author>Wild (y66676026@yandex.ru)</author>
	<link>http://www.opencart.com</link>


	<file path="catalog/model/catalog/manufacturer.php">
		<operation error="abort">
			<search><![CDATA[public function getManufacturers($data = array()) {]]></search>
			<add position="before"><![CDATA[
public function getBrandsByCategoryId($category_id) {
    $query = $this->db->query("
		SELECT
			m.* 
		FROM
			" . DB_PREFIX . "product p 
		RIGHT JOIN " . DB_PREFIX . "product_to_category p2c ON 
			p.product_id = p2c.product_id 
		LEFT JOIN " . DB_PREFIX . "manufacturer m ON 
			p.manufacturer_id = m.manufacturer_id
		WHERE 
			p2c.category_id = " . (int)$category_id . " AND 
			m.manufacturer_id IS NOT NULL
		GROUP BY m.manufacturer_id
    ");
    return $query->rows;
}   	
			]]></add>
		</operation>
	</file>
	
	<file path="catalog/controller/product/category.php">
		<operation error="abort">
			<search><![CDATA[$category_info = $this->model_catalog_category->getCategory($category_id);]]></search>
			<add position="before"><![CDATA[
$this->load->model('catalog/manufacturer');
$brands = $this->model_catalog_manufacturer->getBrandsByCategoryId($category_id);
$data['brands'] = array();
foreach ($brands as $brand) {
	$image = $brand['image'];
	$data['brands'][] = array(
		'name'			=> $brand['name'],
		'image'			=> $this->model_tool_image->resize($brand['image'], 60, 60),
		'href_brand'	=> $this->url->link('product/manufacturer/info',  'manufacturer_id=' . $brand['manufacturer_id'] . $url),
		'href_category'	=> $this->url->link('product/category', '&path=' . $this->request->get['path'] . '&manufacturer_id=' . $brand['manufacturer_id'] . $url)
	);
}
			]]></add>
		</operation>
	</file>

	<file path="catalog/view/theme/*/template/product/category.tpl">
		<operation error="abort">
			<search><![CDATA[<?php if ($products) { ?>]]></search>
			<add position="before"><![CDATA[
<?php if ($brands) { ?>      
<?php if ($categories) { ?>
<hr style="margin: 0;">
<?php } ?>
<div class="row">
	<div style="padding-left: 15px;">
		<?php foreach ($brands as $brand) { ?>
		<div style="display: inline-block; width: 70px; padding: 5px; vertical-align: top; line-height: normal; text-align: center; word-wrap: break-word; overflow: hidden;">
			<a href="<?php echo $brand['href_brand']; ?>">
				<div><img src="<?php echo $brand['image']; ?>" /></div>
				<div style="font-size: smaller;"><?php echo $brand['name']; ?></div>
			</a>
		</div>
		<?php } ?>
	</div>
</div>
<hr style="margin: 0;">
<?php } ?>
			]]></add>
		</operation>
	</file>

</modification>

Спасибо!

Link to post
Share on other sites

Добавьте к имени в конце без пробела перед .xml

.ocmod

ТОЧКАокмод

nameofmod.ocmod.xml

Edited by jaffagold
  • +1 1
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.