コード例 #1
0
 /**
  * Get common order description:
  * - order id
  * - invoice url
  * - date
  * - comments
  *
  * @param       order       $order      Order
  *
  * @return      string                  Common order description
  */
 protected function get_common_description(OsCommerceOrder $order)
 {
     $invoice_url = tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order->info['order_id'], 'SSL', false);
     $common_info = EMAIL_TEXT_ORDER_NUMBER . ': ' . $order->info['order_id'] . "\n" . ($common_info .= EMAIL_TEXT_INVOICE_URL . ': ' . $invoice_url . "\n");
     $common_info .= EMAIL_TEXT_DATE_ORDERED . ': ' . strftime(DATE_FORMAT_LONG) . "\n";
     if ($order->info['comments']) {
         $common_info .= EMAIL_TEXT_COMMENTS . ': ' . tep_db_output($order->info['comments']) . "\n";
     }
     return $common_info;
 }
コード例 #2
0
    ?>
</b> <?php 
    echo tep_date_short($rInfo->date_added);
    ?>
</td>
          </tr>
        </table>
      </tr>
      <tr>
        <td><table witdh="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top" class="main"><b><?php 
    echo ENTRY_REVIEW;
    ?>
</b><br><br><?php 
    echo nl2br(tep_db_output(tep_break_string($rInfo->reviews_text, 15)));
    ?>
</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php 
    echo tep_draw_separator('pixel_trans.gif', '1', '10');
    ?>
</td>
      </tr>
      <tr>
        <td class="main"><b><?php 
    echo ENTRY_RATING;
    ?>
コード例 #3
0
 function before_process()
 {
     global $order_id, $order, $languages_id, $currencies, $order_totals, $customer_id, $sendto, $billto, $payment;
     $new_order_status = DEFAULT_ORDERS_STATUS_ID;
     if (OSCOM_APP_PAYPAL_PS_ORDER_STATUS_ID > 0) {
         $new_order_status = OSCOM_APP_PAYPAL_PS_ORDER_STATUS_ID;
     }
     tep_db_query("update orders set orders_status = '" . (int) $new_order_status . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
     $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => (int) $new_order_status, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
     tep_db_perform('orders_status_history', $sql_data_array);
     // initialized for the email confirmation
     $products_ordered = '';
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         // Stock Update - Joao Correia
         if (STOCK_LIMITED == 'true') {
             if (DOWNLOAD_ENABLED == 'true') {
                 $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\n                                FROM products p\n                                LEFT JOIN products_attributes pa\n                                ON p.products_id=pa.products_id\n                                LEFT JOIN products_attributes_download pad\n                                ON pa.products_attributes_id=pad.products_attributes_id\n                                WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
                 // Will work with only one option for downloadable products
                 // otherwise, we have to build the query dynamically with a loop
                 $products_attributes = isset($order->products[$i]['attributes']) ? $order->products[$i]['attributes'] : '';
                 if (is_array($products_attributes)) {
                     $stock_query_raw .= " AND pa.options_id = '" . (int) $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . (int) $products_attributes[0]['value_id'] . "'";
                 }
                 $stock_query = tep_db_query($stock_query_raw);
             } else {
                 $stock_query = tep_db_query("select products_quantity from products where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
             }
             if (tep_db_num_rows($stock_query) > 0) {
                 $stock_values = tep_db_fetch_array($stock_query);
                 // do not decrement quantities if products_attributes_filename exists
                 if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
                     $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
                 } else {
                     $stock_left = $stock_values['products_quantity'];
                 }
                 tep_db_query("update products set products_quantity = '" . (int) $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
                     tep_db_query("update products set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 }
             }
         }
         // Update products_ordered (for bestsellers list)
         tep_db_query("update products set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
         //------insert customer choosen option to order--------
         $attributes_exist = '0';
         $products_ordered_attributes = '';
         if (isset($order->products[$i]['attributes'])) {
             $attributes_exist = '1';
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n                                   from products_options popt, products_options_values poval, products_attributes pa\n                                   left join products_attributes_download pad\n                                   on pa.products_attributes_id=pad.products_attributes_id\n                                   where pa.products_id = '" . (int) $order->products[$i]['id'] . "'\n                                   and pa.options_id = '" . (int) $order->products[$i]['attributes'][$j]['option_id'] . "'\n                                   and pa.options_id = popt.products_options_id\n                                   and pa.options_values_id = '" . (int) $order->products[$i]['attributes'][$j]['value_id'] . "'\n                                   and pa.options_values_id = poval.products_options_values_id\n                                   and popt.language_id = '" . (int) $languages_id . "'\n                                   and poval.language_id = '" . (int) $languages_id . "'";
                     $attributes = tep_db_query($attributes_query);
                 } else {
                     $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from products_options popt, products_options_values poval, products_attributes pa where pa.products_id = '" . (int) $order->products[$i]['id'] . "' and pa.options_id = '" . (int) $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int) $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int) $languages_id . "' and poval.language_id = '" . (int) $languages_id . "'");
                 }
                 $attributes_values = tep_db_fetch_array($attributes);
                 $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
             }
         }
         //------insert customer choosen option eof ----
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
     }
     // lets start with the email confirmation
     $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link('account_history_info.php', 'order_id=' . $order_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($order->info['comments']) {
         $email_order .= tep_db_output($order->info['comments']) . "\n\n";
     }
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
     }
     if ($order->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
     }
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
     if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = $GLOBALS[$payment];
         $email_order .= $payment_class->title . "\n\n";
         if ($payment_class->email_footer) {
             $email_order .= $payment_class->email_footer . "\n\n";
         }
     }
     tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     // send emails to other people
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
     // load the after_process function from the payment modules
     $this->after_process();
 }
コード例 #4
0
ファイル: reviews.php プロジェクト: digideskio/oscmax2
    ?>
</b> <?php 
    echo tep_date_short($rInfo->date_added);
    ?>
</td>
          </tr>
        </table>
      </tr>
      <tr>
        <td><table witdh="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top" class="main"><b><?php 
    echo ENTRY_REVIEW;
    ?>
</b><br><br><?php 
    echo nl2br(tep_db_output($rInfo->reviews_text));
    ?>
</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php 
    echo tep_draw_separator('pixel_trans.gif', '1', '10');
    ?>
</td>
      </tr>
      <tr>
        <td class="main"><b><?php 
    echo ENTRY_RATING;
    ?>
コード例 #5
0
                $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount']);
                tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
            }
            $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
        }
    }
    //------insert customer choosen option eof ----
    $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
    $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
    $total_cost += $total_products_price;
    $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
}
// lets start with the email confirmation
$email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
if ($order->info['comments']) {
    $email_order .= tep_db_output($order->info['comments']) . "\n\n";
}
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
    $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
}
if ($order->content_type != 'virtual') {
    $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
}
$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
if (is_object(${$payment})) {
    $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
    $payment_class = ${$payment};
    $email_order .= $payment_class->title . "\n\n";
    if ($payment_class->email_footer) {
        $email_order .= $payment_class->email_footer . "\n\n";
コード例 #6
0
ファイル: orders.php プロジェクト: ratepay/oscommerce-module
                                            <td class="smallText" align="center"><b><?php 
    echo TABLE_HEADING_COMMENTS;
    ?>
</b></td>
                                        </tr>
                                        <?php 
    $orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");
    if (tep_db_num_rows($orders_history_query)) {
        while ($orders_history = tep_db_fetch_array($orders_history_query)) {
            echo '          <tr>' . "\n" . '            <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . '            <td class="smallText" align="center">';
            if ($orders_history['customer_notified'] == '1') {
                echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";
            } else {
                echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";
            }
            echo '            <td class="smallText">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n" . '            <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . '&nbsp;</td>' . "\n" . '          </tr>' . "\n";
        }
    } else {
        echo '          <tr>' . "\n" . '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . '          </tr>' . "\n";
    }
    ?>
                                    </table></td>
                            </tr>
                            <tr>
                                <td class="main"><br><b><?php 
    echo TABLE_HEADING_COMMENTS;
    ?>
</b></td>
                            </tr>
                            <tr>
                                <td><?php 
コード例 #7
0
ファイル: edit_orders.php プロジェクト: rrecurse/IntenseCart
                            <td width="91" align="center" class="smallText" style="border:solid 1px #0099FF; border-top:0; border-left:0"><b><?php 
    echo TABLE_HEADING_DATE_ADDED;
    ?>
</b></td>
                            <td align="center" class="smallText" style="border-bottom:solid 1px #0099FF;"><b><?php 
    echo TABLE_HEADING_COMMENTS;
    ?>
</b></td>
                          </tr>
<?php 
    $admin_comments_query = tep_db_query("SELECT orders_id, \n\t\t\t\t\t\t\t\t\t\t\t\t date_added, \n\t\t\t\t\t\t\t\t\t\t\t\t comments, \n\t\t\t\t\t\t\t\t\t\t\t\t admin_user \n\t\t\t\t\t\t\t\t\t\t FROM admin_comments \n\t\t\t\t\t\t\t\t\t\t WHERE orders_id = '" . tep_db_input($oID) . "'\n\t\t\t\t\t\t\t\t\t\t ORDER BY date_added\n\t\t\t\t\t\t\t\t\t\t");
    if (tep_db_num_rows($admin_comments_query)) {
        while ($admin_history = tep_db_fetch_array($admin_comments_query)) {
            echo '<tr>
					<td class="smallText" align="center"  style="border-right:solid 1px #0099FF; padding:10px;">' . tep_datetime_short($admin_history['date_added']) . (!empty($admin_history['admin_user']) ? '<br><br><b>By: ' . $admin_history['admin_user'] : '') . '</b></td>
					<td class="smallText" style="padding:10px;">' . tep_db_output($admin_history['comments']) . '&nbsp;</td>
				</tr>';
        }
    } else {
        echo '<tr>
				<td class="smallText" colspan="2" style="padding:10px;">No Admin Comments.</td>
			  </tr>';
    }
    ?>
			</table></td>
                    </tr>
                    <tr> 
                      <td> 
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
                          <tr> 
                            <td class="main" style="padding-top:10px;"><b>Admin Only Comments</b></td>
コード例 #8
0
 function before_process()
 {
     global $cart_PayPal_Pro_HS_ID, $customer_id, $pphs_result, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, ${$payment};
     $result = false;
     if (isset($_GET['tx']) && !empty($_GET['tx'])) {
         // direct payment (eg, credit card)
         $result = $this->_app->getApiResult('APP', 'GetTransactionDetails', array('TRANSACTIONID' => $_GET['tx']), OSCOM_APP_PAYPAL_HS_STATUS == '1' ? 'live' : 'sandbox');
     } elseif (isset($_POST['txn_id']) && !empty($_POST['txn_id'])) {
         // paypal payment
         $result = $this->_app->getApiResult('APP', 'GetTransactionDetails', array('TRANSACTIONID' => $_POST['txn_id']), OSCOM_APP_PAYPAL_HS_STATUS == '1' ? 'live' : 'sandbox');
     }
     if (!in_array($result['ACK'], array('Success', 'SuccessWithWarning'))) {
         tep_redirect(tep_href_link('shopping_cart.php', 'error_message=' . stripslashes($result['L_LONGMESSAGE0'])));
     }
     $order_id = substr($cart_PayPal_Pro_HS_ID, strpos($cart_PayPal_Pro_HS_ID, '-') + 1);
     $seller_accounts = array($this->_app->getCredentials('HS', 'email'));
     if (tep_not_null($this->_app->getCredentials('HS', 'email_primary'))) {
         $seller_accounts[] = $this->_app->getCredentials('HS', 'email_primary');
     }
     if (!isset($result['RECEIVERBUSINESS']) || !in_array($result['RECEIVERBUSINESS'], $seller_accounts) || $result['INVNUM'] != $order_id || $result['CUSTOM'] != $customer_id) {
         tep_redirect(tep_href_link('shopping_cart.php'));
     }
     $pphs_result = $result;
     $check_query = tep_db_query("select orders_status from orders where orders_id = '" . (int) $order_id . "' and customers_id = '" . (int) $customer_id . "'");
     $tx_order_id = $pphs_result['INVNUM'];
     $tx_customer_id = $pphs_result['CUSTOM'];
     if (!tep_db_num_rows($check_query) || $order_id != $tx_order_id || $customer_id != $tx_customer_id) {
         tep_redirect(tep_href_link('shopping_cart.php'));
     }
     $check = tep_db_fetch_array($check_query);
     $this->verifyTransaction();
     $new_order_status = DEFAULT_ORDERS_STATUS_ID;
     if ($check['orders_status'] != OSCOM_APP_PAYPAL_HS_PREPARE_ORDER_STATUS_ID) {
         $new_order_status = $check['orders_status'];
     }
     if (OSCOM_APP_PAYPAL_HS_ORDER_STATUS_ID > 0 && $check['orders_status'] == OSCOM_APP_PAYPAL_HS_ORDER_STATUS_ID) {
         $new_order_status = OSCOM_APP_PAYPAL_HS_ORDER_STATUS_ID;
     }
     tep_db_query("update orders set orders_status = '" . (int) $new_order_status . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
     $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => (int) $new_order_status, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
     tep_db_perform('orders_status_history', $sql_data_array);
     // initialized for the email confirmation
     $products_ordered = '';
     $subtotal = 0;
     $total_tax = 0;
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         // Stock Update - Joao Correia
         if (STOCK_LIMITED == 'true') {
             if (DOWNLOAD_ENABLED == 'true') {
                 $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\n                                FROM products p\n                                LEFT JOIN products_attributes pa\n                                ON p.products_id=pa.products_id\n                                LEFT JOIN products_attributes_download pad\n                                ON pa.products_attributes_id=pad.products_attributes_id\n                                WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
                 // Will work with only one option for downloadable products
                 // otherwise, we have to build the query dynamically with a loop
                 $products_attributes = $order->products[$i]['attributes'];
                 if (is_array($products_attributes)) {
                     $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
                 }
                 $stock_query = tep_db_query($stock_query_raw);
             } else {
                 $stock_query = tep_db_query("select products_quantity from products where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
             }
             if (tep_db_num_rows($stock_query) > 0) {
                 $stock_values = tep_db_fetch_array($stock_query);
                 // do not decrement quantities if products_attributes_filename exists
                 if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
                     $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
                 } else {
                     $stock_left = $stock_values['products_quantity'];
                 }
                 tep_db_query("update products set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
                     tep_db_query("update products set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 }
             }
         }
         // Update products_ordered (for bestsellers list)
         tep_db_query("update products set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
         //------insert customer choosen option to order--------
         $attributes_exist = '0';
         $products_ordered_attributes = '';
         if (isset($order->products[$i]['attributes'])) {
             $attributes_exist = '1';
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n                                   from products_options popt, products_options_values poval, products_attributes pa\n                                   left join products_attributes_download pad\n                                   on pa.products_attributes_id=pad.products_attributes_id\n                                   where pa.products_id = '" . $order->products[$i]['id'] . "'\n                                   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n                                   and pa.options_id = popt.products_options_id\n                                   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n                                   and pa.options_values_id = poval.products_options_values_id\n                                   and popt.language_id = '" . $languages_id . "'\n                                   and poval.language_id = '" . $languages_id . "'";
                     $attributes = tep_db_query($attributes_query);
                 } else {
                     $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from products_options popt, products_options_values poval, products_attributes pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
                 }
                 $attributes_values = tep_db_fetch_array($attributes);
                 $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
             }
         }
         //------insert customer choosen option eof ----
         $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
         $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
         $total_cost += $total_products_price;
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
     }
     // lets start with the email confirmation
     $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link('account_history_info.php', 'order_id=' . $order_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($order->info['comments']) {
         $email_order .= tep_db_output($order->info['comments']) . "\n\n";
     }
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
     }
     if ($order->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
     }
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
     if (is_object(${$payment})) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = ${$payment};
         $email_order .= $payment_class->title . "\n\n";
         if ($payment_class->email_footer) {
             $email_order .= $payment_class->email_footer . "\n\n";
         }
     }
     tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     // send emails to other people
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
     // load the after_process function from the payment modules
     $this->after_process();
     $cart->reset(true);
     // unregister session variables used during checkout
     tep_session_unregister('sendto');
     tep_session_unregister('billto');
     tep_session_unregister('shipping');
     tep_session_unregister('payment');
     tep_session_unregister('comments');
     tep_session_unregister('cart_PayPal_Pro_HS_ID');
     tep_session_unregister('pphs_result');
     tep_session_unregister('pphs_key');
     tep_redirect(tep_href_link('checkout_process.php', '', 'SSL'));
 }
コード例 #9
0
ファイル: edit_orders.php プロジェクト: digideskio/oscmax2
            if (ORDER_EDITOR_USE_AJAX == 'true') {
                echo '  <tr class="' . $rowClass . '" id="commentRow' . $orders_history['orders_status_history_id'] . '" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this, \'' . $rowClass . '\')">' . "\n" . '    <td class="smallText" align="center"><div id="do_not_delete"><input name="update_comments[' . $orders_history['orders_status_history_id'] . '][delete]" type="checkbox" onClick="updateCommentsField(\'delete\', \'' . $orders_history['orders_status_history_id'] . '\', this.checked, \'\', this)"></div></td>' . "\n" . '    <td class="smallText">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . '    <td class="smallText" align="center">';
            } else {
                echo '  <tr class="' . $rowClass . '" id="commentRow' . $orders_history['orders_status_history_id'] . '" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this, \'' . $rowClass . '\')">' . "\n" . '    <td class="smallText" align="center"><div id="do_not_delete"><input name="update_comments[' . $orders_history['orders_status_history_id'] . '][delete]" type="checkbox"></div></td>' . "\n" . '    <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . '    <td class="smallText" align="center">';
            }
            if ($orders_history['customer_notified'] == '1') {
                echo tep_image(DIR_WS_ICONS . 'tick.png', ICON_TICK) . "</td>\n";
            } else {
                echo tep_image(DIR_WS_ICONS . 'cross.png', ICON_CROSS) . "</td>\n";
            }
            echo '    <td class="smallText" align="left">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n";
            echo '    <td class="smallText" align="left">';
            if (ORDER_EDITOR_USE_AJAX == 'true') {
                echo tep_draw_textarea_field("update_comments[" . $orders_history['orders_status_history_id'] . "][comments]", "40", "5", "" . tep_db_output($orders_history['comments']) . "", "onChange=\"updateCommentsField('update', '" . $orders_history['orders_status_history_id'] . "', 'false', encodeURIComponent(this.value))\"") . '' . "\n" . '    </td>' . "\n";
            } else {
                echo tep_draw_textarea_field("update_comments[" . $orders_history['orders_status_history_id'] . "][comments]", "40", "5", "" . tep_db_output($orders_history['comments']) . "") . '' . "\n" . '    </td>' . "\n";
            }
            echo '  </tr>' . "\n";
        }
    } else {
        echo '  <tr>' . "\n" . '    <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . '  </tr>' . "\n";
    }
    ?>
  </table> 
  </div>

  <div>
    <?php 
    echo tep_draw_separator('pixel_trans.gif', '1', '1');
    ?>
  </div>
