我正在尝试配置magento商店 . 我有一些出现在前端的幽灵产品 . 这些Ghost产品没有名称,没有图像,在我的后端产品列表中找不到 . 但是,他们的添加按钮是活动的并且有效,并且还有一个愿望清单URL .
example.com/wishlist/index/add/product/4/form_key/p3jZL1nym3j4XeNl/
我想在尝试复制一些产品后,我陷入了困境 . 我如何追踪和摆脱这些鬼产品 . 我使用绝对模板 .
你用平板桌吗?如果是,那么尝试重新索引它 . 附:检查产品ID:4(在后端) .
如果您想删除带有空白(null)产品名称和图像的产品,您可以尝试
$products=Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('*')->load(); foreach($products as $key => $pId) { $product=Mage::getModel('catalog/product')->load($pId); if($product->getName()=='' && $product->getMediaGalleryImages()=='') { $product = Mage::getModel('catalog/product')->load($pId)->delete(); echo "successfully deleted product with ID: ". $pId .""; } else{ echo "Could not delete product with ID: ". $pId .""; } }
您也可以尝试删除没有使用imgs的产品
$collection = Mage::getModel('catalog/product')->getCollection(); $collection->getSelect() ->joinLeft( array('_gallery_table' => $collection->getTable('catalog/product_attribute_media_gallery')), 'e.entity_id = _gallery_table.entity_id', array() ) ->where('_gallery_table.value IS NULL'); $collection->delete();
2 回答
你用平板桌吗?如果是,那么尝试重新索引它 . 附:检查产品ID:4(在后端) .
如果您想删除带有空白(null)产品名称和图像的产品,您可以尝试
您也可以尝试删除没有使用imgs的产品