Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show shipping & total cost in cart box left column


abz786

Recommended Posts

Posted

Hi,

 

I've searched the forums thoroughly for a couple days for a solution but I'm unable to find one.

 

Basically, I want the the sub-total, shipping and total cost of an item to be displayed in the cart infobox (left column) as follows:

 

 

1 x Motorola V3

________________

Sub-Total: $445.00

shipping : $2.50

________________

TOTAL: $447.50

 

This needs to work regardless if someone is logged on or off and across all pages of the site.

 

We have simple table rate shipping based on weight.

 

I've made some progress by modifying the catalog/includes/boxes.shopping_cart.php file but this only shows the correct amounts when someone is on the catalog/shopping_cart.php page. As soon as you navigate away from this page the shipping values and the TOTAL values change to 0.00.

 

The 'ship in cart contribution' doesn't help me as this shows shipping & order total estimates on the catalog/shopping_cart.php page which is not what I want.

 

Please can anyone please help? I really need a solution and I know there are quite a few others who are looking for the same thing.

 

Here is my catalog/includes/boxes.shopping_cart.php

 

<?php

/*

$Id: shopping_cart.php,v 1.18 2003/02/10 22:31:06 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- shopping_cart //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);

 

new infoBoxHeading($info_box_contents, true, true);

 

$cart_contents_string = '';

if ($cart->count_contents() > 0) {

$cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

$cart_contents_string .= '<tr><td align="right" valign="top" class="infoBoxContents">';

 

if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

$cart_contents_string .= '<span class="newItemInCart">';

} else {

$cart_contents_string .= '<span class="infoBoxContents">';

}

 

$cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

 

if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

$cart_contents_string .= '<span class="newItemInCart">';

} else {

$cart_contents_string .= '<span class="infoBoxContents">';

}

 

$cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';

 

if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

tep_session_unregister('new_products_id_in_cart');

}

}

$cart_contents_string .= '</table>';

} else {

$cart_contents_string .= BOX_SHOPPING_CART_EMPTY;

}

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $cart_contents_string);

 

if ($cart->count_contents() > 0) {

$info_box_contents[] = array('text' => tep_draw_separator());

$info_box_contents[] = array('align' => 'right',

// 'text' => $currencies->format($cart->show_total()));

//BEGIN EDITED added subtotal title before the price

 

'text' => BOX_SHOPPINGCART_SUB_TOTAL . ' ' . $currencies->format($cart->show_total()));

 

//END EDITED added subtotal title before the price

 

//Code below is mine***************************************

 

$info_box_contents[] = array('align' => 'right',

 

'text' => BOX_SHOPPINGCART_POSTAGE . ' ' . $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),

'value' => $order->info['shipping_cost']);

 

$info_box_contents[] = array('text' => tep_draw_separator());

$info_box_contents[] = array('align' => 'right',

 

 

'text' => BOX_SHOPPINGCART_TOTAL . ' ' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . '</b>',

'value' => $order->info['total']);

 

//End my code *****************************************************

 

}

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- shopping_cart_eof //-->

 

 

Is there anyone who can rise the the challenge?

 

Thanks

  • 3 weeks later...
Posted
Hi,

 

I've searched the forums thoroughly for a couple days for a solution but I'm unable to find one.

 

Basically, I want the the sub-total, shipping and total cost of an item to be displayed in the cart infobox (left column) as follows:

 

 

1 x  Motorola V3

________________

Sub-Total: $445.00

shipping  : $2.50

________________

TOTAL:    $447.50

 

This needs to work regardless if someone is logged on or off and across all pages of the site.   

 

We have simple table rate shipping based on weight.

 

I've made some progress by modifying the catalog/includes/boxes.shopping_cart.php file but this only shows the correct amounts when someone is on the catalog/shopping_cart.php page. As soon as you navigate away from this page the shipping values and the TOTAL values change to 0.00.

 

The 'ship in cart contribution' doesn't help me as this shows shipping & order total estimates on the catalog/shopping_cart.php page which is not what I want.

 

Please can anyone please help? I really need a solution and I know there are quite a few others who are looking for the same thing.

 

Here is my catalog/includes/boxes.shopping_cart.php

 

<?php

/*

  $Id: shopping_cart.php,v 1.18 2003/02/10 22:31:06 hpdl Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright ? 2003 osCommerce

 

  Released under the GNU General Public License

*/

?>

<!-- shopping_cart //-->

          <tr>

            <td>

