Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easiest way to move Shopping Cart?


Kihtra

Recommended Posts

I have a beautiful site in the makes.

 

Does anyone have a simple way (I know nothing is simple, but lets go with the easiest) to move the shopping cart column into different pages.

 

The different pages is a separate section of my website, that isn't part of the shop. That way people can browse other pages of my site and still see what's in their shopping cart.

 

If this is impossible, or really difficult to do, I would still like to know. I like the challenge^^

Link to comment
Share on other sites

Hi, Sure you can do this ..

 

I use an Iframe for my shopping cart, after looking and spending quite a bit of time trying to do this it was just the easiest way for me, without loosing sleep :-"

 

I also use the JavaScript to resize my Iframe, so when people add products to my cart the iframe will actually get longer ..

I am using CONTENT OUTSIDE OF OSC V1.1 Contribution, my outside_shopping_cart.php looks like this http://addons.oscommerce.com/info/1444

 

<?php
/********************************************************
CONTENT OUTSIDE OF OSC V1.1	   

	Author: David Vance  == Adapted for MS2 by Anthony
	Date: 20. 11, 2004

	OSC 2.2 MS2
	PHP Version 4.3.2

	This snippet is an example of placing osCommerce
 content on your site outside of the OSC 
 directory structure.

 It allows you to display the products_new table.

********************************************************/

//saves current working directory for later return
$cwd=getcwd();

//changes current working directory to osc root install directory; something like: /home/david/public_html/catalog/ but not DIR_FS_CATALOG
chdir('/path/to/catalog/'); 

//need all of application_top's configurations and includes; NO OUTPUT ABOVE THIS POINT!
include('includes/application_top.php');

//need the language file
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW);

//start buffering
ob_start(); 

/* BEGIN: From the products_new.php page: */

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

//  new infoBoxHeading($info_box_contents, false, true, tep_href_link(FILENAME_SHOPPING_CART));

 $cart_contents_string = '';
 if ($cart->count_contents() > 0) {
$cart_contents_string = '<table border="0" width="100%" cellspacing="2" 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="">';

  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_SHOPPING_CART) . '" target="_parent">';

  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()));
 }

 new infoBox($info_box_contents);
?>

<?php
$newProductsTable = ob_get_contents();

//stop buffering
ob_end_clean();
?>
<?php
//change back to original working directory
chdir($cwd);


//********* COPY THE CODE ABOVE TO THE TOP OF THE FILE YOU WANT YOUR BOX IN *******\\
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<link href="/path/to/mootools/stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div style="width: 150px;">
<?php 
	echo $newProductsTable; //output your table here (or wherever)
?>
<center><h5><a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" target="_parent">Checkout</a></h5></center>
</div>
</body>
</html>

 

and the the following to include the Iframe

 

<iframe id="myframe" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0" marginheight="0" marginwidth="0" src="/outside_shopping_cart.php" width="150" style="overflow:hidden; width:150px; display:none"></iframe>

 

with this script to resize the Iframe, http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

 

Good Luck!!

Riaan

3am.co.za

 

 

I have a beautiful site in the makes.

 

Does anyone have a simple way (I know nothing is simple, but lets go with the easiest) to move the shopping cart column into different pages.

 

The different pages is a separate section of my website, that isn't part of the shop. That way people can browse other pages of my site and still see what's in their shopping cart.

 

If this is impossible, or really difficult to do, I would still like to know. I like the challenge^^

I'm an osCommerce Pimp ..

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...