Example #1
0
 function osC_Checkout_Payment()
 {
     global $osC_Database, $osC_Session, $osC_Customer, $osC_Services, $breadcrumb, $cart, $total_weight, $total_count, $payment_modules;
     if ($cart->count_contents() < 1) {
         tep_redirect(tep_href_link(FILENAME_CHECKOUT, '', 'SSL'));
     }
     if ($osC_Services->isStarted('breadcrumb')) {
         $breadcrumb->add(NAVBAR_TITLE_CHECKOUT_PAYMENT, tep_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL'));
     }
     // if no shipping method has been selected, redirect the customer to the shipping method selection page
     if ($osC_Session->exists('shipping') == false) {
         tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
     }
     // avoid hack attempts during the checkout procedure by checking the internal cartID
     if (isset($cart->cartID) && $osC_Session->exists('cartID')) {
         if ($cart->cartID != $osC_Session->value('cartID')) {
             tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
         }
     }
     // Stock Check
     if (STOCK_CHECK == 'true' && STOCK_ALLOW_CHECKOUT != 'true') {
         $products = $cart->get_products();
         for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
             if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
                 tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'SSL'));
                 break;
             }
         }
     }
     // redirect to the billing address page when no default address exists
     if ($osC_Customer->hasDefaultAddress() === false) {
         $this->page_contents = 'checkout_payment_address.php';
     }
     // if no billing destination address was selected, use the customers own address as default
     if ($osC_Session->exists('billto') == false) {
         $osC_Session->set('billto', $osC_Customer->default_address_id);
     } else {
         // verify the selected billing address
         $Qcheck = $osC_Database->query('select count(*) as total from :table_address_book where customers_id = :customers_id and address_book_id = :address_book_id');
         $Qcheck->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
         $Qcheck->bindInt(':customers_id', $osC_Customer->id);
         $Qcheck->bindInt(':address_book_id', $osC_Session->value('billto'));
         $Qcheck->execute();
         if ($Qcheck->valueInt('total') != 1) {
             $osC_Session->set('billto', $osC_Customer->default_address_id);
             $osC_Session->remove('payment');
         }
     }
     $total_weight = $cart->show_weight();
     $total_count = $cart->count_contents();
     // load all enabled payment modules
     require DIR_WS_CLASSES . 'payment.php';
     $payment_modules = new payment();
     if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) && ($error = ${$_GET['payment_error']}->get_error())) {
         $messageStack->add('checkout_payment', $error['error'], 'error');
     }
 }
Example #2
0
}
// if no shipping method has been selected, redirect the customer to the shipping method selection page
if (!tep_session_is_registered('shipping')) {
    tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
// avoid hack attempts during the checkout procedure by checking the internal cartID
if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
    if ($cart->cartID != $cartID) {
        tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
    }
}
// Stock Check
if (STOCK_CHECK == 'true' && STOCK_ALLOW_CHECKOUT != 'true') {
    $products = $cart->get_products();
    for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
        if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
            tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
            break;
        }
    }
}
// if no billing destination address was selected, use the customers own address as default
if (!tep_session_is_registered('billto')) {
    tep_session_register('billto');
    $billto = $customer_default_address_id;
} else {
    // verify the selected billing address
    if (is_array($billto) && empty($billto) || is_numeric($billto)) {
        $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customer_id . "' and address_book_id = '" . (int) $billto . "'");
        $check_address = tep_db_fetch_array($check_address_query);
        if ($check_address['total'] != '1') {
    }
}
include DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS;
// load selected payment module
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment($payment);
// load the selected shipping module
require DIR_WS_CLASSES . 'shipping.php';
$shipping_modules = new shipping($shipping);
require DIR_WS_CLASSES . 'order.php';
$order = new order();
// Stock Check
$any_out_of_stock = false;
if (STOCK_CHECK == 'true') {
    for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
        if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
            $any_out_of_stock = true;
        }
    }
    // Out of Stock
    if (STOCK_ALLOW_CHECKOUT != 'true' && $any_out_of_stock == true) {
        tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
    }
}
$payment_modules->update_status();
if ($payment_modules->selected_module != $payment || is_array($payment_modules->modules) && sizeof($payment_modules->modules) > 1 && !is_object(${$payment}) || is_object(${$payment}) && ${$payment}->enabled == false) {
    tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
}
require DIR_WS_CLASSES . 'order_total.php';
$order_total_modules = new order_total();
$order_totals = $order_total_modules->process();
         $lc_align = 'center';
         if (isset($_GET['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . (int) $_GET['manufacturers_id'] . '&amp;products_id=' . $listing[$x]['products_id'] . $params) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'style="height:' . SMALL_IMAGE_HEIGHT . 'px"') . '</a>';
         } else {
             $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&amp;' : '') . 'products_id=' . $listing[$x]['products_id'] . $params) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'style="height:' . SMALL_IMAGE_HEIGHT . 'px"') . '</a>&nbsp;';
         }
         break;
     case 'PRODUCT_LIST_DATE_EXPECTED':
         $duedate = str_replace("00:00:00", "", $listing[$x]['products_date_available']);
         $lc_align = 'center';
         $lc_text = '&nbsp;' . $duedate . '&nbsp;';
         break;
     case 'PRODUCT_LIST_BUY_NOW':
         $valid_to_checkout = true;
         if (STOCK_CHECK == 'true') {
             $stock_check = tep_check_stock((int) $listing[$x]['products_id'], 1);
             if (tep_not_null($stock_check) && STOCK_ALLOW_CHECKOUT == 'false') {
                 $valid_to_checkout = false;
             }
         }
         if ($valid_to_checkout == true) {
             $hide_add_to_cart = hide_add_to_cart();
             $lc_text = '';
             if ($hide_add_to_cart == 'false' && group_hide_show_prices() == 'true') {
                 $lc_text = '<div class="col-sm-6 col-lg-6 no-margin-left product-listing-module-buy-now buy-btn-div"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'cPath', 'products_id')) . 'action=buy_now&amp;products_id=' . $listing[$x]['products_id'] . '&amp;cPath=' . tep_get_product_path($listing[$x]['products_id']) . $params) . '"><button class="product-listing-module-buy-now-button btn btn-success btn-block">' . IMAGE_BUTTON_BUY_NOW . '</button></a></div>';
             }
         }
         $lc_text .= '</div>';
         break;
 }
 $product_contents[] = $lc_text;
            echo '<td class="main">&nbsp;</td>';
        } else {
            ?>
                    <?php 
            /*(echo TEXT_ENTER_QUANTITY . ':&nbsp;&nbsp;' . tep_draw_input_field('cart_quantity', '1', 'size="4" maxlength="4" id="Qty1" onkeyup="document.getElementById(\'Qty2\').value = document.getElementById(\'Qty1\').value;"  ');*/
            ?>

                  <?php 
        }
    }
    ?>

                    <?php 
    $valid_to_checkout = true;
    if (STOCK_CHECK == 'true') {
        $stock_check = tep_check_stock((int) $_GET['products_id'], 1);
        if (tep_not_null($stock_check) && STOCK_ALLOW_CHECKOUT == 'false') {
            $valid_to_checkout = false;
        }
    }
    if ($hide_add_to_cart == 'false' && group_hide_show_prices() == 'true') {
        echo tep_draw_hidden_field('products_id', $product_info['products_id']);
        if ($valid_to_checkout == true) {
        }
    }
    ?>



<h1 class="no-margin-top"><?php 
    echo tep_get_manufacturers_name($product_info['manufacturers_id']);
Example #6
0
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
  <td class="smallText"><b><?php 
echo TABLE_HEADING_PRODUCTS_NAME;
?>
</b></td>
  <td class="smallText" align="right"><b><?php 
echo TABLE_HEADING_PRODUCTS_FINAL_PRICE;
?>
</b></td>
 </tr>
<?php 
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
    $stockCheck = '';
    if (STOCK_CHECK == 'true') {
        $stockCheck = tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);
    }
    $productAttributes = '';
    if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
        for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
            $productAttributes .= '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>' . tep_draw_hidden_field('id[' . $order->products[$i]['id'] . '][' . $order->products[$i]['attributes'][$j]['option_id'] . ']', $order->products[$i]['attributes'][$j]['value_id']);
        }
    }
    ?>
     
 <tr>
  <td class="main" valign="top"><?php 
    echo $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' ( ' . $order->products[$i]['model'] . ' ) ' . $stockCheck . $productAttributes;
    ?>
</td>
  <td class="main" align="right" valign="top"><?php 
    $xoopsTpl->assign("address", tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'));
    if ($order->info['shipping_method']) {
        $xoopsTpl->assign("orderinfo", 1);
        $xoopsTpl->assign("cos_link", tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
        $xoopsTpl->assign("ordership", $order->info['shipping_method']);
    }
}
$xoopsTpl->assign("stw", $sendto != false ? '70%' : '100%');
$xoopsTpl->assign("ot_link", tep_href_link(FILENAME_SHOPPING_CART));
if (sizeof($order->info['tax_groups']) > 1) {
    $xoopsTpl->assign("ordertax", 1);
}
$products = $order->products;
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
    if (STOCK_CHECK == 'true') {
        $products[$i]['stock'] = tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);
        //  echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);
    }
    if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
        $attr[$i] = $order->products[$i]['attributes'];
        for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
            $xoopsTpl->assign("attribs", 1);
        }
    }
    $taxgroups = $order->info['tax_groups'];
    if (sizeof($order->info['tax_groups']) > 1) {
        $products[$i]['stax'] = 1;
        $products[$i]['taxd'] = tep_display_tax_value($order->products[$i]['tax']);
    }
    $products[$i]['final_price'] = $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']);
}
 function checkStock()
 {
     global $cart;
     $products = $cart->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
             tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
             break;
         }
     }
 }
Example #9
0
 function _build_attributes_combinations($attributes, $showoos, $markoos, &$combinations, &$selected_combination, $oidindex = 0, $comb = array(), $id = "", $text = '', $isselected = true)
 {
     global $cart;
     foreach ($attributes[$oidindex]['ovals'] as $attrib) {
         $newcomb = $comb;
         $newcomb[$attributes[$oidindex]['oid']] = $attrib['id'];
         $newid = $id . ',' . $attributes[$oidindex]['oid'] . '-' . $attrib['id'];
         $newtext = $text . ", " . $attrib['text'];
         if (isset($cart->contents[$this->products_id]['attributes'][$attributes[$oidindex]['oid']])) {
             $newisselected = $cart->contents[$this->products_id]['attributes'][$attributes[$oidindex]['oid']] == $attrib['id'] ? $isselected : false;
         } else {
             $newisselected = false;
         }
         if (isset($attributes[$oidindex + 1])) {
             $this->_build_attributes_combinations($attributes, $showoos, $markoos, $combinations, $selected_combination, $oidindex + 1, $newcomb, $newid, $newtext, $newisselected);
         } else {
             $is_out_of_stock = tep_check_stock(tep_get_prid($this->products_id), 1, $newcomb);
             if (!$is_out_of_stock | $showoos == true) {
                 switch ($markoos) {
                     case 'Left':
                         $newtext = ($is_out_of_stock ? TEXT_OUT_OF_STOCK . ' - ' : '') . substr($newtext, 2);
                         break;
                     case 'Right':
                         $newtext = substr($newtext, 2) . ($is_out_of_stock ? ' - ' . TEXT_OUT_OF_STOCK : '');
                         break;
                     default:
                         $newtext = substr($newtext, 2);
                         break;
                 }
                 $combinations[] = array('comb' => $newcomb, 'id' => substr($newid, 1), 'text' => $newtext);
                 if ($newisselected) {
                     $selected_combination = sizeof($combinations) - 1;
                 }
             }
         }
     }
 }
Example #10
0
 function osC_Checkout_Confirmation()
 {
     global $osC_Session, $osC_Services, $messageStack, $breadcrumb, $order, $cart, $payment_modules, $shipping_modules, $order_total_modules, $any_out_of_stock;
     if ($cart->count_contents() < 1) {
         tep_redirect(tep_href_link(FILENAME_CHECKOUT, '', 'SSL'));
     }
     // avoid hack attempts during the checkout procedure by checking the internal cartID
     if (isset($cart->cartID) && $osC_Session->exists('cartID')) {
         if ($cart->cartID != $osC_Session->value('cartID')) {
             tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
         }
     }
     // if no shipping method has been selected, redirect the customer to the shipping method selection page
     if ($osC_Session->exists('shipping') == false) {
         tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
     }
     if ($osC_Services->isStarted('breadcrumb')) {
         $breadcrumb->add(NAVBAR_TITLE_CHECKOUT_CONFIRMATION, tep_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL'));
     }
     if (isset($_POST['payment'])) {
         $osC_Session->set('payment', $_POST['payment']);
     }
     $payment =& $osC_Session->value('payment');
     if (isset($_POST['comments']) && $osC_Session->exists('comments') && empty($_POST['comments'])) {
         $osC_Session->remove('comments');
     } else {
         if (tep_not_null($_POST['comments'])) {
             $osC_Session->set('comments', tep_sanitize_string($_POST['comments']));
         }
     }
     if (DISPLAY_CONDITIONS_ON_CHECKOUT == 'true') {
         if (!isset($_POST['conditions']) || $_POST['conditions'] != '1') {
             $messageStack->add_session('checkout_payment', ERROR_CONDITIONS_NOT_ACCEPTED, 'error');
         }
     }
     // load the selected payment module
     require DIR_WS_CLASSES . 'payment.php';
     $payment_modules = new payment($osC_Session->value('payment'));
     $order = new order();
     $payment_modules->update_status();
     if (is_array($payment_modules->modules) && sizeof($payment_modules->modules) > 1 && !isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment]) && $GLOBALS[$payment]->enabled == false) {
         $messageStack->add_session('checkout_payment', ERROR_NO_PAYMENT_MODULE_SELECTED, 'error');
     }
     if ($messageStack->size('checkout_payment') > 0) {
         tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
     }
     if (is_array($payment_modules->modules)) {
         $payment_modules->pre_confirmation_check();
     }
     // load the selected shipping module
     require DIR_WS_CLASSES . 'shipping.php';
     $shipping_modules = new shipping($osC_Session->value('shipping'));
     require DIR_WS_CLASSES . 'order_total.php';
     $order_total_modules = new order_total();
     // Stock Check
     $any_out_of_stock = false;
     if (STOCK_CHECK == 'true') {
         for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
             if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
                 $any_out_of_stock = true;
             }
         }
         // Out of Stock
         if (STOCK_ALLOW_CHECKOUT != 'true' && $any_out_of_stock == true) {
             tep_redirect(tep_href_link(FILENAME_CHECKOUT));
         }
     }
 }
     $info_box_contents[] = array('params' => 'class="productListing-even"');
 } else {
     $info_box_contents[] = array('params' => 'class="productListing-odd"');
 }
 $cur_row = sizeof($info_box_contents) - 1;
 echo '<tr>';
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 // MOD begin of sub product
 if ((int) $products_parent_id['products_parent_id'] != 0) {
     $products_name = '  ' . '<td class="text-left content-shopping-cart-image-td">    <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_parent_id['products_parent_id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' . '    <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_parent_id['products_parent_id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
 } else {
     $products_name = '  ' . '   <td class="text-left content-shopping-cart-image-td"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' . '  <td class="text-left hide-on-mobile-portrait">  <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><h4 class="no-margin-top small-margin-bottom">' . $products[$i]['name'] . '</h4></a>';
 }
 echo '</tr>';
 if (STOCK_CHECK == 'true') {
     $stock_check = tep_check_stock((int) $products[$i]['id'], $products[$i]['quantity']);
     if (tep_not_null($stock_check)) {
         $any_out_of_stock = 1;
         $products_name .= $stock_check;
     }
 }
 if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
     reset($products[$i]['attributes']);
     while (list($option, $value) = each($products[$i]['attributes'])) {
         if (!is_array($value)) {
             if ($products[$i][$option][$value]['options_values_price'] > 0) {
                 $attribute_price = $products[$i][$option][$value]['price_prefix'] . $currencies->display_price($products[$i][$option][$value]['options_values_price'], tep_get_tax_rate($products[$i]['tax_class_id']));
             } else {
                 $attribute_price = '';
             }
             $products_name .= '<br>' . ' - ' . '<small><i>' . $products[$i][$option][$value]['products_options_name'] . ' : ' . $products[$i][$option][$value]['products_options_values_name'] . '&nbsp;&nbsp;&nbsp;' . $attribute_price . '</i></small>';