我的产品比较链接不起作用.这是在Magento 1.9中.
我的问题几乎与这篇文章完全相同,只是清除索引不起作用.还有什么我可以尝试的吗?
以下是问题:
当我点击产品上的"添加到比较"时,会显示一条消息,指出"此类产品已成功添加到比较列表".
但是,比较产品侧边栏显示"您没有要比较的项目".
我可以告诉该表catalog_compare_item正在填充正确的访客ID和产品ID,但如果我print_r($this->helper('catalog/product_compare')->getItemCount())在模板/ catalog/product/compare/sidebar.phtml中填写,则返回"0".
侧边栏为什么不显示要比较的产品?
从评论中看,您的Magento DB看起来没有report_compared_product_index表.
导入以下SQL以在数据库中创建此表结构.
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`);
Run Code Online (Sandbox Code Playgroud)
如果这有帮助,请告诉我.