I added a new column in the manufacturer table as `status` - `tinyint(1)`
This code emulates the category methods and set to 1 for enable and 0 to disable
What am i missing to stop showing the manufacturer in the manufacturer page if is currently in Disable [0] status?
I have tested trying setting a mysql trigger to update `manufacturer_to_store` `manufacturer_id`='123' `store_id` = '99' but this only witll throw a not found when selecting the manufacturer and the idea is just to never show it if it's status is = '0'
Thanks
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>enable disable manufacturer</name>
<version>1</version>
<author>haxcop</author>
<lik>link</lik>
<code>123</code>
<description>enable and disable manufacturers</description>
<!--model-->
<!--1-->
<file path="admin/model/catalog/manufacturer.php">
<operation info="This add the query Manufacturer model class " error="log">
<search><![CDATA[. "', sort_order = '"]]></search>
<add position="replace"><![CDATA[. "', status = '" . (int)$data['status']. "', sort_order = '"]]>
</add>
</operation>
</file>
<!--Catalog-->
<file path="admin/controller/catalog/manufacturer.php">
<operation info=" This will create two new methods in the Manufacturer controller class - enable and disable. " error="log">
<search><![CDATA[if (isset($this->request->post['manufacturer_seo_url'])) {]]></search>
<add position="before"><![CDATA[ //!SECTION Manufacturer status
if (isset($this->request->post['status'])) {
$data['status'] = $this->request->post['status'];
} elseif (!empty($manufacturer_info)) {
$data['status'] = $manufacturer_info['status'];
} else {
$data['status'] = true;
}
//!SECTION end]]></add>
</operation>
</file>
<!--Form-->
<file path="admin/view/template/catalog/manufacturer_form.twig">
<operation info="add the status select form at the manufacturer form" error="log">
<search><![CDATA[<div class="tab-pane" id="tab-seo">]]></search>
<add position="before"><![CDATA[<div class="form-group">
<label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
<div class="col-sm-10">
<select name="status" id="input-status" class="form-control">
{% if status %}
<option value="1" selected="selected">{{ text_enabled }}</option>
<option value="0">{{ text_disabled }}</option>
{% else %}
<option value="1">{{ text_enabled }}</option>
<option value="0" selected="selected">{{ text_disabled }}</option>
{% endif %}
</select>
</div>
</div>
]]></add>
</operation>
</file>
<!--Language-->
<file path="admin/language/en-gb/catalog/manufacturer.php">
<operation>
<search><![CDATA[ $_['column_action'] = 'Action'; ]]></search>
<add position="after "><![CDATA[// STATUS
$_['column_status'] = 'Status';
$_['text_enable'] = 'Enable';
$_['text_disable'] = 'Disable';]]></add>
</operation>
</file>
</modification>