コード例 #10
0
 function before_process()
 {
     global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID, $order_total_modules;
     global ${$payment}, $onePageCheckout;
     $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-') + 1);
     $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
     if (tep_db_num_rows($check_query)) {
         $check = tep_db_fetch_array($check_query);
         if ($check['orders_status'] == MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID) {
             $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => '');
             tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
         }
     }
     tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
     $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
     tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
     // initialized for the email confirmation
     $products_ordered = '';
     $subtotal = 0;
     $total_tax = 0;
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         // Stock Update - Joao Correia
         //++++ QT Pro: Begin Changed code
         $products_stock_attributes = null;
         if (STOCK_LIMITED == 'true') {
             $products_attributes = $order->products[$i]['attributes'];
             //      if (DOWNLOAD_ENABLED == 'true')
             //++++ QT Pro: End Changed Code
             $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\n                                FROM " . TABLE_PRODUCTS . " p\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                ON p.products_id=pa.products_id\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                ON pa.products_attributes_id=pad.products_attributes_id\n                                WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
             // Will work with only one option for downloadable products
             // otherwise, we have to build the query dynamically with a loop
             //++++ QT Pro: Begin Changed code
             //      $products_attributes = $order->products[$i]['attributes'];
             //++++ QT Pro: End Changed Code
             if (is_array($products_attributes)) {
                 $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
             }
             $stock_query = tep_db_query($stock_query_raw);
         } else {
             $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
         }
         if (tep_db_num_rows($stock_query) > 0) {
             $stock_values = tep_db_fetch_array($stock_query);
             //++++ QT Pro: Begin Changed code
             $actual_stock_bought = $order->products[$i]['qty'];
             $download_selected = false;
             if (DOWNLOAD_ENABLED == 'true' && isset($stock_values['products_attributes_filename']) && tep_not_null($stock_values['products_attributes_filename'])) {
                 $download_selected = true;
                 $products_stock_attributes = '$$DOWNLOAD$$';
             }
             // If not downloadable and attributes present, adjust attribute stock
             if (!$download_selected && is_array($products_attributes)) {
                 $all_nonstocked = true;
                 $products_stock_attributes_array = array();
                 foreach ($products_attributes as $attribute) {
                     if ($attribute['track_stock'] == 1) {
                         $products_stock_attributes_array[] = $attribute['option_id'] . "-" . $attribute['value_id'];
                         $all_nonstocked = false;
                     }
                 }
                 if ($all_nonstocked) {
                     $actual_stock_bought = $order->products[$i]['qty'];
                 } else {
                     asort($products_stock_attributes_array, SORT_NUMERIC);
                     $products_stock_attributes = implode(",", $products_stock_attributes_array);
                     $attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '{$products_stock_attributes}' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                     if (tep_db_num_rows($attributes_stock_query) > 0) {
                         $attributes_stock_values = tep_db_fetch_array($attributes_stock_query);
                         $attributes_stock_left = $attributes_stock_values['products_stock_quantity'] - $order->products[$i]['qty'];
                         tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . $attributes_stock_left . "' where products_stock_attributes = '{$products_stock_attributes}' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                         $actual_stock_bought = $attributes_stock_left < 1 ? $attributes_stock_values['products_stock_quantity'] : $order->products[$i]['qty'];
                     } else {
                         $attributes_stock_left = 0 - $order->products[$i]['qty'];
                         tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " (products_id, products_stock_attributes, products_stock_quantity) values ('" . tep_get_prid($order->products[$i]['id']) . "', '" . $products_stock_attributes . "', '" . $attributes_stock_left . "')");
                         $actual_stock_bought = 0;
                     }
                 }
             }
             //        $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
             //      }
             //      if (tep_db_num_rows($stock_query) > 0) {
             //        $stock_values = tep_db_fetch_array($stock_query);
             // do not decrement quantities if products_attributes_filename exists
             if (!$download_selected) {
                 $stock_left = $stock_values['products_quantity'] - $actual_stock_bought;
                 tep_db_query("UPDATE " . TABLE_PRODUCTS . " \n                        SET products_quantity = products_quantity - '" . $actual_stock_bought . "' \n                        WHERE products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 //++++ QT Pro: End Changed Code
                 if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
                     tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 }
             }
         }
         // Update products_ordered (for bestsellers list)
         tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
         //++++ QT Pro: Begin Changed code
         if (!isset($products_stock_attributes)) {
             $products_stock_attributes = null;
         }
         $sql_data_array = array('orders_id' => $insert_id, 'products_id' => tep_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty'], 'products_stock_attributes' => $products_stock_attributes);
         //++++ QT Pro: End Changed Code
         tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
         $order_products_id = tep_db_insert_id();
         // Start - CREDIT CLASS Gift Voucher Contribution
         //       if (isset($order_total_modules)) {
         //            $order_total_modules->update_credit_account($i);
         //        }
         // End - CREDIT CLASS Gift Voucher Contribution
         //------insert customer choosen option to order--------
         $attributes_exist = '0';
         $products_ordered_attributes = '';
         if (isset($order->products[$i]['attributes'])) {
             $attributes_exist = '1';
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n                                   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                   on pa.products_attributes_id=pad.products_attributes_id\n                                   where pa.products_id = '" . $order->products[$i]['id'] . "'\n                                   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n                                   and pa.options_id = popt.products_options_id\n                                   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n                                   and pa.options_values_id = poval.products_options_values_id\n                                   and popt.language_id = '" . $languages_id . "'\n                                   and poval.language_id = '" . $languages_id . "'";
                     $attributes = tep_db_query($attributes_query);
                 } else {
                     $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
                 }
                 $attributes_values = tep_db_fetch_array($attributes);
                 $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
             }
         }
         //------insert customer choosen option eof ----
         $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
         $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
         $total_cost += $total_products_price;
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
     }
     // Start - CREDIT CLASS Gift Voucher Contribution
     if (isset($order_total_modules)) {
         $order_total_modules->apply_credit();
     }
     // End - CREDIT CLASS Gift Voucher Contribution
     // lets start with the email confirmation
     $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($order->info['comments']) {
         $email_order .= tep_db_output($order->info['comments']) . "\n\n";
     }
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
     }
     /* One Page Checkout - BEGIN */
     $sendToFormatted = tep_address_label($customer_id, $sendto, 0, '', "\n");
     if (ONEPAGE_CHECKOUT_ENABLED == 'True') {
         $sendToFormatted = $onePageCheckout->getAddressFormatted('sendto');
     }
     $billToFormatted = tep_address_label($customer_id, $billto, 0, '', "\n");
     if (ONEPAGE_CHECKOUT_ENABLED == 'True') {
         $billToFormatted = $onePageCheckout->getAddressFormatted('billto');
     }
     /* One Page Checkout - END */
     if ($order->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
     }
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
     if (is_object(${$payment})) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = ${$payment};
         $email_order .= $payment_class->title . "\n\n";
         if ($payment_class->email_footer) {
             $email_order .= $payment_class->email_footer . "\n\n";
         }
     }
     tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     // send emails to other people
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
     // load the after_process function from the payment modules
     $this->after_process();
     $cart->reset(true);
     // unregister session variables used during checkout
     tep_session_unregister('sendto');
     tep_session_unregister('billto');
     tep_session_unregister('shipping');
     tep_session_unregister('payment');
     tep_session_unregister('comments');
     // Added Bugfix 157
     if (tep_session_is_registered('credit_covers')) {
         tep_session_unregister('credit_covers');
     }
     if (isset($order_total_modules)) {
         $order_total_modules->clear_posts();
     }
     // End - CREDIT CLASS Gift Voucher Contribution
     tep_session_unregister('cart_PayPal_Standard_ID');
     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 }
コード例 #11
0
 function before_process()
 {
     global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PostFinance_ID;
     global ${$payment};
     $order_id = substr($cart_PostFinance_ID, strpos($cart_PostFinance_ID, '-') + 1);
     $order_status = $_GET['STATUS'];
     $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
     if (tep_db_num_rows($check_query)) {
         $check = tep_db_fetch_array($check_query);
         if ($check['orders_status'] == MODULE_PAYMENT_POSTFINANCE_PREPARE_ORDER_STATUS_ID) {
             $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_POSTFINANCE_PREPARE_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => '');
             tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
         }
     }
     if ($order_status == '5' || $order_status == '9' || $order_status == '91' || $order_status == '51') {
         tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_POSTFINANCE_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_POSTFINANCE_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
     }
     if ($order_status == '5') {
         $comment_status = 'PostFinance IPN Verified [Payment has been authorized]';
     } elseif ($order_status == '9') {
         $comment_status = 'PostFinance IPN Verified [Payment has been accepted]';
     } elseif ($order_status == '51' || $order_status == '91') {
         $comment_status = 'PostFinance IPN Verified [Payment is pending]';
     }
     if ($order_status == "2") {
         $comment_status = 'PostFinance IPN Invalid [Declined]';
     } elseif ($order_status == "52" || $order_status == "92") {
         $comment_status = 'PostFinance IPN Invalid [Exception occured]';
     } elseif ($order_status == "1") {
         $comment_status = 'PostFinance IPN Invalid [Cancelled]';
     }
     $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_POSTFINANCE_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_POSTFINANCE_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $comment_status);
     tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
     // initialized for the email confirmation
     $products_ordered = '';
     $subtotal = 0;
     $total_tax = 0;
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         if (STOCK_LIMITED == 'true') {
             if (DOWNLOAD_ENABLED == 'true') {
                 $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\r\n                                FROM " . TABLE_PRODUCTS . " p\r\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\r\n                                ON p.products_id=pa.products_id\r\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\r\n                                ON pa.products_attributes_id=pad.products_attributes_id\r\n                                WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
                 $products_attributes = $order->products[$i]['attributes'];
                 if (is_array($products_attributes)) {
                     $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
                 }
                 $stock_query = tep_db_query($stock_query_raw);
             } else {
                 $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
             }
             if (tep_db_num_rows($stock_query) > 0) {
                 $stock_values = tep_db_fetch_array($stock_query);
                 if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
                     $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
                 } else {
                     $stock_left = $stock_values['products_quantity'];
                 }
                 if ($order_status == '5' || $order_status == '9' || $order_status == '91' || $order_status == '51') {
                     tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                     if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
                         tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                     }
                 }
             }
         }
         if ($order_status == '5' || $order_status == '9' || $order_status == '91' || $order_status == '51') {
             tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
         }
         //------insert customer choosen option to order--------
         $attributes_exist = '0';
         $products_ordered_attributes = '';
         if (isset($order->products[$i]['attributes'])) {
             $attributes_exist = '1';
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\r\n                                   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\r\n                                   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\r\n                                   on pa.products_attributes_id=pad.products_attributes_id\r\n                                   where pa.products_id = '" . $order->products[$i]['id'] . "'\r\n                                   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\r\n                                   and pa.options_id = popt.products_options_id\r\n                                   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\r\n                                   and pa.options_values_id = poval.products_options_values_id\r\n                                   and popt.language_id = '" . $languages_id . "'\r\n                                   and poval.language_id = '" . $languages_id . "'";
                     $attributes = tep_db_query($attributes_query);
                 } else {
                     $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
                 }
                 $attributes_values = tep_db_fetch_array($attributes);
                 $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
             }
         }
         //------insert customer choosen option eof ----
         $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
         $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
         $total_cost += $total_products_price;
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
     }
     // lets start with the email confirmation
     $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($order->info['comments']) {
         $email_order .= tep_db_output($order->info['comments']) . "\n\n";
     }
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
     }
     if ($order->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
     }
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
     if (is_object(${$payment})) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = ${$payment};
         $email_order .= $payment_class->title . "\n\n";
         if ($payment_class->email_footer) {
             $email_order .= $payment_class->email_footer . "\n\n";
         }
     }
     if ($order_status == '5' || $order_status == '9' || $order_status == '91' || $order_status == '51') {
         tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         // send emails to other people
         if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
             tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         }
     }
     if ($order_status == '1' || $order_status == '2' || $order_status == '92' || $order_status == '52') {
         if (tep_not_null(MODULE_PAYMENT_POSTFINANCE_DEBUG_EMAIL)) {
             $email_body = '$HTTP_POST_VARS:' . "\n\n";
             reset($HTTP_POST_VARS);
             while (list($key, $value) = each($HTTP_POST_VARS)) {
                 $email_body .= $key . '=' . $value . "\n";
             }
             $email_body .= "\n" . '$HTTP_GET_VARS:' . "\n\n";
             reset($HTTP_GET_VARS);
             while (list($key, $value) = each($HTTP_GET_VARS)) {
                 $email_body .= $key . '=' . $value . "\n";
             }
             tep_mail('', MODULE_PAYMENT_POSTFINANCE_DEBUG_EMAIL, 'Post Finance IPN Invalid Process', $email_body, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         }
         tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . $order_id . '"');
         tep_redirect(tep_href_link('checkout_payment.php'));
     }
     // load the after_process function from the payment modules
     $this->after_process();
     $cart->reset(true);
     // unregister session variables used during checkout
     tep_session_unregister('sendto');
     tep_session_unregister('billto');
     tep_session_unregister('shipping');
     tep_session_unregister('payment');
     tep_session_unregister('comments');
     tep_session_unregister('cart_PostFinance_ID');
     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 }
コード例 #12
0
 function before_process()
 {
     global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID;
     $insert_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-') + 1);
     $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int) $insert_id . "'");
     if (tep_db_num_rows($check_query)) {
         $check = tep_db_fetch_array($check_query);
         if ($check['orders_status'] == MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID) {
             $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => '');
             tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
         }
     }
     tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int) $insert_id . "'");
     $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
     tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
     // initialized for the email confirmation
     $products_ordered = '';
     $subtotal = 0;
     $total_tax = 0;
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         // Update products_ordered (for bestsellers list)
         tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
         //------insert customer choosen option eof ----
         $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
         $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
         $total_cost += $total_products_price;
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . "\n";
     }
     // lets start with the email confirmation
     $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long(DATE_FORMAT_LONG) . "\n\n";
     if ($order->info['comments']) {
         $email_order .= tep_db_output($order->info['comments']) . "\n\n";
     }
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
     }
     if ($order->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, false) . "\n";
     }
     if ($billto != false) {
         //		$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
         //						EMAIL_SEPARATOR . "\n" .
         //						tep_address_label($customer_id, $billto, false) . "\n\n";
     }
     if (is_object(${$payment})) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = ${$payment};
         $email_order .= $payment_class->title . "\n\n";
         if ($payment_class->email_footer) {
             $email_order .= strip_tags($payment_class->email_footer) . "\n\n";
         }
     }
     $email_subject = STORE_NAME . ' - ' . sprintf(EMAIL_TEXT_SUBJECT, $insert_id);
     tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], $email_subject, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     // send emails to other people
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, $email_subject, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
     // load the after_process function from the payment modules
     $this->after_process();
     $cart->reset(true);
     $order = new order($insert_id);
     $order_total_sum = 0;
     $order_shipping_sum = 0;
     reset($order->totals);
     while (list(, $order_total) = each($order->totals)) {
         if ($order_total['class'] == 'ot_total') {
             $order_total_sum = $order_total['value'];
         } elseif ($order_total['class'] == 'ot_shipping') {
             $order_shipping_sum = $order_total['value'];
         }
     }
     $order_shipping_title = strtolower($order->info['shipping_method']);
     if (mb_strpos($order_shipping_title, 'самовывоз', 0, 'CP1251') !== false) {
         $order_shipping_id = 1;
     } elseif (mb_strpos($order_shipping_title, 'подмосковье', 0, 'CP1251') !== false) {
         if ($order_shipping_sum == 0) {
             $order_shipping_id = 5;
         } else {
             $order_shipping_id = 4;
         }
     } elseif (mb_strpos($order_shipping_title, 'курьером', 0, 'CP1251') !== false) {
         if ($order_shipping_sum == 0) {
             $order_shipping_id = 3;
         } else {
             $order_shipping_id = 2;
         }
     } elseif (mb_strpos($order_shipping_title, 'почт', 0, 'CP1251') !== false) {
         if (DOMAIN_ZONE == 'ru') {
             $order_shipping_id = 6;
         } elseif (DOMAIN_ZONE == 'ua') {
             $order_shipping_id = 8;
         } elseif (DOMAIN_ZONE == 'by') {
             $order_shipping_id = 9;
         }
     } elseif (strpos($order_shipping_title, 'postal') !== false) {
         $order_shipping_id = 7;
     } elseif (strpos($order_shipping_title, 'deutsche') !== false) {
         $order_shipping_id = 10;
     } else {
         $order_shipping_id = 0;
     }
     $order_payment_id = 0;
     $order_payment_title = strtolower($order->info['payment_method']);
     if (mb_strpos($order_payment_title, 'налич', 0, 'CP1251') !== false) {
         $order_payment_id = 1;
     } elseif (strpos($order_payment_title, 'order') !== false) {
         $order_payment_id = 6;
     } elseif (strpos($order_payment_title, 'check') !== false) {
         $order_payment_id = 7;
     } elseif (strpos($order_payment_title, 'pal') !== false) {
         $order_payment_id = 8;
     } elseif (mb_strpos($order_payment_title, 'налож', 0, 'CP1251') !== false) {
         $order_payment_id = 2;
     } elseif (mb_strpos($order_payment_title, 'банк', 0, 'CP1251') !== false) {
         $order_payment_id = 3;
     } elseif (mb_strpos($order_payment_title, 'безнал', 0, 'CP1251') !== false) {
         $order_payment_id = 4;
     } elseif (mb_strpos($order_payment_title, 'почтовым', 0, 'CP1251') !== false) {
         $order_payment_id = 5;
     }
     $date_purchased = preg_replace('/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/', '$3-$2-$1 $4:$5:$6', $order->info['date_purchased']);
     $order_file = UPLOAD_DIR . 'orders/' . SHOP_PREFIX . 'im' . $insert_id . '.csv';
     $fp = fopen($order_file, 'w');
     reset($order->products);
     $common_data = array('ORDER_ID', 'ORDER_DATE_INSERT', 'USER_ID', 'PAY_SYSTEM_ID', 'DELIVERY_ID', 'PRICE_DELIVERY', 'ORDER_PRICE', 'REGION', 'RAYON', 'CITY', 'INDEX', 'ADDRESS', 'PHONE', 'COMMENTS', 'PRODUCT_ID', 'PRODUCT_QUANTITY', 'PRODUCT_PRICE');
     fputcsvsafe($fp, $common_data, ';');
     while (list(, $product) = each($order->products)) {
         $common_data = array();
         $common_data[] = $server_prefix . 'im' . $insert_id;
         $common_data[] = $date_purchased;
         $common_data[] = $order->customer['id'];
         $common_data[] = $order_payment_id;
         // тип оплаты
         $common_data[] = $order_shipping_id;
         // тип доставки
         $common_data[] = $order_shipping_sum;
         // стоимость доставки
         $common_data[] = $order_total_sum;
         // сумма заказа
         $common_data[] = $order->delivery['state'];
         $common_data[] = $order->delivery['suburb'];
         $common_data[] = $order->delivery['city'];
         $common_data[] = $order->delivery['postcode'];
         $common_data[] = $order->delivery['street_address'];
         $common_data[] = $order->customer['telephone'];
         $common_data[] = $order->info['comments'];
         $common_data[] = $product['code'];
         $common_data[] = $product['qty'];
         $common_data[] = $product['final_price'];
         fputcsvsafe($fp, $common_data, ';');
     }
     fclose($fp);
     // unregister session variables used during checkout
     tep_session_unregister('sendto');
     tep_session_unregister('billto');
     tep_session_unregister('shipping');
     tep_session_unregister('payment');
     tep_session_unregister('comments');
     tep_session_unregister('cart_PayPal_Standard_ID');
     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 }
