Author Topic: removing graphics  (Read 11646 times)

Offline llegrand

  • Hero Member
  • *****
  • Posts: 1798
  • Karma: +520/-7
    • View Profile
removing graphics
« on: October 30, 2013, 04:51:32 PM »
I am having difficulty in removing the demo images from the resource library.  I installed the demo,  I have deleted the demo products.  But cannot get the images to delete using the resource library tools.

You can see by the attached that there is nothing mapped to the image.
But it refused the command to delete the image.
How do I clean this up?  Other than go into the databases (3) and removing them?



Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: removing graphics
« Reply #1 on: October 30, 2013, 10:53:04 PM »
You can not delete resource if it is in use (mapped to product, category, etc)

If you do not need demo products, just deleted all products in the product list grid.
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline llegrand

  • Hero Member
  • *****
  • Posts: 1798
  • Karma: +520/-7
    • View Profile
Re: removing graphics
« Reply #2 on: October 31, 2013, 12:05:20 AM »
Abantecarte,  please read more carefully.

I did say I had already deleted the products.  And the screen shot shows that there is nothingmapped to the image.   My question is why can I not delete the image?   


Offline junkyard

  • Full Member
  • ***
  • Posts: 127
  • Karma: +25/-0
    • View Profile
Re: removing graphics
« Reply #3 on: October 31, 2013, 02:53:39 PM »
+1  Have just checked and report that it happens to us as well:  deleted all demo objects like demo products, categories, customers and their orders -- nevertheless, none of the demo images can be removed from the Library.  "Mapped To" shows None, and unmapping prior deleting makes no difference either.

Offline llegrand

  • Hero Member
  • *****
  • Posts: 1798
  • Karma: +520/-7
    • View Profile
Re: removing graphics
« Reply #4 on: October 31, 2013, 04:41:15 PM »
Thanks Junkyard for testing., too. I just went to the demo on Abantecart and tested there also and it has the same results.  If you delete product without unmapping.   You cannot delete the image.

However,  and this is important!!  If you unmap the media BEFORE deleting the product.  It works as expected.  At least in my testing on the demo on Abantecart.

So I would suggest there needs to be a check in delete product process that checks for mapped graphics.  At least a message that tells you to remove the mapping first.  Or asks if you want to remove the mapping.

After a bit with lots of adds and deletes the resource library will grow entirely too large.

This may need to be moved to Bug Fixes.  But I have not done that.

Thanks Abantecart for putting this on the "fix - it" list - or attending to it with your proposed update to resource library.

Lee


Offline junkyard

  • Full Member
  • ***
  • Posts: 127
  • Karma: +25/-0
    • View Profile
Re: removing graphics
« Reply #5 on: November 11, 2013, 06:56:07 PM »
If someone who have already deleted some product or a category or a manufacturer without unmapping the mapped images first so now she cannot remove the images from the Resource Library (including the demo ones) -- if you really need to remove it, a workaround is to find & delete its orphaned mapping in database. Here's what we came up with:

1. backup your sql database, or at least  resource_map table:
http://dev.mysql.com/doc/refman/5.5/en/mysqldump.html
2. find and delete the orphaned mappings for the imagery somehow...  e.g. by their naming pattern.  below is what we did for the images remaining from demo products/categories/manufacturers -- those objects have been already removed everywhere in our Admin panel a while ago (we did not know we should have unmapped the images first in the Library at that time):
mysql> delete from ac_resource_map where resource_id in (select resource_id from  ac_resource_descriptions where name like '%demo_%');
mysql> delete from ac_resource_map where resource_id in (select resource_id from  ac_resource_descriptions where name like 'mf_%');

Then we could remove the graphics as usual in the Admin via Resource Library (in our case, there were 304 demo images found by 'demo_', and a few our owns).  Cleaning things via the Library interface (not in db!) correctly deleted their related files in public_html/resources/image directory.

