Post by storiqax » Mon Sep 24, 2018 7:42 pm

1) Go to admin\controller\catalog and find the manufacturer.php file

Then find the following code:

Code: Select all

foreach ($results as $result) {
	$data['manufacturers'][] = array(
		'manufacturer_id' => $result['manufacturer_id'],
		'name'            => $result['name'],
		'sort_order'      => $result['sort_order'],
		'edit'            => $this->url->link('catalog/manufacturer/edit', 'user_token=' . $this->session->data['user_token'] . '&manufacturer_id=' . $result['manufacturer_id'] . $url, true)
	);
}
Replace it with the following and save it:

Code: Select all

$this->load->model('tool/image');

foreach ($results as $result) {
	if (is_file(DIR_IMAGE . $result['image'])) {
		$image = $this->model_tool_image->resize($result['image'], 40, 40);
	} else {
		$image = $this->model_tool_image->resize('no_image.png', 40, 40);
	}

	$data['manufacturers'][] = array(
		'manufacturer_id' => $result['manufacturer_id'],
		'name'            => $result['name'],
		'sort_order'      => $result['sort_order'],
		'edit'            => $this->url->link('catalog/manufacturer/edit', 'user_token=' . $this->session->data['user_token'] . '&manufacturer_id=' . $result['manufacturer_id'] . $url, true),
		// ManufacturerLogo
		'image' => $image,
		// ManufacturerLogo end
	);
}
2) Go to admin\view\template\catalog\ and find the manufacturer_list.twig file
Find the following code:

Code: Select all

<table class="table table-bordered table-hover">
  <thead>
	<tr>
	  <td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);" /></td>
	  <td class="text-left">{% if sort == 'name' %}
		<a href="{{ sort_name }}" class="{{ order|lower }}">{{ column_name }}</a>
		{% else %}
		<a href="{{ sort_name }}">{{ column_name }}</a>
		{% endif %}</td>
	  <td class="text-right">{% if sort == 'sort_order' %}
		<a href="{{ sort_sort_order }}" class="{{ order|lower }}">{{ column_sort_order }}</a>
		{% else %}
		<a href="{{ sort_sort_order }}">{{ column_sort_order }}</a>
		{% endif %}</td>
	  <td class="text-right">{{ column_action }}</td>
	</tr>
  </thead>
  <tbody>
	{% if manufacturers %}
	{% for manufacturer in manufacturers %}
	<tr>
	  <td class="text-center">{% if manufacturer.manufacturer_id in selected %}
		<input type="checkbox" name="selected[]" value="{{ manufacturer.manufacturer_id }}" checked="checked" />
		{% else %}
		<input type="checkbox" name="selected[]" value="{{ manufacturer.manufacturer_id }}" />
		{% endif %}</td>
	  <td class="text-left">{{ manufacturer.name }}</td>
	  <td class="text-right">{{ manufacturer.sort_order }}</td>
	  <td class="text-right"><a href="{{ manufacturer.edit }}" data-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary"><i class="fa fa-pencil"></i></a></td>
	</tr>
	{% endfor %}
	{% else %}
	<tr>
	  <td class="text-center" colspan="4">{{ text_no_results }}</td>
	</tr>
	{% endif %}
  </tbody>
</table>
Replace it with the following and save:

Code: Select all

<table class="table table-bordered table-hover">
  <thead>
	<tr>
	  <td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);" /></td>
	  <td>Image</td>
	  <td class="text-left">{% if sort == 'name' %}
		<a href="{{ sort_name }}" class="{{ order|lower }}">{{ column_name }}</a>
		{% else %}
		<a href="{{ sort_name }}">{{ column_name }}</a>
		{% endif %}</td>
	  <td class="text-right">{% if sort == 'sort_order' %}
		<a href="{{ sort_sort_order }}" class="{{ order|lower }}">{{ column_sort_order }}</a>
		{% else %}
		<a href="{{ sort_sort_order }}">{{ column_sort_order }}</a>
		{% endif %}</td>
	  <td class="text-right">{{ column_action }}</td>
	</tr>
  </thead>
  <tbody>
	{% if manufacturers %}
	{% for manufacturer in manufacturers %}
	<tr>
	  <td class="text-center">{% if manufacturer.manufacturer_id in selected %}
		<input type="checkbox" name="selected[]" value="{{ manufacturer.manufacturer_id }}" checked="checked" />
		{% else %}
		<input type="checkbox" name="selected[]" value="{{ manufacturer.manufacturer_id }}" />
		{% endif %}</td>
	  <td class="text-left">{% if manufacturer.image %}<img src="{{ manufacturer.image }}" alt="{{ manufacturer.name }}" class="img-thumbnail" /> {% else %} <span class="img-thumbnail list"><i class="fa fa-camera fa-2x"></i></span> {% endif %}</td> 
	  <td class="text-left">{{ manufacturer.name }}</td>
	  <td class="text-right">{{ manufacturer.sort_order }}</td>
	  <td class="text-right"><a href="{{ manufacturer.edit }}" data-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary"><i class="fa fa-pencil"></i></a></td>
	</tr>
	{% endfor %}
	{% else %}
	<tr>
	  <td class="text-center" colspan="5">{{ text_no_results }}</td>
	</tr>
	{% endif %}
  </tbody>
</table>
If you did everything right you should be able to see the manufacturer image to manufacturers list in admin panel :)
Image

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm
Who is online

Users browsing this forum: No registered users and 14 guests