5

I have upgraded my Magento CE platform from 1.9.0.1 to 1.9.2.2 and few days ago, I noticed that abandoned carts report is not updated with new carts. Where as I have checked in Customer Edit form, we can see all the items in shopping cart, also they are shown in sales_order_quote in Db, which means carts are being created, but they are not listed in reports.

I have tested it by creating a test customer account, and the problem is same. Any idea where in the code I should look for...?

Thanks

  • I just figured out that if customer account is created before the up-gradation, it works perfect i.e: Their carts are shown in reports. The problem is only with new customer accounts... – Sohaib Afzal Jan 23 '16 at 12:22
12

This is a magento core bug. What happens is, when customers are registered on website, the middle name attribute entity value is not created at the customer_entity_varchar table. The value should be NULL if the middle name is empty. But It will be created when you edit the customer from the admin panel.

FIX: Override "app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php" by copying it to local path "app/code/local/Mage/Reports/Model/Resource/Quote/Collection.php"

And change line 209 from "joinInner" to "joinLeft" will solve the problem.

  • It's important to flush Magento cache too – WaPoNe Sep 14 '16 at 10:27
  • just upgraded to magento ver 1.9.3.4. Any idea why this bug hasn't been fixed in the core yet? Not really too keen on overwriting core files. – frshjb373 Aug 30 '17 at 20:06
  • That worked right away – Arnie Aug 20 at 10:21
6

Solutions: Yes this is known bug caused by the middle name attribute in recent versions of Magento. Here is the solution for this issue, we need to insert records for middle name attribute for old customers, here is the script to update database table

require 'app/Mage.php';
Mage::app('default');

$db_read = Mage::getSingleton('core/resource')->getConnection('core_read');
$tablePrefix = (string) Mage::getConfig()->getTablePrefix();

$sql = 'SELECT entity_id FROM ' . $tablePrefix .'customer_entity where entity_id NOT IN (SELECT entity_id FROM '. $tablePrefix.'customer_entity_varchar where attribute_id = 6)';

$db_write1= Mage::getSingleton('core/resource')->getConnection('core_write');
$value=$db_read->query($sql);
echo "<br>Total: ".count($value);
$i =1;
while ($row = $value->fetch())
{
    //print_r($row);
    echo "<br>".$i." - ".$row['entity_id'];
    $sql = 'INSERT INTO '. $tablePrefix.'customer_entity_varchar (entity_type_id, attribute_id, entity_id) VALUES (1, 6, '.$row['entity_id'].' )';
    $db_write1->query($sql);  
};
  • 1
    This saved my life today :3 – Keenora Fluffball Jun 26 at 9:20
  • Thanks @KeenoraFluffball , and I am happy that my post helped you in resolving your problem! – Jitendra Mandloi Jul 3 at 10:51
1

Yes this is known bug caused by the middle name attribute in recent versions of Magento.

I could not find better than this post (see the comment of the answer)

Get all abandoned carts in Magento

I know there's a proper fix somewhere I just can't get my hands on it, will update my answer when I find it

Not the answer you're looking for? Browse other questions tagged or ask your own question.