Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

echo / print out cart quantity & total $ in cart


luxor

Recommended Posts

I would like to have a text output of the cart quanity and total $ amount currently in the cart on every page of site.

 

 

Is it in a cookie, or is it in a database table?

 

 

If it's in a database table, which table is it? how would you pull the proper data for the current user? using the session id?....

Link to comment
Share on other sites

The info is in the $cart object - you can show them like this:

 

 

Quantity:

 

<?php echo $cart->count_contents(); ?>

 

Total:

 

<?php echo $currencies->format($cart->show_total()); ?>

 

 

Sonia

Link to comment
Share on other sites

thanks for reply.

 

when i place that code i get the following error:

 

Fatal error: Call to a member function on a non-object in public_html/nov/root/top_below_bar.php on line 13

 

which includes do i need?

Link to comment
Share on other sites

you need to call application_top-php into your file to use the osCommerce classes and functions (and session)

 

  require('includes/application_top.php');

 

 

Sonia

Link to comment
Share on other sites

yes this should do it, but my site files where i need to show cart info are outside the osc dir. so the include files that are found in the application_top php are not being loaded with adsolute directory path. I did try to make every include absolute. However, it's seem like an endless operation to make the include files inside these included files absolute as well.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...