794_The.Definitive.Guide.to.Magento.pdf

Shippingaddressid 2 invoiceid 5 items array 0 array

Info icon This preview shows pages 309–313. Sign up to view the full content.

'shipping_address_id' => '2', 'invoice_id' => '5', 'items' => array ( 0 => array ( 'increment_id' => '', 'parent_id' => '5', 'store_id' => NULL, 'created_at' => '2009-08-13 00:00:08', 'updated_at' => '2009-08-13 00:00:08', 'is_active' => '1', 'weee_tax_applied' => 'a:0:{}', 'qty' => '1.0000', 'cost' => '0.0000', 'price' => '32.0000', 'tax_amount' => '0.0000',
Image of page 309

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

APPENDIX API REFERENCES 288 'row_total' => '32.0000', 'base_price' => '32.0000', 'base_tax_amount' => '0.0000', 'base_row_total' => '32.0000', 'base_weee_tax_applied_amount' => '0.0000', 'base_weee_tax_applied_row_amount' => '0.0000', 'weee_tax_applied_amount' => '0.0000', 'weee_tax_applied_row_amount' => '0.0000', 'weee_tax_disposition' => '0.0000', 'weee_tax_row_disposition' => '0.0000', 'base_weee_tax_disposition' => '0.0000', 'base_weee_tax_row_disposition' => '0.0000', 'sku' => 'SSS3006', 'name' => 'Product Red', 'order_item_id' => '1', 'product_id' => '1', 'item_id' => '6', ), ), 'comments' => array ( 0 => array ( 'increment_id' => '', 'parent_id' => '5', 'store_id' => NULL, 'created_at' => '2009-08-13 00:00:08', 'updated_at' => '2009-08-13 00:00:08', 'is_active' => '1', 'comment' => 'Invoice Created', 'is_customer_notified' => '0', 'comment_id' => '7', ), ), ) Zend XML-RPC Example // Prepare data $invoice_increment_id = '200000001'; // Using Zend XML-RPC $results = $client->call('call', array($session_id, 'sales_order_invoice.info', array($invoice_increment_id) ) ); // view results var_dump($results);
Image of page 310
APPENDIX API REFERENCES 289 Method: sales_order_invoice.create ($order_increment_id, $items, $comment, $email_send, $email_with_comment) Description: Creates an invoice. Return: Int, newly created invoice_increment_id. Arguments: $order_increment_id (required). This is the order number. $items (required). Key/value array of item_id and qty. See the following example. $comment (optional). Invoice comment message. $email_send (optional). True/false; sends an e-mail to the customer. $email_with_comment (optional). True/false, sends an e-mail with the comment. Zend XML-RPC Example // Prepare the data $order_increment_id = '200000004'; $product_id = '1234'; $qty_invoiced = '6'; $comment = 'New invoice creation.'; $item_id = ''; // Pull sales_order.info $results = $client->call('call', array($session_id, 'sales_order.info', array($order_increment_id))); // Extract the item_id foreach ($results['items'] as $item) { if ($item['product_id'] == $product_id) $item_id = $item['item_id']; } // Create the items array $items = array($item_id => $qty_invoiced); // Create order invoice $new_invoice_increment_id = $client->call('call', array($session_id, 'sales_order_invoice.create', array( $order_increment_id, $items, $comment, true, true ) ) ); // Display the new invoice increment id echo $new_invoice_increment_id;
Image of page 311

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

APPENDIX API REFERENCES 290 Method: sales_order_invoice.addComment ($invoice_increment_id, $comment, $email_send, $email_with_comment) Description: Adds an invoice comment. Return: Boolean; true if successful. Arguments: $invoice_increment_id (required). This is the invoice increment id. $comment (required). Shipment comment message. $email_send (optional). True/false; sends an e-mail to the customer. $email_with_comment (optional). True/false, sends an e-mail with the comment. SOAP Example // Prepare data $invoice_increment_id = '200000001'; $comment = 'Invoice has been setup.'; $email_send = true; $email_with_comment = true; // using SOAP method $results = $client->call($session_id, 'sales_order_invoice.addComment', array( $invoice_increment_id, $comment, $email_sent, $email_with_comment ) ); // return true if successful var_dump($results); Method: sales_order_invoice.capture ($invoice_increment_id) Description: Captures an invoice.
Image of page 312
Image of page 313
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern