当我在结帐页面时,我在浏览器控制台上收到以下错误。
ReferenceError: payment is not defined
当我点击信用卡付款选项时,不会打开任何表单以输入卡详细信息,并且会引发上述错误。
对于Magento管理员中的信用卡authorize.net选项正在使用。我也在使用paypal快速结账
我在template\checkout\onepage\payment\methods.phtml
文件中有以下代码
<dl class="sp-methods" id="checkout-payment-method-load">
<?php
$methods = $this->getMethods();
$oneMethod = count($methods) <= 1;
?>
<?php echo $this->getfieldshtml(1); ?>
<?php
foreach ($methods as $_method):
$_code = $_method->getCode();
?>
<dt>
<?php if(!$oneMethod): ?>
<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->htmlEscape($_method->getTitle()) ?>" onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> class="radio" />
<?php else: ?>
<span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span>
<?php $oneMethod = $_code; ?>
<?php endif; ?>
<label for="p_method_<?php echo $_code ?>"><?php echo $this->getMethodTitle($_method) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
</dt>
<?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
<dd>
<?php echo $html; ?>
</dd>
<?php endif; ?>
<?php endforeach; ?>
<?php echo $this->getfieldshtml(2); ?>
<?php echo $this->getfieldshtml(3); ?>
</dl>
<?php echo $this->getChildChildHtml('additional'); ?>
<script type="text/javascript">
//<![CDATA[
//function obsrv(id){
// if(id && id!=null){
// $$("#"+id+" input,#"+id+" label,#"+id+" select").each(function(onebyone){if($(onebyone.id) && $(onebyone.id)!=null){$(onebyone.id).removeAttribute("disabled");}});
// }
// }
<?php echo $this->getChildChildHtml('scripts'); ?>
$$("#co-payment-form input,#co-payment-form select").each(function(onebyone){if($(onebyone.id) && $(onebyone.id)!=null && onebyone.name.startsWith('fm_fields')){if(true){$(onebyone.id).removeAttribute("disabled");}}});
<?php if (is_string($oneMethod)): ?>
payment.switchMethod('<?php echo $oneMethod ?>');
<?php endif; ?>
//]]>
</script>
我用以下代码替换了代码,因为它也存在于Magento默认代码文件中
<script type="text/javascript">
//<![CDATA[
<?php echo $this->getChildChildHtml('scripts'); ?>
payment.init();
<?php if (is_string($oneMethod)): ?>
payment.switchMethod('<?php echo $oneMethod ?>');
<?php endif; ?>
//]]>
</script>
但仍然没有运气
答案 0 :(得分:0)
替换所有付款。通过计费。在该文件中以及ogone +的osc_payment.js和payment.js中添加此可配置布局:
<checkout_onestep_index>
<reference name="head">
<action method="addJs"><script>netresearch/ops/osc_payment.js</script></action>
<action method="addJs"><script>netresearch/ops/payment.js</script></action>
</reference>
<reference name="head">
<action method="addCss"><stylesheet>css/ops.css</stylesheet></action>
</reference>
</checkout_onestep_index>
答案 1 :(得分:-1)
我有同样的错误,可能是出于其他原因,也许不是,所以这就是我解决它的方法......
我们已将PHP设置为使用逗号进行类型&#34; float&#34;。但是payment.phtml正在呼应:
var quoteBaseGrandTotal = <?php echo (float)$this->getQuoteBaseGrandTotal(); ?>;
当订单金额为19,83欧元时,结果为:
var quoteBaseGrandTotal = 19,83;
这产生了javascript错误。
我没有足够的时间来正确修补,所以我用以下代码替换:
var quoteBaseGrandTotal = <?php echo str_replace(',','.', (float)$this->getQuoteBaseGrandTotal() ); ?>;
问题消失了。