【问题标题】:Get "Use Billing Address" from shipping address section of Onepage checkout从 Onepage 结帐的送货地址部分获取“使用帐单地址”
【发布时间】:2013-02-28 02:28:53
【问题描述】:

我试图让礼品选项消息仅在客户运送到与 Onepage 结帐流程中的帐单地址不同的地址时显示。我可以使用

从帐单部分获取“运送到相同/不同地址”
$this->getQuote()->getShippingAddress()->getData('same_as_billing')

而且效果很好。但是,如果客户将其设为送货方式,并回击更改送货地址,则该字段似乎不会更新。我试过检查

$this->getQuote()->getShippingAddress()->getData('use_billing_address')

但该数据不存在。事实上,当我在additional.phtml中有这两行时:

Mage::log("Same as billing: ".$this->getQuote()->getShippingAddress()->getData('same_as_billing'));
Mage::log("Use billing: ".$this->getQuote()->getShippingAddress()->getData('use_billing_address'));

当我从送货地址转到送货方式时,它不会触发。有人可以在这里给我一些指导吗?

【问题讨论】:

    标签: magento


    【解决方案1】:

    我最终使用了 javascript 函数而不是 PHP,因为它不会重新加载页面以访问每个部分。

    在 template/giftmessage/inline.phtml 中,我添加了以下内容:

        function _showHideGift() {
            var flag=document.getElementById('shipping:same_as_billing').checked;
            if(!flag){
                document.getElementById('gift-messages').style.display="block";
            }else{
                document.getElementById('gift-messages').style.display="none";
        }}
    

    然后使用togleVisilibityOnObjects调用调用CDATA内部块下面的函数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-17
      • 1970-01-01
      • 1970-01-01
      • 2018-05-12
      相关资源
      最近更新 更多