コード例 #13
0
ファイル: fancy.php プロジェクト: eosc/EosC-2.3
           </table>
           </td>
           </tr>
           <tr>
           <td align="center" width="95%">
           <table width="95%" border="0" cellpadding="0" cellspacing="0">
           <tr>
           <td width="95%" class="smallText">
           <table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
           <tr>
           <td width="150" align="left" valign="top" class="smallText"><?php 
                echo tep_date_short($sInfo->date_added);
                ?>
</td>
           <td align="left" valign="top" class="smallText"><?php 
                echo nl2br(tep_db_output($orders_comments['comments']));
                ?>
<br><br></td>
	</tr>
</table></td>
</tr></table></td></tr>

<?php 
            }
        }
    }
    if ($has_comments == false) {
        ?>

		 <tr>
		 <td align="center" width="95%">
コード例 #14
0
                          </tr>
<?php 
    $supply_request_history_query = tep_db_query("SELECT * FROM " . TABLE_SUPPLY_REQUEST_STATUS_HISTORY . "\r\n\t\t\t\t\t\t\t\t\t\t\t\t  WHERE supply_request_id = '" . (int) $sID . "' \r\n\t\t\t\t\t\t\t\t\t\t\t\t  ORDER BY date_added\r\n\t\t\t\t\t\t\t\t\t\t\t\t");
    if (tep_db_num_rows($supply_request_history_query)) {
        while ($supply_request_history = tep_db_fetch_array($supply_request_history_query)) {
            echo '<tr>
					<td class="smallText" align="center">' . tep_datetime_short($supply_request_history['date_added']) . '</td>
					<td class="smallText" align="center">';
            if ($supply_request_history['supplier_notified'] == '1') {
                echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK);
            } else {
                echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS);
            }
            echo '	</td>
					<td class="smallText" align="left">' . $supply_request_status_array[$supply_request_history['supply_request_status_id']] . '</td>
					<td class="smallText" align="left" width="50%">' . nl2br(tep_db_output($supply_request_history['comments'])) . '&nbsp;</td>
				  </tr>';
        }
    } else {
        echo ' <tr><td class="smallText" colspan="5">' . TEXT_NO_SUPPLY_REQUEST_HISTORY . '</td></tr>';
    }
    ?>
</table>
</td>
</tr>
<tr>
	<td>
		<table border="0" cellspacing="0" cellpadding="2" width="100%">
			<tr class="dataTableHeadingRow">
			    <td class="dataTableHeadingContent" align="left"><?php 
    echo TABLE_HEADING_STATUS;
コード例 #15
0
ファイル: orders.php プロジェクト: digideskio/oscmax2
            <td class="dataTableHeadingContent"><?php 
    echo TABLE_HEADING_TRANSACTION_INFO;
    ?>
</td>
          </tr>
<?php 
    $orders_history_query = tep_db_query("select orders_status_history_id, orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");
    if (tep_db_num_rows($orders_history_query)) {
        while ($orders_history = tep_db_fetch_array($orders_history_query)) {
            echo '          <tr class="dataTableRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)">' . "\n" . '            <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . '            <td class="smallText" align="center">';
            if ($orders_history['customer_notified'] == '1') {
                echo tep_image(DIR_WS_ICONS . 'tick.png', ICON_TICK) . "</td>\n";
            } else {
                echo tep_image(DIR_WS_ICONS . 'cross.png', ICON_CROSS) . "</td>\n";
            }
            echo '            <td class="smallText">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n" . '            <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . '&nbsp;</td>' . "\n" . '            <td class="smallText">' . $paypal_wpp->get_transaction_info($orders_history['orders_status_history_id']) . '</td>' . "\n" . '          </tr>' . "\n";
        }
    } else {
        echo '          <tr>' . "\n" . '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . '          </tr>' . "\n";
    }
    ?>
        </table></td>
      </tr>
      <tr>
        <td class="main"><br><b><?php 
    echo TABLE_HEADING_NEW_ORDER_COMMENTS;
    ?>
</b></td>
      </tr>
      <tr>
        <td><?php 
コード例 #16
0
ファイル: invoice.php プロジェクト: eosc/EosC-2.3
<BR>
<P>
<BR>
<P>
<BR>
<P>
<tr>
<td class="smallText" align="center"><b>Date Added</b></td>
<td class="smallText" align="center"><b>Status</b></td>
<td class="smallText" align="center"><b>Comments</b></td>
</tr>
<tr>
<?php 
$orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");
if (tep_db_num_rows($orders_history_query)) {
    while ($orders_history = tep_db_fetch_array($orders_history_query)) {
        echo '          <tr>' . "\n" . '            <td class="smallText" valign="middle" align="center" width = 100>' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . '            <td class="smallText" valign="middle" align="center" width = 100>' . $orders_status_array[$orders_history['orders_status_id']] . '&nbsp;</td>' . "\n" . '            <td class="smallText" valign="middle">' . nl2br(tep_db_output($orders_history['comments'])) . '&nbsp;</td>' . "\n" . '          </tr>' . "\n";
    }
} else {
    echo '          <tr>' . "\n" . '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . '          </tr>' . "\n";
}
?>
</tr>
</table></CENTER>
<!-- body_text_eof //-->

