Post by Iamdbat » Sat Jul 08, 2017 5:07 am

Is it possible to just hardcode subcategory images for 1.5.6.4 as opposed to using an xml extension etc ... the less stylesheets and xml for speed is my preference and I just dont like how any of the extensions that I bought to do this actually perform .... anyone with the know how? ... would appreciate it

Active Member

Posts

Joined
Sat Jan 28, 2012 7:32 am

Post by IP_CAM » Fri Jul 14, 2017 9:36 am

Sure, just take an Extension XML File, able to do it, then you see,
what is to be either removed, replaced, or added, before or after the
Extension Anchor Tag, looked for in the OC Source File, linked to this.
Then, insert the VqMod/OcMod Content directly into the corresponding Default File(s).
Just check the VqMod/OcMod Manuals on the Web, to find out in detail.
But you CANNOT hardcode a single FIXED Image Link into a Category File,
or it would exist on any other category Page as well.
Good Luck!
Ernie
---
Sample (OcMod!) Command Routine Lines:
Search in the <file path="catalog/controller/product/category.php">
<search> for this anchor tag/line :: <?php if ($categories) { ?>
<add position="replace" index="1" offset="3">
meaning, 3 Lines (offset) BELOW the FIRST such Line (index='1')
---
Sample OcMod XML File - VqMod Files look a little different !

Code: Select all

<modification>
<name>Subcategory Images</name>
<code>subcategory-images</code>
<version>2.2</version>
<author>opencartarabic.com</author>
<link>http://www.opencartarabic.com</link>
------
LIKE IN THE :
<file path="catalog/controller/product/category.php">
<operation>
<search><![CDATA[
$data['categories'][] = array(
]]></search>
<add position="replace" index="1" offset="3"><![CDATA[
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], 100, 100);
} else {
$image = $this->model_tool_image->resize('placeholder.png', 100, 100);
}
$data['categories'][] = array(
'name'  => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
'thumb' => $image
);
]]></add>
</operation>
</file>
-----
AND IN THE :
-----
<file path="catalog/view/theme/*/template/product/category.tpl">
<operation>
<search><![CDATA[
<?php if ($categories) { ?>
]]></search>
<add position="replace" index="1" offset="25"><![CDATA[
<?php if ($categories) { ?>
<div class="col-sm-12">
<div>
<h3><?php echo $text_refine; ?></h3>
</div>
<div style="text-align: center;">
<div class="row">
<?php foreach ($categories as $category) { ?>
<div class="col-sm-2 col-xs-6" style="margin-bottom: 20px;">
<a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" alt="<?php echo $category['name']; ?>" /></a>
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
</div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
]]></add>
</operation>
</file>
</modification>

Ernie's OpenShop v.1.75 + OpenCart v.1.5.6.5 LIGHT Test Sites with free responsive Themes
http://www.bigmax.ch/shop/ - http://www.ebikes.li - http://www.ipc.li/shop/ - http://www.openshop.li/shop/
Image


User avatar
Guru Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 16 guests