我在Magento Stackexchange上问过这个问题没有任何成功,因此我现在在这里问.
我正在使用Magento Community Edition 1.9.0.1并正确创建并注册了我的模块,但我似乎无法检测出运输方法.基本上,如果选择统一费率或免费送货,我想隐藏货到付款.这是我的观察者类的代码:
class Kol_PaymentToggle_Model_Observer
{
public function paymentMethodIsActive(Varien_Event_Observer $observer) {
$event = $observer->getEvent();
$method = $event->getMethodInstance();
$result = $event->getResult();
$quote = $observer->getEvent()->getQuote();
$shippingMethod = $quote->getShippingAddress()->getShippingMethod();
if($shippingMethod == "standardshipping" || $shippingMethod == "free") {
if($method->getCode() == 'cashondelivery' ) {
$result->isAvailable = false;
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我猜我没有使用正确的运输方式代码名称或付款方式代码名称,但我不确定.有人有什么建议吗?
编辑: 我只启用了3种送货方式:
编辑2:config.xml的 输出
<?xml version="1.0"?>
<config>
<modules>
<Kol_PaymentToggle>
<version>0.0.1</version> …Run Code Online (Sandbox Code Playgroud) Goodmorning Stackoverflow,
我正在Magento 2中定制结帐页面.现在我正在尝试在发货地址表单中显示占位符而不是标签,但直到现在都没有成功.我希望有人可以帮助我
干杯,豪尔赫
更新:
在控制台中,我可以看到变量赋予元素输入的属性占位符.
<input class="input-text" type="text" data-bind="
value: value,
valueUpdate: 'keyup',
hasFocus: focused,
attr: {
name: inputName,
placeholder: placeholder, // <<<< right here
'aria-describedby': noticeId,
id: uid,
disabled: disabled
}" name="street[0]" placeholder="" aria-describedby="notice-BVWUCFN" id="BVWUCFN">
Run Code Online (Sandbox Code Playgroud)
现在我想知道是否有一种方法可以通过后端修改这个变量,所以我可以在占位符attr中显示标签名称. 见截图
我的英语不好的天堂