Example #1
0
 function loadSummaryData()
 {
     global $toC_Json, $osC_Language;
     $osC_Order = new osC_Order($_REQUEST['orders_id']);
     $response['customer'] = '<p style="margin-left:10px;">' . osC_Address::format($osC_Order->getCustomer(), '<br />') . '</p>' . '<p style="margin-left:10px;>' . osc_icon('telephone.png') . $osC_Order->getCustomer('telephone') . '<br />' . osc_icon('write.png') . $osC_Order->getCustomer('email_address') . '</p>';
     $response['shippingAddress'] = '<p style="margin-left:10px;">' . osC_Address::format($osC_Order->getDelivery(), '<br />') . '</p>';
     $response['billingAddress'] = '<p style="margin-left:10px;">' . osC_Address::format($osC_Order->getBilling(), '<br />') . '</p>';
     $response['paymentMethod'] = '<p style="margin-left:10px;">' . $osC_Order->getPaymentMethod() . '</p>';
     if ($osC_Order->isValidCreditCard()) {
         $response['paymentMethod'] .= '
       <table border="0" cellspacing="0" cellpadding="0">
         <tr>
           <td>' . $osC_Language->get('credit_card_type') . '</td>
           <td>' . $osC_Order->getCreditCardDetails('type') . '</td>
         </tr>
         <tr>
           <td>' . $osC_Language->get('credit_card_owner_name') . '</td>
           <td>' . $osC_Order->getCreditCardDetails('owner') . '</td>
         </tr>
         <tr>
           <td>' . $osC_Language->get('credit_card_number') . '</td>
           <td>' . $osC_Order->getCreditCardDetails('number') . '</td>
         </tr>
         <tr>
           <td>' . $osC_Language->get('credit_card_expiry_date') . '</td>
           <td>' . $osC_Order->getCreditCardDetails('expires') . '</td>
         </tr>
       </table>';
     }
     $response['status'] = '<p style="margin-left:10px;">' . $osC_Order->getStatus() . '<br />' . ($osC_Order->getDateLastModified() > $osC_Order->getDateCreated() ? osC_DateTime::getShort($osC_Order->getDateLastModified(), true) : osC_DateTime::getShort($osC_Order->getDateCreated(), true)) . '</p>' . '<p style="margin-left:10px;">' . $osC_Language->get('number_of_comments') . ' ' . $osC_Order->getNumberOfComments() . '</p>';
     $response['total'] = '<p style="margin-left:10px;">' . $osC_Order->getTotal() . '</p>' . '<p style="margin-left:10px;">' . $osC_Language->get('number_of_products') . ' ' . $osC_Order->getNumberOfProducts() . '<br />' . $osC_Language->get('number_of_items') . ' ' . $osC_Order->getNumberOfItems() . '</p>';
     echo $toC_Json->encode($response);
 }
Example #2
0
echo $osC_Language->get('subsection_billing_address');
?>
</b></td>
          </tr>
          <tr>
            <td><?php 
echo osC_Address::format($osC_Order->getBilling(), '<br />');
?>
</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><?php 
echo $osC_Order->getCustomer('telephone');
?>
</td>
          </tr>
          <tr>
            <td><?php 
echo '<a href="mailto:' . $osC_Order->getCustomer('email_address') . '"><u>' . $osC_Order->getCustomer('email_address') . '</u></a>';
?>
</td>
          </tr>
        </table></td>
        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td><b><?php 
