Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

echo / print out cart quantity & total $ in cart


luxor

Recommended Posts

Posted

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?....

Posted

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

Posted

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?

Posted

Sorry - I dont need to use STS, so am not familiar with it. That code works fine in a standard osCommerce.

 

 

Sonia

Posted

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

Posted

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.

Posted

Would it not be simpler to move your files?

 

 

Sonia

Archived

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

×
×
  • Create New...