<br>
</body>
</html>
<?php 
require DIR_WS_INCLUDES . 'application_bottom.php';
コード例 #17
0
 function before_process()
 {
     global $HTTP_GET_VARS, $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_Sofortueberweisung_Direct_ID;
     global ${$payment};
     $md5var4 = md5($HTTP_GET_VARS['sovar3'] . MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_CNT_PASSWORT);
     // Statusupdate nur wenn keine Cartänderung vorgenommen
     $order_total_integer = number_format($order->info['total'] * $currencies->get_value('EUR'), 2, '.', '') * 100;
     if ($order_total_integer < 1) {
         $order_total_integer = '000';
     } elseif ($order_total_integer < 10) {
         $order_total_integer = '00' . $order_total_integer;
     } elseif ($order_total_integer < 100) {
         $order_total_integer = '0' . $order_total_integer;
     }
     $order_id = substr($cart_Sofortueberweisung_Direct_ID, strpos($cart_Sofortueberweisung_Direct_ID, '-') + 1);
     $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
     if (tep_db_num_rows($check_query)) {
         $check = tep_db_fetch_array($check_query);
         if ($check['orders_status'] == MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_PREPARE_ORDER_STATUS_ID) {
             $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_PREPARE_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => '');
             if ($md5var4 == $HTTP_GET_VARS['sovar4'] && (int) $HTTP_GET_VARS['betrag_integer'] == (int) $order_total_integer) {
                 $sql_data_array['comments'] = 'Zahlung durch Sofortüberweisung Weiter-Button/Weiterleitung bestätigt!';
             } else {
                 $sql_data_array['comments'] = MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_TEXT_CHECK_ERROR . '\\n' . $HTTP_GET_VARS['betrag_integer'] / 100 . '!=' . $order_total_integer / 100;
             }
             if (MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_STORE_TRANSACTION_DETAILS == 'True') {
                 $sql_data_array['comments'] = (!empty($sql_data_array['comments']) ? $sql_data_array['comments'] . "\n\n" : '') . serialize($HTTP_GET_VARS) . "\n" . serialize($HTTP_POST_VARS);
             }
             tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
         }
     }
     tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
     $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
     tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
     // initialized for the email confirmation
     $products_ordered = '';
     $subtotal = 0;
     $total_tax = 0;
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         // Stock Update - Joao Correia
         if (STOCK_LIMITED == 'true') {
             if (DOWNLOAD_ENABLED == 'true') {
                 $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\r\n                                FROM " . TABLE_PRODUCTS . " p\r\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\r\n                                ON p.products_id=pa.products_id\r\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\r\n                                ON pa.products_attributes_id=pad.products_attributes_id\r\n                                WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
                 // Will work with only one option for downloadable products
                 // otherwise, we have to build the query dynamically with a loop
                 $products_attributes = $order->products[$i]['attributes'];
                 if (is_array($products_attributes)) {
                     $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
                 }
                 $stock_query = tep_db_query($stock_query_raw);
             } else {
                 $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
             }
             if (tep_db_num_rows($stock_query) > 0) {
                 $stock_values = tep_db_fetch_array($stock_query);
                 // do not decrement quantities if products_attributes_filename exists
                 if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
                     $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
                 } else {
                     $stock_left = $stock_values['products_quantity'];
                 }
                 tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
                     tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 }
             }
         }
         // Update products_ordered (for bestsellers list)
         tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
         //------insert customer choosen option to order--------
         $attributes_exist = '0';
         $products_ordered_attributes = '';
         if (isset($order->products[$i]['attributes'])) {
             $attributes_exist = '1';
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\r\n                                   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\r\n                                   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\r\n                                   on pa.products_attributes_id=pad.products_attributes_id\r\n                                   where pa.products_id = '" . $order->products[$i]['id'] . "'\r\n                                   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\r\n                                   and pa.options_id = popt.products_options_id\r\n                                   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\r\n                                   and pa.options_values_id = poval.products_options_values_id\r\n                                   and popt.language_id = '" . $languages_id . "'\r\n                                   and poval.language_id = '" . $languages_id . "'";
                     $attributes = tep_db_query($attributes_query);
                 } else {
                     $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
                 }
                 $attributes_values = tep_db_fetch_array($attributes);
                 $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
             }
         }
         //------insert customer choosen option eof ----
         $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
         $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
         $total_cost += $total_products_price;
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
     }
     // lets start with the email confirmation
     $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($order->info['comments']) {
         $email_order .= tep_db_output($order->info['comments']) . "\n\n";
     }
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
     }
     if ($order->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
     }
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
     if (is_object(${$payment})) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = ${$payment};
         $email_order .= $payment_class->title . "\n\n";
         if ($payment_class->email_footer) {
             $email_order .= $payment_class->email_footer . "\n\n";
         }
     }
     tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     // send emails to other people
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
     // load the after_process function from the payment modules
     $this->after_process();
     $cart->reset(true);
     // unregister session variables used during checkout
     tep_session_unregister('sendto');
     tep_session_unregister('billto');
     tep_session_unregister('shipping');
     tep_session_unregister('payment');
     tep_session_unregister('comments');
     tep_session_unregister('cart_Sofortueberweisung_Direct_ID');
     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 }
コード例 #18
0
 exit;*/
 if ($notify_customer == 'on' && $shipping_status == '2') {
     //tep_mail($check_status['customers_name'], $check_status['customers_email_address'], 'Shipment of items in order '. (int)$orders_id .' by Sareez.com'  , $email, 'Sareez.com', '*****@*****.**');
     //tep_mail($check_status['customers_name'], '*****@*****.**', 'Shipment of items in order '. (int)$orders_id .' by Sareez.com'  , $email, 'Sareez.com', '*****@*****.**');
     $error = false;
     $CFG['smtp_debug'] = 1;
     $CFG['smtp_server'] = 'ssl://smtp.gmail.com';
     $CFG['smtp_port'] = '465';
     $CFG['smtp_authenticate'] = 'true';
     $CFG['smtp_username'] = '******';
     $CFG['smtp_password'] = '******';
     //$to	= '*****@*****.**';
     $to = trim($check_status['customers_email_address']);
     $name = 'Sareez';
     $email_address = '*****@*****.**';
     $enquiry = nl2br(tep_db_output($emailed));
     $subject = 'Shipment of items in order ' . (int) $orders_id . ' by Sareez.com';
     $order_no = (int) $orders_id;
     class phpmailerAppException extends Exception
     {
         public function errorMessage()
         {
             $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />";
             return $errorMsg;
         }
     }
     try {
         $to = $to;
         if (filter_var($to, FILTER_VALIDATE_EMAIL) === FALSE) {
             throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!<br />");
         }
コード例 #19
0
   </tr>
<?php 
    $r = 0;
    $orders_history_query = tep_db_query("SELECT orders_status_history_id, orders_status_id, date_added, customer_notified, comments \n                                    FROM " . TABLE_ORDERS_STATUS_HISTORY . " \n\t\t\t\t\t\t\t\t\tWHERE orders_id = '" . tep_db_prepare_input($_GET['oID']) . "' \n\t\t\t\t\t\t\t\t\tORDER BY date_added");
    if (tep_db_num_rows($orders_history_query)) {
        while ($orders_history = tep_db_fetch_array($orders_history_query)) {
            $r++;
            $rowClass = $r / 2 == floor($r / 2) ? 'dataTableRowOver' : 'dataTableRow';
            echo '  <tr class="' . $rowClass . '" id="commentRow' . $orders_history['orders_status_history_id'] . '" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this, \'' . $rowClass . '\')">' . "\n" . '	  <td class="smallText" align="center"><div id="do_not_delete"><input name="update_comments[' . $orders_history['orders_status_history_id'] . '][delete]" type="checkbox" onClick="updateCommentsField(\'delete\', \'' . $orders_history['orders_status_history_id'] . '\', this.checked, \'\', this)"></div></td>' . "\n" . '    <td class="dataTableHeadingContent" align="left" width="10">&nbsp;</td>' . "\n" . '    <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . '    <td class="dataTableHeadingContent" align="left" width="10">&nbsp;</td>' . "\n" . '    <td class="smallText" align="center">';
            if ($orders_history['customer_notified'] == '1') {
                echo tep_image(DIR_WS_ICONS . 'tick.png', ICON_TICK) . "</td>\n";
            } else {
                echo tep_image(DIR_WS_ICONS . 'cross.png', ICON_CROSS) . "</td>\n";
            }
            echo '    <td class="dataTableHeadingContent" align="left" width="10">&nbsp;</td>' . "\n" . '    <td class="smallText" align="left">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n";
            echo '    <td class="dataTableHeadingContent" align="left" width="10">&nbsp;</td>' . "\n" . '    <td class="smallText" align="left">' . tep_draw_textarea_field("update_comments[" . $orders_history['orders_status_history_id'] . "][comments]", "40", "5", "" . tep_db_output($orders_history['comments']) . "", "onChange=\"updateCommentsField('update', '" . $orders_history['orders_status_history_id'] . "', 'false', encodeURIComponent(this.value))\"") . '' . "\n" . '    </td>' . "\n";
            echo '  </tr>' . "\n";
        }
    } else {
        echo '  <tr>' . "\n" . '    <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . '  </tr>' . "\n";
    }
    ?>
  
  </table>
  
  <?php 
}
// end if ($action == 'insert_new_comment') {
//12. insert shipping method when one doesn't already exist
if ($action == 'insert_shipping') {
    $order = new manualOrder($_GET['oID']);
コード例 #20
0
ファイル: orders.php プロジェクト: Akofelaz/oscommerce2
</strong></td>
        <td class="dataTableHeadingContent" align="center"><strong><?php 
    echo TABLE_HEADING_COMMENTS;
    ?>
</strong></td>
        <td class="dataTableHeadingContent" align="right"><strong><?php 
    echo TABLE_HEADING_CUSTOMER_NOTIFIED;
    ?>
</strong></td>
      </tr>

<?php 
    $orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added desc");
    if (tep_db_num_rows($orders_history_query)) {
        while ($orders_history = tep_db_fetch_array($orders_history_query)) {
            echo '      <tr class="dataTableRow">' . "\n" . '        <td class="dataTableContent" valign="top">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . '        <td class="dataTableContent" valign="top">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n" . '        <td class="dataTableContent" valign="top">' . nl2br(tep_db_output($orders_history['comments'])) . '&nbsp;</td>' . "\n" . '        <td class="dataTableContent" valign="top" align="right">';
            if ($orders_history['customer_notified'] == '1') {
                echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK);
            } else {
                echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS);
            }
            echo '        </td>' . "\n" . '      </tr>' . "\n";
        }
    } else {
        echo '      <tr class="dataTableRow">' . "\n" . '        <td class="dataTableContent" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . '      </tr>' . "\n";
    }
    ?>

    </table>
  </div>