echo $osC_Language->get('subsection_shipping_address');
?>
Example #3
0
 function listChooseProducts()
 {
     global $toC_Json, $osC_Database, $osC_Language, $osC_Currencies, $osC_Tax;
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $Qproducts = $osC_Database->query('select SQL_CALC_FOUND_ROWS * from :table_products p left join :table_products_description pd on p.products_id = pd.products_id where p.products_status = 1 and pd.language_id = :language_id and p.products_status = 1');
     if (!empty($_REQUEST['search'])) {
         $Qproducts->appendQuery('and pd.products_name  like :products_name');
         $Qproducts->bindValue(':products_name', '%' . $_REQUEST['search'] . '%');
     }
     $Qproducts->appendQuery('order by p.products_id ');
     $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
     $Qproducts->bindInt(':language_id', $osC_Language->getID());
     $Qproducts->setExtBatchLimit($start, $limit);
     $Qproducts->execute();
     $osC_Currencies = new osC_Currencies();
     $osC_Order = new osC_Order($_REQUEST['orders_id']);
     $osC_Tax = new osC_Tax_Admin();
     $_SESSION['currency'] = $osC_Order->getCurrency();
     $records = array();
     while ($Qproducts->next()) {
         $products_id = $Qproducts->valueInt('products_id');
         $osC_Product = new osC_Product($products_id, $osC_Order->getCustomer('customers_id'));
         if (!$osC_Product->hasVariants()) {
             $products_name = $osC_Product->getTitle();
             $products_price = $osC_Product->getPriceFormated();
             if ($osC_Product->isGiftCertificate()) {
                 $products_name .= '<table cellspacing="0" cellpadding="0" border="0">';
                 if ($osC_Product->isOpenAmountGiftCertificate()) {
                     $products_name .= '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_amount') . '</i></td><td><input id="' . $products_id . '_price' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" value="' . round($osC_Product->getOpenAmountMinValue() * $osC_Order->getCurrencyValue(), 2) . '"/></td></tr>';
                 }
                 if ($osC_Product->isEmailGiftCertificate()) {
                     $products_name .= '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_sender_name') . '</i></td><td><input id="' . $products_id . '_sender_name' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_sender_email') . '</i></td><td><input id="' . $products_id . '_sender_email' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_name') . '</i></td><td><input id="' . $products_id . '_recipient_name' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_email') . '</i></td><td><input id="' . $products_id . '_recipient_email' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_message') . '</i></td><td><textarea id="' . $products_id . '_message' . '" class=" x-form-textarea x-form-field" style="width: 140px" /></textarea></td></tr>';
                 } else {
                     if ($osC_Product->isPhysicalGiftCertificate()) {
                         $products_name .= '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_sender_name') . '</i></td><td><input id="' . $products_id . '_sender_name' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_recipient_name') . '</i></td><td><input id="' . $products_id . '_recipient_name' . '" type="text" class="x-form-text x-form-field x-form-empty-field" style="width: 140px" /></td></tr>' . '<tr><td><i>--&nbsp;&nbsp;' . $osC_Language->get('field_message') . '</i></td><td><textarea id="' . $products_id . '_message' . '" class=" x-form-textarea x-form-field" style="width: 140px" /></textarea></td></tr>';
                     }
                 }
                 $products_name .= '</table>';
             }
             $records[] = array('products_id' => $products_id, 'products_name' => $products_name, 'products_type' => $osC_Product->getProductType(), 'products_sku' => $osC_Product->getSKU(), 'products_price' => $products_price, 'products_quantity' => $osC_Product->getQuantity(), 'new_qty' => $Qproducts->valueInt('products_moq'), 'has_variants' => false);
         } else {
             $records[] = array('products_id' => $products_id, 'products_name' => $osC_Product->getTitle(), 'products_type' => $osC_Product->getProductType(), 'products_sku' => $osC_Product->getSKU(), 'products_price' => $osC_Product->getPriceFormated(), 'products_quantity' => $osC_Product->getQuantity(), 'new_qty' => $Qproducts->valueInt('products_moq'), 'has_variants' => true);
             foreach ($osC_Product->getVariants() as $product_id_string => $details) {
                 $variants = '';
                 foreach ($details['groups_name'] as $groups_name => $values_name) {
                     $variants .= '&nbsp;&nbsp;&nbsp;<i>' . $groups_name . ' : ' . $values_name . '</i><br />';
                 }
                 $records[] = array('products_id' => $product_id_string, 'products_name' => $variants, 'products_type' => $osC_Product->getProductType(), 'products_sku' => $osC_Product->getSKU(osc_parse_variants_from_id_string($product_id_string)), 'products_price' => $osC_Currencies->format($osC_Product->getPrice(osc_parse_variants_from_id_string($product_id_string)), $osC_Order->getCurrency()), 'products_quantity' => $details['quantity'], 'new_qty' => $Qproducts->valueInt('products_moq'), 'has_variants' => false);
             }
         }
     }
     unset($_SESSION['currency']);
     $response = array(EXT_JSON_READER_TOTAL => $Qproducts->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
 function listCreditsMemo()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $osC_Currencies = new osC_Currencies_Admin();
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $Qslips = $osC_Database->query('select r.* from :table_orders_refunds r ');
     if (isset($_REQUEST['customers_id']) && !empty($_REQUEST['customers_id'])) {
         $Qslips->appendQuery(', ' . TABLE_ORDERS . ' o where r.orders_id = o.orders_id and o.customers_id = :customers_id and r.orders_refunds_type = :orders_refunds_type');
         $Qslips->bindInt(':customers_id', $_REQUEST['customers_id']);
     } else {
         $Qslips->appendQuery('where orders_refunds_type = :orders_refunds_type');
     }
     if (isset($_REQUEST['orders_id']) && !empty($_REQUEST['orders_id'])) {
         $Qslips->appendQuery('and orders_id = :orders_id ');
         $Qslips->bindInt(':orders_id', $_REQUEST['orders_id']);
     }
     $Qslips->bindTable(':table_orders_refunds', TABLE_ORDERS_REFUNDS);
     $Qslips->bindInt(':orders_refunds_type', ORDERS_RETURNS_TYPE_CREDIT_SLIP);
     $Qslips->setExtBatchLimit($start, $limit);
     $Qslips->execute();
     $records = array();
     while ($Qslips->next()) {
         $orders_refunds_id = $Qslips->value('orders_refunds_id');
         $Qproducts = $osC_Database->query("select orders_products_id, products_quantity from :table_orders_refunds_products where orders_refunds_id = :orders_refunds_id");
         $Qproducts->bindTable(':table_orders_refunds_products', TABLE_ORDERS_REFUNDS_PRODUCTS);
         $Qproducts->bindInt(':orders_refunds_id', $orders_refunds_id);
         $Qproducts->execute();
         $products_ids = array();
         $products_qty = array();
         while ($Qproducts->next()) {
             $products_ids[] = $Qproducts->valueInt('orders_products_id');
             $products_qty[$Qproducts->valueInt('orders_products_id')] = $Qproducts->valueInt('products_quantity');
         }
         $total = 0;
         $quantity = 0;
         $products = array();
         $osC_Order = new osC_Order($Qslips->valueInt('orders_id'));
         $products_table = '<table width="100%">';
         foreach ($osC_Order->getProducts() as $product) {
             if (in_array($product['orders_products_id'], $products_ids)) {
                 $product_info = $products_qty[$product['orders_products_id']] . '&nbsp;x&nbsp;' . $product['name'];
                 if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_name') . ': ' . $product['senders_name'] . '</i></nobr>';
                     if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                         $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_email') . ': ' . $product['senders_email'] . '</i></nobr>';
                     }
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_name') . ': ' . $product['recipients_name'] . '</i></nobr>';
                     if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                         $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_email') . ': ' . $product['recipients_email'] . '</i></nobr>';
                     }
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;&nbsp;<i>' . $variants['groups_name'] . ': ' . $variants['values_name'] . '</i></nobr>';
                     }
                 }
                 $products[] = $product_info;
                 $quantity += $products_qty[$product['orders_products_id']];
                 $products_table .= '<tr><td>' . $product_info . '</td><td width="60" valign="top" align="right">' . $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%">';
         $order_total .= '<tr><td align="right">' . $osC_Language->get("field_sub_total") . '&nbsp;&nbsp;&nbsp;</td><td width="60" align="right">' . $osC_Currencies->format($Qslips->value('sub_total')) . '</td></tr>';
         $order_total .= '<tr><td align="right">' . $osC_Language->get("field_shipping_fee") . '&nbsp;&nbsp;&nbsp;</td><td width="60" align="right">' . $osC_Currencies->format($Qslips->value('shipping')) . '</td></tr>';
         $order_total .= '<tr><td align="right">' . $osC_Language->get("field_handling") . '&nbsp;&nbsp;&nbsp;</td><td width="60" align="right">' . $osC_Currencies->format($Qslips->value('handling')) . '</td></tr>';
         $order_total .= '<tr><td align="right">' . $osC_Language->get("field_refund_total") . '&nbsp;&nbsp;&nbsp;</td><td width="60" align="right">' . $osC_Currencies->format($Qslips->value('refund_total')) . '</td></tr>';
         $order_total .= '</table>';
         $records[] = array('orders_refunds_id' => $Qslips->valueInt('orders_refunds_id'), 'credit_slips_id' => $Qslips->valueInt('credit_slips_id'), 'orders_id' => $Qslips->valueInt('orders_id'), 'customers_name' => $osC_Order->getCustomer('name'), 'total_products' => $quantity, 'total_refund' => $osC_Currencies->format($Qslips->value('refund_total')), 'sub_total' => $osC_Currencies->format($Qslips->value('sub_total')), 'date_added' => osC_DateTime::getShort($Qslips->value('date_added')), 'shipping_address' => osC_Address::format($osC_Order->getDelivery(), '<br />'), 'shipping_method' => $osC_Order->getDeliverMethod(), 'billing_address' => osC_Address::format($osC_Order->getBilling(), '<br />'), 'payment_method' => $osC_Order->getPaymentMethod(), 'comments' => $Qslips->value('comments'), 'products' => $products_table, 'totals' => $order_total);
     }
     $response = array(EXT_JSON_READER_TOTAL => $Qslips->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
Example #5
0
<div id="sectionSummary" <?php 
    if (!empty($section)) {
        echo 'style="display: none;"';
    }
    ?>
>
  <table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBoxContent">
    <tr>
      <td width="33%" valign="top">
        <div class="infoBoxHeading"><?php 
    echo tep_image('templates/' . $template . '/images/icons/16x16/personal.png', ENTRY_CUSTOMER, '16', '16') . ' ' . ENTRY_CUSTOMER;
    ?>
</div>
        <div class="infoBoxContent">
          <p><?php 
    echo tep_address_format($osC_Order->getCustomer('format_id'), $osC_Order->getCustomer(), 1, '', '<br>');
    ?>
</p>
          <p><?php 
    echo tep_image('templates/' . $template . '/images/icons/16x16/telephone.png', ENTRY_TELEPHONE_NUMBER, '16', '16') . ' ' . $osC_Order->getCustomer('telephone') . '<br>' . tep_image('templates/' . $template . '/images/icons/16x16/write.png', ENTRY_EMAIL_ADDRESS, '16', '16') . ' ' . $osC_Order->getCustomer('email_address');
    ?>
</p>
        </div>
      </td>
      <td width="33%" valign="top">
        <div class="infoBoxHeading"><?php 
    echo tep_image('templates/' . $template . '/images/icons/16x16/home.png', ENTRY_SHIPPING_ADDRESS, '16', '16') . ' ' . ENTRY_SHIPPING_ADDRESS;
    ?>
</div>
        <div class="infoBoxContent">
          <p><?php 
Example #6
0
    ?>
</li>
  </ul>

  <div id="section_summary_content">
    <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td width="33%" valign="top">
          <fieldset style="border: 0; height: 100%;">
            <legend style="margin-left: -20px; font-weight: bold;"><?php 
    echo osc_icon('personal.png') . ' ' . $osC_Language->get('subsection_customer');
    ?>
</legend>

            <p><?php 
    echo osC_Address::format($osC_Order->getCustomer(), '<br />');
    ?>
</p>
            <p><?php 
    echo osc_icon('telephone.png') . ' ' . $osC_Order->getCustomer('telephone') . '<br />' . osc_icon('write.png') . ' ' . $osC_Order->getCustomer('email_address');
    ?>
</p>
          </fieldset>
        </td>
        <td width="33%" valign="top">
          <fieldset style="border: 0; height: 100%;">
            <legend style="margin-left: -20px; font-weight: bold;"><?php 
    echo osc_icon('home.png') . ' ' . $osC_Language->get('subsection_shipping_address');
    ?>
</legend>
 function createStoreCredit($data)
 {
     global $osC_Database, $osC_Language;
     $error = false;
     $osC_Database->startTransaction();
     //order refund
     $Qinsert = $osC_Database->query('insert into :table_orders_refunds (orders_refunds_type, orders_id, credit_slips_id, sub_total, shipping, handling, refund_total, comments, date_added) values (:orders_refunds_type, :orders_id, :credit_slips_id, :sub_total, :shipping, :handling, :refund_total, :comments, now())');
     $Qinsert->bindTable(':table_orders_refunds', TABLE_ORDERS_REFUNDS);
     $Qinsert->bindInt(':orders_refunds_type', ORDERS_RETURNS_TYPE_STORE_CREDIT);
     $Qinsert->bindInt(':orders_id', $data['orders_id']);
     $Qinsert->bindRaw(':credit_slips_id', 'null');
     $Qinsert->bindValue(':sub_total', $data['sub_total']);
     $Qinsert->bindValue(':shipping', $data['shipping_fee']);
     $Qinsert->bindValue(':handling', $data['handling']);
     $Qinsert->bindValue(':refund_total', $data['sub_total'] + $data['shipping_fee'] + $data['handling']);
     $Qinsert->bindValue(':comments', $data['comments']);
     $Qinsert->setLogging($_SESSION['module'], null);
     $Qinsert->execute();
     if ($osC_Database->isError()) {
         $error = true;
     } else {
         $orders_refunds_id = $osC_Database->nextID();
         //orders refunds products
         $return_products = explode(';', $data['return_quantity']);
         foreach ($return_products as $product) {
             list($orders_products_id, $quantity) = explode(':', $product);
             $Qproduct = $osC_Database->query('insert into :table_orders_refunds_products (orders_refunds_id, orders_products_id, products_quantity) values (:orders_refunds_id, :orders_products_id, :products_quantity)');
             $Qproduct->bindTable(':table_orders_refunds_products', TABLE_ORDERS_REFUNDS_PRODUCTS);
             $Qproduct->bindInt(':orders_refunds_id', $orders_refunds_id);
             $Qproduct->bindInt(':orders_products_id', $orders_products_id);
             $Qproduct->bindInt(':products_quantity', $quantity);
             $Qproduct->setLogging($_SESSION['module'], $orders_refunds_id);
             $Qproduct->execute();
             if ($osC_Database->isError()) {
                 $error = true;
                 break;
             }
             if ($error === false) {
                 $Qupdate = $osC_Database->query('update :table_orders_products set products_return_quantity = products_return_quantity + :products_return_quantity where orders_products_id = :orders_products_id');
                 $Qupdate->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
                 $Qupdate->bindInt(':products_return_quantity', $quantity);
                 $Qupdate->bindInt(':orders_products_id', $orders_products_id);
                 $Qupdate->setLogging($_SESSION['module'], $orders_refunds_id);
                 $Qupdate->execute();
                 if ($osC_Database->isError()) {
                     $error = true;
                     break;
                 }
             }
             if ($error === false && $data['restock_quantity'] === true) {
                 $Qcheck = $osC_Database->query('select products_id from :table_orders_products where orders_products_id = :orders_products_id and orders_id = :orders_id');
                 $Qcheck->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
                 $Qcheck->bindInt(':orders_products_id', $orders_products_id);
                 $Qcheck->bindInt(':orders_id', $data['orders_id']);
                 $Qcheck->setLogging($_SESSION['module'], $orders_refunds_id);
                 $Qcheck->execute();
                 $products_id = $Qcheck->valueInt('products_id');
                 if (!osC_Product::restock($data['orders_id'], $orders_products_id, $products_id, $quantity)) {
                     $error = true;
                     break;
                 }
             }
         }
     }
     if ($error === false) {
         $Qreturn = $osC_Database->query('update :table_orders_returns set orders_returns_status_id = :orders_returns_status_id, admin_comments = :admin_comments, date_updated = now() where orders_returns_id = :id');
         $Qreturn->bindTable(':table_orders_returns', TABLE_ORDERS_RETURNS);
         $Qreturn->bindInt(':orders_returns_status_id', ORDERS_RETURNS_STATUS_REFUNDED_STORE_CREDIT);
         $Qreturn->bindValue(':admin_comments', $data['comment']);
         $Qreturn->bindInt(':id', $data['orders_returns_id']);
         $Qreturn->setLogging($_SESSION['module'], $data['orders_returns_id']);
         $Qreturn->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qcustomer = $osC_Database->query('select customers_id from :table_orders where orders_id = :orders_id');
         $Qcustomer->bindTable(':table_orders', TABLE_ORDERS);
         $Qcustomer->bindInt(':orders_id', $data['orders_id']);
         $Qcustomer->execute();
         $customers_id = $Qcustomer->valueInt('customers_id');
         $Qhistory = $osC_Database->query('insert into :table_customers_credits_history (customers_id, action_type, date_added, amount, comments) values (:customers_id, :action_type, now(), :amount, :comments)');
         $Qhistory->bindTable(':table_customers_credits_history', TABLE_CUSTOMERS_CREDITS_HISTORY);
         $Qhistory->bindInt(':customers_id', $customers_id);
         $Qhistory->bindInt(':action_type', STORE_CREDIT_ACTION_TYPE_ORDER_REFUNDED);
         $Qhistory->bindValue(':amount', $data['sub_total'] + $data['shipping_fee'] + $data['handling']);
         $Qhistory->bindValue(':comments', sprintf($osC_Language->get('infomation_store_credit_from_order'), $data['orders_id']));
         $Qhistory->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
         if ($error === false) {
             $Qupdate = $osC_Database->query('update :table_customers set customers_credits = (customers_credits + :customers_credits) where customers_id = :customers_id');
             $Qupdate->bindTable(':table_customers', TABLE_CUSTOMERS);
             $Qupdate->bindRaw(':customers_credits', $data['sub_total'] + $data['shipping_fee'] + $data['handling']);
             $Qupdate->bindInt(':customers_id', $customers_id);
             $Qupdate->setLogging($_SESSION['module'], $data['$orders_refunds_id']);
             $Qupdate->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         $osC_Order = new osC_Order($data['orders_id']);
         $return_products_ids = array();
         $return_products_qty = array();
         $return_products = explode(';', $data['return_quantity']);
         foreach ($return_products as $product) {
             list($orders_products_id, $quantity) = explode(':', $product);
             $return_products_ids[] = $orders_products_id;
             $return_products_qty[$orders_products_id] = $quantity;
         }
         $products = array();
         foreach ($osC_Order->getProducts() as $product) {
             if (in_array($product['orders_products_id'], $return_products_ids)) {
                 $product_info = $return_products_qty[$product['orders_products_id']] . '&nbsp;x&nbsp;' . $product['name'];
                 if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_name') . ': ' . $product['senders_name'] . '</i></nobr>';
                     if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                         $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_email') . ': ' . $product['senders_email'] . '</i></nobr>';
                     }
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_name') . ': ' . $product['recipients_name'] . '</i></nobr>';
                     if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                         $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_email') . ': ' . $product['recipients_email'] . '</i></nobr>';
                     }
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;&nbsp;<i>' . $variants['groups_name'] . ': ' . $variants['values_name'] . '</i></nobr>';
                     }
                 }
                 $products[] = $product_info;
             }
         }
         $customers_name = $osC_Order->getCustomer('name');
         $customers_email_address = $osC_Order->getCustomer('email_address');
         require_once 'includes/classes/currencies.php';
         $osC_Currencies = new osC_Currencies_Admin();
         include '../includes/classes/email_template.php';
         $email_template = toC_Email_Template::getEmailTemplate('admin_create_order_store_credit');
         $email_template->setData($customers_name, $customers_email_address, implode('<br />', $products), $data['orders_id'], $osC_Currencies->format($data['sub_total'] + $data['shipping_fee'] + $data['handling']));
         $email_template->buildMessage();
         $email_template->sendEmail();
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
Example #8
0
$osC_Order = new osC_Order($_GET['oID']);
?>

<h1><?php 
echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle());
?>
</h1>

<?php 
if ($osC_MessageStack->size($osC_Template->getModule()) > 0) {
    echo $osC_MessageStack->get($osC_Template->getModule());
}
?>

<div class="infoBoxHeading"><?php 
echo osc_icon('trash.png') . ' [#' . $osC_Order->getOrderID() . '] ' . $osC_Order->getCustomer('name');
?>
</div>
<div class="infoBoxContent">
  <form name="oDelete" action="<?php 
echo osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&' . (isset($_GET['search']) ? 'search=' . $_GET['search'] . '&' : '') . (isset($_GET['status']) ? 'status=' . $_GET['status'] . '&' : '') . (isset($_GET['cID']) ? 'cID=' . $_GET['cID'] . '&' : '') . 'page=' . $_GET['page'] . '&oID=' . $osC_Order->getOrderID() . '&action=delete');
?>
" method="post">

  <p><?php 
echo $osC_Language->get('introduction_delete_order');
?>
</p>

  <p><?php 
echo '<b>#' . $osC_Order->getOrderID() . ': ' . $osC_Order->getCustomer('name') . '</b>';