Using Yireo Trashcan for Magento

The Yireo Trashcan module allows you to restore various Magento content (like products or CMS-pages), when they are deleted by accident. This tutorial shows you what you should do to implement this recycle bin into your Magento site.

Installing the Yireo Trashcan module

Download the ZIP-file to your computer, extract all files and upload those files to the Magento root-folder using FTP or SSH. The ZIP-file contains the following folders which correspond with existing folders in Magento:

  • app/etc/modules
  • app/code/community
  • app/design/frontend/base/default/layout
  • app/design/frontend/base/default/templates

Refresh Magento caching

After uploading these files and folders to Magento, refresh the Magento cache. You can either do this from the Magento backend (System > Cache Management). Or you could also remove the entire var/cache folder through FTP or SSH to remove the cache manually.

Manual SQL-queries

During the installation procedure described above, Magento should detect a new database-schema and install the TrashCan database-table accordingly. If this fails, for instance because the database-user doesn't have enough privileges, the following SQL-statement can be used to create the needed database-table manually:

CREATE TABLE IF NOT EXISTS `trashcan_object` (
  `object_id` int(11) NOT NULL AUTO_INCREMENT,
  `label` varchar(255) NOT NULL,
  `resource_class` varchar(255) NOT NULL,
  `resource_data` longblob NOT NULL,
  `trashed_timestamp` datetime NOT NULL,
  `trashed_by` int(11) NOT NULL,
  PRIMARY KEY (`object_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Note that the database-table trashcan_object might need an additional database table-prefix, depending on how you configured your Magento database.

Removing TrashCan

To remove TrashCan from your Magento application, remove the files mentioned above and perform the following database-query:

DROP TABLE `trashcan_object`;

Note that the database-table trashcan_object might need an additional database table-prefix, depending on how you configured your Magento database.