コード例 #21
0
 function before_process()
 {
     /* ** Altered for CCGV **
           global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID, $$payment, $HTTP_GET_VARS, $HTTP_POST_VARS, $messageStack;
     
           $result = false;
     	*/
     global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID, ${$payment}, $HTTP_GET_VARS, $HTTP_POST_VARS, $messageStack, $order_total_modules;
     $result = false;
     $order_total_modules->apply_credit();
     /* **EOF alteration for CCGV ** */
     if (isset($HTTP_POST_VARS['receiver_email']) && ($HTTP_POST_VARS['receiver_email'] == MODULE_PAYMENT_PAYPAL_STANDARD_ID || defined('MODULE_PAYMENT_PAYPAL_STANDARD_PRIMARY_ID') && tep_not_null(MODULE_PAYMENT_PAYPAL_STANDARD_PRIMARY_ID) && $HTTP_POST_VARS['receiver_email'] == MODULE_PAYMENT_PAYPAL_STANDARD_PRIMARY_ID)) {
         $parameters = 'cmd=_notify-validate';
         foreach ($HTTP_POST_VARS as $key => $value) {
             $parameters .= '&' . $key . '=' . urlencode(stripslashes($value));
         }
         $result = $this->sendTransactionToGateway($this->form_action_url, $parameters);
     }
     if ($result != 'VERIFIED') {
         if (defined('MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_INVALID_TRANSACTION')) {
             $messageStack->add_session('header', MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_INVALID_TRANSACTION);
         }
         $this->sendDebugEmail($result);
         tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
     }
     $this->verifyTransaction();
     $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-') + 1);
     $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "' and customers_id = '" . (int) $customer_id . "'");
     if (!tep_db_num_rows($check_query) || $order_id != $HTTP_POST_VARS['invoice'] || $customer_id != $HTTP_POST_VARS['custom']) {
         tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
     }
     $check = tep_db_fetch_array($check_query);
     $new_order_status = DEFAULT_ORDERS_STATUS_ID;
     if ($check['orders_status'] != MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID) {
         $new_order_status = $check['orders_status'];
     }
     if (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 && $check['orders_status'] == MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID) {
         $new_order_status = MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID;
     }
     tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (int) $new_order_status . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
     $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => (int) $new_order_status, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
     tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
     // initialized for the email confirmation
     $products_ordered = '';
     $subtotal = 0;
     $total_tax = 0;
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         // Stock Update - Joao Correia
         if (STOCK_LIMITED == 'true') {
             if (DOWNLOAD_ENABLED == 'true') {
                 $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\n                                FROM " . TABLE_PRODUCTS . " p\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                ON p.products_id=pa.products_id\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                ON pa.products_attributes_id=pad.products_attributes_id\n                                WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
                 // Will work with only one option for downloadable products
                 // otherwise, we have to build the query dynamically with a loop
                 $products_attributes = $order->products[$i]['attributes'];
                 if (is_array($products_attributes)) {
                     $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
                 }
                 $stock_query = tep_db_query($stock_query_raw);
             } else {
                 $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
             }
             if (tep_db_num_rows($stock_query) > 0) {
                 $stock_values = tep_db_fetch_array($stock_query);
                 // do not decrement quantities if products_attributes_filename exists
                 if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
                     $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
                 } else {
                     $stock_left = $stock_values['products_quantity'];
                 }
                 tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
                     tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 }
             }
         }
         // Update products_ordered (for bestsellers list)
         tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
         //------insert customer choosen option to order--------
         $attributes_exist = '0';
         $products_ordered_attributes = '';
         if (isset($order->products[$i]['attributes'])) {
             $attributes_exist = '1';
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n                                   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                   on pa.products_attributes_id=pad.products_attributes_id\n                                   where pa.products_id = '" . $order->products[$i]['id'] . "'\n                                   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n                                   and pa.options_id = popt.products_options_id\n                                   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n                                   and pa.options_values_id = poval.products_options_values_id\n                                   and popt.language_id = '" . $languages_id . "'\n                                   and poval.language_id = '" . $languages_id . "'";
                     $attributes = tep_db_query($attributes_query);
                 } else {
                     $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
                 }
                 $attributes_values = tep_db_fetch_array($attributes);
                 $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
             }
         }
         //------insert customer choosen option eof ----
         $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
         $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
         $total_cost += $total_products_price;
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
     }
     // lets start with the email confirmation
     $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($order->info['comments']) {
         $email_order .= tep_db_output($order->info['comments']) . "\n\n";
     }
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
     }
     if ($order->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
     }
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
     if (is_object(${$payment})) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = ${$payment};
         $email_order .= $payment_class->title . "\n\n";
         if ($payment_class->email_footer) {
             $email_order .= $payment_class->email_footer . "\n\n";
         }
     }
     tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     // send emails to other people
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
     // load the after_process function from the payment modules
     $this->after_process();
     $cart->reset(true);
     // unregister session variables used during checkout
     tep_session_unregister('sendto');
     tep_session_unregister('billto');
     tep_session_unregister('shipping');
     tep_session_unregister('payment');
     tep_session_unregister('comments');
     tep_session_unregister('cart_PayPal_Standard_ID');
     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 }
