谷歌结帐 XML 无效值


Google Checkout XML invalid value

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

我已经尝试了他们的支持,但没有得到回应。

我在尝试订购东西时收到以下错误:

解析 XML 时出错;来自解析器的消息是:属性值无效 购物车中的单价。商品.商品-2.单价:必填字段 不得为空

在谷歌商家控制台中,这转化为:

"我们收到的 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;
}

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

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

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