Post by hm2k » Thu Mar 13, 2008 11:33 pm

When inserting images, it would be useful if when the "Image Title" is left blank, it would populate from the image filename, minus the file extension.

So if you're uploading product1.jpg, it would automatically give the image title "product1".

This would make uploading images a far less tedious task.

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by hm2k » Thu Mar 13, 2008 11:54 pm

It's a bit quick and dirty but here's what I did:

OPEN admin/controller/image.php
FIND:
$sql = "insert into image_description set image_id = '?', language_id = '?', title = '?'";
ABOVE ADD:
if (empty($value['title'])) { $value['title']=$upload->getName('image'); }

FIND:
if ((strlen($value['title']) 64)) {
ABOVE ADD:
if (empty($value['title'])) { $value['title']=$upload->getName('image'); }

...done...

That will mean now, that when you submit an image file, it will simply use the filename as the "Image Title" if it is left blank.

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by bruce » Sat Mar 15, 2008 1:16 pm

That is a good idea.

I have added "integration" fields to customer (customer_code) and product (product_code) which are alternate unique text indexes. If I name the images to match the product codes, it makes it really easy to match the images to products later on. Easier for the customer too who identifies their products by the product_code, not the product_id in opencart.

You have made it even easier now.  ;D

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by Nonconforme » Sat Apr 05, 2008 8:15 am

thanks a lot for that code, i'm going to test it.  :)

Newbie

Posts

Joined
Sat Apr 05, 2008 7:02 am
Who is online

Users browsing this forum: No registered users and 2 guests