Version Notes
Version: 1.0.0
Release Stability: Stable
Download this release
Release Info
| Developer | Gotechsolution |
| Extension | Gts_Ddd |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/local/Gts/Ddd/Block/Adminhtml/System/Config/Form/Field/Checkboxs.php +92 -0
- app/code/local/Gts/Ddd/Helper/Data.php +315 -0
- app/code/local/Gts/Ddd/Helper/Data.php~ +15 -0
- app/code/local/Gts/Ddd/controllers/Adminhtml/DeleteController.php +37 -0
- app/code/local/Gts/Ddd/etc/adminhtml.xml +21 -0
- app/code/local/Gts/Ddd/etc/config.xml +47 -0
- app/code/local/Gts/Ddd/etc/system.xml +64 -0
- app/etc/modules/Gts_Ddd.xml +19 -0
- package.xml +59 -0
app/code/local/Gts/Ddd/Block/Adminhtml/System/Config/Form/Field/Checkboxs.php
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Gts_Ddd_Block_Adminhtml_System_Config_Form_Field_Checkboxs extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
| 4 |
+
|
| 5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
| 6 |
+
|
| 7 |
+
$output = '<script>
|
| 8 |
+
function gtsDeleteData(){
|
| 9 |
+
var result = confirm("'.$this->__("Make sure, you want to delete dummy data..").'");
|
| 10 |
+
if (result==true) {
|
| 11 |
+
var delOrd = "delOrd/0/";
|
| 12 |
+
var delPro = "delPro/0/";
|
| 13 |
+
var delCus = "delCus/0/";
|
| 14 |
+
var delCat = "delCat/0/";
|
| 15 |
+
var delUrl = "delUrl/0/";
|
| 16 |
+
var delLog = "delLog/0/";
|
| 17 |
+
|
| 18 |
+
if(document.getElementById("gts-delete-product").checked){
|
| 19 |
+
delPro = "delPro/1/";
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
if(document.getElementById("gts-delete-order").checked){
|
| 23 |
+
delOrd = "delOrd/1/";
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
if(document.getElementById("gts-delete-customer").checked){
|
| 27 |
+
delCus = "delCus/1/";
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
if(document.getElementById("gts-delete-category").checked){
|
| 31 |
+
delCat = "delCat/1/";
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
if(document.getElementById("gts-delete-url").checked){
|
| 35 |
+
delUrl = "delUrl/1/";
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
if(document.getElementById("gts-delete-log").checked){
|
| 39 |
+
delLog = "delLog/1/";
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
var xmlhttp;
|
| 43 |
+
if (window.XMLHttpRequest) {
|
| 44 |
+
xmlhttp = new XMLHttpRequest();
|
| 45 |
+
} else {
|
| 46 |
+
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
document.getElementById("gts_delete").style = "none";
|
| 51 |
+
document.getElementById("gts_msg1").style = "block";
|
| 52 |
+
document.getElementById("gts_msg").innerHTML = "'.$this->__("Please be patient! your dummy data is deleting...").'";
|
| 53 |
+
|
| 54 |
+
xmlhttp.onreadystatechange = function() {
|
| 55 |
+
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
| 56 |
+
document.getElementById("gts_msg").innerHTML = "";
|
| 57 |
+
document.getElementById("gts_delete").style = "block";
|
| 58 |
+
document.getElementById("gts_msg").innerHTML = xmlhttp.responseText;
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
xmlhttp.open("GET","' . Mage::helper("adminhtml")->getUrl("ddd/adminhtml_delete/delete/") . '" + delPro + delOrd + delCus + delCat + delUrl + delLog, true);
|
| 63 |
+
xmlhttp.send();
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
</script>
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
<div id="gts_msg1" style="display:none;">
|
| 70 |
+
<ul class="messages">
|
| 71 |
+
<li class="success-msg" id="gts_msg"> </li>
|
| 72 |
+
</ul>
|
| 73 |
+
</div>
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
<div><b> <input type="checkbox" name="gts-delete-product" id="gts-delete-product" /> All Product</b> </div>
|
| 78 |
+
<div><b> <input type="checkbox" name="gts-delete-order" id="gts-delete-order" /> All Order</b> </div>
|
| 79 |
+
<div><b> <input type="checkbox" name="gts-delete-customer" id="gts-delete-customer" /> All Customer</b> </div>
|
| 80 |
+
<div><b> <input type="checkbox" name="gts-delete-category" id="gts-delete-category" /> All Category</b> </div>
|
| 81 |
+
<div><b> <input type="checkbox" name="gts-delete-url" id="gts-delete-url" /> Empty Url Rewrite Table</b> </div>
|
| 82 |
+
<div><b> <input type="checkbox" name="gts-delete-log" id="gts-delete-log" /> Empty Log Tables</b> </div>
|
| 83 |
+
<br />
|
| 84 |
+
<br />
|
| 85 |
+
<div id="gts_delete">
|
| 86 |
+
<button name="gts_delete" onclick="gtsDeleteData()" class="scalable" type="button" title="Delete"><span><span><span>Remove</span></span></span></button>
|
| 87 |
+
</div>';
|
| 88 |
+
|
| 89 |
+
return $output . '<div class="clear"></div>';
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
}
|
app/code/local/Gts/Ddd/Helper/Data.php
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
*
|
| 4 |
+
*
|
| 5 |
+
* @category Gts
|
| 6 |
+
* @package Gts_Ddd
|
| 7 |
+
* @author Gotechsolution.com (GTS)
|
| 8 |
+
* @link http://www.gotechsolution.com/
|
| 9 |
+
* @copyright Copyright (c) 2012 (http://www.mgt-commerce.com)
|
| 10 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
class Gts_Ddd_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Function Delete Product
|
| 18 |
+
* @author GTS
|
| 19 |
+
* @return String delete success or error message
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
public function delPro() {
|
| 23 |
+
try{
|
| 24 |
+
$table_prifix = $this->getTablePrifix();
|
| 25 |
+
$dbObj = $this->getConnectionObj();
|
| 26 |
+
$dbObj->query('SET FOREIGN_KEY_CHECKS = 0');
|
| 27 |
+
|
| 28 |
+
$table_names = array('catalog_product_bundle_option',
|
| 29 |
+
'catalog_product_bundle_option_value',
|
| 30 |
+
'catalog_product_bundle_selection',
|
| 31 |
+
'catalog_product_entity_datetime',
|
| 32 |
+
'catalog_product_entity_decimal',
|
| 33 |
+
'catalog_product_entity_gallery',
|
| 34 |
+
'catalog_product_entity_int',
|
| 35 |
+
'catalog_product_entity_media_gallery',
|
| 36 |
+
'catalog_product_entity_media_gallery_value',
|
| 37 |
+
'catalog_product_entity_text',
|
| 38 |
+
'catalog_product_entity_tier_price',
|
| 39 |
+
'catalog_product_entity_varchar',
|
| 40 |
+
'catalog_product_flat_1',
|
| 41 |
+
'catalog_product_link',
|
| 42 |
+
'catalog_product_link_attribute',
|
| 43 |
+
'catalog_product_link_attribute_decimal',
|
| 44 |
+
'catalog_product_link_attribute_int',
|
| 45 |
+
'catalog_product_link_attribute_varchar',
|
| 46 |
+
'catalog_product_link_type',
|
| 47 |
+
'catalog_product_option',
|
| 48 |
+
'catalog_product_option_price',
|
| 49 |
+
'catalog_product_option_title',
|
| 50 |
+
'catalog_product_option_type_price',
|
| 51 |
+
'catalog_product_option_type_title',
|
| 52 |
+
'catalog_product_option_type_value',
|
| 53 |
+
'catalog_product_super_attribute_label',
|
| 54 |
+
'catalog_product_super_attribute_pricing',
|
| 55 |
+
'catalog_product_super_attribute',
|
| 56 |
+
'catalog_product_super_link',
|
| 57 |
+
'catalog_product_enabled_index',
|
| 58 |
+
'catalog_product_website',
|
| 59 |
+
'catalog_product_relation',
|
| 60 |
+
'catalog_category_product_index',
|
| 61 |
+
'catalog_category_product',
|
| 62 |
+
'cataloginventory_stock_item',
|
| 63 |
+
'cataloginventory_stock_status',
|
| 64 |
+
'cataloginventory_stock_status_idx',
|
| 65 |
+
'cataloginventory_stock',
|
| 66 |
+
'core_url_rewrite');
|
| 67 |
+
|
| 68 |
+
foreach($table_names as $table_name){
|
| 69 |
+
$dbObj->query('TRUNCATE TABLE `'.$table_prifix.$table_name.'`');
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
$dbObj->query("INSERT INTO `".$table_prifix."catalog_product_link_type`(`link_type_id`,`code`) VALUES (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell')");
|
| 74 |
+
$dbObj->query("INSERT INTO `".$table_prifix."catalog_product_link_attribute`(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) VALUES (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal')");
|
| 75 |
+
$dbObj->query("INSERT INTO `".$table_prifix."cataloginventory_stock`(`stock_id`,`stock_name`) VALUES (1,'Default')");
|
| 76 |
+
$dbObj->query("TRUNCATE TABLE `".$table_prifix."catalog_product_entity`");
|
| 77 |
+
|
| 78 |
+
$dbObj->query('SET FOREIGN_KEY_CHECKS = 1');
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
return $this->__('Product has been deleted successfully !!');
|
| 82 |
+
|
| 83 |
+
} catch (Exception $e){
|
| 84 |
+
Mage::log($e->getMessage(), null, 'gts.log', true);
|
| 85 |
+
return $e->getMessage();
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* Function Delete Order
|
| 93 |
+
* @author GTS
|
| 94 |
+
* @return String delete success or error message
|
| 95 |
+
*/
|
| 96 |
+
|
| 97 |
+
public function delOrd() {
|
| 98 |
+
try{
|
| 99 |
+
|
| 100 |
+
$tablePrefix = $this->getTablePrifix();
|
| 101 |
+
$dbObj = $this->getConnectionObj();
|
| 102 |
+
|
| 103 |
+
$orderTableName = array (
|
| 104 |
+
'sales_flat_order',
|
| 105 |
+
'sales_flat_order_address',
|
| 106 |
+
'sales_flat_order_grid',
|
| 107 |
+
'sales_flat_order_item',
|
| 108 |
+
'sales_flat_order_status_history',
|
| 109 |
+
'sales_flat_quote',
|
| 110 |
+
'sales_flat_quote_address',
|
| 111 |
+
'sales_flat_quote_address_item',
|
| 112 |
+
'sales_flat_quote_item',
|
| 113 |
+
'sales_flat_quote_item_option',
|
| 114 |
+
'sales_flat_order_payment',
|
| 115 |
+
'sales_flat_quote_payment',
|
| 116 |
+
'sales_flat_shipment',
|
| 117 |
+
'sales_flat_shipment_item',
|
| 118 |
+
'sales_flat_shipment_grid',
|
| 119 |
+
'sales_flat_invoice',
|
| 120 |
+
'sales_flat_invoice_grid',
|
| 121 |
+
'sales_flat_invoice_item',
|
| 122 |
+
'sendfriend_log',
|
| 123 |
+
'tag',
|
| 124 |
+
'tag_relation',
|
| 125 |
+
'tag_summary',
|
| 126 |
+
'wishlist',
|
| 127 |
+
'log_quote',
|
| 128 |
+
'report_event'
|
| 129 |
+
);
|
| 130 |
+
$dbObj->query('SET FOREIGN_KEY_CHECKS=0');
|
| 131 |
+
|
| 132 |
+
for($ga=0;$ga<=(count($orderTableName)-1);$ga++){
|
| 133 |
+
$dbObj->query('TRUNCATE `'.$tablePrefix.$orderTableName[$ga].'`');
|
| 134 |
+
$dbObj->query('ALTER TABLE `'.$tablePrefix.$orderTableName[$ga].'` AUTO_INCREMENT=1');
|
| 135 |
+
|
| 136 |
+
}
|
| 137 |
+
$dbObj->query('SET FOREIGN_KEY_CHECKS = 1');
|
| 138 |
+
|
| 139 |
+
return $this->__('Order has been deleted successfully !!');
|
| 140 |
+
|
| 141 |
+
} catch (Exception $e){
|
| 142 |
+
Mage::log($e->getMessage(), null, 'gts.log', true);
|
| 143 |
+
return $e->getMessage();
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
/**
|
| 151 |
+
* Function Delete Customer
|
| 152 |
+
* @author GTS
|
| 153 |
+
* @return String delete success or error message
|
| 154 |
+
*/
|
| 155 |
+
|
| 156 |
+
public function delCus() {
|
| 157 |
+
try{
|
| 158 |
+
|
| 159 |
+
$tablePrefix = $this->getTablePrifix();
|
| 160 |
+
$dbObj = $this->getConnectionObj();
|
| 161 |
+
|
| 162 |
+
$customerTableName = array (
|
| 163 |
+
'customer_address_entity',
|
| 164 |
+
'customer_address_entity_datetime',
|
| 165 |
+
'customer_address_entity_decimal',
|
| 166 |
+
'customer_address_entity_int',
|
| 167 |
+
'customer_address_entity_text',
|
| 168 |
+
'customer_address_entity_text',
|
| 169 |
+
'customer_address_entity_varchar',
|
| 170 |
+
'customer_entity',
|
| 171 |
+
'customer_entity_datetime',
|
| 172 |
+
'customer_entity_decimal',
|
| 173 |
+
'customer_entity_int',
|
| 174 |
+
'customer_entity_text',
|
| 175 |
+
'customer_entity_varchar',
|
| 176 |
+
'log_customer',
|
| 177 |
+
'log_visitor',
|
| 178 |
+
'log_visitor_info',
|
| 179 |
+
'log_visitor_info',
|
| 180 |
+
'eav_entity_store');
|
| 181 |
+
$dbObj->query('SET FOREIGN_KEY_CHECKS=0');
|
| 182 |
+
|
| 183 |
+
for($gau=0;$gau<=(count($customerTableName)-1);$gau++){
|
| 184 |
+
$dbObj->query('TRUNCATE `'.$tablePrefix.$customerTableName[$gau].'`');
|
| 185 |
+
$dbObj->query('ALTER TABLE `'.$tablePrefix.$customerTableName[$gau].'` AUTO_INCREMENT=1 ');
|
| 186 |
+
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
$dbObj->query('SET FOREIGN_KEY_CHECKS = 1');
|
| 190 |
+
|
| 191 |
+
return $this->__('Customer has been deleted successfully !!');
|
| 192 |
+
|
| 193 |
+
} catch (Exception $e){
|
| 194 |
+
Mage::log($e->getMessage(), null, 'gts.log', true);
|
| 195 |
+
return $e->getMessage();
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
/**
|
| 201 |
+
* Function Delete Category
|
| 202 |
+
* @author GTS
|
| 203 |
+
* @return String delete success or error message
|
| 204 |
+
*/
|
| 205 |
+
|
| 206 |
+
public function delCat() {
|
| 207 |
+
|
| 208 |
+
try{
|
| 209 |
+
$categoryCollection = Mage::getModel('catalog/category')->getCollection()
|
| 210 |
+
->addFieldToFilter('level', array('gteq' => 2));
|
| 211 |
+
|
| 212 |
+
foreach($categoryCollection as $category) {
|
| 213 |
+
$category->delete();
|
| 214 |
+
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
return $this->__('Cateory has been deleted successfully !!');
|
| 220 |
+
|
| 221 |
+
} catch (Exception $e){
|
| 222 |
+
Mage::log($e->getMessage(), null, 'gts.log', true);
|
| 223 |
+
return $e->getMessage();
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
/**
|
| 229 |
+
* Function Empty Log Tables
|
| 230 |
+
* @author GTS
|
| 231 |
+
* @return String delete success or error message
|
| 232 |
+
*/
|
| 233 |
+
|
| 234 |
+
public function delLog() {
|
| 235 |
+
|
| 236 |
+
try{
|
| 237 |
+
$table_prifix = $this->getTablePrifix();
|
| 238 |
+
$dbObj = $this->getConnectionObj();
|
| 239 |
+
$dbObj->query('SET FOREIGN_KEY_CHECKS = 0');
|
| 240 |
+
|
| 241 |
+
$table_names = array('log_customer',
|
| 242 |
+
'log_quote',
|
| 243 |
+
'log_summary',
|
| 244 |
+
'log_summary_type',
|
| 245 |
+
'log_url',
|
| 246 |
+
'log_url_info',
|
| 247 |
+
'log_visitor',
|
| 248 |
+
'log_visitor_info',
|
| 249 |
+
'log_visitor_online');
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
foreach($table_names as $table_name){
|
| 253 |
+
$dbObj->query('TRUNCATE TABLE `'.$table_prifix.$table_name.'`');
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
$dbObj->query('SET FOREIGN_KEY_CHECKS = 1');
|
| 257 |
+
|
| 258 |
+
return $this->__('Log tables has been empty successfully !!');
|
| 259 |
+
|
| 260 |
+
} catch (Exception $e){
|
| 261 |
+
Mage::log($e->getMessage(), null, 'gts.log', true);
|
| 262 |
+
return $e->getMessage();
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
/**
|
| 269 |
+
* Function Empty Url Rewrite Table
|
| 270 |
+
* @author GTS
|
| 271 |
+
* @return String delete success or error message
|
| 272 |
+
*/
|
| 273 |
+
|
| 274 |
+
public function delUrl() {
|
| 275 |
+
|
| 276 |
+
try{
|
| 277 |
+
$table_prifix = $this->getTablePrifix();
|
| 278 |
+
$dbObj = $this->getConnectionObj();
|
| 279 |
+
$dbObj->query("TRUNCATE TABLE `".$table_prifix."core_url_rewrite`");
|
| 280 |
+
return $this->__('Url rewrite table has been empty successfully !!');
|
| 281 |
+
|
| 282 |
+
} catch (Exception $e){
|
| 283 |
+
Mage::log($e->getMessage(), null, 'gts.log', true);
|
| 284 |
+
return $e->getMessage();
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
/**
|
| 291 |
+
* Function get Table Prifix
|
| 292 |
+
* @author GTS
|
| 293 |
+
* @return String Table Prifix
|
| 294 |
+
*/
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
private function getTablePrifix() {
|
| 298 |
+
return (string) Mage::getConfig()->getTablePrefix();
|
| 299 |
+
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
/**
|
| 304 |
+
* Function get Database Connection
|
| 305 |
+
* @author GTS
|
| 306 |
+
* @return String Database Connection
|
| 307 |
+
*/
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
private function getConnectionObj() {
|
| 311 |
+
return Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 312 |
+
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
}
|
app/code/local/Gts/Ddd/Helper/Data.php~
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
*
|
| 4 |
+
*
|
| 5 |
+
* @category Green
|
| 6 |
+
* @package Green_Fedexindia
|
| 7 |
+
* @author Gaurav Agarwal <gaurav.agarwal@greenhonchos.com,gaurav.nietmca@gmail.com>
|
| 8 |
+
* @copyright Copyright (c) 2012 (http://www.mgt-commerce.com)
|
| 9 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Green_Fedexindia_Helper_Data extends Mage_Core_Helper_Abstract
|
| 13 |
+
{
|
| 14 |
+
|
| 15 |
+
}
|
app/code/local/Gts/Ddd/controllers/Adminhtml/DeleteController.php
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
*
|
| 5 |
+
*
|
| 6 |
+
* @category Gts
|
| 7 |
+
* @package Gts_Ddd
|
| 8 |
+
* @author Gotechsolution.com (GTS)
|
| 9 |
+
* @link http://www.gotechsolution.com/
|
| 10 |
+
* @copyright Copyright (c) 2012 (http://www.mgt-commerce.com)
|
| 11 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
class Gts_Ddd_Adminhtml_DeleteController extends Mage_Adminhtml_Controller_Action
|
| 15 |
+
{
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Function handled the delete action call & parameter
|
| 19 |
+
* @author GTS
|
| 20 |
+
* @return String return success or error message
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
public function deleteAction(){
|
| 24 |
+
|
| 25 |
+
$fields = $this->getRequest()->getParams();
|
| 26 |
+
$msg = '';
|
| 27 |
+
foreach ($fields as $key => $value) {
|
| 28 |
+
if($value > 0 && $key !='key'){
|
| 29 |
+
$msg .= Mage::helper('ddd')->$key().'<br />';
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
echo $msg?$msg:$this->__('Please select checkbox');
|
| 33 |
+
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
}
|
app/code/local/Gts/Ddd/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<adminhtml>
|
| 2 |
+
<acl>
|
| 3 |
+
<resources>
|
| 4 |
+
<admin>
|
| 5 |
+
<children>
|
| 6 |
+
<system>
|
| 7 |
+
<children>
|
| 8 |
+
<config>
|
| 9 |
+
<children>
|
| 10 |
+
<gts_ddd><!-- section name -->
|
| 11 |
+
<title>GTS Delete Dummy Data</title><!-- title or lable given -->
|
| 12 |
+
</gts_ddd>
|
| 13 |
+
</children>
|
| 14 |
+
</config>
|
| 15 |
+
</children>
|
| 16 |
+
</system>
|
| 17 |
+
</children>
|
| 18 |
+
</admin>
|
| 19 |
+
</resources>
|
| 20 |
+
</acl>
|
| 21 |
+
</adminhtml>
|
app/code/local/Gts/Ddd/etc/config.xml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
*
|
| 5 |
+
* @category Gts
|
| 6 |
+
* @package Gts_Ddd
|
| 7 |
+
* @author Gotechsolution.com (GTS)
|
| 8 |
+
* @link http://www.gotechsolution.com/
|
| 9 |
+
* @copyright Copyright (c) 2012 (http://www.mgt-commerce.com)
|
| 10 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
-->
|
| 14 |
+
|
| 15 |
+
<config>
|
| 16 |
+
<modules>
|
| 17 |
+
<Gts_Ddd>
|
| 18 |
+
<version>0.1.0</version>
|
| 19 |
+
</Gts_Ddd>
|
| 20 |
+
</modules>
|
| 21 |
+
|
| 22 |
+
<admin>
|
| 23 |
+
<routers>
|
| 24 |
+
<ddd>
|
| 25 |
+
<use>admin</use>
|
| 26 |
+
<args>
|
| 27 |
+
<module>Gts_Ddd</module>
|
| 28 |
+
<frontName>ddd</frontName>
|
| 29 |
+
</args>
|
| 30 |
+
</ddd>
|
| 31 |
+
</routers>
|
| 32 |
+
</admin>
|
| 33 |
+
|
| 34 |
+
<global>
|
| 35 |
+
<blocks>
|
| 36 |
+
<ddd>
|
| 37 |
+
<class>Gts_Ddd_Block</class>
|
| 38 |
+
</ddd>
|
| 39 |
+
</blocks>
|
| 40 |
+
<helpers>
|
| 41 |
+
<ddd>
|
| 42 |
+
<class>Gts_Ddd_Helper</class>
|
| 43 |
+
</ddd>
|
| 44 |
+
</helpers>
|
| 45 |
+
</global>
|
| 46 |
+
|
| 47 |
+
</config>
|
app/code/local/Gts/Ddd/etc/system.xml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<config>
|
| 2 |
+
<tabs>
|
| 3 |
+
<gts>
|
| 4 |
+
<label>GTS</label>
|
| 5 |
+
<sort_order>210</sort_order>
|
| 6 |
+
</gts>
|
| 7 |
+
</tabs>
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
<sections>
|
| 11 |
+
<gts_ddd module="contacts" translate="label">
|
| 12 |
+
<label>GTS Delete Dummy Data</label>
|
| 13 |
+
<tab>gts</tab>
|
| 14 |
+
<sort_order>120</sort_order>
|
| 15 |
+
<show_in_default>1</show_in_default>
|
| 16 |
+
<show_in_website>1</show_in_website>
|
| 17 |
+
<show_in_store>1</show_in_store>
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
<groups>
|
| 21 |
+
<gts_ddd_setting translate="label">
|
| 22 |
+
<label>GTS Delete Dummy Data Setting</label>
|
| 23 |
+
<sort_order>10</sort_order>
|
| 24 |
+
<show_in_default>1</show_in_default>
|
| 25 |
+
<show_in_website>1</show_in_website>
|
| 26 |
+
<show_in_store>1</show_in_store>
|
| 27 |
+
<comment>
|
| 28 |
+
<![CDATA[
|
| 29 |
+
<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
|
| 30 |
+
This Extension was developed by <b> <a href="http://www.gotechsolution.com" target="_blank">www.gotechsolution.com</a> </b>
|
| 31 |
+
<br/>For more clarification refer to read<a href="http://www.gotechsolution.com/">Delete Dummy Data Doc</a>.
|
| 32 |
+
<br/>For any query Email us: <b> gotechsolution1@gmail.com</b>
|
| 33 |
+
</div>
|
| 34 |
+
<div id="messages">
|
| 35 |
+
<ul class="messages">
|
| 36 |
+
<li class="notice-msg">Please take a database backup first.
|
| 37 |
+
</li>
|
| 38 |
+
</ul>
|
| 39 |
+
</div>
|
| 40 |
+
|
| 41 |
+
]]>
|
| 42 |
+
</comment>
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
<fields>
|
| 46 |
+
|
| 47 |
+
<chk_gts_ddd>
|
| 48 |
+
<label>Select Checkboxes: </label>
|
| 49 |
+
<frontend_type>Checkboxes</frontend_type>
|
| 50 |
+
|
| 51 |
+
<frontend_model>ddd/adminhtml_system_config_form_field_checkboxs</frontend_model>
|
| 52 |
+
<sort_order>13</sort_order>
|
| 53 |
+
<show_in_default>1</show_in_default>
|
| 54 |
+
<show_in_website>1</show_in_website>
|
| 55 |
+
<show_in_store>1</show_in_store>
|
| 56 |
+
</chk_gts_ddd>
|
| 57 |
+
|
| 58 |
+
</fields>
|
| 59 |
+
</gts_ddd_setting>
|
| 60 |
+
</groups>
|
| 61 |
+
|
| 62 |
+
</gts_ddd>
|
| 63 |
+
</sections>
|
| 64 |
+
</config>
|
app/etc/modules/Gts_Ddd.xml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<!--
|
| 4 |
+
/**
|
| 5 |
+
*
|
| 6 |
+
* @NameSpace Gts
|
| 7 |
+
* @package Gts_Ddd (Delete Dummy Data)
|
| 8 |
+
* @author GTS
|
| 9 |
+
*/
|
| 10 |
+
-->
|
| 11 |
+
|
| 12 |
+
<config>
|
| 13 |
+
<modules>
|
| 14 |
+
<Gts_Ddd>
|
| 15 |
+
<active>true</active>
|
| 16 |
+
<codePool>local</codePool>
|
| 17 |
+
</Gts_Ddd>
|
| 18 |
+
</modules>
|
| 19 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Gts_Ddd</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>GTS provide a way which is help full to develope magento projects. Using this extension we can enhance the project speed and sapce.
|
| 10 |
+
Features:-
|
| 11 |
+

|
| 12 |
+
1) Clear Logs and Url Rewrite Tables
|
| 13 |
+

|
| 14 |
+
2) Delete Dummy Product
|
| 15 |
+

|
| 16 |
+
3) Delete Dummy Category
|
| 17 |
+

|
| 18 |
+
4) Delete Dummy Cutomers
|
| 19 |
+

|
| 20 |
+
5) Delete Dummy Orders
|
| 21 |
+

|
| 22 |
+
6) Enhance Site Speed
|
| 23 |
+

|
| 24 |
+
7) Remove garbage data </summary>
|
| 25 |
+
<description>Whenever we worked on developed projects , we have created lot of dummy data for testing purpose like Orders, Product, categories, customers, etc. And without remove dummy data we take a database backup and upload it on live server, for this cause magento take more space and slow the website.
|
| 26 |
+

|
| 27 |
+
Using this Extension you can enhance your projects Like:-
|
| 28 |
+

|
| 29 |
+
1) Clear Logs and Url Rewrite Tables
|
| 30 |
+

|
| 31 |
+
2) Delete Dummy Product
|
| 32 |
+

|
| 33 |
+
3) Delete Dummy Category
|
| 34 |
+

|
| 35 |
+
4) Delete Dummy Cutomers
|
| 36 |
+

|
| 37 |
+
5) Delete Dummy Orders
|
| 38 |
+

|
| 39 |
+
6) Enhance Site Speed
|
| 40 |
+

|
| 41 |
+
7) Remove garbage data 
|
| 42 |
+

|
| 43 |
+
8) All the things are done in single place
|
| 44 |
+

|
| 45 |
+
9) Provide more Space
|
| 46 |
+

|
| 47 |
+
10) Easy to use.
|
| 48 |
+

|
| 49 |
+
If you have any query or Suggestion mail us gotechsolution1@gmail.com</description>
|
| 50 |
+
<notes>Version: 1.0.0
|
| 51 |
+
Release Stability: Stable
|
| 52 |
+
</notes>
|
| 53 |
+
<authors><author><name>Gotechsolution</name><user>gotechsolution</user><email>gotechsolution1@gmail.com</email></author></authors>
|
| 54 |
+
<date>2015-01-30</date>
|
| 55 |
+
<time>06:33:21</time>
|
| 56 |
+
<contents><target name="magelocal"><dir name="Gts"><dir name="Ddd"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Checkboxs.php" hash="958e4e82cdde73e8c3d1ad8359362edb"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="1f2c44756e59d0e67b3ae9a9aad49723"/><file name="Data.php~" hash="22c9f6a246be5b7b39f5371c0beb69b1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeleteController.php" hash="a9b536d1d51c9431e2de75667fa06676"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="251ea9a2e798ac7cc19fe72bef5ad0d5"/><file name="config.xml" hash="0d077f7fe5ab1d94311c7c8c35882fbf"/><file name="system.xml" hash="cb733d6d2263f17427958441d35ea9ed"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Gts_Ddd.xml" hash="1bf3c4985a2ab45355bca51cb8f112d1"/></dir></target></contents>
|
| 57 |
+
<compatible/>
|
| 58 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
| 59 |
+
</package>
|