Of course it is up to you to be careful(!) and not delete real mappings and all..   Please always try Lee's solution first  before messing with database:  try to unmap the images in the Library as you normally do in the Admin first,  see if it helps you remove the graphics in usual way.  If your not sure what your doing, don't break your db and wait for official fixes.   Since the issue isn't only to demo images but to all kinds of resources in Library, hopefully this is going to be fixed in the upcoming releases.
« Last Edit: November 11, 2013, 06:59:13 PM by junkyard »

Offline eCommerce Core

  • Administrator
  • Hero Member
  • *****
  • Posts: 1602
  • Karma: +93/-1
    • View Profile
Re: removing graphics
« Reply #6 on: November 12, 2013, 04:26:29 PM »
I agree, this interface requires improvement in UI. But there is no harm with keeping images in the resource library even if they are not mapped to anywhere.  It it just a repository.
“If you’re in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent.”
― Warren Buffett

Offline DavidLIR

  • Jr. Member
  • **
  • Posts: 86
  • Karma: +7/-0
    • View Profile
    • Love is Real
Re: removing graphics
« Reply #7 on: November 18, 2013, 04:55:07 PM »
Yes it is true. there is no harm in some extra data...however it is quite cumbersome to wade through all the unneeded pictures to work with the ones I have uploaded.  Another thought that might be of some help...if you could create a file system within the storage files that you could access from the upload menu, then perhaps you could at least move all those sample pictures into a folder...better yet perhaps they could already be in a folder when the program is installed.
David ;)
Love is Real....All Else is Illusion

Offline llegrand

  • Hero Member
  • *****
  • Posts: 1798
  • Karma: +520/-7
    • View Profile
Re: removing graphics
« Reply #8 on: November 18, 2013, 06:35:05 PM »
Just an aside in this discussion -  I think keeping your files as compact as possible is always the best policy in the long run.  If you continue to have lots of images that you're not using (or planning on using)  these files just keep growing and will slow down your delivery.  The same is true for keeping the databases clean.

For me it is a compounded issue as my site will be replicated for a large number of store owners.   So keeping the files lean is a bigger consideration for me as an extra gig per store adds quickly for a couple of hundred sites. 

My point in this post was that the order of deletion is highly important in the management of resources in this cart.  I was a much more involved process to clean all the info out over several databases and the graphics files that I would have hoped for.  This would not have been necessary if on deleting the graphic a message flagged to say this is mapped -  unmap it first.

But Abantecart says they are working on the way resources are managed so I am hopeful all will improve soon.

Lee

Offline DavidLIR

  • Jr. Member
  • **
  • Posts: 86
  • Karma: +7/-0
    • View Profile
    • Love is Real
Re: removing graphics
« Reply #9 on: November 18, 2013, 09:10:30 PM »
Thank you.  I just want to say that I appreciate the clarification.  I also deleted all the products before considering that the pictures needed deleted and so I have all these pictures that I have to constantly work around in order to map a picture to another item which has already been uploaded.  Perhaps, later on I will take the time to do the work wof deleting them but for now perhaps we can help some others to avoid this.

David
Love is Real....All Else is Illusion

Offline markstoneco

  • Newbie
  • *
  • Posts: 1
  • Karma: +1/-0
    • View Profile
Re: removing graphics
« Reply #10 on: November 27, 2013, 02:57:16 AM »
I found a go-around way of fixing this problem which I myself foolishly did (not unmapping the image from the item before deleting the product.) For those of you who have already deleted the demo products, simply install abantecart again to your public_htm folder under a different folder so as not to disrupt your previous updates. Login. Go to the Data tab. Export the demo product lists. import it back to your original abantecart (the one you've been updating) and voila, now you have your original "demo products" back. From here you can start unmapping the images from the product and delete the corresponding images.

Hope this helps! I purposely made an account just to share my victory!

 ;D

Offline DavidLIR

  • Jr. Member
  • **
  • Posts: 86
  • Karma: +7/-0
    • View Profile
    • Love is Real
Re: removing graphics
« Reply #11 on: November 29, 2013, 10:35:52 AM »
Markstoneco,

Thank you, great idea...obvious now that I think about it...

David ;)
Love is Real....All Else is Illusion

 

Powered by SMFPacks Social Login Mod