Jump to content

Resolved - Images - present but not showing up


Recommended Posts

A site operator accidentally deleted a folder with 750+images (images and many sub-folders).

I restored a complete set from 4 weeks ago but it appears maybe half of them have lost their association with a product.


Any ideas how deleting images can remove their association? (I would think the product would still be associated in the DB). And any ideas how to restore the associations? I have cleared all caches (SQL, Skins, content) and run 'Update File List".





Link to comment
Share on other sites

If you have a backup of the database your hosting provider may have made, you will be wanting to get a hold of the CC_filemanager and CC_image_index tables -- the ones with 750 more records in it than what you have now.


In FileManager::buildDatabase, one of the housekeeping processes is to compare the CC_filemanager table's records with the existence of the file each respective record refers to. If the file does not exist, the table record gets deleted. (I cannot guess the reason for this.)


The admin screen Images (Image FileManager), Update File List tab, removes orphaned database records. This also happens when any product is brought up for editing. Any image assigned to that product, as determined by an association in the CC_image_index table, that does not exist, the appropriate CC_image_index record is deleted and the FileManager::buildDatabase is called.

Link to comment
Share on other sites

You sir are a rock star. As for the Housekeeping of images with the CubeCart DB.... wow. So databases never ever clean up what you want but if someone accidentally drags a folder within another folder, deletes a folder, renames a folder.... restores be damned you have no product images? Wow!  This admin lost 841 images (according to phpMyAdmin) and thus had 841 products with no image, She was going to manually update them one at a time or just have me revert the entire site back 3 days and work from screenshots of new customers and purchases. You've got my vote to remove that housekeeping task!


I was able to fix this in less than 10 minutes thanks to your post and a post I'd written after my last major CubeCart issue a few years back (webhost issue). http://www.gfisk.com/merge-data-from-two-databases/


1. requested backup of /images/source folder & Database from webhost

2. restore images

3. review databases

4. run this code once for the filemanager table and once for image index table. Sucks any differences from the good database base and inserts them into the current database.


INSERT IGNORE INTO `ccrt1`.`CubeCart_image_index`
FROM `ccrt1bak`.`CubeCart_image_index`
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...