function getProducts() { global $toC_Json, $osC_Language; $osC_Tax = new osC_Tax_Admin(); $osC_Currencies = new osC_Currencies_Admin(); $osC_Order = new osC_Order($_REQUEST['orders_id']); $records = array(); foreach ($osC_Order->getProducts() as $product) { $product_info = $product['quantity'] . ' x ' . $product['name']; if (isset($product['variants']) && is_array($product['variants']) && sizeof($product['variants']) > 0) { foreach ($product['variants'] as $variants) { $product_info .= '<br /><nobr> <i>' . $variants['groups_name'] . ': ' . $variants['values_name'] . '</i></nobr>'; } } if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('senders_name') . ': ' . $product['senders_name'] . '</i></nobr>'; if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('senders_email') . ': ' . $product['senders_email'] . '</i></nobr>'; } $product_info .= '<br /><nobr> <i>' . $osC_Language->get('recipients_name') . ': ' . $product['recipients_name'] . '</i></nobr>'; if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('recipients_email') . ': ' . $product['recipients_email'] . '</i></nobr>'; } $product_info .= '<br /><nobr> <i>' . $osC_Language->get('messages') . ': ' . $product['messages'] . '</i></nobr>'; } $records[] = array('products' => $product_info, 'return_quantity' => $product['return_quantity'] > 0 ? $product['return_quantity'] : '', 'model' => $product['model'], 'tax' => $osC_Tax->displayTaxRateValue($product['tax']), 'price_net' => $osC_Currencies->format($product['final_price'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'price_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], 1, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_net' => $osC_Currencies->format($product['final_price'] * $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue())); } foreach ($osC_Order->getTotals() as $totals) { $records[] = array('products' => '', 'model' => '', 'tax' => '', 'price_net' => '', 'price_gross' => $totals['title'], 'total_net' => '', 'total_gross' => $totals['text']); } $response = array(EXT_JSON_READER_ROOT => $records); echo $toC_Json->encode($response); }
function listOrdersEditProducts() { global $toC_Json, $osC_Database, $osC_Language, $osC_ShoppingCart, $osC_Currencies, $osC_Weight, $osC_Tax; $osC_Tax = new osC_Tax_Admin(); $osC_Weight = new osC_Weight(); $osC_Currencies = new osC_Currencies(); $osC_Order = new osC_Order($_REQUEST['orders_id']); $records = array(); foreach ($osC_Order->getProducts() as $products_id_string => $product) { $product_info = $product['name']; if (isset($product['variants']) && is_array($product['variants']) && sizeof($product['variants']) > 0) { foreach ($product['variants'] as $variants) { $product_info .= '<br /><nobr> <i>' . $variants['groups_name'] . ': ' . $variants['values_name'] . '</i></nobr>'; } } if (isset($product['customizations']) && !empty($product['customizations'])) { $product_info .= '<p>'; foreach ($product['customizations'] as $key => $customization) { $product_info .= '<div style="float: left">' . $customization['qty'] . ' x ' . '</div>'; $product_info .= '<div style="margin-left: 25px">'; foreach ($customization['fields'] as $orders_products_customizations_values_id => $field) { if ($field['customization_type'] == CUSTOMIZATION_FIELD_TYPE_INPUT_TEXT) { $product_info .= $field['customization_fields_name'] . ': ' . $field['customization_value'] . '<br />'; } else { $product_info .= $field['customization_fields_name'] . ': <a href="' . osc_href_link_admin(FILENAME_JSON, 'module=orders&action=download_customization_file&file=' . $field['customization_value'] . '&cache_file=' . $field['cache_filename']) . '">' . $field['customization_value'] . '</a>' . '<br />'; } } $product_info .= '</div>'; } $product_info .= '</p>'; } if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) { $product_info .= ' (' . $product['gift_certificates_code'] . ')'; $product_info .= '<br /><nobr> <i>' . $osC_Language->get('senders_name') . ': ' . $product['senders_name'] . '</i></nobr>'; if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('senders_email') . ': ' . $product['senders_email'] . '</i></nobr>'; } $product_info .= '<br /><nobr> <i>' . $osC_Language->get('recipients_name') . ': ' . $product['recipients_name'] . '</i></nobr>'; if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('recipients_email') . ': ' . $product['recipients_email'] . '</i></nobr>'; } $product_info .= '<br /><nobr> <i>' . $osC_Language->get('messages') . ': ' . $product['messages'] . '</i></nobr>'; } $osC_Product = new osC_Product($product['id'], $osC_Order->getCustomer('customers_id')); $records[] = array('orders_products_id' => $product['orders_products_id'], 'products_id' => $product['id'], 'products_type' => $product['type'], 'products' => $product_info, 'quantity' => $product['quantity'] > 0 ? $product['quantity'] : '', 'qty_in_stock' => $osC_Product->getQuantity($products_id_string), 'sku' => $product['sku'], 'tax' => $osC_Tax->displayTaxRateValue($product['tax']), 'price_net' => round($product['final_price'] * $osC_Order->getCurrencyValue(), 2), 'price_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], 1, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_net' => $osC_Currencies->format($product['final_price'] * $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'action' => array('class' => 'icon-delete-record', 'qtip' => '')); } $order_totals = '<table cellspacing="5" cellpadding="5" width="300" border="0">'; foreach ($osC_Order->getTotals() as $totals) { $order_totals .= '<tr><td align="right">' . $totals['title'] . ' </td><td width="60">' . $totals['text'] . '</td></tr>'; } $order_totals .= '</table>'; $response = array(EXT_JSON_READER_ROOT => $records, 'totals' => $order_totals, 'shipping_method' => $osC_Order->getDeliverMethod()); echo $toC_Json->encode($response); }
?> </th> </tr> </thead> <tbody> <?php foreach ($osC_Order->getProducts() as $product) { echo ' <tr>' . "\n" . ' <td valign="top" align="right">' . $product['quantity'] . ' x</td>' . "\n" . ' <td valign="top">' . $product['name']; if (isset($product['attributes']) && sizeof($product['attributes']) > 0) { foreach ($product['attributes'] as $attribute) { echo '<br /><nobr> ' . $attribute['option'] . ': ' . $attribute['value'] . '</nobr>'; } } echo ' </td>' . "\n" . ' <td valign="top">' . $product['model'] . '</td>' . "\n"; echo ' <td align="right" valign="top">' . $osC_Tax->displayTaxRateValue($product['tax']) . '</td>' . "\n" . ' <td align="right" valign="top"><b>' . $osC_Currencies->format($product['price'], true, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()) . '</b></td>' . "\n" . ' <td align="right" valign="top"><b>' . $osC_Currencies->displayPriceWithTaxRate($product['price'], $product['tax'], 1, true, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()) . '</b></td>' . "\n" . ' <td align="right" valign="top"><b>' . $osC_Currencies->format($product['price'] * $product['quantity'], true, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()) . '</b></td>' . "\n" . ' <td align="right" valign="top"><b>' . $osC_Currencies->displayPriceWithTaxRate($product['price'], $product['tax'], $product['quantity'], true, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()) . '</b></td>' . "\n"; echo ' </tr>' . "\n"; } ?> </tbody> </table> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php foreach ($osC_Order->getTotals() as $total) { echo ' <tr>' . "\n" . ' <td align="right">' . $total['title'] . '</td>' . "\n" . ' <td align="right">' . $total['text'] . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table></td> </tr> </table>
function listOrdersEditProducts() { global $toC_Json, $osC_Database, $osC_Language, $osC_ShoppingCart, $osC_Currencies, $osC_Weight, $osC_Tax; $osC_Tax = new osC_Tax_Admin(); $osC_Weight = new osC_Weight(); $osC_Currencies = new osC_Currencies(); $osC_Order = new osC_Order($_REQUEST['orders_id']); $records = array(); foreach ($osC_Order->getProducts() as $products_id_string => $product) { $product_info = $product['name']; if (isset($product['variants']) && is_array($product['variants']) && sizeof($product['variants']) > 0) { foreach ($product['variants'] as $variants) { $product_info .= '<br /><nobr> <i>' . $variants['groups_name'] . ': ' . $variants['values_name'] . '</i></nobr>'; } } if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) { $product_info .= ' (' . $product['gift_certificates_code'] . ')'; $product_info .= '<br /><nobr> <i>' . $osC_Language->get('senders_name') . ': ' . $product['senders_name'] . '</i></nobr>'; if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('senders_email') . ': ' . $product['senders_email'] . '</i></nobr>'; } $product_info .= '<br /><nobr> <i>' . $osC_Language->get('recipients_name') . ': ' . $product['recipients_name'] . '</i></nobr>'; if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('recipients_email') . ': ' . $product['recipients_email'] . '</i></nobr>'; } $product_info .= '<br /><nobr> <i>' . $osC_Language->get('messages') . ': ' . $product['messages'] . '</i></nobr>'; } $osC_Product = new osC_Product($product['id'], $osC_Order->getCustomer('customers_id')); $records[] = array('orders_products_id' => $product['orders_products_id'], 'products_id' => $product['id'], 'products_type' => $product['type'], 'products' => $product_info, 'quantity' => $product['quantity'] > 0 ? $product['quantity'] : '', 'qty_in_stock' => $osC_Product->getQuantity($products_id_string), 'sku' => $product['sku'], 'tax' => $osC_Tax->displayTaxRateValue($product['tax']), 'price_net' => round($product['final_price'] * $osC_Order->getCurrencyValue(), 2), 'price_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], 1, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_net' => $osC_Currencies->format($product['final_price'] * $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'total_gross' => $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], $product['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()), 'action' => array('class' => 'icon-delete-record', 'qtip' => '')); } $order_totals = '<table cellspacing="5" cellpadding="5" width="300" border="0">'; foreach ($osC_Order->getTotals() as $totals) { $order_totals .= '<tr><td align="right">' . $totals['title'] . ' </td><td width="60">' . $totals['text'] . '</td></tr>'; } $order_totals .= '</table>'; $response = array(EXT_JSON_READER_ROOT => $records, 'totals' => $order_totals, 'shipping_method' => $osC_Order->getDeliverMethod()); echo $toC_Json->encode($response); }
function listOrders() { global $toC_Json, $osC_Database, $osC_Language; require_once 'includes/classes/order.php'; require_once 'includes/classes/currencies.php'; $osC_Currencies = new osC_Currencies_Admin(); $Qorders = $osC_Database->query('select o.orders_id, o.date_purchased, s.orders_status_name, ot.text as order_total from :table_orders o, :table_orders_total ot, :table_orders_status s where o.orders_id = ot.orders_id and ot.class = "total" and o.orders_status = s.orders_status_id and o.customers_email_address = :customers_email_address and s.language_id = :language_id '); $Qorders->bindTable(':table_orders', TABLE_ORDERS); $Qorders->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL); $Qorders->bindTable(':table_orders_status', TABLE_ORDERS_STATUS); $Qorders->bindValue(':customers_email_address', $_REQUEST['email']); $Qorders->bindInt(':language_id', $osC_Language->getID()); $Qorders->execute(); $records = array(); while ($Qorders->next()) { $osC_Order = new osC_Order($Qorders->valueInt('orders_id')); $products_table = '<table width="100%">'; foreach ($osC_Order->getProducts() as $product) { $product_info = $product['name']; if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('senders_name') . ': ' . $product['senders_name'] . '</i></nobr>'; if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('senders_email') . ': ' . $product['senders_email'] . '</i></nobr>'; } $product_info .= '<br /><nobr> <i>' . $osC_Language->get('recipients_name') . ': ' . $product['recipients_name'] . '</i></nobr>'; if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $product_info .= '<br /><nobr> <i>' . $osC_Language->get('recipients_email') . ': ' . $product['recipients_email'] . '</i></nobr>'; } $product_info .= '<br /><nobr> <i>' . $osC_Language->get('messages') . ': ' . $product['messages'] . '</i></nobr>'; } if (isset($product['variants']) && is_array($product['variants']) && sizeof($product['variants']) > 0) { foreach ($product['variants'] as $variants) { $product_info .= '<br /><nobr> <i>' . $variants['groups_name'] . ': ' . $variants['values_name'] . '</i></nobr>'; } } $products_table .= '<tr><td width="15">' . $product['quantity'] . ' x ' . '</td><td>' . $product_info . '</td><td valign="top" align="right" width="50">' . $osC_Currencies->displayPriceWithTaxRate($product['final_price'], $product['tax'], 1, $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()) . '</td></tr>'; } $products_table .= '</table>'; $order_total = '<table width="100%">'; foreach ($osC_Order->getTotals() as $total) { $order_total .= '<tr><td align="right">' . $total['title'] . ' </td><td width="60" align="right">' . $total['text'] . '</td></tr>'; } $order_total .= '</table>'; $records[] = array('orders_id' => $Qorders->valueInt('orders_id'), 'order_total' => strip_tags($Qorders->value('order_total')), 'date_purchased' => osC_DateTime::getShort($Qorders->value('date_purchased')), 'orders_status_name' => $Qorders->value('orders_status_name'), 'products' => $products_table, 'totals' => $order_total); } $response = array(EXT_JSON_READER_ROOT => $records); echo $toC_Json->encode($response); }