gpt4 book ai didi

Magento 电子邮件模板 : $_item -> getDescription returns null

转载 作者:行者123 更新时间:2023-12-02 12:03:53 25 4
gpt4 key购买 nike

项目

修改 Magento 的电子邮件模板以包含长描述

Magento 版本

1.6.2.0

正在编辑的文件

app/design/frontend/default/<template name>/template/email/order/items/order/default.phtml

此文件中感兴趣的代码及其行号:

31 <strong style="font-size:11px;"><?php echo $this->htmlEscape($_item->getName()) ?></strong>
46 <?php echo $this->escapeHtml($_item->getDescription()) ?>

问题

$_item -> getName() 有效,但 $_item -> getDescription() 返回 null

调试

$_item 的 Zend 转储(显示已定义的“名称”;“描述”为空):

array(79) {
["item_id"] => string(3) "584"
["order_id"] => string(3) "398"
["parent_item_id"] => NULL
["quote_item_id"] => string(4) "1951"
["store_id"] => string(1) "1"
["created_at"] => string(19) "2012-06-04 14:15:39"
["updated_at"] => string(19) "2012-06-04 14:16:18"
["product_id"] => string(3) "156"
["product_type"] => string(6) "simple"
["product_options"] => string(140) "a:1:{s:15:"info_buyRequest";a:3:{s:4:"uenc";s:48:"aHR0cDovL2Rldi5hcHBvZ2VlLmNvbS9iYXNlL21hYy5odG1s";s:7:"product";s:3:"156";s:3:"qty";i:1;}}"
["weight"] => string(6) "0.0100"
["is_virtual"] => string(1) "0"
["sku"] => string(9) "MC969LL/A"
["name"] => string(21) "11" MacBook Air 128GB"
["description"] => NULL
["applied_rule_ids"] => NULL
["additional_data"] => NULL
["free_shipping"] => string(1) "0"
["is_qty_decimal"] => string(1) "0"
["no_discount"] => string(1) "0"
["qty_backordered"] => NULL
["qty_canceled"] => string(6) "0.0000"
["qty_invoiced"] => string(6) "0.0000"
["qty_ordered"] => string(6) "1.0000"
["qty_refunded"] => string(6) "0.0000"
["qty_shipped"] => string(6) "1.0000"
["base_cost"] => NULL
["price"] => string(9) "1199.0000"
["base_price"] => string(9) "1199.0000"
["original_price"] => string(9) "1199.0000"
["base_original_price"] => string(9) "1199.0000"
["tax_percent"] => string(6) "7.0000"
["tax_amount"] => string(7) "83.9300"
["base_tax_amount"] => string(7) "83.9300"
["tax_invoiced"] => string(6) "0.0000"
["base_tax_invoiced"] => string(6) "0.0000"
["discount_percent"] => string(6) "0.0000"
["discount_amount"] => string(6) "0.0000"
["base_discount_amount"] => string(6) "0.0000"
["discount_invoiced"] => string(6) "0.0000"
["base_discount_invoiced"] => string(6) "0.0000"
["amount_refunded"] => string(6) "0.0000"
["base_amount_refunded"] => string(6) "0.0000"
["row_total"] => string(9) "1199.0000"
["base_row_total"] => string(9) "1199.0000"
["row_invoiced"] => string(6) "0.0000"
["base_row_invoiced"] => string(6) "0.0000"
["row_weight"] => string(6) "0.0100"
["base_tax_before_discount"] => NULL
["tax_before_discount"] => NULL
["ext_order_item_id"] => NULL
["locked_do_invoice"] => NULL
["locked_do_ship"] => NULL
["price_incl_tax"] => string(9) "1282.9300"
["base_price_incl_tax"] => string(9) "1282.9300"
["row_total_incl_tax"] => string(9) "1282.9300"
["base_row_total_incl_tax"] => string(9) "1282.9300"
["hidden_tax_amount"] => NULL
["base_hidden_tax_amount"] => NULL
["hidden_tax_invoiced"] => NULL
["base_hidden_tax_invoiced"] => NULL
["hidden_tax_refunded"] => NULL
["base_hidden_tax_refunded"] => NULL
["is_nominal"] => string(1) "0"
["tax_canceled"] => NULL
["hidden_tax_canceled"] => NULL
["tax_refunded"] => NULL
["gift_message_id"] => NULL
["gift_message_available"] => string(1) "0"
["base_weee_tax_applied_amount"] => string(6) "0.0000"
["base_weee_tax_applied_row_amnt"] => string(6) "0.0000"
["base_weee_tax_applied_row_amount"] => string(6) "0.0000"
["weee_tax_applied_amount"] => string(6) "0.0000"
["weee_tax_applied_row_amount"] => string(6) "0.0000"
["weee_tax_applied"] => string(6) "a:0:{}"
["weee_tax_disposition"] => string(6) "0.0000"
["weee_tax_row_disposition"] => string(6) "0.0000"
["base_weee_tax_disposition"] => string(6) "0.0000"
["base_weee_tax_row_disposition"] => string(6) "0.0000"
}

问题

为什么这里的描述为空?

我发现在下订单后更改产品名称不会更改订单中的名称,因此订单对象似乎在订购的产品上有自己的数据,该数据与实时目录分开(我认为这是有道理的:您希望该信息是静态的且不可更改)。

由于数据库中的空间被浪费,它不会在每次订购时尝试存储项目的长和/或短描述,这也是有道理的。但为什么要包含描述字段而将其留空呢?

这是获取该信息以加载目录/产品模型、查找我想要的产品和属性 ( like here ) 的唯一方法吗?

最佳答案

你一切都是对的。我不知道为什么他们包含 description 字段,但在我的所有 250,000 个订单中该字段都是空的。

您可以通过以下方式获取描述:

$_description = Mage::getModel('catalog/product')
->load($_item->getProductId())
->getDescription();

这很可能返回 null,就像产品已被删除的情况一样。

关于Magento 电子邮件模板 : $_item -> getDescription returns null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10900548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com