Pregunta

I'm using a plugin called http://www.jigoshop.com with Wordpress (both the latest versions) and I'm having problems with their Google Checkout gateway.

I've tried their support but yet to get a response.

I'm getting the following errors when trying to order something:

Error parsing XML; message from parser is: Invalid value for attribute unit-price in shopping-cart.items.item-2.unit-price: Required field must not be blank

In the Google merchant console this translates to:

"XML that we recieved"

_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 that we sent"

_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

I've had a look through their code and can find this that corresponds to 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;
}

Can anyone help with this problem? I'm really stuck with a deadline looming fast!

¿Fue útil?

Solución

If you added only one item to the shopping cart, then based on the code provided, item-2 is the shipping cost.

Make sure your $order->order_shipping is initialized correctly.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top