Yarnell Posted February 17 Posted February 17 Database::getInstance()->delete('CubeCart_sessions', array('location' >= 2022), false); Hey all, How do I change the >= 2022 to LIKE %2022%? Quote
bsmither Posted February 18 Posted February 18 Using CubeCart's Database class, the statement would be: Database::getInstance()->delete('CubeCart_sessions', array('location' => "~2022")); The third parameter (false) is not necessary. It defaults to an empty string. That third parameter limits how many records get deleted. Quote
Yarnell Posted February 18 Author Posted February 18 I noticed that the location field is varbinary. Is there anyway to match the above code to a varbinary field? I can't seem to get it to work. Quote
bsmither Posted February 18 Posted February 18 (edited) I have no idea why 'location' is varbinary. CubeCart uses that column to store the web address used to access the site, including any querystring. Nothing in that textual string would require the table column to handle binary (that is, non-textual) data. Let's review what you actually need to accomplish. What is the nature of the content that is in the 'location' column that contains 2022? Edited February 18 by bsmither Quote
Yarnell Posted February 18 Author Posted February 18 2022 was just an example. I would like to weed out any sessions that I don't need to track. cron jobs for example. I have a wget command running every 30 mins or so and cubecart creates a new session each time it runs. So would it be ok for me to just change the field to varchar... it won't effect anything? Quote
bsmither Posted February 18 Posted February 18 I would think you would have the same problem. "I would like to weed out any sessions that I don't need to track." Where are you tracking sessions? In admin, Statistics, Users Online tab? If so, is there a link above the table to Display Customers Only? The database table CubeCart_sessions gets trimmed of records that are older than seven days. Quote
Yarnell Posted February 18 Author Posted February 18 Yeah, the users online tab. and I put a traffic chart on my dashboard. I will try converting that field to a varchar... see if that makes a difference. Quote
bsmither Posted February 18 Posted February 18 If the traffic chart on the dashboard does not have a comparable way to limit the results to Customers Only, then perhaps your solution is to rewrite the custom code to add more to the WHERE clause: AND `session_last` > `session_start` Quote
Yarnell Posted February 18 Author Posted February 18 Yeah, the chart has the option to switch between visitors and customers. I used the customer_id field to limit to customers only. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.