我正在尝试将客户的电话号码显示在客户帐户信息部分下.我知道电话号码属于客户地址部分,但我正在尝试重新设计客户帐户信息的样子.
我为客户ID添加了一个新的自定义字段,我可以使用以下代码显示它,因为客户ID属于customer_entity.
<?php echo $this->__('Identification:') ?><?php echo $this->htmlEscape($this->getCustomer()->getCustid()) ?>
Run Code Online (Sandbox Code Playgroud)
但现在我正试图通过使用它来为电话号码做同样的事情
<?php echo $this->__('Telephone:') ?><?php echo $this->htmlEscape($this->getCustomer()->getTelephone()) ?>
Run Code Online (Sandbox Code Playgroud)
但它不显示任何数据,因为它属于customer_address_entity,我相信它应该是
->getAddress()->getTelephone()
Run Code Online (Sandbox Code Playgroud)
代替
->getCustomer()->getTelephone()
Run Code Online (Sandbox Code Playgroud)
但是使用 - > getAddress只会给我一个错误"在非对象上调用成员函数getTelephone()"
有谁知道怎么做?
作为参考,我试图在customer\account\dashboard\info.phtml文件上显示此数据
提前致谢.
Ale*_*ley 15
哦,谢谢,我现在发帖!(见原帖后的评论).
只需使用以下内容:
$this->getCustomer()->getPrimaryBillingAddress()->getTelephone();
Run Code Online (Sandbox Code Playgroud)
第一部分将为您提供所有细节,然后您可以var_dump()
根据@paperids 进行探索.
这个答案应该转到@Alex,但只是为了完成,我将这个作为答案发布:
使用:
$this->getCustomer()->getPrimaryBillingAddress()->getTelephone()
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
28041 次 |
最近记录: |