
Cart2Quote Module Uninstall Manual
Cart2Quote Module Removal Manual
Our Quotation module for Magento 2 provides functionality for generating and managing quotations. In this guide, we will walk you through the process of completely removing the module from your Magento 2 store, ensuring that all related files and database entries are thoroughly cleaned up.
This process is designed for users who want to uninstall the Cart2Quote module, including removing both the module's source files and database records.
1. Disable the Cart2Quote Module
Before removing any files or database entries, we first need to disable the Cart2Quote module. This will ensure that the module is no longer active and that Magento doesn't attempt to load it.
Steps:
Disable the Module: Run the following command to disable the Cart2Quote_Quotation module in Magento:
bash php bin/magento module:disable Cart2Quote_Quotation Cart2Quote_Features Cart2Quote_License
Note: Mentioning the 'Cart2Quote_Features' & 'Cart2Quote_License' modules is only necessary for Cart2Quote Trial, Starter, Business & Enterprise Cart2Quote module versions.
Upgrade the Database: After disabling the module, perform an upgrade to ensure Magento recognises the change:
bash php bin/magento setup:upgrade
This step ensures that the module is disabled and won't affect the system while we proceed with the uninstallation.
2. Remove Source Files
To completely remove the Cart2Quote module, we need to delete its source files from your Magento installation.
Steps:
Delete the Module Directory: Navigate to the Magento root directory and remove the
Cart2Quote_Quotation
module:bash # Effective for C2Q module installed in your app/code/ directory rm -rf app/code/Cart2Quote/Quotation # Effective for C2Q module installed in your vendor/ directory rm -rf vendor/cart2quote
Remove Cache and Generated Files: To ensure that there are no leftover files, clear Magento’s cache and any generated files:
bash rm -rf var/cache/* var/generation/* var/di/* var/page_cache/*
3. Run the Uninstall Script
The Cart2Quote module includes a built-in uninstall script (Uninstall.php
) that automates the process of cleaning up the database. This script ensures that all database entries related to the module are removed, including custom tables, columns, and configuration settings. This is one of the most convenient features of the Cart2Quote module, making it easy to clean up after uninstallation without requiring manual intervention.
Uninstall.php Features:
The uninstall script has been designed to remove all the module's database changes, which include:
Removing Configuration Entries: The uninstall script deletes any configuration values associated with the Cart2Quote module by targeting the
core_config_data
table where thepath
starts withcart2quote_quotation%
. This ensures that all configuration settings are removed.php $setup->getConnection()->delete( $setup->getTable('core_config_data'), ['path LIKE ?' => 'cart2quote_quotation%'] );
Dropping Database Tables: The script automatically drops several tables created by the module, ensuring no leftover data from quotations or statuses:
php $setup->getConnection('checkout')->dropTable($setup->getTable('quotation_quote')); // Additional drop table commands for other related tables
Removing Custom Columns: It also removes any columns added by the module to existing tables, such as the
quote
table:php $setup->getConnection('checkout')->dropColumn($setup->getTable('quote'), 'is_quotation_quote'); $setup->getConnection('checkout')->dropColumn($setup->getTable('quote'), 'linked_quotation_id');
Running the Uninstall Script:
Once you have disabled the module, the uninstall script will automatically run when you execute the setup:upgrade
command.
bash
php bin/magento setup:upgrade
This command triggers the uninstall script, ensuring that all database entries and tables created by the Cart2Quote module are removed.
4. Manual Database Cleanup (if needed)
While the Uninstall.php
script should handle most of the database cleanup automatically, you may need to manually delete database entries if the script doesn’t fully execute due to an error or incomplete uninstallation.
Steps:
Remove Configuration Entries: Manually delete any leftover configuration entries from the
core_config_data
table:sql DELETE FROM core_config_data WHERE path LIKE 'cart2quote_quotation%';
Drop Database Tables: Drop the following tables related to the Cart2Quote module:
sql DROP TABLE IF EXISTS quotation_quote, quotation_quote_sections, quotation_quote_section_items, quotation_quote_status, quotation_quote_status_history, quotation_quote_status_label, quotation_quote_status_state, quotation_quote_tier_item, quotation_aggregated;
Remove Columns from the
quote
Table: If the uninstall script did not remove them, drop the columns added by Cart2Quote to thequote
table:sql ALTER TABLE quote DROP COLUMN is_quotation_quote, DROP COLUMN linked_quotation_id;
5. Clear Cache and Recompile (Final Cleanup)
After removing the files and cleaning up the database, run the following commands to clear Magento’s cache and recompile the application. This ensures that there are no residual files or configurations that could cause issues after the module has been removed.
Steps:
Flush Cache:
bash php bin/magento cache:flush
Compile Code:
bash php bin/magento setup:di:compile
Deploy Static Content:
bash php bin/magento setup:static-content:deploy
Conclusion
Our Quotation module has been carefully designed with convenience in mind, especially with the inclusion of the Uninstall.php
script. This script automates the removal of the module’s database entries, ensuring that everything from configuration values to custom tables and columns are cleaned up with minimal manual effort. By following this guide, you can ensure a smooth and thorough uninstallation process for the Cart2Quote module.
Should you encounter any issues during the uninstallation, you can always perform the manual steps described above to ensure everything is cleaned up properly.