Closed lindseydiloreto closed 9 years ago
I'll take a look right now
Awesome, thanks! I briefly communicated with Adam about this issue via email, he suggested we move the ticket over here.
This could be an actual SDK issue... I can't replicate the problem on the API, probably need another set of eyes. cc @AJSturrock
Sounds good, thanks for looking into it.
Yeah, it's strange that Cart::Insert
is returning NULL... Shouldn't every API call return something?
Do you access to the cmd line from your dev machine. Could you possibly try this:
curl -X POST https://api.molt.in/v1/carts/YOUR_CART_ID \
-H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
-d "id=PRODUCT_ID" \
-d "quantity=1"
I'd like to know what you get back
I ran this...
curl -X POST https://api.molt.in/v1/carts/a01b7c05119e55eabdb80fb8ad376587 \
-H "Authorization: Bearer XXXX" \
-d "id=968362763212554388" \
-d "quantity=1"
... and got this...
{
"status": true,
"result": {
"identifier": "8e73df6ac3d8603addb9bc1226aeab77",
"id": "968362763212554388",
"quantity": 1,
"order": null,
"created_at": "2015-04-21 23:09:31",
"updated_at": "2015-04-21 23:09:31",
"sku": "EVENT-0152",
"title": "Peers Conference",
"slug": "peers-conference",
"price": null,
"sale_price": 0,
"status": {
"value": "Live",
"data": {
"key": "1",
"value": "Live"
}
},
"category": {
"value": "Uncategorized",
"data": {
"959922182450840426": {
"id": "959922182450840426",
"order": null,
"created_at": "2015-04-10 07:40:41",
"updated_at": "2015-04-21 21:22:16",
"parent": null,
"slug": "uncategorized",
"status": {
"value": "Live",
"data": {
"key": "1",
"value": "Live"
}
},
"title": "Uncategorized",
"description": "Products that do not fit into another category"
}
}
},
"stock_level": 80,
"stock_status": {
"value": "In Stock",
"data": {
"key": "1",
"value": "In Stock"
}
},
"description": "<p>In Philly<\/p>",
"requires_shipping": {
"value": "No",
"data": {
"key": "0",
"value": "No"
}
},
"weight": 0,
"height": 0,
"width": 0,
"depth": 0,
"catalog_only": {
"value": "No",
"data": {
"key": "0",
"value": "No"
}
},
"tax_band": null,
"collection": null,
"brand": null,
"is_variation": false,
"modifiers": [
],
"images": [
],
"pricing": {
"formatted": {
"with_tax": "$0.00",
"without_tax": "$0.00",
"tax": "$0.00"
},
"rounded": {
"with_tax": 0,
"without_tax": 0,
"tax": 0
},
"raw": {
"with_tax": 0,
"without_tax": 0,
"tax": 0
}
},
"name": "Peers Conference",
"total": 0,
"total_before_tax": 0,
"totals": {
"pre_discount": {
"formatted": {
"with_tax": "$0.00",
"without_tax": "$0.00",
"tax": "$0.00"
},
"rounded": {
"with_tax": 0,
"without_tax": 0,
"tax": 0
},
"raw": {
"with_tax": 0,
"without_tax": 0,
"tax": 0
}
},
"post_discount": {
"formatted": {
"with_tax": "$0.00",
"without_tax": "$0.00",
"tax": "$0.00"
},
"rounded": {
"with_tax": 0,
"without_tax": 0,
"tax": 0
},
"raw": {
"with_tax": 0,
"without_tax": 0,
"tax": 0
}
}
}
}
}
So looks like the API itself is working! Must be an SDK issue (or user issue).
Yes! Thanks for that. We'll work out a patch...
Brilliant, thanks! :)
@lindseydiloreto You might want to remove your identifying tokens / IDs in your comment above! :)
@Nessworthy @lindseydiloreto bearer token shouldn't last long but yes, censor applied! :+1:
Test cart and product IDs are ok to post :)
@lindseydiloreto quite strange, I've copy and pasted your exact PHP code and just changed the slug to another product on one of our test stores and it's working correctly. Would you be able to try again and let us know the results?
If that doesn't work can you also post the data array for the product with "my-slug" in the first example if this product exists? If it was just an example of your code though that's fine. Only thing I can think it might be is an issue with product variations/stock levels for a specific product/s?
Weird, it's totally working for me now too!
I just ran a composer update
on my local version of the SDK... I didn't think it was out of sync, but I guess it was. Whatever the bug was, it must have been fixed recently.
Alright, thanks @AJSturrock and @outrunthewolf! Closing this ticket.
No worries, anytime!
I'm using the PHP SDK, and my code is not working. I feel like something similar was working recently, so I'm wondering if something has changed...
This is the version I'm using...
Any thoughts?