0

我正在使用一个名为http://www.jigoshop.com的插件和 Wordpress(都是最新版本),但他们的 Google Checkout 网关出现问题。

我已经尝试过他们的支持,但尚未得到回应。

尝试订购商品时出现以下错误:

解析 XML 时出错;来自解析器的消息是:shopping-cart.items.item-2.unit-price 中属性 unit-price 的值无效:必填字段不能为空

在 Google 商家控制台中,这转换为:

“我们收到的 XML”

_type=checkout-shopping-cart&shopping-cart.merchant-private-data=273&checkout-flow-support.merchant-checkout-flow-support.continue-shopping-url=http%3A%2F%2Fwww.carolinemontagu.com%2Fv2%2Fevents%2Fcheckout%2Fthanks%2F&checkout-flow-support.merchant-checkout-flow-support.edit-cart-url=http%3A%2F%2Fwww.carolinemontagu.com%2Fv2%2Fevents%2Forder%2F&shopping-cart.items.item-1.item-name=Leadership+Success%3A+Early+bird+%26%238211%3B+19th+Oct&shopping-cart.items.item-1.item-description=&shopping-cart.items.item-1.unit-price=205.83&shopping-cart.items.item-1.unit-price.currency=GBP&shopping-cart.items.item-1.quantity=1&shopping-cart.items.item-1.merchant-item-id=211&shopping-cart.items.item-2.item-name=Shipping&shopping-cart.items.item-2.item-description=&shopping-cart.items.item-2.unit-price=&shopping-cart.items.item-2.unit-price.currency=GBP&shopping-cart.items.item-2.quantity=1&shopping-cart.items.item-2.merchant-item-id=

“我们发送的 XML”

_type=error&error-message=Error+parsing+XML%3B+message+from+parser+is%3A+Invalid+value+for+attribute+unit-price+in+shopping-cart.items.item-2.unit-price%3A+Required+field+must+not+be+blank&serial-number=3f096700-bb6f-4e28-8740-f6ffa0d09aeb

我查看了他们的代码,可以找到对应于shopping-cart.items.item-2.unit-price

private function formatOrder(jigoshop_order $order) {
    $result = array(
        '_type' => 'checkout-shopping-cart',
        'shopping-cart.merchant-private-data' => $order->id,
        'checkout-flow-support.merchant-checkout-flow-support.continue-shopping-url' => get_permalink(get_option('jigoshop_thanks_page_id')),
        'checkout-flow-support.merchant-checkout-flow-support.edit-cart-url' => get_permalink(get_option('jigoshop_cart_page_id')),
        //shipping-taxed
    );

    $i = 1;
    foreach($order->items as $item) {
        $prefix = "shopping-cart.items.item-$i.";//shopping-cart.items.item-1.item-name

        $result[$prefix.'item-name'] = $item['name'];
        $result[$prefix.'item-description'] = '';
        $result[$prefix.'unit-price'] = $item['cost'];
        $result[$prefix.'unit-price.currency'] = get_option('jigoshop_currency');
        $result[$prefix.'quantity'] = $item['qty'];
        $result[$prefix.'merchant-item-id'] = $item['id'];

        $i++;
    }

    $prefix = "shopping-cart.items.item-$i.";

    $result[$prefix.'item-name'] = __('Shipping', 'jigoshop');
    $result[$prefix.'item-description'] = '';
    $result[$prefix.'unit-price'] = $order->order_shipping;
    $result[$prefix.'unit-price.currency'] = get_option('jigoshop_currency');
    $result[$prefix.'quantity'] = 1;
    $result[$prefix.'merchant-item-id'] = $order->shipping_method;

    return $result;
}

任何人都可以帮助解决这个问题吗?我真的被迫在眉睫的最后期限所困!

4

1 回答 1

1

如果您只将一件商品添加到购物车中,那么根据提供的代码,item-2 是运费。

确保您的 $order->order_shipping 已正确初始化。

于 2012-05-10T02:42:47.043 回答