if (!$success) { array_push($purchaseFailed, $dbitem); } } if (count($purchaseFailed) > 0) { db_deleteOrder($dborder->id); } } else { $item = $item_arr->item; $output[] = '<tr>'; $output[] = '<td>' . $item->name . '</td>'; $output[] = '<td>' . $item->quantity . '</td>'; $output[] = '</tr>'; //Get item from store inventory ans save it in order summary $dbitem = getItemByName($item->name); $success = db_addOrderItem($dborder->id, $dbitem->id, $item->quantity, $item->price); //Insert order summary for this item if (!$success) { array_push($purchaseFailed, $dbitem); } } $output[] = '</tbody>'; $output[] = '</table>'; //Send Email to customer $buyer = db_getUserById($dborder->userid); // Buyer Information: added by JAM - 06/18/2012 $profile_fields = profile_user_record($dborder->userid); $data = new object(); $data->userfullname = fullname($buyer); $data->firstname = $buyer->firstname; $data->lastname = $buyer->lastname;
db_addGoogleCheckoutOrder($neworder->email, $neworder->ordernumber, $neworder->purchasedate, $neworder->fulfillmentorderstate, $neworder->financialorderstate); $dborder = db_getOrderByOrderNumber($neworder->ordernumber); $total = 0; //Get shopping cart information $items = get_arr_result($data[$root]['shopping-cart']['items']['item']); foreach ($items as $item) { $itemname = $item['item-name']['VALUE']; $itemdescription = $item['item-description']['VALUE']; $currency = $item['unit-price']['currency']; $unitprice = $item['unit-price']['VALUE']; $quantity = $item['quantity']['VALUE']; //Get item from store inventory $sql_getitem = 'SELECT * from mdl_shoppingcart_store_inventory WHERE name = "' . $itemname . '" and description = "' . $itemdescription . '"'; $dbitem = db_getrecord($sql_getitem); //Insert order summary for this item db_addOrderItem($dborder->id, $dbitem->id, $quantity, $unitprice); $total += $quantity * $unitprice; } db_modifyOrderTotal($dborder->id, $total); $user = db_getUserByEmail($email); $Gresponse->SendAck(); //$data[$root]['serial-number'] break; case "authorization-amount-notification": break; case "order-state-change-notification": $new_financial_state = $data[$root]['new-financial-order-state']['VALUE']; $new_fulfillment_order = $data[$root]['new-fulfillment-order-state']['VALUE']; $ordernumber = $data[$root]['google-order-number']['VALUE']; $date = $data[$root]['timestamp']['VALUE']; $dborder = db_getOrderByOrderNumber($ordernumber);
if (!$success) { array_push($purchaseFailed, $dbitem); } } if (count($purchaseFailed) > 0) { db_deleteOrder($dborder_id); } } else { $item = $item_arr->item; $output[] = '<tr>'; $output[] = '<td>' . $item->name . '</td>'; $output[] = '<td>' . $item->quantity . '</td>'; $output[] = '</tr>'; //Get item from store inventory ans save it in order summary $dbitem = db_getItemByName($item->name); $success = db_addOrderItem($dborder_id, $dbitem['id'], $item->quantity, $item->price); //Insert order summary for this item if (!$success) { array_push($purchaseFailed, $dbitem); } } $output[] = '</tbody>'; $output[] = '</table>'; //Send Email to customer $buyer = refactored_db_getUserById($dborder_userid); // Buyer Information: added by JAM - 06/18/2012 //$profile_fields = profile_user_record($dborder_userid); jh 7/13/2015 Note: need to look for a comparable function in efront. $data = new object(); $data->userfullname = $buyer['name'] . " " . $buyer['surname']; $data->firstname = $buyer['name']; $data->lastname = $buyer['surname'];