Created
March 3, 2018 19:25
-
-
Save mazdafunsunn/3aec57822c289c1809d1120db23a8b0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<modification> | |
<id>Third level subcategory</id> | |
<version>1.0</version> | |
<vqmver>2.5.0</vqmver> | |
<author>Epic-IT.lv</author> | |
<file name="catalog/controller/module/category.php"> | |
<operation info="replace ABC with 123"> | |
<search position="after" offset="4"><![CDATA[if (isset($parts[1])) {]]></search> | |
<add><![CDATA[ | |
if (isset($parts[2])) { | |
$this->data['sisters_id'] = $parts[2]; | |
} else { | |
$this->data['sisters_id'] = 0; | |
} | |
]]></add> | |
</operation> | |
<operation> | |
<search position="replace" offset="30"><![CDATA[foreach ($categories as $category) {]]></search> | |
<add><![CDATA[ | |
foreach ($categories as $category) { | |
$children_data = array(); | |
$children = $this->model_catalog_category->getCategories($category['category_id']); | |
foreach ($children as $child) { | |
$sister_data = array(); | |
$sisters = $this->model_catalog_category->getCategories($child['category_id']); | |
if(count($sisters) > 1) { | |
foreach ($sisters as $sisterMember) { | |
$sister_data[] = array( | |
'category_id' =>$sisterMember['category_id'], | |
'name' => $sisterMember['name'], | |
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']. '_' . $sisterMember['category_id']) | |
); | |
} | |
$children_data[] = array( | |
'category_id' => $child['category_id'], | |
'sister_id' => $sister_data, | |
'name' => $child['name'], | |
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']) | |
); | |
}else{ | |
$children_data[] = array( | |
'category_id' => $child['category_id'], | |
'sister_id' =>'', | |
'name' => $child['name'], | |
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']) | |
); | |
} | |
} | |
$data = array( | |
'filter_category_id' => $category['category_id'], | |
'filter_sub_category' => true | |
); | |
$product_total = $this->model_catalog_product->getTotalProducts($data); | |
$this->data['categories'][] = array( | |
'category_id' => $category['category_id'], | |
'name' => $category['name'], | |
'children' => $children_data, | |
'sister' => $sister_data, | |
'href' => $this->url->link('product/category', 'path=' . $category['category_id']) | |
); | |
} | |
]]></add> | |
</operation> | |
</file> | |
<file name="catalog/view/theme/default/template/module/category.tpl"> | |
<operation> | |
<search position="after" offset="6"><![CDATA[<?php foreach ($category['children'] as $child) { ?>]]></search> | |
<add><![CDATA[ | |
<?php if($child['sister_id']){ ?> | |
<ul> | |
<?php foreach($child['sister_id'] as $sisters) { ?> | |
<li> | |
<?php if ($sisters['category_id'] == $sisters_id) { ?> | |
<a href="<?php echo $sisters['href']; ?>" class="active"> - <?php echo $sisters['name']; ?></a> | |
<?php } else { ?> | |
<a href="<?php echo $sisters['href']; ?>"> - <?php echo $sisters['name']; ?></a> | |
<?php } ?> | |
</li> | |
<?php } ?> | |
</ul> | |
<?php } ?> | |
]]></add> | |
</operation> | |
</file> | |
<file name="catalog/view/theme/default/stylesheet/style.css"> | |
<operation> | |
<search position="after" offset="2"><![CDATA[.box-category > ul > li ul > li > a.active + ul {]]></search> | |
<add><![CDATA[ | |
.box-category > ul > li ul > li ul > li a.active { | |
font-weight: bold; | |
color: #06bcc3; | |
} | |
.box-category > ul > li ul > li ul > li a.active + ul { | |
display: block; | |
} | |
]]></add> | |
</operation> | |
</file> | |
</modification> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment