Ejemplo n.º 1
0
$xoopsTpl->assign("xoops_module_header", '<link rel="stylesheet" type="text/css" media="screen" href="' . XOOPS_URL . '/modules/osC/templates/stylesheet.css" />' . $payment_modules->javascript_validation());
require DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT;
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
include "includes/header.php";
$xoopsTpl->assign("payment_form", tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"'));
$xoopsTpl->assign("py_img", tep_image(DIR_WS_IMAGES . 'table_background_payment.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT));
if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {
    $xoopsTpl->assign("error", 1);
    $xoopsTpl->assign("err_title", tep_output_string_protected($error['title']));
    $xoopsTpl->assign("err_txt", tep_output_string_protected($error['error']));
}
$xoopsTpl->assign("chk_link", tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL'));
$xoopsTpl->assign("chk_img", tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS));
$xoopsTpl->assign("arrow_se", tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'));
$xoopsTpl->assign("cust_lbl", tep_address_label($customer_id, $billto, true, ' ', '<br>'));
$selection = $payment_modules->selection();
if (sizeof($selection) > 1) {
    $xoopsTpl->assign("selection", 1);
}
$radio_buttons = 0;
for ($i = 0, $n = sizeof($selection); $i < $n; $i++) {
    $selection[$i]['radio'] = $radio_buttons;
    if ($selection[$i]['id'] == $payment || $n == 1) {
        $selection[$i]['on'] = 1;
    }
    if (sizeof($selection) > 1) {
        $selection[$i]['field'] = tep_draw_radio_field('payment', $selection[$i]['id']);
    } else {
        $selection[$i]['field'] = tep_draw_hidden_field('payment', $selection[$i]['id']);
    }
Ejemplo n.º 2
0
</td>
                <td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="main" align="center" valign="top"><b><?php 
    echo SELECTED_ADDRESS;
    ?>
</b><br><?php 
    echo tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif');
    ?>
</td>
                    <td><?php 
    echo tep_draw_separator('pixel_trans.gif', '10', '1');
    ?>
</td>
                    <td class="main" valign="top"><?php 
    echo tep_address_label($customer_id, $HTTP_GET_VARS['delete'], true, ' ', '<br>');
    ?>
</td>
                    <td><?php 
    echo tep_draw_separator('pixel_trans.gif', '10', '1');
    ?>
</td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php 
Ejemplo n.º 3
0
    $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";
    }
}
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
$payment_modules->after_process();
Ejemplo n.º 4
0
<div class="contentContainer">
  <h2><?php 
echo PRIMARY_ADDRESS_TITLE;
?>
</h2>

  <div class="contentText">
    <div class="ui-widget infoBoxContainer" style="float: right;">
      <div class="ui-widget-header infoBoxHeading"><?php 
echo PRIMARY_ADDRESS_TITLE;
?>
</div>

      <div class="ui-widget-content infoBoxContents">
        <?php 
echo tep_address_label($customer_id, $customer_default_address_id, true, ' ', '<br />');
?>
      </div>
    </div>

    <?php 
echo PRIMARY_ADDRESS_DESCRIPTION;
?>
  </div>

  <div style="clear: both;"></div>

  <h2><?php 
echo ADDRESS_BOOK_TITLE;
?>
</h2>
Ejemplo n.º 5
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));
     }
 }
      <div class="alert alert-warning">
        <?php 
    echo TEXT_SELECTED_PAYMENT_DESTINATION;
    ?>
      </div>
    </div>
    <div class="col-sm-4">
      <div class="panel panel-primary">
        <div class="panel-heading"><?php 
    echo TITLE_PAYMENT_ADDRESS;
    ?>
</div>

        <div class="panel-body">
          <?php 
    echo tep_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, ' ', '<br />');
    ?>
        </div>
      </div>
    </div>
  </div>

  <div class="clearfix"></div>

<?php 
    if ($addresses_count > 1) {
        ?>

  <div class="page-header">
    <h4><?php 
        echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES;
 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'));
 }
    <div class="col-sm-8">
      <div class="alert alert-warning"><?php 
    echo DELETE_ADDRESS_DESCRIPTION;
    ?>
</div>
    </div>
    <div class="col-sm-4">
      <div class="panel panel-danger">
        <div class="panel-heading"><?php 
    echo DELETE_ADDRESS_TITLE;
    ?>
</div>

        <div class="panel-body">
          <?php 
    echo tep_address_label($customer_id, (int) $_GET['delete'], true, ' ', '<br />');
    ?>
        </div>
      </div>
    </div>
  </div>

  <div class="buttonSet">
    <span class="buttonAction"><?php 
    echo tep_draw_button(IMAGE_BUTTON_DELETE, 'fa fa-trash', tep_href_link('address_book_process.php', 'delete=' . $_GET['delete'] . '&action=deleteconfirm&formid=' . md5($sessiontoken), 'SSL'), 'primary', NULL, 'btn-danger');
    ?>
</span>

    <?php 
    echo tep_draw_button(IMAGE_BUTTON_BACK, 'fa fa-angle-left', tep_href_link('address_book.php', '', 'SSL'));
    ?>
    $mm_ordertotal .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n" . '<br/ >';
}
//retrieve html and txt headers
$header_query = tep_db_query("select htmlheader, htmlfooter, txtheader, txtfooter from " . TABLE_MM_TEMPLATES . " where title = '" . $mail_manager_status['template'] . "'");
$header = tep_db_fetch_array($header_query);
//build email
$output_content_html = $header['htmlheader'] . $mail_manager_status['htmlcontent'] . $header['htmlfooter'];
$output_content_txt = $header['txtheader'] . $mail_manager_status['txtcontent'] . $header['txtfooter'];
$output_subject = EMAIL_TEXT_CONFIRM . STORE_NAME;
//define values for placeholder variables
$order_no = EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id;
$order_date = EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG);
// PWA Integration: Select Invoice URL if customer is a guest
if (tep_session_is_registered('customer_is_guest')) {
    $invoice_url = EMAIL_WARNING . "\n\n";
} else {
    $invoice_url = EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false);
}
$delivery_address = tep_address_label($customer_id, $sendto, 0, '', '<br />');
$billing_address = tep_address_label($customer_id, $billto, 0, '', '<br />');
$order_comments = $order->info['comments'];
$paymentmethod = $order->info['payment_method'];
$ccardtype = $order->info['cc_type'];
$payment_class = $payment_class->email_footer;
//define placeholders
$placeholders = array('$storeurl', '$storename', '$storeemail', '$separator', '$orderno', '$orderdate', '$invoiceurl', '$productsorderedhead', '$productsordered', '$deliveryaddresshead', '$deliveryaddress', '$billingaddresshead', '$billingaddress', '$paymethodhead', '$paymentmethod', '$ccardtype', '$ordercomments', '$totaltext', 'subtotaltext', '$ordertotal');
$values = array(HTTP_SERVER, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SEPARATOR, $order_no, $order_date, $invoice_url, EMAIL_TEXT_PRODUCTS, $products_ordered, EMAIL_TEXT_DELIVERY_ADDRESS, $delivery_address, EMAIL_TEXT_BILLING_ADDRESS, $billing_address, EMAIL_TEXT_PAYMENT_METHOD, $paymentmethod, $ccardtype, $order_comments, EMAIL_TEXT_TOTAL, EMAIL_TEXT_SUBTOTAL, $mm_ordertotal);
$output_content_html = str_replace($placeholders, $values, $output_content_html);
$output_content_txt = str_replace($placeholders, $values, $output_content_txt);
//send email
tep_mm_sendmail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, strip_tags($output_content_txt));
Ejemplo n.º 10
0
    //------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" . OSCOM::getDef('email_separator') . "\n" . OSCOM::getDef('email_text_order_number') . ' ' . $insert_id . "\n" . OSCOM::getDef('email_text_invoice_url') . ' ' . OSCOM::link('account_history_info.php', 'order_id=' . $insert_id, false) . "\n" . OSCOM::getDef('email_text_date_ordered') . ' ' . strftime(OSCOM::getDef('date_format_long')) . "\n\n";
if ($order->info['comments']) {
    $email_order .= HTML::outputProtected($order->info['comments']) . "\n\n";
}
$email_order .= OSCOM::getDef('email_text_products') . "\n" . OSCOM::getDef('email_separator') . "\n" . $products_ordered . OSCOM::getDef('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" . OSCOM::getDef('email_text_delivery_address') . "\n" . OSCOM::getDef('email_separator') . "\n" . tep_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
}
$email_order .= "\n" . OSCOM::getDef('email_text_billing_address') . "\n" . OSCOM::getDef('email_separator') . "\n" . tep_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
if (isset($OSCOM_PM)) {
    $email_order .= OSCOM::getDef('email_text_payment_method') . "\n" . OSCOM::getDef('email_separator') . "\n";
    $email_order .= $order->info['payment_method'] . "\n\n";
    if (isset($OSCOM_PM->email_footer)) {
        $email_order .= $OSCOM_PM->email_footer . "\n\n";
    }
}
$orderEmail = new Mail($order->customer['email_address'], $order->customer['firstname'] . ' ' . $order->customer['lastname'], STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_text_subject'));
$orderEmail->setBody($email_order);
$orderEmail->send();
// send emails to other people
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    $extraEmail = new Mail(SEND_EXTRA_ORDER_EMAILS_TO, null, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_text_subject'));
    $extraEmail->setBody($email_order);
    $extraEmail->send();
Ejemplo n.º 11
0
    $navigation->set_snapshot();
    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
require DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADDRESS_BOOK;
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
include "includes/header.php";
$xoopsTpl->assign("site_image", tep_image(DIR_WS_IMAGES . 'table_background_address_book.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT));
$xoopsTpl->assign("seperator", tep_draw_separator('pixel_trans.gif', '100%', '10'));
$xoopsTpl->assign("seperator1", tep_draw_separator('pixel_trans.gif', '10', '1'));
if ($messageStack->size('addressbook') > 0) {
    $xoopsTpl->assign("smessage", 1);
    $xoopsTpl->assign("messagetext", $messageStack->output('addressbook'));
}
$xoopsTpl->assign("arrow_se", tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'));
$xoopsTpl->assign("adr_label", tep_address_label($customer_id, $customer_default_address_id, true, ' ', '<br>'));
$addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customer_id . "' order by firstname, lastname");
$i = 0;
$xoopsTpl->assign("img_small", tep_image_button('small_edit.gif', SMALL_IMAGE_BUTTON_EDIT));
$xoopsTpl->assign("img_small_del", tep_image_button('small_delete.gif', SMALL_IMAGE_BUTTON_DELETE));
while ($addresses = tep_db_fetch_array($addresses_query)) {
    $address[$i] = $addresses;
    $format_id = tep_get_address_format_id($addresses['country_id']);
    $address[$i]['link'] = tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses['address_book_id'], 'SSL');
    $address[$i]['link_delete'] = tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $addresses['address_book_id'], 'SSL');
    if ($addresses['address_book_id'] == $customer_default_address_id) {
        $address[$i]['default_address'] = '&nbsp;<small><i>' . PRIMARY_ADDRESS . '</i></small>';
    }
    $address[$i]['name'] = tep_output_string_protected($addresses['firstname'] . ' ' . $addresses['lastname']);
    $address[$i]['address'] = tep_address_format($format_id, $addresses, true, ' ', '<br>');
    $i++;
Ejemplo n.º 12
0
    <div class="col-sm-8">
      <div class="alert alert-warning"><?php 
    echo OSCOM::getDef('delete_address_description');
    ?>
</div>
    </div>
    <div class="col-sm-4">
      <div class="panel panel-danger">
        <div class="panel-heading"><?php 
    echo OSCOM::getDef('delete_address_title');
    ?>
</div>

        <div class="panel-body">
          <?php 
    echo tep_address_label($_SESSION['customer_id'], $_GET['delete'], true, ' ', '<br />');
    ?>
        </div>
      </div>
    </div>
  </div>

  <div class="buttonSet">
    <span class="buttonAction"><?php 
    echo HTML::button(OSCOM::getDef('image_button_delete'), 'fa fa-trash', OSCOM::link('address_book_process.php', 'delete=' . $_GET['delete'] . '&action=deleteconfirm&formid=' . md5($_SESSION['sessiontoken'])), null, 'btn-danger');
    ?>
</span>

    <?php 
    echo HTML::button(OSCOM::getDef('image_button_back'), 'fa fa-angle-left', OSCOM::link('address_book.php'));
    ?>
    ?>
</b><br>
         <?php 
    echo TEXT_SELECTED_SHIPPING_DESTINATION;
    ?>
		 </div>
		</div>

        <div class="col-sm-6 col-lg-6">
         <div class="well clearfix">
			<?php 
    echo '<b>' . TITLE_SHIPPING_ADDRESS . '</b>';
    ?>
<br>
		<?php 
    echo tep_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, ' ', '<br>');
    ?>
		</div>
		</div>


<?php 
    if ($addresses_count > 1) {
        ?>
                   <div class="col-sm-12 col-lg-12">
         <div class="well clearfix">
            <b><?php 
        echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES;
        ?>
</b></br>
                <?php 
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL'));
include "includes/header.php";
include "inlcudes/form_check.js.php";
$addresses_count = tep_count_customer_address_book_entries();
$xoopsTpl->assign("form_ship", tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL'), 'post', 'onSubmit="return check_form_optional(checkout_address);"'));
$xoopsTpl->assign("site_image", tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT));
$xoopsTpl->assign("seperator", tep_draw_separator('pixel_trans.gif', '100%', '10'));
$xoopsTpl->assign("seperator1", tep_draw_separator('pixel_trans.gif', '10', '1'));
if ($messageStack->size('checkout_address') > 0) {
    $xoopsTpl->assign("message", 1);
    $xoopsTpl->assign("messagetext", $messageStack->output('checkout_address'));
}
if ($process == false) {
    $xoopsTpl->assign("process", 0);
    $xoopsTpl->assign("arrow_se", tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'));
    $xoopsTpl->assign("ship_adr", tep_address_label($customer_id, $sendto, true, ' ', '<br>'));
    if ($addresses_count > 1) {
        $xoopsTpl->assign("address", 1);
        $radio_buttons = 0;
        $i = 0;
        $addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customer_id . "'");
        while ($addresses = tep_db_fetch_array($addresses_query)) {
            $adr[$i] = $addresses;
            $adr[$i]['radio'] = $radio_buttons;
            $format_id = tep_get_address_format_id($addresses['country_id']);
            if ($addresses['address_book_id'] == $sendto) {
                $adr[$i]['sendto'] == 1;
                echo '                  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
            } else {
                echo '                  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
            }
Ejemplo n.º 15
0
    <div class="col-sm-8">
      <div class="alert alert-warning"><?php 
        echo EDIT_ADDRESS_DESCRIPTION;
        ?>
</div>
    </div>
    <div class="col-sm-4">
      <div class="panel panel-warning">
        <div class="panel-heading"><?php 
        echo SELECTED_ADDRESS;
        ?>
</div>

        <div class="panel-body">
          <?php 
        echo tep_address_label($_SESSION['customer_id'], (int) $_GET['edit'], true, ' ', '<br />');
        ?>
        </div>
      </div>
    </div>
  </div>
<?php 
    }
    ?>

<?php 
    include DIR_WS_MODULES . 'address_book_details.php';
    ?>

<?php 
    if (isset($_GET['edit']) && is_numeric($_GET['edit'])) {
<?php 
if ($_GET['payment_address'] != 'process') {
    if ($osC_Customer->hasDefaultAddress() === true) {
        ?>

<div class="moduleBox">
  <div class="outsideHeading"><?php 
        echo TABLE_HEADING_PAYMENT_ADDRESS;
        ?>
</div>

  <div class="content">
    <div style="float: right; padding: 0px 0px 10px 20px;">
      <?php 
        echo tep_address_label($osC_Customer->id, $osC_Session->value('billto'), true, ' ', '<br>');
        ?>
    </div>

    <div style="float: right; padding: 0px 0px 10px 20px; text-align: center;">
      <?php 
        echo '<b>' . TITLE_PAYMENT_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif');
        ?>
    </div>

    <?php 
        echo TEXT_SELECTED_PAYMENT_DESTINATION;
        ?>
  </div>
</div>
Ejemplo n.º 17
0
    <div class="col-sm-8">
      <div class="alert alert-warning"><?php 
echo PRIMARY_ADDRESS_DESCRIPTION;
?>
</div>
    </div>
    <div class="col-sm-4">
      <div class="panel panel-primary">
        <div class="panel-heading"><?php 
echo PRIMARY_ADDRESS_TITLE;
?>
</div>

        <div class="panel-body">
          <?php 
echo tep_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], true, ' ', '<br />');
?>
        </div>
      </div>
    </div>
  </div>

  <div class="clearfix"></div>

  <div class="page-header">
    <h4><?php 
echo ADDRESS_BOOK_TITLE;
?>
</h4>
  </div>
Ejemplo n.º 18
0
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']);
        $email_order .= "\n" . sprintf(MAX_AVAILABLE_IN, tep_date_long($transfer_to_delivery_date));
        if (ALLOW_SHOW_RECEIVE_IN == 'true' && isset($order->info['city_delivery_days'])) {
            $email_order .= ' ' . sprintf(MAX_RECEIVE_IN, tep_date_long($delivery_to_city_date));
        }
        $email_order .= "\n";
    }
}
if ($billto != false) {
    #	$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
    #					EMAIL_SEPARATOR . "\n" .
    #					tep_address_label($customer_id, $billto, 0, '', "\n") . "\n";
Ejemplo n.º 19
0
    ?>
	<fieldset>
	<legend><?php 
    echo TABLE_HEADING_BILLING_ADDRESS;
    ?>
</legend>
	<table border="0" cellspacing="0" cellpadding="0" width="100%">
	  <tr valign="top">
		<td><?php 
    echo '<strong class="errorText">' . TEXT_SELECTED_BILLING_DESTINATION . '</strong>';
    ?>
</td>
	  </tr>
	  <tr valign="top">
		<td><?php 
    echo tep_address_label($customer_id, $billto, true);
    ?>
</td>
	  </tr>
	  <tr valign="top">
		<td><?php 
    echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' . IMAGE_BUTTON_CHANGE_ADDRESS . ' &raquo;</a>';
    ?>
</td>
	  </tr>
	</table>
	</fieldset>
<?php 
}
?>
	<fieldset>
Ejemplo n.º 20
0
    //------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 . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . OSCOM::link('account_history_info.php', 'order_id=' . $insert_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
if ($order->info['comments']) {
    $email_order .= HTML::outputProtected($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($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
}
$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
if (is_object(${$_SESSION}['payment'])) {
    $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
    $payment_class = ${$_SESSION}['payment'];
    $email_order .= $order->info['payment_method'] . "\n\n";
    if (isset($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
$payment_modules->after_process();
Ejemplo n.º 21
0
 function _process()
 {
     global $osC_Database, $osC_Session, $osC_Customer, $osC_Currencies, $cart, $order, $payment_modules, $shipping_modules, $order_total_modules;
     // load selected payment module
     require DIR_WS_CLASSES . 'payment.php';
     $payment_modules = new payment($osC_Session->value('payment'));
     // load the selected shipping module
     require DIR_WS_CLASSES . 'shipping.php';
     $shipping_modules = new shipping($osC_Session->value('shipping'));
     $order = new order();
     // load the before_process function from the payment modules
     $payment_modules->before_process();
     require DIR_WS_CLASSES . 'order_total.php';
     $order_total_modules = new order_total();
     $order_totals = $order_total_modules->process();
     $Qorder = $osC_Database->query('insert into :table_orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, customers_ip_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values (:customers_id, :customers_name, :customers_company, :customers_street_address, :customers_suburb, :customers_city, :customers_postcode, :customers_state, :customers_country, :customers_telephone, :customers_email_address, :customers_address_format_id, :customers_ip_address, :delivery_name, :delivery_company, :delivery_street_address, :delivery_suburb, :delivery_city, :delivery_postcode, :delivery_state, :delivery_country, :delivery_address_format_id, :billing_name, :billing_company, :billing_street_address, :billing_suburb, :billing_city, :billing_postcode, :billing_state, :billing_country, :billing_address_format_id, :payment_method, :cc_type, :cc_owner, :cc_number, :cc_expires, :date_purchased, :orders_status, :currency, :currency_value)');
     $Qorder->bindTable(':table_orders', TABLE_ORDERS);
     $Qorder->bindInt(':customers_id', $osC_Customer->id);
     $Qorder->bindValue(':customers_name', $order->customer['firstname'] . ' ' . $order->customer['lastname']);
     $Qorder->bindValue(':customers_company', $order->customer['company']);
     $Qorder->bindValue(':customers_street_address', $order->customer['street_address']);
     $Qorder->bindValue(':customers_suburb', $order->customer['suburb']);
     $Qorder->bindValue(':customers_city', $order->customer['city']);
     $Qorder->bindValue(':customers_postcode', $order->customer['postcode']);
     $Qorder->bindValue(':customers_state', $order->customer['state']);
     $Qorder->bindValue(':customers_country', $order->customer['country']['title']);
     $Qorder->bindValue(':customers_telephone', $order->customer['telephone']);
     $Qorder->bindValue(':customers_email_address', $order->customer['email_address']);
     $Qorder->bindInt(':customers_address_format_id', $order->customer['format_id']);
     $Qorder->bindValue(':customers_ip_address', tep_get_ip_address());
     $Qorder->bindValue(':delivery_name', $order->delivery['firstname'] . ' ' . $order->delivery['lastname']);
     $Qorder->bindValue(':delivery_company', $order->delivery['company']);
     $Qorder->bindValue(':delivery_street_address', $order->delivery['street_address']);
     $Qorder->bindValue(':delivery_suburb', $order->delivery['suburb']);
     $Qorder->bindValue(':delivery_city', $order->delivery['city']);
     $Qorder->bindValue(':delivery_postcode', $order->delivery['postcode']);
     $Qorder->bindValue(':delivery_state', $order->delivery['state']);
     $Qorder->bindValue(':delivery_country', $order->delivery['country']['title']);
     $Qorder->bindInt(':delivery_address_format_id', $order->delivery['format_id']);
     $Qorder->bindValue(':billing_name', $order->billing['firstname'] . ' ' . $order->billing['lastname']);
     $Qorder->bindValue(':billing_company', $order->billing['company']);
     $Qorder->bindValue(':billing_street_address', $order->billing['street_address']);
     $Qorder->bindValue(':billing_suburb', $order->billing['suburb']);
     $Qorder->bindValue(':billing_city', $order->billing['city']);
     $Qorder->bindValue(':billing_postcode', $order->billing['postcode']);
     $Qorder->bindValue(':billing_state', $order->billing['state']);
     $Qorder->bindValue(':billing_country', $order->billing['country']['title']);
     $Qorder->bindInt(':billing_address_format_id', $order->billing['format_id']);
     $Qorder->bindValue(':payment_method', $order->info['payment_method']);
     $Qorder->bindValue(':cc_type', $order->info['cc_type']);
     $Qorder->bindValue(':cc_owner', $order->info['cc_owner']);
     $Qorder->bindValue(':cc_number', $order->info['cc_number']);
     $Qorder->bindValue(':cc_expires', $order->info['cc_expires']);
     $Qorder->bindRaw(':date_purchased', 'now()');
     $Qorder->bindValue(':orders_status', $order->info['order_status']);
     $Qorder->bindValue(':currency', $order->info['currency']);
     $Qorder->bindValue(':currency_value', $order->info['currency_value']);
     $Qorder->execute();
     $insert_id = $osC_Database->nextID();
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $Qtotals = $osC_Database->query('insert into :table_orders_total (orders_id, title, text, value, class, sort_order) values (:orders_id, :title, :text, :value, :class, :sort_order)');
         $Qtotals->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
         $Qtotals->bindInt(':orders_id', $insert_id);
         $Qtotals->bindValue(':title', $order_totals[$i]['title']);
         $Qtotals->bindValue(':text', $order_totals[$i]['text']);
         $Qtotals->bindValue(':value', $order_totals[$i]['value']);
         $Qtotals->bindValue(':class', $order_totals[$i]['code']);
         $Qtotals->bindInt(':sort_order', $order_totals[$i]['sort_order']);
         $Qtotals->execute();
     }
     $Qstatus = $osC_Database->query('insert into :table_orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values (:orders_id, :orders_status_id, :date_added, :customer_notified, :comments)');
     $Qstatus->bindTable(':table_orders_status_history', TABLE_ORDERS_STATUS_HISTORY);
     $Qstatus->bindInt(':orders_id', $insert_id);
     $Qstatus->bindInt(':orders_status_id', $order->info['order_status']);
     $Qstatus->bindRaw(':date_added', 'now()');
     $Qstatus->bindInt(':customer_notified', SEND_EMAILS == 'true' ? '1' : '0');
     $Qstatus->bindValue(':comments', $order->info['comments']);
     $Qstatus->execute();
     // initialized for the email confirmation
     $products_ordered = '';
     $subtotal = 0;
     $total_tax = 0;
     $total_weight = 0;
     $total_cost = 0;
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         // Stock Update - Joao Correia
         if (STOCK_LIMITED == 'true') {
             if (DOWNLOAD_ENABLED == 'true') {
                 $Qstock = $osC_Database->query('select products_quantity, pad.products_attributes_filename from :table_products p left join :table_products_attributes pa on (p.products_id = pa.products_id) left join :table_products_attributes_download pad on (pa.products_attributes_id = pad.products_attributes_id) where p.products_id = :products_id');
                 $Qstock->bindTable(':table_products', TABLE_PRODUCTS);
                 $Qstock->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                 $Qstock->bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD);
                 $Qstock->bindInt(':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)) {
                     $Qstock->appendQuery('and pa.options_id = :options_id and pa.options_values_id = :options_values_id');
                     $Qstock->bindInt(':options_id', $products_attributes[0]['option_id']);
                     $Qstock->bindInt(':options_values_id', $products_attributes[0]['value_id']);
                 }
             } else {
                 $Qstock = $osC_Database->query('select products_quantity from :table_products where products_id = :products_id');
                 $Qstock->bindTable(':table_products', TABLE_PRODUCTS);
                 $Qstock->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
             }
             $Qstock->execute();
             if ($Qstock->numberOfRows() > 0) {
                 $stock_left = $Qstock->valueInt('products_quantity');
                 // do not decrement quantities if products_attributes_filename exists
                 if (DOWNLOAD_ENABLED != 'true' || DOWNLOAD_ENABLED == 'true' && strlen($Qstock->value('products_attributes_filename')) < 1) {
                     $stock_left = $stock_left - $order->products[$i]['qty'];
                     $Qupdate = $osC_Database->query('update :table_products set products_quantity = :products_quantity where products_id = :products_id');
                     $Qupdate->bindTable(':table_products', TABLE_PRODUCTS);
                     $Qupdate->bindInt(':products_quantity', $stock_left);
                     $Qupdate->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
                     $Qupdate->execute();
                 }
                 if (STOCK_ALLOW_CHECKOUT == 'false' && $stock_left < 1) {
                     $Qupdate = $osC_Database->query('update :table_products set products_status = :products_status where products_id = :products_id');
                     $Qupdate->bindTable(':table_products', TABLE_PRODUCTS);
                     $Qupdate->bindInt(':products_status', 0);
                     $Qupdate->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
                     $Qupdate->execute();
                 }
             }
         }
         // Update products_ordered (for bestsellers list)
         $Qupdate = $osC_Database->query('update :table_products set products_ordered = products_ordered + :products_ordered where products_id = :products_id');
         $Qupdate->bindTable(':table_products', TABLE_PRODUCTS);
         $Qupdate->bindInt(':products_ordered', $order->products[$i]['qty']);
         $Qupdate->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
         $Qupdate->execute();
         $Qproducts = $osC_Database->query('insert into :table_orders_products (orders_id, products_id, products_model, products_name, products_price, final_price, products_tax, products_quantity) values (:orders_id, :products_id, :products_model, :products_name, :products_price, :final_price, :products_tax, :products_quantity)');
         $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
         $Qproducts->bindInt(':orders_id', $insert_id);
         $Qproducts->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
         $Qproducts->bindValue(':products_model', $order->products[$i]['model']);
         $Qproducts->bindValue(':products_name', $order->products[$i]['name']);
         $Qproducts->bindValue(':products_price', $order->products[$i]['price']);
         $Qproducts->bindValue(':final_price', $order->products[$i]['final_price']);
         $Qproducts->bindValue(':products_tax', $order->products[$i]['tax']);
         $Qproducts->bindInt(':products_quantity', $order->products[$i]['qty']);
         $Qproducts->execute();
         $order_products_id = $osC_Database->nextID();
         //------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') {
                     $Qattributes = $osC_Database->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 from :table_products_options popt, :table_products_options_values poval, :table_products_attributes pa left join :table_products_attributes_download pad on (pa.products_attributes_id = pad.products_attributes_id) where pa.products_id = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :popt_language_id and poval.language_id = :poval_language_id');
                     $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
                     $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
                     $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                     $Qattributes->bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD);
                     $Qattributes->bindInt(':products_id', $order->products[$i]['id']);
                     $Qattributes->bindInt(':options_id', $order->products[$i]['attributes'][$j]['option_id']);
                     $Qattributes->bindInt(':options_values_id', $order->products[$i]['attributes'][$j]['value_id']);
                     $Qattributes->bindInt(':popt_language_id', $osC_Session->value('languages_id'));
                     $Qattributes->bindInt(':poval_language_id', $osC_Session->value('languages_id'));
                 } else {
                     $Qattributes = $osC_Database->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 = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :popt_language_id and poval.language_id = :poval_language_id');
                     $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
                     $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
                     $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                     $Qattributes->bindInt(':products_id', $order->products[$i]['id']);
                     $Qattributes->bindInt(':options_id', $order->products[$i]['attributes'][$j]['option_id']);
                     $Qattributes->bindInt(':options_values_id', $order->products[$i]['attributes'][$j]['value_id']);
                     $Qattributes->bindInt(':popt_language_id', $osC_Session->value('languages_id'));
                     $Qattributes->bindInt(':poval_language_id', $osC_Session->value('languages_id'));
                 }
                 $Qattributes->execute();
                 $Qopa = $osC_Database->query('insert into :table_orders_products_attributes (orders_id, orders_products_id, products_options, products_options_values, options_values_price, price_prefix) values (:orders_id, :orders_products_id, :products_options, :products_options_values, :options_values_price, :price_prefix)');
                 $Qopa->bindTable(':table_orders_products_attributes', TABLE_ORDERS_PRODUCTS_ATTRIBUTES);
                 $Qopa->bindInt(':orders_id', $insert_id);
                 $Qopa->bindInt(':orders_products_id', $order_products_id);
                 $Qopa->bindValue(':products_options', $attributes_values['products_options_name']);
                 $Qopa->bindValue(':products_options_values', $attributes_values['products_options_values_name']);
                 $Qopa->bindValue(':options_values_price', $attributes_values['options_values_price']);
                 $Qopa->bindValue(':price_prefix', $attributes_values['price_prefix']);
                 $Qopa->execute();
                 if (DOWNLOAD_ENABLED == 'true' && strlen($Qattributes->value('products_attributes_filename')) > 0) {
                     $Qopd = $osC_Database->query('insert into :table_orders_products_download (orders_id, orders_products_id, orders_products_filename, download_maxdays, download_count) values (:orders_id, :orders_products_id, :orders_products_filename, :download_maxdays, :download_count)');
                     $Qopd->bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD);
                     $Qopd->bindInt(':orders_id', $insert_id);
                     $Qopd->bindInt(':orders_products_id', $order_products_id);
                     $Qopd->bindValue(':orders_products_filename', $Qattributes->value('products_attributes_filename'));
                     $Qopd->bindValue(':download_maxdays', $Qattributes->value('products_attributes_maxdays'));
                     $Qopd->bindValue(':download_count', $Qattributes->value('products_attributes_maxcount'));
                     $Qopd->execute();
                 }
                 $products_ordered_attributes .= "\n\t" . $Qattributes->value('products_options_name') . ' ' . $Qattributes->value('products_options_values_name');
             }
         }
         //------insert customer choosen option eof ----
         $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
         $total_tax += tep_calculate_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'];
         $total_cost += $order->products[$i]['final_price'];
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $osC_Currencies->displayPrice($order->products[$i]['final_price'], $order->products[$i]['tax_class_id'], $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, 'orders=' . $insert_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($order->info['comments']) {
         $email_order .= tep_output_string_protected($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($osC_Customer->id, $osC_Session->value('sendto'), 0, '', "\n") . "\n";
     }
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($osC_Customer->id, $osC_Session->value('billto'), 0, '', "\n") . "\n\n";
     $payment =& $osC_Session->value('payment');
     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 (isset($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
     $payment_modules->after_process();
     $cart->reset(true);
     // unregister session variables used during checkout
     $osC_Session->remove('sendto');
     $osC_Session->remove('billto');
     $osC_Session->remove('shipping');
     $osC_Session->remove('payment');
     $osC_Session->remove('comments');
     tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'success', 'SSL'));
 }
 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();
 }
Ejemplo n.º 23
0
 // BOF order comment fix by AlexStudio
 if ($comments) {
     $email_order .= $comments . "\n\n";
 }
 // EOF order comment fix by AlexStudio
 $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";
 }
 // BOF content type fix by AlexStudio
 /* 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 ($content_type != 'virtual') {
     // EOF content type fix by AlexStudio
     $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_format($order->delivery['format_id'], $order->delivery, 0, '', "\n") . "\n";
 }
 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_format($order->billing['format_id'], $order->billing, 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";
 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'));
 }
</div>
	</div>
	</form>
<?php 
}
echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL'), 'post', ($addresses_count < MAX_ADDRESS_BOOK_ENTRIES ? 'onsubmit="return check_form_optional(checkout_address);" ' : '') . 'class="form-div"');
if ($process == false) {
    if ($addresses_count > 0) {
        ?>
<!-- 	<fieldset>
	<legend><?php 
        echo TABLE_HEADING_SHIPPING_ADDRESS;
        ?>
</legend>
	<div><?php 
        echo tep_address_label($customer_id, $sendto, true);
        ?>
</div>
	</fieldset>
	<div class="buttons">
	  <div style="text-align: right;"><?php 
        echo tep_draw_hidden_field('action', 'submit') . tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE);
        ?>
</div>
	</div> -->
	<fieldset>
	<legend><?php 
        echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES;
        ?>
</legend>
	<table border="0" cellspacing="0" cellpadding="0" width="100%">
   <?php 
    echo $messageStack->output('addressbook');
    ?>
</div>
<?php 
}
?>
    <div class="row">
      <div class="col-sm-6 col-lg-6">
        <h3 class="small-margin-top"><?php 
echo PRIMARY_ADDRESS_TITLE;
?>
</h3>
        <div class="well">
          <address class="small-margin-bottom small-margin-top"><?php 
echo tep_address_label($_SESSION['customer_id'], isset($_SESSION['customer_default_address_id']) ? (int) $_SESSION['customer_default_address_id'] : 0, true, ' ', '<br>');
?>
</address>
        </div>
      </div>
      <div class="col-sm-6 col-lg-6">
        <h3 class="small-margin-top">&nbsp;</h3>
        <div class="well">
          <p> <?php 
echo PRIMARY_ADDRESS_DESCRIPTION;
?>
</p>
        </div>
      </div>
    </div>
    <div class="row">
Ejemplo n.º 27
0
    ?>
</td>
						<td align="right" width="100%" valign="top">
						
								<table border="0" cellspacing="0" cellpadding="2">
								  <tr>
									<td class="main" align="center" valign="top"><?php 
    echo '<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif');
    ?>
</td>
									<td><?php 
    echo tep_draw_separator('pixel_trans.gif', '10', '1');
    ?>
</td>
									<td class="main" valign="top" width="70%"><?php 
    echo tep_address_label($customer_id, $sendto, true, ' ', '<br>');
    ?>
</td>
									<td><?php 
    echo tep_draw_separator('pixel_trans.gif', '10', '1');
    ?>
</td>
								  </tr>
								</table>
						</td>
					  </tr>
				</table>
                
<?php 
    echo tep_draw_infoBox_bottom();
    ?>
 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'));
 }
Ejemplo n.º 29
0
          <?php 
echo tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'glyphicon-home', tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL'));
?>
        </div>
        <div class="clearfix"></div>
      </div>
    </div>
    <div class="col-sm-4">
      <div class="panel panel-primary">
        <div class="panel-heading"><?php 
echo TITLE_BILLING_ADDRESS;
?>
</div>
        <div class="panel-body">
          <?php 
echo tep_address_label($customer_id, $billto, true, ' ', '<br />');
?>
        </div>
      </div>
    </div>
  </div>

  <div class="clearfix"></div>

  <h2><?php 
echo TABLE_HEADING_PAYMENT_METHOD;
?>
</h2>

<?php 
$selection = $payment_modules->selection();
Ejemplo n.º 30
0
<?php 
if ($messageStack->size('address_book') > 0) {
    echo $messageStack->output('address_book');
}
?>

<div class="moduleBox">
  <div class="outsideHeading"><?php 
echo PRIMARY_ADDRESS_TITLE;
?>
</div>

  <div class="content">
    <div style="float: right; padding: 0px 0px 10px 20px;">
      <?php 
echo tep_address_label($osC_Customer->id, $osC_Customer->default_address_id, true, ' ', '<br>');
?>
    </div>

    <div style="float: right; padding: 0px 0px 10px 20px; text-align: center;">
      <?php 
echo '<b>' . PRIMARY_ADDRESS_TITLE . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif');
?>
    </div>

    <?php 
echo PRIMARY_ADDRESS_DESCRIPTION;
?>
  </div>
</div>