コード例 #22
0
    $navigation_path_array = array_reverse($navigation->path);
    reset($navigation_path_array);
    while (list($i, $navigation_path_row) = each($navigation_path_array)) {
        $order_products_id = $navigation_path_row['real_get']['products_id'];
        if (basename($navigation_path_row['real_page']) == FILENAME_PRODUCT_INFO && tep_not_null($order_products_id) && !in_array($order_products_id, $order_products)) {
            tep_order_log($insert_id, 'About to insert into products_viewed');
            tep_db_query("insert into " . TABLE_ORDERS_PRODUCTS_VIEWED . " (orders_id, products_id) values ('" . (int) $insert_id . "', '" . (int) $order_products_id . "')");
            tep_order_log($insert_id, 'After inserted into products_viewed');
        }
    }
}
tep_order_log($insert_id, 'Insert into products_viewed finished');
// lets start with the email confirmation
$email_order = (defined('EMAIL_TEXT_WELCOME') && tep_not_null(EMAIL_TEXT_WELCOME) ? sprintf(EMAIL_TEXT_WELCOME, STORE_OWNER) : STORE_NAME) . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . '" target="_blank">' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . '</a>' . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long(date('Y-m-d')) . "\n";
if ($order->info['comments']) {
    $email_order .= "\n" . EMAIL_TEXT_COMMENTS . "\n" . EMAIL_SEPARATOR . "\n" . tep_db_output($order->info['comments']) . "\n";
}
$email_order .= "\n" . EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
    $order_totals_title = trim(strip_tags($order_totals[$i]['title']));
    if (substr($order_totals_title, -1) != ':') {
        $order_totals_title .= ':';
    }
    $email_order .= $order_totals_title . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
}
if ($order->content_type != 'virtual') {
    $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
    if (ALLOW_SHOW_AVAILABLE_IN == 'true' && $order->content_type != 'virtual') {
        $transfer_to_delivery_date = tep_calculate_date_available($order->info['delivery_transfer']);
        //	  $delivery_to_city_date = date('Y-m-d', strtotime($transfer_to_delivery_date) + $order->info['city_delivery_days']*60*60*24);
        $delivery_to_city_date = tep_calculate_date_available($order->info['delivery_transfer'] + $order->info['city_delivery_days']);
コード例 #23
0
 function before_process()
 {
     global $customer_id, $order, $order_totals, $sendto, $billto, $payment, $currencies;
     global ${$payment};
     $pass = false;
     if (isset($_GET['transaction_id']) && isset($_GET['msid'])) {
         if ($_GET['transaction_id'] == substr($GLOBALS[$this->_mbcartID], strpos($GLOBALS[$this->_mbcartID], '-') + 1)) {
             if ($_GET['msid'] == strtoupper(md5(MODULE_PAYMENT_MONEYBOOKERS_MERCHANT_ID . $_GET['transaction_id'] . strtoupper(md5(MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD))))) {
                 $pass = true;
             }
         }
     } elseif (isset($_GET['osig']) && $_GET['osig'] == md5(MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD . $GLOBALS[$this->_mbcartID])) {
         $pass = true;
     }
     if ($pass == true) {
         $order_id = substr($GLOBALS[$this->_mbcartID], strpos($GLOBALS[$this->_mbcartID], '-') + 1);
         $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
         if (tep_db_num_rows($check_query)) {
             $check = tep_db_fetch_array($check_query);
             if ($check['orders_status'] == MODULE_PAYMENT_MONEYBOOKERS_PREPARE_ORDER_STATUS_ID) {
                 $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_MONEYBOOKERS_PREPARE_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => '');
                 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
             }
         }
         tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
         $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
         tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
         // initialized for the email confirmation
         $products_ordered = '';
         $subtotal = 0;
         $total_tax = 0;
         for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
             // Stock Update - Joao Correia
             if (STOCK_LIMITED == 'true') {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\n                                  FROM " . TABLE_PRODUCTS . " p\n                                  LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                  ON p.products_id=pa.products_id\n                                  LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                  ON pa.products_attributes_id=pad.products_attributes_id\n                                  WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
                     // Will work with only one option for downloadable products
                     // otherwise, we have to build the query dynamically with a loop
                     $products_attributes = $order->products[$i]['attributes'];
                     if (is_array($products_attributes)) {
                         $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
                     }
                     $stock_query = tep_db_query($stock_query_raw);
                 } else {
                     $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 }
                 if (tep_db_num_rows($stock_query) > 0) {
                     $stock_values = tep_db_fetch_array($stock_query);
                     // do not decrement quantities if products_attributes_filename exists
                     if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
                         $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
                     } else {
                         $stock_left = $stock_values['products_quantity'];
                     }
                     tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                     if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
                         tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                     }
                 }
             }
             // Update products_ordered (for bestsellers list)
             tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
             //------insert customer choosen option to order--------
             $attributes_exist = '0';
             $products_ordered_attributes = '';
             if (isset($order->products[$i]['attributes'])) {
                 $attributes_exist = '1';
                 for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                     if (DOWNLOAD_ENABLED == 'true') {
                         $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                     left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                     on pa.products_attributes_id=pad.products_attributes_id\n                                     where pa.products_id = '" . $order->products[$i]['id'] . "'\n                                     and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n                                     and pa.options_id = popt.products_options_id\n                                     and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n                                     and pa.options_values_id = poval.products_options_values_id\n                                     and popt.language_id = '" . $_SESSION['languages_id'] . "'\n                                     and poval.language_id = '" . $_SESSION['languages_id'] . "'";
                         $attributes = tep_db_query($attributes_query);
                     } else {
                         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
                     }
                     $attributes_values = tep_db_fetch_array($attributes);
                     $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
                 }
             }
             //------insert customer choosen option eof ----
             $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
             $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
             $total_cost += $total_products_price;
             $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
         }
         // lets start with the email confirmation
         $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
         if ($order->info['comments']) {
             $email_order .= tep_db_output($order->info['comments']) . "\n\n";
         }
         $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
         for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
             $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
         }
         if ($order->content_type != 'virtual') {
             $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
         }
         $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
         if (is_object(${$payment})) {
             $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
             $payment_class = ${$payment};
             $email_order .= $payment_class->title . "\n\n";
             if ($payment_class->email_footer) {
                 $email_order .= $payment_class->email_footer . "\n\n";
             }
         }
         tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         // send emails to other people
         if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
             tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         }
         // load the after_process function from the payment modules
         $this->after_process();
         $_SESSION['cart']->reset(true);
         // unregister session variables used during checkout
         unset($_SESSION['sendto']);
         unset($_SESSION['billto']);
         unset($_SESSION['shipping']);
         unset($_SESSION['payment']);
         unset($_SESSION['comments']);
         unset($_SESSION[$this->_mbcartID]);
         tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
     } else {
         tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
     }
 }
コード例 #24
0
        //Customer State
        $transaction_string .= '   "' . tep_db_output($orders['customers_country']) . '"' . "\n";
        //Customer Country
        $transaction_string .= ');' . "\n";
        // Get products info for Analytics "Products"
        $item_string = '';
        $items_query = tep_db_query("SELECT DISTINCT o.products_id, o.products_model, o.products_name, o.final_price, o.products_quantity, p2c.categories_id, cd.categories_name \r\n                                   from " . TABLE_ORDERS_PRODUCTS . " o, \r\n                                        " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, \r\n                                        " . TABLE_CATEGORIES_DESCRIPTION . " cd  \r\n                                 WHERE o.orders_id = '" . $order_id . "' \r\n                                   and p2c.products_id = o.products_id \r\n                                   and cd.categories_id = p2c.categories_id \r\n                                   and cd.language_id = '" . $languages_id . "' \r\n                                 ORDER BY products_name");
        while ($items = tep_db_fetch_array($items_query)) {
            $item_string .= 'pageTracker._addItem(' . "\n";
            $item_string .= '  "' . $order_id . '",' . "\n";
            //Order ID
            $item_string .= '  "' . $items['products_id'] . '",' . "\n";
            // SKU
            $item_string .= '  "' . tep_db_output($items['products_name']) . '",' . "\n";
            //Product Name
            $item_string .= '  "' . tep_db_output($items['categories_name']) . '", ' . "\n";
            // Category Name
            $item_string .= '  "' . number_format($items['final_price'], 2) . '",' . "\n";
            // Price
            $item_string .= '  "' . $items['products_quantity'] . '"' . "\n";
            //Qty Ordered
            $item_string .= ');' . "\n";
        }
        $rci .= "\n";
        $rci .= $transaction_string . $item_string . "\n";
        $rci .= '  pageTracker._trackTrans();' . "\n";
    }
    // if page == checkout_success eof
    $rci .= '</script>' . "\n";
} else {
    //show anyletics code not updated only on view source
コード例 #25
0
 /**
  * Cribbed (again) from osCommerce. Their design philosophy must be: Always
  * Repeat Yourself (At Least If You Want To Do Anything That's Not Baked In.) --
  * ARY(ATLIFYWTDATNBI)
  */
 public function sendOrderEmail($productsOrdered, $orderTotals)
 {
     include OSC_INCLUDES_PATH . 'includes/languages/english/checkout_process.php';
     $emailText = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $this->fields['orders_id'] . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $this->fields['orders_id'], 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($this->fields['comments']) {
         $emailText .= tep_db_output($this->fields['comments']) . "\n\n";
     }
     $emailText .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $productsOrdered . EMAIL_SEPARATOR . "\n";
     for ($i = 0, $n = sizeof($orderTotals); $i < $n; $i++) {
         $emailText .= strip_tags($orderTotals[$i]['title']) . ' ' . strip_tags($orderTotals[$i]['text']) . "\n";
     }
     extract($this->getShippingAddress());
     $emailText .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . "{$name}\n{$street_address}\n" . ($suburb ? $suburb . "\n" : "") . "{$city}, {$state} {$postcode}\n{$country}\n\n";
     extract($this->getShippingAddress());
     $emailText .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . "{$name}\n{$street_address}\n" . ($suburb ? $suburb . "\n" : "") . "{$city}, {$state} {$postcode}\n{$country}\n\n";
     //    print_r($this);
     //    die($emailText);
     tep_mail($this->fields['customers_firstname'] . ' ' . $this->fields['customers_lastname'], $this->fields['customers_email_address'], EMAIL_TEXT_SUBJECT, $emailText, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $emailText, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
 }
コード例 #26
0
ファイル: edit_orders.php プロジェクト: eosc/EosC-2.3
    echo TABLE_HEADING_COMMENTS;
    ?>
</td>
   </tr>
<?php 
    $orders_history_query = tep_db_query("select * from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");
    if (tep_db_num_rows($orders_history_query)) {
        while ($orders_history = tep_db_fetch_array($orders_history_query)) {
            echo '  <tr>' . "\n" . '    <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . '    <td class="dataTableHeadingContent" align="left" width="10">&nbsp;</td>' . "\n" . '    <td class="smallText" align="center">';
            if ($orders_history['customer_notified'] == '1') {
                echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";
            } else {
                echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";
            }
            echo '    <td class="dataTableHeadingContent" align="left" width="10">&nbsp;</td>' . "\n" . '    <td class="smallText" align="left">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n";
            echo '    <td class="dataTableHeadingContent" align="left" width="10">&nbsp;</td>' . "\n" . '    <td class="smallText" align="left">' . nl2br(tep_db_output($orders_history['comments'])) . '&nbsp;</td>' . "\n";
            echo '  </tr>' . "\n";
        }
    } else {
        echo '  <tr>' . "\n" . '    <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . '  </tr>' . "\n";
    }
    ?>
</table>

			  </td>
      </tr>
      <tr>
        <td><?php 
    echo tep_draw_separator('pixel_trans.gif', '1', '1');
    ?>
</td>