Orphaned Items - Images

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Orphaned Items - Images

Post by draneb » Tue Jul 07, 2009 6:53 am

Hello,

What does the Orphaned Items - Images button in the admin do?

I know I have some missing images for products so I went into the Admin and clicked on it thinking it would return a list of products without images.

It acts like it is looking but then returns this

Internet Explorer cannot display the webpage

Also, if I try to create a GoogleBase feed with missing images it will redirect me back to the Admin Login page and not create the file.
AC 7.0.3 build 13937

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Orphaned Items - Images

Post by mazhar » Tue Jul 07, 2009 8:25 am

Make sure that you have no sub folder under ProductImages folder. It seems that if you have some sub folder under ProductImages folder and trigger the image look up process hangs.
http://bugs.ablecommerce.com/show_bug.cgi?id=8179

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: Orphaned Items - Images

Post by draneb » Tue Jul 07, 2009 11:16 am

Ohh yes, that is exactly what is doing it. I was relating it to when I uploaded some products without images but at the same time I also started creating directories under ProductImages because it became too large and stopped responding.

Wow, this is even throwing off the Marketing Feeds. I am unable to create any product feeds. It will hang and redirect you back to the admin login page as well.

I have way too many images to try and change them back to the /ProductImages folder. From your experience is this something they might fix fairly quickly or can I expect to wait awhile?

Thank you.
AC 7.0.3 build 13937

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Orphaned Items - Images

Post by mazhar » Wed Jul 08, 2009 5:43 am

I think problem is that when looking for sub directories, code is always looking in ProductImages folder hence putting application into an infinite loop. Try following fix, edit Website/Admin/Catalog/OrphanedItems.aspx.cs file and locate following code line

Code: Select all

string[] directories = System.IO.Directory.GetDirectories(imagesFolderPath);
and update it as below

Code: Select all

string[] directories = System.IO.Directory.GetDirectories(dirPath);
Now it will fix hang issue and will also start looking in sub folders.

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: Orphaned Items - Images

Post by draneb » Wed Jul 08, 2009 9:58 am

Mazhar,

I just wanted to give some feedback.

The first time I used it I got a Server Timed Out error. I waited a little while and tried it again and it worked.
It is returning images in the sub folders and saying they don't belong with any products when they actually do (as additional images) so I just wanted to let you know.

It looks like that fix didn't help the feed builders. They still redirect to the login page.
Do you think the sub folders are also causing that? It has to be, that seems like when the problem started.

Thank you.
AC 7.0.3 build 13937

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Orphaned Items - Images

Post by mazhar » Wed Jul 08, 2009 10:22 am

Well I think there is one more issue with code, locate following code

Code: Select all

// ADD THE RELATIVE PATH INFORMATION
                if (dirPath != imagesFolderPath) fileName = System.IO.Path.Combine(dirPath.Substring(imagesFolderPath.Length + 1), fileName);
and update it with this block

Code: Select all

// ADD THE RELATIVE PATH INFORMATION
                if (dirPath != imagesFolderPath) fileName = dirPath.Substring(imagesFolderPath.Length + 1)+"/"+ fileName;
Now test it again.

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: Orphaned Items - Images

Post by draneb » Wed Jul 08, 2009 11:05 am

Looking better! haha

There is one other thing I see. It is returning some of the items in the list (but not all) in this format
ac\crosses/459_a3_50yr.jpg

shouldn't it be
ac/crosses/459_a3_50yr.jpg ?

because when I hover over the magnifying glass it just shows a broken image red X because that is not the correct path format.

Can you tell if there is something in that orphaneditems file that may be causing that?
AC 7.0.3 build 13937

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Orphaned Items - Images

Post by mazhar » Thu Jul 09, 2009 8:54 am

It seems that our previous fix was not working for root/sub/sub directory structure. Here is the updated code. So instead of using above fix try following fix and replace

Code: Select all

// ADD THE RELATIVE PATH INFORMATION
                if (dirPath != imagesFolderPath) fileName = System.IO.Path.Combine(dirPath.Substring(imagesFolderPath.Length + 1), fileName);
with following code block

Code: Select all

// ADD THE RELATIVE PATH INFORMATION
                if (dirPath != imagesFolderPath)
                {
                    string basePart = dirPath.Replace(imagesFolderPath+"\\", string.Empty);
                    basePart = basePart.Replace("\\", "/");
                    fileName = basePart+"/"+fileName;
                }

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: Orphaned Items - Images

Post by draneb » Thu Jul 09, 2009 9:53 am

Hi Mazhar,

That didn't seem to work for me. It returned results like
Alt/Alt\b1005.jpg

Just messing around I commented this out

Code: Select all

// ADD THE RELATIVE PATH INFORMATION
                if (dirPath != imagesFolderPath) fileName = System.IO.Path.Combine(dirPath.Substring(imagesFolderPath.Length + 1), fileName);
and just left your block of code

Code: Select all

// ADD THE RELATIVE PATH INFORMATION
                if (dirPath != imagesFolderPath)
                {
                    string basePart = dirPath.Replace(imagesFolderPath+"\\", string.Empty);
                    basePart = basePart.Replace("\\", "/");
                    fileName = basePart+"/"+fileName;
                }
and it appears to be working fine now. I will check it out some more as there were a lot of pages to go through.
Thank you!
AC 7.0.3 build 13937

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Orphaned Items - Images

Post by mazhar » Thu Jul 09, 2009 9:58 am

sounds good

Post Reply