Anonymous User and Activity Logging MaintenanceApplies to: AbleCommerce 7.0.0 through 7.0.7 Date: 11/18/2011, Amended 10/22/12 and 07/17/13 Download: Anonymous User Maintenance patch (needed for versions 7.0.0 through 7.0.6) On this page you will find information on solving maintenance problems and errors. Please review the entire page.
|
|
Description of Anonymous User Maintenance IssueTurning on database maintenance for the anonymous user has been an available feature since AbleCommerce 7.0.1. However, it was not enabled in the default installation settings. This issue has the potential for accumulating large numbers of anonymous user records in the database. To see if your installation is impacted -
Download
Instructions:
Enable Automatic Maintenance
Installations of 7.0.1 and later are NOT affected by this issue.
New Maintenance feature to cleanup databaseAfter applying the patch, you should be able to check number of records in your database, as well as trigger the maintenance manually. Note: This step is highly recommended, even if you have already enabled automatic maintenance.
TIP: This is a resource intensive process so make sure to perform this task during an off-peak time.
TIP: If you are experiencing extremely long delays, then you may need to begin with a number larger than 30 days. Repeat the process while gradually reducing the number of days as needed.
Manually trigger maintenance routine
Description of Activity Logging IssueTurning on activity logging has been an available feature since AbleCommerce 7.0.0. However, it may be possible that large numbers of records build up in the AC_Activity table with high traffic sites. If this should happen, then we recommend that you either manually remove the records from the database, clear the log file from merchant admin, and/or change the number of days to maintain history. To see if your installation is impacted -
Manually Remove Anonymous Records from DatabaseThe following SQL script can be used to manually remove anonymous users, baskets, and wishlists from the database. Before doing this, you should already have a basic understanding of SQL server scripts. Some important notes: The first block is a SELECT statement, so you can see how many users you would actually be affecting by running the next three statements. You can change the dates as you needed to remove more or less data. You can also modify the AffiliateId IS NULL part to IS NOT NULL if you want to remove anonymous users who also have an affiliate assigned to them (if you even use that functionality). As always, make a backup of the database before continuing.
SELECT statement for Anonymous Users:
Statements to remove Anonymous Users Baskets, Wishlists and Users. Run in order.
Fix User ConstraintsFor installations upgraded from version 7.0.0, the User Maintenance scripts may fail and result in errors like the following: Severity: Error
To Fix User Constraint error:
e.g. http://yourdomain/install/Fixuserconstraints.aspx
Database Scripts to fix user constraintsIn the event you have access, and the ability to run an SQL query directly on the database, this is also an option to you. Make sure to backup your database before continuing. For SQL 2005 and 2008 Server, execute the following query: IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME = 'ac_Orders'
For SQL 2000 Server, execute this query instead: /* STEP 2: Remove existing constraint */
Manual database cleanup and fixing maintenance errorsUsing the Dataport, or changing the database outside of the AbleCommerce, can sometimes lead to errors such as this - System.ArgumentException: An item with the same key has already been added. If this should occur, you will need to open the Products table and remove any columns that shouldn't be there.
If you are getting errors similar to the one below, then your store maintenance are not working. The DELETE statement conflicted with the REFERENCE constraint "ac_Addresses_ac_BasketShipments_FK1". The conflict occurred in database "sample_AC", table "dbo.ac_BasketShipments", column 'AddressId'.
It is a bad data condition that can't be fixed by running any of the standard updates we provide. The SQL query below can be run to fix the problem. There is a toggle so you first preview the records before deleting them. If you notice in the script below, there is a variable called @preview. You can change this between 0 (update) and 1 (preview). Start with a preview and run it against the database to see if there are records it thinks need to be altered. If so, then change preview to 0 and rerun it to reconcile the addresses. Once this is done, the maintenance scripts should be running again. Then you will need to run this script on your MS SQL 2005+ database - DECLARE @storeId int; DECLARE @daysToKeep int; DECLARE @expireDate DateTime; DECLARE @preview bit; SET @storeId = 1; /* CHANGE @daysToKeep TO NUMBER OF DAYS TO KEEP NONAFFILIATE ANONYMOUS USERS */ SET @daysToKeep = 5; SET @expireDate = DATEADD(Day, -1 * @daysToKeep, GETDATE()); /* CHANGE @preview TO 0 TO EXECUTE UPDATE */ SET @preview = 1; IF (@preview <> 0) BEGIN SELECT * FROM ac_BasketShipments WHERE AddressId IN ( SELECT AddressId FROM ac_Addresses WHERE UserId IN ( SELECT UserId FROM ac_Users WHERE StoreId = @storeId AND IsAnonymous = 1 AND AffiliateId IS NULL AND (LastActivityDate IS NULL OR LastActivityDate < @expireDate) )) END ELSE BEGIN UPDATE ac_BasketShipments SET AddressId = 0 WHERE AddressId IN ( SELECT AddressId FROM ac_Addresses WHERE UserId IN ( SELECT UserId FROM ac_Users WHERE StoreId = @storeId AND IsAnonymous = 1 AND AffiliateId IS NULL AND (LastActivityDate IS NULL OR LastActivityDate < @expireDate) )) END
|
Copyright © 1994 - 2024 AbleCommerce.com, All rights Reserved
eCommerce shopping cart software platform