Post by montanaflynn » Tue Dec 15, 2009 4:27 am

A client added some images to categories and wants to remove them completely, but their is no option for that. How about adding an remove image button?

User avatar
New member

Posts

Joined
Fri Oct 09, 2009 5:19 am

Post by Qphoria » Wed Dec 16, 2009 3:26 am

I second this... a nice small x next to the image to remove would be good. or use the do not enter sign that the option remove button uses

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by montanaflynn » Thu Dec 17, 2009 12:45 pm

My idea would be to remove the image input in the "data" tab from the product section and into the image tab where it makes more sense to be. If more than one image is uploaded a default labeled checkbox should be added for users to select the default image and the remainder would be Additional images. That would be more logical to most people.

Also the order of tabs could be changed to put images after data and be renamed like this:

General
Data
Images
Options
Discounts
Specials

User avatar
New member

Posts

Joined
Fri Oct 09, 2009 5:19 am

Post by fido-x » Thu Dec 17, 2009 1:20 pm


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 montanaflynn » Thu Dec 17, 2009 1:59 pm

Thanks fido, but I am looking for opencart to make these changes in later releases. If you have any comments or suggestions they would be appreciated.

User avatar
New member

Posts

Joined
Fri Oct 09, 2009 5:19 am

Post by fido-x » Thu Dec 17, 2009 6:58 pm

montanaflynn wrote:Thanks fido, but I am looking for opencart to make these changes in later releases. If you have any comments or suggestions they would be appreciated.
I don't think my comments on this issue would be appreciated, but here they are anyway.

Currently, the only way to remove images is to do it via FTP. The "Image Manager" I pointed you to, allows you to do it from the OpenCart admin. It is available for versions 1.3.2 and 1.3.4. Maybe you should ask your client if they want to wait for the next release when Daniel may or may not include some means of managing images.

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 i2Paq » Thu Dec 17, 2009 7:28 pm

fido-x wrote:
montanaflynn wrote:Thanks fido, but I am looking for opencart to make these changes in later releases. If you have any comments or suggestions they would be appreciated.
I don't think my comments on this issue would be appreciated, but here they are anyway.
Why not, it is up to people to buy anything if they need it and you provide something usefull so why not point towards it.

You are not the only one ;)

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by burrito » Sun Sep 26, 2010 11:14 pm

Qphoria wrote:I second this... a nice small x next to the image to remove would be good. or use the do not enter sign that the option remove button uses
I'm actually looking into this now, my initial idea was to create a dbase-routine to remove the image from the dbase when the button is clicked.
But now that I'm thinking about it, all it needs to do is go back to the original state :
- empty hidden field
- default preview because hidden field is empty

My javascript just isn't good enough to solve this (I don't know any javascript for that matter ;) )

This is what I have so far:
behind the image preview I added:

Code: Select all

<span class="remove" onclick="image_remove('image', 'preview');">&nbsp;</span>
And after the javascript function for the image manager I added:

Code: Select all

<script type="text/javascript"><!--
function image_remove(field, preview) {
			$('#' + field).replaceWith('');
			$('#' + preview).replaceWith('<img src="<?php echo $no_image; ?>" alt="" id="' + preview + '" class="image" onclick="image_upload(\'' + field + '\', \'' + preview + '\');" />');
					
				};
//--></script>
the $no_image is added to the controller as well to link to the right image and size.

Now the page still works :P and the remove button is shown... just doesn't do what I want it to do, I made the hidden image field temporarily visible for a better understanding of whats happening.

It's actually pretty straight forward ... the value of the field "image" needs to be replaced by nothing and the preview relaced by <img src="<?php echo $no_image; ?>" alt="" id="' + preview + '" class="image" onclick="image_upload(\'' + field + '\', \'' + preview + '\');" />

anyone here to finalize this?
Last edited by burrito on Mon Sep 27, 2010 5:23 am, edited 1 time in total.

Image
Opencart specialist | Our website | Our modules


User avatar
Active Member

Posts

Joined
Tue Dec 15, 2009 6:10 pm
Location - Amsterdam, The Netherlands

Post by burrito » Mon Sep 27, 2010 3:05 am

OK, I have it working now.... it wasnt for a few hours and I repasted some code and now it works... still don't know what I have changed... but who cares :P

haha

so, here it is, how to add the button:
next to your preview image (or whereever you want the remove button) add:

Code: Select all

<span class="remove" onclick="image_remove('image', 'preview');">&nbsp;</span>
and right after the script for image_upload, add:

Code: Select all

<script type="text/javascript"><!--
function image_remove(field, preview) {
	document.getElementById(field).value = '';
	$('#' + preview).replaceWith('<img src="<?php echo $no_image; ?>" alt="" id="' + preview + '" class="image" onclick="image_upload(\'' + field + '\', \'' + preview + '\');" />');
				};
//--></script>
Also remember to add this to your controller file:

Code: Select all

$this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);

Image
Opencart specialist | Our website | Our modules


User avatar
Active Member

Posts

Joined
Tue Dec 15, 2009 6:10 pm
Location - Amsterdam, The Netherlands
Who is online

Users browsing this forum: No registered users and 4 guests