0

我已经安装了 PayPal 模块并添加了所有 API 详细信息。它出现在页面上,但无法单击。为什么会这样?在源代码中查看的代码是这样的:

我觉得有点奇怪。像图像应该以某种方式链接到表单吗?

还在沙盒模式下尝试过,但也不起作用。

<div id="HOOK_SHOPPING_CART_EXTRA">
    <div id="container_express_checkout" style="float:right; margin: 10px 40px 0 0">
        <img id="payment_paypal_express_checkout" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" alt="" />
        <form id="paypal_payment_form" action="http://mydomain.com/store/modules/paypal/express_checkout/payment.php" data-ajax="false" title="Pay with PayPal" method="post" data-ajax="false">
            <!-- Change dynamicaly when the form is submitted -->
            <input type="hidden" name="quantity" value="1" />
            <input type="hidden" name="id_p_attr" value="" />
            <input type="hidden" name="express_checkout" value="cart"/>
            <input type="hidden" name="current_shop_url" value="http://mydomain.com/store/index.php?controller=order&multi-shipping=0" />
            <input type="hidden" name="bn" value="FR_PRESTASHOP_H3S" />
        </form>
    </div>
</div>
4

1 回答 1

0

自己修好了。使按钮工作所需的代码缺少标题。如果以后有人发现这个页面,你需要的代码是:

$(document).ready( function() {

$('#payment_paypal_express_checkout').click(function() {
    $('#paypal_payment_form').submit();
    return false;
});

$('#paypal_payment_form').live('submit', function() {
    var nb = $('#quantity_wanted').val();
    var id = $('#idCombination').val();

    $('#paypal_payment_form input[name=quantity]').val(nb);
    $('#paypal_payment_form input[name=id_p_attr]').val(id);
});

function displayExpressCheckoutShortcut() {
    var id_product = $('input[name="id_product"]').val();
    var id_product_attribute = $('input[name="id_product_attribute"]').val();

    $.ajax({
        type: "GET",
        url: baseDir+'/modules/paypal/express_checkout/ajax.php',
        data: { get_qty: "1", id_product: id_product, id_product_attribute: id_product_attribute },
        cache: false,
        success: function(result) {
            if (result >= '1')
                $('#container_express_checkout').slideDown();
            else
                $('#container_express_checkout').slideUp();
            return true;
        }
    });
}

$('select[name^="group_"]').change(function () {
    displayExpressCheckoutShortcut();
});

$('.color_pick').click(function () {
    displayExpressCheckoutShortcut();
});




var modulePath = 'modules/paypal';
var subFolder = '/integral_evolution';
var fullPath = baseDir + modulePath + subFolder;
var confirmTimer = false;

if ($('form[target="hss_iframe"]').length == 0) {
    if ($('select[name^="group_"]').length > 0)
        displayExpressCheckoutShortcut();
    return false;
} else {
    checkOrder();
}

function checkOrder() {
    confirmTimer = setInterval(getOrdersCount, 1000);
}

    function getOrdersCount() {
    $.get(
        fullPath + '/confirm.php',
        { id_cart: '7' },
        function (data) {
            if ((typeof(data) != 'undefined') && (data > 0)) {
                clearInterval(confirmTimer);
                window.location.replace(fullPath + '/submit.php?id_cart=7');
                $('p.payment_module, p.cart_navigation').hide();
            }
        }
    );
}
});
于 2013-03-31T17:38:45.943 回答