0

在前几轮让爬虫导入产品数据之后,我最近在我的视图中看到了空产品。不幸的是,在删除之前存在的两个产品后,这些“空”产品仍然存在。我还确保没有额外的变体类型,并清除了 commerce_line_item 表。有人知道我在哪里可以找到并摆脱这些无名的产品吗?

这是一张供参考的照片:http: //i.imgur.com/bISsCmB.png [1]

我注意到这个标题(这个产品是由创建的)可以被选择和编辑。这是唯一出现的标题:http: //i.imgur.com/xwZKRBJ.png

不幸的是,在尝试编辑后,这是我得到的错误:http: //i.imgur.com/e0sbwsT.png

运行@Clive 的脚本后,我无法刷新缓存并收到以下错误:

Notice: Undefined index: label in entity_views_field_definition() (line 191 of /home/accuairt/public_html/profiles/commerce_kickstart/modules/contrib/entity/views/entity.views.inc).
Notice: Undefined index: search_api_views_fulltext in views_handler_filter->accept_exposed_input() (line 1260 of /home/accuairt/public_html/profiles/commerce_kickstart/modules/contrib/views/handlers/views_handler_filter.inc).
Notice: Undefined index: table in entity_views_plugin_row_entity_view->init() (line 20 of /home/accuairt/public_html/profiles/commerce_kickstart/modules/contrib/entity/views/plugins/entity_views_plugin_row_entity_view.inc).
SearchApiException: Unknown or invalid item type node. in search_api_get_datasource_controller() (line 1506 of /home/accuairt/public_html/profiles/commerce_kickstart/modules/contrib/search_api/search_api.module).
STATUS MESSAGE Operating in maintenance mode. Go online.
The website encountered an unexpected error. Please try again later.

我从几个小时前恢复了备份,以使站点恢复原状。

编辑:12/18 仍在寻找答案。必须有一张我可以清除的表格才能摆脱这些信息。

4

1 回答 1

1

如果您确定应该删除所有没有标题的产品,您可以尝试以下操作:

$query = new \EntityFieldQuery();
$query->entityCondition('entity_type', 'commerce_product')
  ->propertyCondition('title', '');

$results = $query->execute();
if (!empty($results['commerce_product'])) {
  commerce_product_delete_multiple(array_keys($results['commerce_product']));
}

在运行删除功能之前检查查询结果可能是明智的,只是为了确保您没有错误地删除您想要保留的任何内容。

于 2013-12-16T18:04:27.290 回答