Jump to content

Can't Use pscleaner After Upgrade


Recommended Posts

I can't use pscleaner any more. I just upgraded today and when I click on "Delete orders and customers" it just pops up a message "Please read the disclaimer and click "yes" above". But there is no "Yes" anywhere to click. I am trying to put a new site on line and can't until I figure out how to delete my test data.

 

I am accessing pscleaner from Modules->Modules, selecting pscleaner, then clicking "configure". I see 4 sections: Catalog, Orders and customers, Functional integrity constraints, Database cleaning. There is a button in each section, but no input elements to acknowledge the disclaimer. In pscleaner.php there is a reference to submitTruncateCatalog_on, but this element does not appear on the page.

 

Also a comment on this module: You should warn people that running Functional Integrity Constraints will delete all messages that are not tied to a shopping cart. I ran this on another live site, never expecting that an integrity check would delete any data. But all non-order related messages are DELETED with no warning. This is really stupid-- I did not expect an "integrity check" to delete hundreds of messages (all inquiries made via the contact form that do not reference an order). Does someone at PrestaShop think these messages are not important? Now I can spend the next couple of hours restoring the lost data (yes "hours" because I have to do it in such a way that I don't lose new orders, etc. that are happening after the deletion and at some point I also must shut down the site temporarily and lose money).

Edited by MisterPresta (see edit history)
Link to comment
Share on other sites

I worked around this by editing the file /modules/pscleaner/pscleaner.php. I added "return true;" (at line 105) to bypass the check of whether or not you acknowledged the disclaimer. That change is only for clearing sales and orders history. You have to do the same thing around line 97 for clearing the catalog. WARNING: if you make these changes, your data will be cleared without any further warning or confirmation (just by clicking the button).

 

I never figured out why the acknowledgement checkboxes are not displayed.

 

Again, like I already stated in my original message, BE VERY CAREFUL with the "integrity check"-- it will delete things you don't expect!!

Link to comment
Share on other sites

Same problem here!! There is no where to click "Yes". So annoying. Why cant PS bring back clean blank install. Who is going to use demo products if some is trying to build their real ecommerce website!! Leave demo products alone on a demo website somewhere. I think it is a botheration of cleaning everything is the price you pay for using Prestashop. Devs, just think again if this is really practical?

Link to comment
Share on other sites

The following tables are truncated to remove products, followed by the tables for customers and orders. This comes directly from pscleaner.php, and you should look there yourself because it also deletes files in some directories which I don't show here (such as product images).

'product',
'product_shop',
'feature_product',
'product_lang',
'category_product',
'product_tag',
'tag',
'image',
'image_lang',
'image_shop',
'specific_price',
'specific_price_priority',
'product_carrier',
'cart_product',
'compare_product',
'product_attachment',
'product_country_tax',
'product_download',
'product_group_reduction_cache',
'product_sale',
'product_supplier',
'scene_products',
'warehouse_product_location',
'stock',
'stock_available',
'stock_mvt',
'customization',
'customization_field',
'supply_order_detail',
'attribute_impact',
'product_attribute',
'product_attribute_shop',
'product_attribute_combination',
'product_attribute_image',
'attribute',
'attribute_impact',
'attribute_lang',
'attribute_group',
'attribute_group_lang',
'attribute_group_shop',
'attribute_shop',
'product_attribute',
'product_attribute_shop',
'product_attribute_combination',
'product_attribute_image',
'stock_available',
'manufacturer',
'manufacturer_lang',
'manufacturer_shop',
'supplier',
'supplier_lang',
'supplier_shop',
'customization',
'customization_field',
'customization_field_lang',
'customized_data',
'feature',
'feature_lang',
'feature_product',
'feature_shop',
'feature_value',
'feature_value_lang',
'pack',
'scene',
'scene_category',
'scene_lang',
'scene_products',
'scene_shop',
'search_index',
'search_word',
'specific_price',
'specific_price_priority',
'specific_price_rule',
'specific_price_rule_condition',
'specific_price_rule_condition_group',
'stock',
'stock_available',
'stock_mvt',
 
For customers and orders:
'customer',
'cart',
'cart_product',
'connections',
'connections_page',
'connections_source',
'customer_group',
'customer_message',
'customer_message_sync_imap',
'customer_thread',
'guest',
'message',
'message_readed',
'orders',
'order_carrier',
'order_cart_rule',
'order_detail',
'order_detail_tax',
'order_history',
'order_invoice',
'order_invoice_payment',
'order_invoice_tax',
'order_payment',
'order_return',
'order_return_detail',
'order_slip',
'order_slip_detail',
'page',
'pagenotfound',
'page_type',
'page_viewed',
'referrer_cache',
'sekeyword',
 

 

Link to comment
Share on other sites

I have run this sql to clear all the necessary tables in phpMySQL. Hope this helps some one. Just replace dbprefix_ to your own db prefix e.g. ps_

TRUNCATE TABLE dbprefix_product;
TRUNCATE TABLE dbprefix_product_shop;
TRUNCATE TABLE dbprefix_feature_product;
TRUNCATE TABLE dbprefix_product_lang;
TRUNCATE TABLE dbprefix_category_product;
TRUNCATE TABLE dbprefix_product_tag;
TRUNCATE TABLE dbprefix_tag;
TRUNCATE TABLE dbprefix_image;
TRUNCATE TABLE dbprefix_image_lang;
TRUNCATE TABLE dbprefix_image_shop;
TRUNCATE TABLE dbprefix_specific_price;
TRUNCATE TABLE dbprefix_specific_price_priority;
TRUNCATE TABLE dbprefix_product_carrier;
TRUNCATE TABLE dbprefix_cart_product;
TRUNCATE TABLE dbprefix_compare_product;
TRUNCATE TABLE dbprefix_product_attachment;
TRUNCATE TABLE dbprefix_product_country_tax;
TRUNCATE TABLE dbprefix_product_download;
TRUNCATE TABLE dbprefix_product_group_reduction_cache;
TRUNCATE TABLE dbprefix_product_sale;
TRUNCATE TABLE dbprefix_product_supplier;
TRUNCATE TABLE dbprefix_scene_products;
TRUNCATE TABLE dbprefix_warehouse_product_location;
TRUNCATE TABLE dbprefix_stock;
TRUNCATE TABLE dbprefix_stock_available;
TRUNCATE TABLE dbprefix_stock_mvt;
TRUNCATE TABLE dbprefix_customization;
TRUNCATE TABLE dbprefix_customization_field;
TRUNCATE TABLE dbprefix_supply_order_detail;
TRUNCATE TABLE dbprefix_attribute_impact;
TRUNCATE TABLE dbprefix_product_attribute;
TRUNCATE TABLE dbprefix_product_attribute_shop;
TRUNCATE TABLE dbprefix_product_attribute_combination;
TRUNCATE TABLE dbprefix_product_attribute_image;
TRUNCATE TABLE dbprefix_attribute;
TRUNCATE TABLE dbprefix_attribute_impact;
TRUNCATE TABLE dbprefix_attribute_lang;
TRUNCATE TABLE dbprefix_attribute_group;
TRUNCATE TABLE dbprefix_attribute_group_lang;
TRUNCATE TABLE dbprefix_attribute_group_shop;
TRUNCATE TABLE dbprefix_attribute_shop;
TRUNCATE TABLE dbprefix_product_attribute;
TRUNCATE TABLE dbprefix_product_attribute_shop;
TRUNCATE TABLE dbprefix_product_attribute_combination;
TRUNCATE TABLE dbprefix_product_attribute_image;
TRUNCATE TABLE dbprefix_stock_available;
TRUNCATE TABLE dbprefix_manufacturer;
TRUNCATE TABLE dbprefix_manufacturer_lang;
TRUNCATE TABLE dbprefix_manufacturer_shop;
TRUNCATE TABLE dbprefix_supplier;
TRUNCATE TABLE dbprefix_supplier_lang;
TRUNCATE TABLE dbprefix_supplier_shop;
TRUNCATE TABLE dbprefix_customization;
TRUNCATE TABLE dbprefix_customization_field;
TRUNCATE TABLE dbprefix_customization_field_lang;
TRUNCATE TABLE dbprefix_customized_data;
TRUNCATE TABLE dbprefix_feature;
TRUNCATE TABLE dbprefix_feature_lang;
TRUNCATE TABLE dbprefix_feature_product;
TRUNCATE TABLE dbprefix_feature_shop;
TRUNCATE TABLE dbprefix_feature_value;
TRUNCATE TABLE dbprefix_feature_value_lang;
TRUNCATE TABLE dbprefix_pack;
TRUNCATE TABLE dbprefix_scene;
TRUNCATE TABLE dbprefix_scene_category;
TRUNCATE TABLE dbprefix_scene_lang;
TRUNCATE TABLE dbprefix_scene_products;
TRUNCATE TABLE dbprefix_scene_shop;
TRUNCATE TABLE dbprefix_search_index;
TRUNCATE TABLE dbprefix_search_word;
TRUNCATE TABLE dbprefix_specific_price;
TRUNCATE TABLE dbprefix_specific_price_priority;
TRUNCATE TABLE dbprefix_specific_price_rule;
TRUNCATE TABLE dbprefix_specific_price_rule_condition;
TRUNCATE TABLE dbprefix_specific_price_rule_condition_group;
TRUNCATE TABLE dbprefix_stock;
TRUNCATE TABLE dbprefix_stock_available;
TRUNCATE TABLE dbprefix_stock_mvt;
TRUNCATE TABLE dbprefix_customer;
TRUNCATE TABLE dbprefix_cart;
TRUNCATE TABLE dbprefix_cart_product;
TRUNCATE TABLE dbprefix_connections;
TRUNCATE TABLE dbprefix_connections_page;
TRUNCATE TABLE dbprefix_connections_source;
TRUNCATE TABLE dbprefix_customer_group;
TRUNCATE TABLE dbprefix_customer_message;
TRUNCATE TABLE dbprefix_customer_message_sync_imap;
TRUNCATE TABLE dbprefix_customer_thread;
TRUNCATE TABLE dbprefix_guest;
TRUNCATE TABLE dbprefix_message;
TRUNCATE TABLE dbprefix_message_readed;
TRUNCATE TABLE dbprefix_orders;
TRUNCATE TABLE dbprefix_order_carrier;
TRUNCATE TABLE dbprefix_order_cart_rule;
TRUNCATE TABLE dbprefix_order_detail;
TRUNCATE TABLE dbprefix_order_detail_tax;
TRUNCATE TABLE dbprefix_order_history;
TRUNCATE TABLE dbprefix_order_invoice;
TRUNCATE TABLE dbprefix_order_invoice_payment;
TRUNCATE TABLE dbprefix_order_invoice_tax;
TRUNCATE TABLE dbprefix_order_payment;
TRUNCATE TABLE dbprefix_order_return;
TRUNCATE TABLE dbprefix_order_return_detail;
TRUNCATE TABLE dbprefix_order_slip;
TRUNCATE TABLE dbprefix_order_slip_detail;
TRUNCATE TABLE dbprefix_page;
TRUNCATE TABLE dbprefix_pagenotfound;
TRUNCATE TABLE dbprefix_page_type;
TRUNCATE TABLE dbprefix_page_viewed;
TRUNCATE TABLE dbprefix_referrer_cache;
TRUNCATE TABLE dbprefix_sekeyword;
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Hi all,

 

Same problem with version 1.1.2 fresh upgrade.

You need to edit the pscleaner.php file like this :

 

line 80 : add && Tools::getValue('checkTruncateCatalog') > 0 into the if statement

line 85 : add && Tools::getValue('checkTruncateSales') > 0 into the if statement

 

line 583 : replace 'type' => 'switch' with 'type' => 'radio'

line 617 : same replacement

 

line 695 :

replace return array('checkTruncateSales' => '0', 'submitTruncateCatalog' => 0);

with return array('checkTruncateSales' => 0, 'checkTruncateCatalog' => 0);

 

make sure your fields look like these in the renderForm function :

$fields_form_1 = array(
			'form' => array(
				'legend' => array(
					'title' => $this->l('Catalog'),
					'icon' => 'icon-cogs'
				),
				'input' => array(
					array(
						'type' => 'radio',
						'label' => $this->l('I understand that all the catalog data will be removed without possible rollback: products, features, categories, tags, images, prices, attachments, scenes, stocks, attribute groups and values, manufacturers, suppliers...'),
						'name' => 'checkTruncateCatalog',
						'values' => array(
							array(
								'id' => 'checkTruncateCatalog_on',
								'value' => 1,
								'label' => '<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />'
							),
							array(
								'id' => 'checkTruncateCatalog_off',
								'value' => 0,
								'label' => '<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" />'
							)
						)
					)
				),
				'submit' => array(
					'title' => $this->l('Delete catalog'),
					'class' => 'btn btn-default',
					'name' => 'submitTruncateCatalog',
					'id' => 'submitTruncateCatalog',
				)
			)
		);
		
		$fields_form_2 = array(
			'form' => array(
				'legend' => array(
					'title' => $this->l('Orders and customers'),
					'icon' => 'icon-cogs'
				),
				'input' => array(
					array(
						'type' => 'radio',
						'label' => $this->l('I understand that all the orders and customers will be removed without possible rollback: customers, carts, orders, connections, guests, messages, stats...'),
						'name' => 'checkTruncateSales',
						'values' => array(
							array(
								'id' => 'checkTruncateSales_on',
								'value' => 1,
								'label' => '<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />'
							),
							array(
								'id' => 'checkTruncateSales_off',
								'value' => 0,
								'label' => '<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" />'
							)
						)
					)
				),
				'submit' => array(
					'title' => $this->l('Delete orders & customers'),
					'class' => 'btn btn-default',
					'name' => 'submitTruncateSales',
					'id' => 'submitTruncateSales',
				)
			)
		);

The design is still quite awful but seems to work.

Hope this helps.

Edited by infra_developpeurs (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 5 weeks later...

Hi Everyone

 

I have modified the pscleaner.php and resolved the issues as well, and also make the interface looks a bit better by putting in the proper parameters for "radio" buttons.

 

Please see the attached pscleaner.php for details.

 

Cheers

Jim

 

Just want to thank you about fixing that issue. You solved me the problem

 

Thanks a lot

Link to comment
Share on other sites

×
×
  • Create New...