codeswholesale / codeswholesale-sdk-php

A PHP wrapper for CodesWholesale's API
Apache License 2.0
36 stars 21 forks source link

CreateOrder should return the order id, too. #6

Closed aedogroup closed 8 years ago

aedogroup commented 9 years ago

CreateOrder really should return the order id, for bookkeeping purposes. I don't see any reason why it is not included at the moment.

codeswholesale commented 9 years ago

Hello,

You can easly get orderId. Please take a look on code below:

foreach ($order->getItems() as $item) { $cwProduct =\CodesWholesale\Resource\Product::get($cwProductId); $codes = \CodesWholesale\Resource\Order::createBatchOrder($cwProduct, array('quantity' => $qty)); $cwOrderId = $codes->getOrderId(); }

Variable $codes will return for you your orderId. Hope it helps ;)

Maciej

aedogroup commented 9 years ago

There is no such method/function in Resource/Code.php ;(

aedogroup commented 9 years ago

Am I missing something, or what?

fefrik commented 9 years ago

Hello, It is not about Resource/Code but about Resource/CodeList.php ;-)

Anyway, this method $codes->getOrderId() return object orderID like XXXXX-XXXXX-XXXXX-XXXXX, but I would like to get invoice number for bookkeeping.

Is it possible to implement or add new method for those purposes?

Thank you