Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Ship in Cart module for old snapshots of OSC


quicklyshop

Recommended Posts

For most of you who didnt upgrade their version of oscommerce to 2.2MS1.

Ship in cart was really usefull module and it was only working MS1.

Below code should work with any shipping method and tax options. So no headaches.(That is what i assume ofcource)

So save below code as ship_in_cart.php and upload it to catalog/includes/modules/.

open catalog/shopping_cart.php and add below lines

<tr>

<td><?php require(DIR_WS_MODULES . 'ship_in_cart.php'); ?></td>

</tr>

before

<tr>

<td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>

 

<?php
// Check if there is something in the cart
?if ($cart->count_contents() == 0) {
? ?tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));
?}

// Stock Check
?if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
? ?$products = $cart->get_products();
? ?$any_out_of_stock = 0;
? ?for ($i=0; $i<sizeof($products); $i++) {
? ? ?if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
? ? ? ?$any_out_of_stock = 1;
? ? ?}
? ?}
? ?if ($any_out_of_stock) {
? ? ?tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
? ?}
?}

// Register needed checkout variables
?if (!tep_session_is_registered('sendto')) {
? ?$sendto = $customer_default_address_id;
? ?tep_session_register('sendto');
?}
?if ($HTTP_POST_VARS['sendto']) {
? ?$sendto = $HTTP_POST_VARS['sendto'];
?}

?if ($HTTP_POST_VARS['shipping_quote_all'] == '0') {
? ?$shipping_quote_all = '0';
?} else {
? ?$shipping_quote_all = '1';
?}
?if ($HTTP_POST_VARS['comments']) {
? ?$comments = stripslashes($HTTP_POST_VARS['comments']);
?}
?if ($HTTP_POST_VARS['payment']) {
? ?$payment = stripslashes($HTTP_POST_VARS['payment']);
?}
?if ($HTTP_POST_VARS['shipping_selected']) {
? ?$shipping_selected = stripslashes($HTTP_POST_VARS['shipping_selected']);
?}
?if (!tep_session_is_registered('comments')) {
? ?tep_session_register('comments');
?}
?if (!tep_session_is_registered('payment')) {
? ?tep_session_register('payment');
?}
?if (!tep_session_is_registered('shipping_selected')) {
? ?tep_session_register('shipping_selected');
?}
?if (!tep_session_is_registered('shipping_cost')) {
? ?tep_session_register('shipping_cost');
?}
?if (!tep_session_is_registered('shipping_method')) {
? ?tep_session_register('shipping_method');
?}
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);
?$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_ADDRESS, '', 'SSL'));
?$breadcrumb->add(NAVBAR_TITLE_2);

?$address = tep_db_query("select entry_postcode as postcode, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "' and address_book_id = '" . $sendto . "'");
?$address_values = tep_db_fetch_array($address);

?$total_weight = $cart->show_weight();
?$total_count = $cart->count_contents();

// load shipping modules as objects
?require(DIR_WS_CLASSES . 'shipping.php');
?$shipping_modules = new shipping;
?$shipping_modules->quote();
?if ( ($shipping_quoted == '') && (MODULE_SHIPPING_INSTALLED) ) { // Null if no quotes selected
? ?tep_redirect(tep_href_link(FILENAME_CHECKOUT_ADDRESS, '' , 'SSL'));
?}

// load payment modules as objects
?require(DIR_WS_CLASSES . 'payment.php');
?$payment_modules = new payment;
?require(DIR_WS_CLASSES . 'order_total.php');
?require(DIR_WS_CLASSES . 'order.php');
?$order = new order;
?$order_total_modules = new order_total;
?> ? ? ?<tr>
? ? ? ? ? ?<td ><br><table border="0" width="100%" cellspacing="0" cellpadding="0" >
? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ?<td colspan=2 class="infoBoxHeading"><?php echo TABLE_HEADING_SHIPPING_INFO; ?></td>
? ? ? ? ? ? ? ?<td ?class="infoBoxContents" align="right"><?php if (tep_count_shipping_modules() > 1) echo TABLE_HEADING_SHIPPING_QUOTE; ?></td>
? ? ? ? ? ? ?</tr>
? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ?<td colspan=2><?php echo $shipping_modules->display(); ?></td>
? ? ? ? ?</tr>
? ? ? 
? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ?<td colspan=2 class="infoBoxHeading"> Total cost if you order today:</td>
? ? ? ? ?</tr>
? ? ? ? <?php
?if (MODULE_ORDER_TOTAL_INSTALLED) {
? ?$order_total_modules->process();
? ?echo $order_total_modules->output();
?}
?>
</table></td>
? ? ? ? ?</tr>

Edited by quicklyshop

I can't type a trick like i can type.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...