<?php

  $info_box_contents = array();

  $info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);

 

  new infoBoxHeading($info_box_contents, true, true);

 

  $cart_contents_string = '';

  if ($cart->count_contents() > 0) {

    $cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';

    $products = $cart->get_products();

    for ($i=0, $n=sizeof($products); $i<$n; $i++) {

      $cart_contents_string .= '<tr><td align="right" valign="top" class="infoBoxContents">';

 

      if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

        $cart_contents_string .= '<span class="newItemInCart">';

      } else {

        $cart_contents_string .= '<span class="infoBoxContents">';

      }

 

      $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

 

      if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

        $cart_contents_string .= '<span class="newItemInCart">';

      } else {

        $cart_contents_string .= '<span class="infoBoxContents">';

      }

 

      $cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';

 

      if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

        tep_session_unregister('new_products_id_in_cart');

      }

    }

    $cart_contents_string .= '</table>';

  } else {

    $cart_contents_string .= BOX_SHOPPING_CART_EMPTY;

  }

 

  $info_box_contents = array();

  $info_box_contents[] = array('text' => $cart_contents_string);

 

  if ($cart->count_contents() > 0) {

    $info_box_contents[] = array('text' => tep_draw_separator());

    $info_box_contents[] = array('align' => 'right',

//                                'text' => $currencies->format($cart->show_total()));

//BEGIN EDITED added subtotal title before the price

 

                              'text' => BOX_SHOPPINGCART_SUB_TOTAL . '  ' . $currencies->format($cart->show_total()));

 

//END EDITED added subtotal title before the price

 

//Code below is mine***************************************

 

                  $info_box_contents[] = array('align' => 'right',

                         

                                'text' => BOX_SHOPPINGCART_POSTAGE . '  ' . $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),

                                'value' => $order->info['shipping_cost']);

   

$info_box_contents[] = array('text' => tep_draw_separator());

$info_box_contents[] = array('align' => 'right',

 

 

                                'text' => BOX_SHOPPINGCART_TOTAL . '  ' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . '</b>',

                              'value' => $order->info['total']);

 

//End my code *****************************************************

 

  }

  new infoBox($info_box_contents);

?>

            </td>

          </tr>

<!-- shopping_cart_eof //-->

Is there anyone who can rise the the challenge?

 

Thanks

 

 

I think you should make a code that query table "customers_basket" to show the up-to-date status of shopping cart. The table represents the most accurate of "what's in your cart". Hope it can help.

  • 2 months later...
Posted
Hi,

 

I've searched the forums thoroughly for a couple days for a solution but I'm unable to find one.

 

Basically, I want the the sub-total, shipping and total cost of an item to be displayed in the cart infobox (left column) as follows:

 

 

1 x  Motorola V3

________________

Sub-Total: $445.00

shipping  : $2.50

________________

TOTAL:    $447.50

 

This needs to work regardless if someone is logged on or off and across all pages of the site.   

 

We have simple table rate shipping based on weight.

 

I've made some progress by modifying the catalog/includes/boxes.shopping_cart.php file but this only shows the correct amounts when someone is on the catalog/shopping_cart.php page. As soon as you navigate away from this page the shipping values and the TOTAL values change to 0.00.

 

The 'ship in cart contribution' doesn't help me as this shows shipping & order total estimates on the catalog/shopping_cart.php page which is not what I want.

 

Please can anyone please help? I really need a solution and I know there are quite a few others who are looking for the same thing.

 

Here is my catalog/includes/boxes.shopping_cart.php

 

<?php

/*

  $Id: shopping_cart.php,v 1.18 2003/02/10 22:31:06 hpdl Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright ? 2003 osCommerce

 

  Released under the GNU General Public License

*/

?>

<!-- shopping_cart //-->

          <tr>

            <td>

<?php

  $info_box_contents = array();

  $info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);

 

  new infoBoxHeading($info_box_contents, true, true);

 

  $cart_contents_string = '';

  if ($cart->count_contents() > 0) {

    $cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';

    $products = $cart->get_products();

    for ($i=0, $n=sizeof($products); $i<$n; $i++) {

      $cart_contents_string .= '<tr><td align="right" valign="top" class="infoBoxContents">';

 

      if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

        $cart_contents_string .= '<span class="newItemInCart">';

      } else {

        $cart_contents_string .= '<span class="infoBoxContents">';

      }

 

      $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

 

      if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

        $cart_contents_string .= '<span class="newItemInCart">';

      } else {

        $cart_contents_string .= '<span class="infoBoxContents">';

      }

 

      $cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';

 

      if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

        tep_session_unregister('new_products_id_in_cart');

      }

    }

    $cart_contents_string .= '</table>';

  } else {

    $cart_contents_string .= BOX_SHOPPING_CART_EMPTY;

  }

 

  $info_box_contents = array();

  $info_box_contents[] = array('text' => $cart_contents_string);

 

  if ($cart->count_contents() > 0) {

    $info_box_contents[] = array('text' => tep_draw_separator());

    $info_box_contents[] = array('align' => 'right',

//                                'text' => $currencies->format($cart->show_total()));

//BEGIN EDITED added subtotal title before the price

 

                              'text' => BOX_SHOPPINGCART_SUB_TOTAL . '  ' . $currencies->format($cart->show_total()));

 

//END EDITED added subtotal title before the price

 

//Code below is mine***************************************

 

                  $info_box_contents[] = array('align' => 'right',

                         

                                'text' => BOX_SHOPPINGCART_POSTAGE . '  ' . $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),

                                'value' => $order->info['shipping_cost']);

   

$info_box_contents[] = array('text' => tep_draw_separator());

$info_box_contents[] = array('align' => 'right',

 

 

                                'text' => BOX_SHOPPINGCART_TOTAL . '  ' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . '</b>',

                              'value' => $order->info['total']);

 

//End my code *****************************************************

 

  }

  new infoBox($info_box_contents);

?>

            </td>

          </tr>

<!-- shopping_cart_eof //-->

Is there anyone who can rise the the challenge?

 

Thanks

 

did u ever get this working?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...