![](/img/trans.png)
[英]Paypal Checkout error - ReferenceError: actions is not defined
[英]ReferenceError: payment is not defined on checkout page
在结帐页面上时,浏览器控制台上出现以下错误。
ReferenceError: payment is not defined
当我单击信用卡付款选项时,没有打开表格来输入卡详细信息,并且引发了上述错误。
对于使用Magento管理员中的信用卡authorize.net选项,我也在使用Paypal Express结帐
我在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>
但是仍然没有运气
替换所有付款。 通过计费。 在该文件以及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>
我遇到了同样的错误,也许是出于另一个原因,也许不是,所以这就是我的解决方法...
我们已将PHP设置为对类型“ float”使用逗号。 但是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() ); ?>;
问题消失了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.