Search code examples
phpjquerymysqlimagento-1.9

Compare Products link or button does not work in Magento 1.9.3.2


I have added a product comparison link but it doesn't work. This is in Magento 1.9.3.2

My issues are almost identical to this post, with the exception that clearing the index did not work.

Is there anything else I can try?

Here are the issues:

When I click "Add to Compare" on a product, a message stating that such-and-such product successfully added to compare list appears. However the compare products sidebar shows "You have no items to compare. But it's not working any more.


Solution

  • It looks like your Magento DB does not have report_compared_product_index table.

    Import the following SQL to create this table structure in your DB.

    CREATE TABLE IF NOT EXISTS `report_compared_product_index` (
      `index_id` bigint(20) unsigned NOT NULL COMMENT 'Index Id',
      `visitor_id` int(10) unsigned DEFAULT NULL COMMENT 'Visitor Id',
      `customer_id` int(10) unsigned DEFAULT NULL COMMENT 'Customer Id',
      `product_id` int(10) unsigned NOT NULL COMMENT 'Product Id',
      `store_id` smallint(5) unsigned DEFAULT NULL COMMENT 'Store Id',
      `added_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Added At'
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='Reports Compared Product Index Table' AUTO_INCREMENT=1 ;
    
    ALTER TABLE `report_compared_product_index`
      ADD PRIMARY KEY (`index_id`),
      ADD UNIQUE KEY `UNQ_REPORT_COMPARED_PRODUCT_INDEX_VISITOR_ID_PRODUCT_ID` (`visitor_id`,`product_id`),
      ADD UNIQUE KEY `UNQ_REPORT_COMPARED_PRODUCT_INDEX_CUSTOMER_ID_PRODUCT_ID` (`customer_id`,`product_id`),
      ADD KEY `IDX_REPORT_COMPARED_PRODUCT_INDEX_STORE_ID` (`store_id`),
      ADD KEY `IDX_REPORT_COMPARED_PRODUCT_INDEX_ADDED_AT` (`added_at`),
      ADD KEY `IDX_REPORT_COMPARED_PRODUCT_INDEX_PRODUCT_ID` (`product_id`);
    

    Let me know if this helps.