View Single Post
  #195  
Old 03-10-2011, 06:27 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: X-Cart v4.4.2 released

Another bug in 4.4.x; actually I checked 4.2.x and 4.3.x and it exists there as well (partially)

When placing an order as anonymous customer stats info is recorded in "stats_customers_products" table with userid=0 (which do not exists). How to replicate - place an order with anonymous user and check database integrity from admin/maintenance - you will get an error "userid 0 from stats_customers_products doesn't exist in customers table".

What happens:
In include/func/func.order.php -> function func_place_order on or around line 1057
Code:
'userid' => $userinfo['id'] ? $userinfo['id'] : 0,
which will set userid = 0 for every anonymous customer order. But there is no userid 0. Database integrity check in admin/maintenance doesn't check orders table against customers table so it won't show an error.

On or around line 1259 in the same file (function) starts this if statement
Code:
if (!empty($active_modules['Recommended_Products'])) {

which places a record in "stats_customers_products" table. The above if statement should be
Code:
if (!empty($active_modules['Advanced_Statistics'])) {
This is a statistics table, so why "Recommended_Products" is the condition? So even if you have Advanced_Statistics mod off but Recommended_Products mod on this statistics table gets records. Clearly a bug. That's number one. Number 2 bug is that when that record is placed it has userid=0 for anonymous checkouts which immediatelly will result in data integration error with customers table.
__________________
Steve Stoyanov
CFLSystems.com
Web Development