Post by tifosi » Wed Feb 18, 2009 10:28 pm

v1.1.7

1. When creating a category the image is being auto selected from the first alphabetical image instead of 'no image'. No image is not 'selected' by default and is also showing up as an image when deleting images.

New member

Posts

Joined
Tue Feb 17, 2009 8:14 am

Post by fido-x » Wed Feb 18, 2009 11:12 pm

In "admin/model/catalog/image.php", change line 58 from --

Code: Select all

$sql .= " ORDER BY id.title";
to

Code: Select all

$sql .= " ORDER BY i.image_id";
And line 78 from --

Code: Select all

$query = $this->db->query("SELECT * FROM image i LEFT JOIN image_description id ON (i.image_id = id.image_id) WHERE id.language_id = '" . (int)$this->language->getId() . "' ORDER BY id.title");
to

Code: Select all

$query = $this->db->query("SELECT * FROM image i LEFT JOIN image_description id ON (i.image_id = id.image_id) WHERE id.language_id = '" . (int)$this->language->getId() . "' ORDER BY i.image_id");
Make sure you clear your cache and image/cache folders.

This will change to sort order to sort by image_id rather than name. Since the "no image" image has the lowest image_id, it will display first.

Fido-X.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by tifosi » Thu Feb 19, 2009 6:49 pm

Thanks. That's a workaround, but I was thinking more of a change of core logic.

Making the 'no image' a system default for category/product and removing it from any image listings. It would also get around any possible tug-of-war confusions when deleting manufacturers/categories/products where the image is set as 'no image'.

In a similar way to manufacturer select being:
--None---
man-a
man-b
man-c
etc

The image listing would be
--No Image--
image-a
image-b
image-c

with the 'no-image' image selected by default for all cat/prod. It looks and feels neater.

One for Daniel.

New member

Posts

Joined
Tue Feb 17, 2009 8:14 am

Post by fido-x » Thu Feb 19, 2009 11:07 pm

The "core logic", as you put it, is to select the first image in the list.

As for any "tugs of war", this only occurs if you try to delete an image that is attached to a manufacturer, category or product. There is no "tug of war" when deleting the manufacturer, category or product unless the image is deleted as well (which isn't the case).

However, you could try this --
In "admin/controller/catalog/category.php" find (around line 206)

Code: Select all

$this->load->model('catalog/image');
insert the following after this line:--

Code: Select all

$this->data['no_image'] = $this->model_catalog_image->getImage(33);
Then in "admin/view/template/catalog/category_form.tpl" find

Code: Select all

<select name="image_id" id="image_id" class="image" onchange="$('#image').load('index.php?route=catalog/image/thumb&image_id=' + this.value);">
insert the following after this line:--

Code: Select all

<option value="<?php echo $no_image['image_id']; ?>"><?php echo $no_image['title']; ?></option>
This will give you image 33 (the "no image" image) as the default -- regardless of sort order.

Fido-X.

User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia
Who is online

Users browsing this forum: No registered users and 5 guests