【问题标题】:Magento 2 how does beforeSaveAddressInformation pluginMagento 2 beforeSaveAddressInformation 插件怎么做
【发布时间】:2020-02-13 11:12:53
【问题描述】:

我正在查看这个网址 - Magento 2 Add a custom input field on chackout forrm and save it

我尝试过同样的方法,但我不确定这部分是怎么来的

$customField = $shippingAddressExtensionAttributes->getFiscalCode();
$shippingAddress->setFiscalCode($customField);

这个 getFiscalCode 在哪里,它是一个自定义 AttributeCode

【问题讨论】:

    标签: magento2 checkout shipping


    【解决方案1】:

    getFiscalCode() 方法是一种访问器方法,用于标识字段,例如使用示例中提到的扩展属性 fiscal_code 创建的字段。

    不仅仅是扩展属性,magento 中的所有集合模型都使用以下驼峰式结构,例如数据库表中的列entity_id,可以通过$modelCollection->getEntityId()$modelCollection->setEntityId($valueOfEntityId) 访问

    这是一个很好的阅读理解Magento 2: CRUD Models for Database Access的想法

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-09
      • 2023-01-09
      • 2016-01-31
      • 2011-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-16
      相关资源
      最近更新 更多