【问题标题】:Where is the table that holds the "Special Price" in Magento?Magento 中的“特价”表在哪里?
【发布时间】:2012-09-20 00:22:40
【问题描述】:

我正在尝试使用 mySQL 和 php 脚本批量更新“Special_price”和“price”,我知道包含“price”的表和行,但不知道包含“special_price”的表和行。

我已经查看了数据库本身,但仍然没有运气。有任何想法吗?我需要表名和字段名。

【问题讨论】:

  • 在 eav_attribute 表中查找 attribute_code。我敢打赌有一个插件可以做到这一点,没有人应该直接玩magento中的db
  • :/ 理想情况下是的.. 但是我使用 API 时遇到错误。但是属性 id 对我有什么帮助?

标签: php mysql magento


【解决方案1】:

我是 Magento Question Answers Guild 的成员,要求我建议您修复 API 错误,而不是使用普通的旧 SQL 来更新数据库。正如其他地方所提到的,直接更新数据库可能会使 Magento 进入系统无法识别的状态,这可能会导致奇怪的、令人愤怒的错误。

也就是说,特价值将与其他产品属性值一起存储在

catalog_product_entity_decimal

表。该表有一个attribute_id 列,与eav_attribute 表有外键关系。在eav_attribute 表中查找代码为special_price 的属性。 attribute_id 和产品的 entity_id 应该足以在 catalog_product_entity_decimal 中找到正确的行。

请记住,如果产品没有 special_price 集,则不会存在任何行。还要记住,如果产品在不同的范围级别设置了special_price,则可能有不止一行。

【讨论】:

  • 非常感谢。欣赏你的回答。我在 magento 1.9.1.0 上工作正常
  • 您的意思是说有更好的方法可以使用 Magento API 批量更新产品属性?我该怎么做?
【解决方案2】:

特价是十进制类型的属性。 首先,您需要通过应用以下 sql 查询来获取属性 id: SELECT attribute_id FROM eav_attribute WHERE attribute_code='special_price';

然后,您可以通过在catalog_product_entity_decimal 表中插入一条记录来为任何产品添加特价。

【讨论】:

    【解决方案3】:

    以下是如何从通过 csv 文件导入到 temp_import_sp_price_delete 的 SKU 列表中删除特价。

    delete deci from catalog_product_entity_decimal deci, 
                     `catalog_product_entity` pr,
                     temp_import_sp_price_delete temp 
    where temp.SKU= pr.SKU and pr.entity_id=deci.entity_id and deci.attribute_id=76 
    

    【讨论】:

    • 这似乎没有回答所提出的问题,即更改特价,而不是删除特价。此外,您应该解释为什么会这样以及魔术数字 76 的含义(根据其他答案,我怀疑 your 数据库中只有 76)。
    猜你喜欢
    • 2012-07-17
    • 1970-01-01
    • 2017-01-13
    • 1970-01-01
    • 1970-01-01
    • 2015-06-28
    • 2018-12-31
    • 2010-09-19
    • 1970-01-01
    相关资源
    最近更新 更多