This blog is outdated! Go to for latest updates

Smart Cart 2 - javascript jQuery shopping cart plugin


Smart Cart 2 is a flexible and feature rich jQuery plug-in for shopping cart. It makes the add-to-cart section of online shopping much easy and user friendly.
It is very easy to implement and only minimal HTML required. The selected items in the cart are accessible as an array of product/quantity pair delimited with ‘|’ on submit form or when checkout event is triggered. Smart Cart 2 have a simple and compact design with tabbed interface to saves space.
To avoid complexity I haven’t implemented built-in Ajax support, but using the events you can easily implement the Ajax features. The product list is more dynamic with built-in search and category filter. Template option gives you freedom to customize the product details display on product list and cart. It is also having option to show the product image and its expanded tool tip.

Version: 2.0


View Demo

Product Home:

Smart Cart 2: Download from SourceForge

  • Easy to implement, minimal HTML required
  • Clean and compact design, tabbed design saves space
  • Product search and Category filter enables easy and fast access to the product what users are looking for
  • Automatically calculates subtotal and total
  • Quantity is editable from the cart list
  • Event support, custom Ajax feature and validation can easily implement using the events
  • Product Image display and expanded tool tip display
  • Can implement multiple cart on same page
  • Template option, for easily customizing product display details
  • Pre-populate products on cart on page load

Smart Cart 2 Documentation

Getting Started:

Basic Usage:
With option parametrs:
$('# SmartCart). smartCart ({
   selected: 0,  // 0 = produts list, 1 = cart  
   resultName: 'products_selected[]', 
   enableImage: true,
   enableImageTooltip: true,
   enableSearch: true,
   enableCategoryFilter: true,
   productItemTemplate:'<strong><%=pname%></strong><br />Category: <%=pcategory%><br />
                        <small><%=pdesc%></small><br /><strong>

                        Price: <%=pprice%></strong>',

   // Events
   onAdd: null,      
   onAdded: null,    
   onRemove: null,   
   onRemoved: null,  
   onUpdate: null,   
   onUpdated: null,  
   onCheckout: null 
See Option Parameter Description
See Event Description

Installing Smart Cart 2:

Step 1: Get the latest version of jQuery (jQuery 1.3 or above)

Step 2: Download the Smart Cart 2 ( or

Step 3: Include following lines on the head section of your html file (Make sure the paths are correct).
<link href="styles/smart_cart.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery.smartCart-2.0.js"></script>
Step 4: Copy the below javascript code to head section
<script type="text/javascript">
Step 5: Copy the below html to the body section.
<div id="SmartCart" class="scMain">
  <input type="hidden" pimage="products/product1.jpg" pprice="2299.99" pdesc="" 
    pcategory="Computers" pname="Apple MacBook Pro MA464LL/A 15.4" pid="100">

  <input type="hidden" pimage="products/product6.jpg" pprice="2699.99" pdesc="" 
    pcategory="Computers" pname="Sony VAIO 11.1&quot; Notebook PC" pid="101">
  <input type="hidden" pimage="products/product3.jpg" pprice="550.00" pdesc="" 
    pcategory="Cameras" pname="Canon Digital Rebel" pid="102">
Description:Text marked bold are the pseudo attributes that describes about the product. Like product name, price, description etc.

pid : Product ID
pname : Name of the product
pdesc : Description of the product
pprice : Price of the product
pimage : Product image source
pcategory : Category of the product

You can add more product details by adding new attributes to the input element, and so you can show them on product list or cart by editing the template.
You can customize the pseudo attribute names, and configure it on the plug-in file on the Attribute Settings section.

Finished: That's all, Browse the page you are set to go.

Some more details & descriptions:

1. How to show more product details on product list / How to customize Template?

<input type="hidden" pimage="products/product1.jpg" pprice="2299.99" pdesc="The Intel Core Duo." pcategory="Computers" pname="Apple MacBook Pro" pid="100"
product_sku ="SDK334455">

Here added a new pseudo attribute "product_sku".
Describes below is how to apply product list template, and the highlighted part will be replaced with the SKU of specified for corresponding product.

Specify your attribute by wrapping it with <%= and %> on the templates (productItemTemplate, cartItemTemplate) will be replaced with the value of the attribute on the product list or cart when displayed.

  var productTemplateWithSKU = '<strong><%=pname%></strong><br />
          Category: <%=pcategory%><br /> 
      <small><%=pdesc%></small><br /><strong>Price: <%=pprice%></strong><br />

      <strong>SKU:  <%=product_sku%></strong>';
  // calling Smart cart
  $('#SmartCart').smartCart({productItemTemplate: productTemplateWithSKU });

2. How to enable category filter?

Category filter is an automatic option and you can enable or disable by specifying the Option parameter: enableCategoryFilter to true/false
Also the product category attribute should present the hidden element, if it is empty or null the category filter will be disabled. The category select box is filled automatically by reading the category attribute.

So to enable category filter you have to do only 2 things:
1. Enable it on option parameter enableCategoryFilter : true (true by default).
2. Specify category attribute in the hidden element.

<input type="hidden" pimage="products/product1.jpg" pprice="2299.99" 
 pdesc="The Intel Core Duo." pcategory="Computers" pname="Apple MacBook Pro" 

Parameter Description:

Parameter Name Description Values Default Value
selected specify the selected tab 0 = product list
1= cart
resultName the name of the request to be passed when submitted
enableImage Enable/Disable Image display on product list and cart true = enabled
false= disabled
enableImageTooltip Enable/Disable Image tool tip display on product list and cart true = enabled
false= disabled
enableSearch Enable/Disable search for the products on product list true = enabled
false= disabled
enableCategoryFilter Enable/Disable category filter for the products on product list. Automatically disables if category attributes are not presents in the hidden elements true = enabled
false= disabled
productItemTemplate Template for the product display on product list String
(see details)
<strong><%=pname%></strong><br />
Category: <%=pcategory%><br />

<small><%=pdesc%></small><br />
<strong>Price: <%=pprice%></strong>
cartItemTemplate Template for the product display on cart String
(see details)


Event Description:

Event Name Description Parameters Default
onAdd Triggered immediately when click on add to cart button and just before staring add to cart process. This is a decision making event, based on its function return value (true/false) the product add to cart process can be canceled or continued. Object: object of the hidden element of the product to add.
Quantity: The quantity of the product to add.
onAdded Triggered when click on add to cart button but only after finish adding the product to cart. This event doesn’t accept return values. Object: object of the hidden element of the product added.
Quantity: The quantity of the product added.
onRemove Triggered immediately when a product is about to remove from cart, i.e. when click remove button on cart. This a decision making event, based on its function return value (true/false) the remove process can be canceled on continued. Object: object of the hidden element of the product to remove. null
onRemoved Triggered when the product remove (from cart) process is finished. This event doesn’t accept return values. Object: object of the hidden element of the product removed. null
onUpdate Triggered when a product quantity is updated by changing it from cart. This a decision making event, based on its function return value (true/false) the update process can be canceled on continued. Object: object of the hidden element of the product to update.
Quantity: The quantity of the product to update
onUpdated Triggered when product quantity is finished updating. This event doesn’t accept return values. Object: object of the hidden element of the product updated.
Quantity: The quantity of the product updated.
onCheckout Triggered when click on Checkout button on cart. If this even is not specified it will automatically submits the form element available. This event doesn’t accept return values. Object: an object of the select element which contains option elements with value as the pair of product_id and quantity delimited with pipe ‘|’ symbol. null


Nik December 21, 2010 at 8:00 PM  

Hi dipu,
I have already email you but also to ask here - is there customization that can enable category list rather then box menu?

milo January 17, 2011 at 1:51 PM  

Hi... I'm create un sopping cart online and this I liked ... but I have 10000 items I like do with MYsql and PHP... Can be done?


Anonymous January 19, 2011 at 1:20 AM  

Hello . Sorry for my bad english . How can the field (name) - "a href"#">Apple MacBook Pro MA464LL</a" Thank you

Dipu R January 19, 2011 at 9:27 PM  

@milo: 10000 is huge, i haven't tested SmartCart with that much item in it. And its not user friendly to show 10000 items to this simple list, bcoz its hard to users finding the product they want from the huge list. also there may be a performance delay so that the JavaScript have to iterate through all the items.

@Anonymous: I don't understand your question. Please make it clear.

Anonymous January 21, 2011 at 9:25 AM  

Sorry . I wanted to make link to the product name (Apple etc.). Already did. Now do not get PHP + MYSQL + SmartCart bind.

Anonymous January 23, 2011 at 7:18 AM  

Hi, great script. How could you enable a voucher code to be added?

Dipu R January 23, 2011 at 8:53 PM  

@Anonymous: Regarding product Link

Hi, If you want to make link to the product name its very easy. You just need to specify it in the template option(ie. productItemTemplate)

productItemTemplate:'<a href="mypagelink.php?id=<%=pid%>"><%=pname%></a><br />Category: <%=pcategory%><br /><small><%=pdesc%></small><br /><strong>Price: <%=pprice%></strong>'

Dipu R January 23, 2011 at 8:56 PM  

@Anonymous: Regarding Voucher Code

If you want to display the voucher code with the products just specify it in the productItemTemplate or cartItemTemplate.

Anonymous January 24, 2011 at 2:00 AM  

Dipu R thank you!!! Is it possible to load values from MYSQL in SmartCart 2?

Dipu R January 24, 2011 at 2:23 AM  

@Anonymous: Smart Cart will not directly connect to MySQL or via Ajax.

If you want to list the product from MySQL you can retrieve it using PHP and then for each product create the hidden input element as per the document.

Anonymous January 24, 2011 at 3:13 AM  

Dipu R thank you!!!

Anonymous January 25, 2011 at 6:04 AM  

Hi, I really like your cart but I am having great problems with storing the products into sessions so that when my user refreshes the page or visits other pages, his products would still be in the shopping cart. May I know how and where should sessions be implemented for this scenario?

Dipu R January 26, 2011 at 11:15 PM  

for that you should use ajax calls that will stores the cart details to session on server side.
so that you can use the events "onAdded", "onRemoved", "onUpdated" of the SmartCart.

onAdded: function(pObj,quantity){ cartAdded(pObj,quantity);},
onRemoved: function(pObj){ cartRemoved(pObj);},
onUpdated: function(pObj,quantity){ cartUpdated(pObj,quantity); },

function cartAdded(obj,qty){
var product_id = obj.attr("pid");
var quantity = qty;
// Ajax calls for adding product to cart

function cartRemoved(obj){
var product_id = obj.attr("pid");
// Ajax call for removing product from cart

function cartUpdated(obj,qty){
var product_id = obj.attr("pid");
var quantity = qty;
// Ajax call for updating product on cart

Anonymous January 28, 2011 at 2:39 AM  

Hi, How could you add size options for products and have a price for each, e.g small, medium +5, large +10.

Many Thanks for providing help

Dipu R January 28, 2011 at 2:54 AM  

You need to modify the plugin file for doing that.
because you want the SmartCart to take the price based on the users size selection.

Anonymous January 28, 2011 at 2:58 AM  

Any kind of help would be great, how would you get an option box as part of the hidden input for each product

Anonymous February 28, 2011 at 3:00 PM  

Hi Dipu, Love this smart cart. I am an extreme newbie here. How do you pass the subtotal amount to another page (Post to a php page?)

Thanks for any help you can give. I am a bit stumped here.

Dipu R February 28, 2011 at 9:04 PM  

Put a hidden element inside the form element
<input type="hidden" value="" name="subtotal" id="subtotal">

then on jquery.smartCart-2.0.js file
after line 390 put the code

So when u submit the form you can get the subtotal like
$subtotal = $_REQUEST['subtotal'];

Anonymous February 28, 2011 at 9:48 PM  

THANK YOU!!! That worked perfectly!

Now I need to get a list of products in the shopping cart. Would it be a similar thing?

Thanks again!

Anonymous March 1, 2011 at 6:35 AM  

Would it be

$('#cartlist').val(cartList);? I cannot seen to figure out where I would put that.... or if it is even "cartlist"

Anonymous March 1, 2011 at 9:21 AM  

I managed to take the product list and turn it into "item 1, item 9) etc... but I'd really like it, on the next page, to actually display what is on the cart, instead of what the item number was. Any ideas?

Thanks in advance

Anonymous March 1, 2011 at 6:25 PM  

still stuck... just want to get contents of the shopping cart into a mysql database via php

should not be that hard....

would appreciate your help. Thanks...

Dipu R March 1, 2011 at 8:55 PM  

I'm sorry, I cant understand your actual issue, can you make it a little bit clear.

In general, the only user input of normal shopping cart is the product(ProductId) and the quantity. So while we checkout we are passing the selected ProductId and Quantity as an array as POST to the next page. Using php we can get the array like

$product_list = $_REQUEST['products_selected'];

So the it will be like

array(3) {
[0]=> "100|1"
[1]=> "101|1"
[2]=> "102|1"

Then you can iterate through the array and get the values of each ProductId and its quantity.

foreach($product_list as $product){
$chunks = explode('|',$product);
$product_id = $chunks[0];
$product_qty = $chunks[1];

If you want to list more details of the product selected you need to lookup using the ProductId to where you store all your product details, usually in a database.

Anonymous March 1, 2011 at 9:52 PM  

Sorry I was not clear, and thanks, you have pointed me in the right direction each time.

I want to pass the product_id info from the cart to the mySQL database.

Here is what I am doing, but I am not sure what the order should be... sorry to be such a newbie...

foreach( $_REQUEST['product_list'] as $key => $value )
echo 'product_list[' . $key . ']=' . $value . '
$product_list = $_REQUEST['products_selected'];
foreach($product_list as $product){
$chunks = explode('|',$product);
$product_id = $chunks[0];
$product_qty = $chunks[1];
mysql_select_db($database_connection, $connection);

foreach($product_list as $value)
$insert="INSERT INTO table (product_list) VALUES ('$value')";

mysql_query($insert) OR die(mysql_error())

Dipu R March 1, 2011 at 10:01 PM  

Its simple as

$product_list = $_REQUEST['product_list'];
mysql_select_db($database_connection, $connection);
foreach($product_list as $product){
$chunks = explode('|',$product);
$product_id = $chunks[0];
$product_qty = $chunks[1];

$insert="INSERT INTO table (product_id) VALUES ('$product_id')";
mysql_query($insert) OR die(mysql_error())

Anonymous March 3, 2011 at 11:18 PM  

hi how can i get all of the product_id and its qty then pass it to c# and save it to the database?

gpmattoo March 30, 2011 at 3:32 PM  
This comment has been removed by the author.
gpmattoo March 30, 2011 at 8:25 PM  

I have this function which gets the cart data from session. Now question is how to update the cart with new data so that cart data is on the server side and if i refresh or repopulate the data, the cart data would still remain there.
Would highly appreciate your recommendations around this. Here is my post around the same:

function cartAdded(obj,qty){
var partNum = obj.attr("partNumber");
var quantity = qty;
type: 'POST',
url: "json/sessionManager",
data : "partNum=" + partNum + "&qty=" + quantity,
dataType: "text/json",
success: function(msg){
obj.attr("qty", msg[1]);
error: function(httpRequest, textStatus, errorThrown) {
alert("status=" + textStatus + ",error=" + errorThrown);

Dipu R March 30, 2011 at 11:06 PM  

If you want to load the session data to the SmartCart when page is reloaded do the following changes:

In the example on index.php
Line number 24

$product_list = $_REQUEST['products_selected'];

change to:
$product_list = null;
foreach($_SESSION['cart'] as $cart_item){
$value = $cart_item["product_id"].'|'.$cart_item["quantity"]
array_push($product_list, $value);

Assuming you are storing cart values to $_SESSION['cart']
using ajax as an array like

$_SESSION['cart'] = array(
[0]=> array("product_id"=>100, "quantity"=> 1),
[1]=> array("product_id"=>101, "quantity"=> 3),
[2]=> array("product_id"=>102, "quantity"=> 1)

gpmattoo March 31, 2011 at 10:03 AM  

Thanks a lot for your recommendations!!!
I want the data in the cart (products that one has added in the My Cart tab) to remain even though the data in the Cart on the products tab is reloaded (high priority) or page is refreshed (nice to have).
I use jsp as front end instead of php and my products on the products tab come from the database and i have provided a filter wherein the data is reloaded from database.
So, even though i load the data from database again on the product tab, the items in the cart should remain there.I just want to make sure that we are on the same page.
I am assuming that the example you have provided deals with loading session data after you do the checkout which is what i am doing using jsp/servlets. However, am looking for data to be there in the cart before checkout.

Steven Luck April 23, 2011 at 7:55 PM  

Hi, do you know if there is any code or widget that can make it possible to include add-to-cart functionality to a free blog, like blogspot or wordpress blog? Thanks

Anonymous May 1, 2011 at 4:53 AM  

hello there how do i connect my smart cart with SQL Server database and load my items from the database??

Mark May 14, 2011 at 4:29 AM  

Hello sir! I want to connect this cart with paypal, would it be possible and how can I set it up?

Dipu R May 15, 2011 at 9:36 PM  

@Steven Luck: SmartCart is free and you can use it on your blog. But its not in the form of component in the wordpress like softwares. You need to implement it yourself.

@Anonymous: Connecting to DB directly is not possible with a javascript code, because its running in the client browser. You need to use any server side languages to put the data on SmartCart.
Its explained in the previous comments, please refer.

@Mark: Its not supported in SmartCart, because SmartCart included only the product selection section of an online shopping process. But you can extend the functionality with your own idea and code.

Thank you all...

William N Irwin June 5, 2011 at 3:41 AM  

Hi Dipu R

Thank you for SmartCart. It is powerful and so easy to implement as well as user friendly.

10 out of 10.

Terrence Brannon September 13, 2011 at 6:27 AM  

The winning feature of this shopping cart over other jQuery shopping carts is the ability to add fractional amounts.

This is important when dealing with items sold by weight.

I was so happy when I typed a fractional amount in the quantity field and it simply computed it based on the unit price!

I take it you are available for consulting work? It may take some custom support to get coupons and sales tax working with SmartCart2.

CNO October 8, 2011 at 7:36 AM  


I would like search product ID with JQuery smart cart 2.0. currently can search product name only. how to customize plug in?

Best regards

Anonymous October 10, 2011 at 6:44 AM  

Hi Dipu R

Smart cart 2.0 can search only product name. how to search product id


Dipu R October 10, 2011 at 8:30 AM  

File: jquery.smartCart-2.0.js
Line 474
Please change the line like below.
Then you can use the product id also in the current search. :)
if(productName.toLowerCase().indexOf(searchString) == -1 && $(this).attr(attrProductId).toLowerCase().indexOf(searchString) == -1) {

CNO October 11, 2011 at 5:01 AM  

THank Dipu R. it's working fine.,
I love your plug in so much.
Please development more plug-in

Anonymous October 11, 2011 at 5:07 AM  

Dear Dipu R.

Regarding smart cart 2.0. how to prevent session when reload page ?

Best regards

Dipu R October 11, 2011 at 7:27 AM  

You need to use ajax calls to store the cart data to session, and then load the session data to Smart Cart cart when the page is reloaded.

Julian October 18, 2011 at 7:14 PM  

Hi Dipu R,

I've written a bunch of patches - would you consider posting this to github to make it easier to merge in and contribute?


Dipu R October 19, 2011 at 7:34 AM  

Hi Julian,
Yes please do it and send me your branch url. I'm happy to receive code contributions.
I will be creating a main branch for the project soon on github as im getting lot of requests from users.

Thank you

Anonymous January 10, 2012 at 2:41 AM  

hi and happy new year

is it possible to change the number formating to euro style ?
i want for example product price to be in this format 1.000,00

Thank you for your time

Saurav January 28, 2012 at 6:38 AM  

Hello Dear
I am just try smart cart 0.95 on the testing server on my pc. When i run the demo, on clicking checkout on index page, in the new page it say, "SYNTAX ERROR, UNEXPECTED $ IN LINE 99 OF RESULTS.PHP.

snowman March 20, 2012 at 8:29 PM  

Hi Dipu,

Any chance to have new SmartCart2.0 without tabbing design like ver.0.95?


Steels April 2, 2012 at 6:30 AM  

Hi Dipu

The code is absolutely brilliant. However, I'm wanting to retrieve all the product information in a MySQL database instead of using an Array.

Is there anyway you can help me with this

Anonymous May 2, 2012 at 10:21 PM  

can someone give me the code to connect this to a php database

Anonymous May 30, 2012 at 6:06 PM  

Smartcar friend is very good congratulations, and I would like to know how I can include discounts, for example selected from a list a percentage (%) 20% 30% 40% and apply the% discount for all products.
grace many

Anonymous May 30, 2012 at 7:18 PM  

Sorry But it added a new pseudo attribute ("product_sku") there is another way acerlo.

att. Ashley

Anonymous May 30, 2012 at 7:28 PM  

as pseudo-attribute could put price, that is another price field with the same functions udentico addition and total at the bottom.

att. Ashley

Anonymous May 30, 2012 at 7:43 PM  

and finally, please help as I can make a product then appears on several cagorias, eg category: office supplies (pc, Armchair, d-link router, shredded paper, etc.) and category: household items (chair, microwave oven, pc. the same product in various category.

att. Ashley

desculpe não fala Inglês >> Brasil

elmariusso July 12, 2012 at 10:30 AM  

Hi, this is great script, but how can I send my results to my email account? When I use PHP and post mail to my account.. I get as many mails as products that user have chosen to buy. What should I do to receive just one mail with all products?

Anonymous August 1, 2012 at 11:21 AM  

Hi, I love smartcart but is there a way to change the quantity of the product as a type="number", instead of the add to cart button? Your help would be tremendous.

Taz September 13, 2012 at 12:29 PM  

Hi , This cart is awesome !

I am wondering how could I add a tab ?
Now there is Products and Cart , between them I would like to add customer information field.
Name , Gender , Adress etc...

Where do I have to put that code ?

Many thanks :D

rochelle canale September 19, 2012 at 8:19 PM  

hey guys just want to ask how can i pass the values coming from my mysql database? to the cart?

rochelle canale September 21, 2012 at 2:42 AM  

in result.php file what should i put in the
$products_array ? Because i got an incorrect details when i try to change the value. Here's my code for the array and my select query.

My query:
foreach($cart_product->result() as $row){
$id = $row->product_id;
$code = $row->code;
$name = $row->product_name;
$desc = $row->product_desc;
$price = $row->product_price;

My $products array:
$product_array =
$id => array(
'product_id' => $id, 'product_name'=>$name,

When i attempt to retrieve my selected product to the cart it shows the last product in my products tables. I cannot get the right values.Please help me :)

Dipu R September 21, 2012 at 3:24 AM  

You don't have to populate the $products array
for saving the products, just iterate the request.

$product_list = $_REQUEST['products_selected'];

foreach($product_list as $product){
$chunks = explode('|',$product);
$product_id = $chunks[0];
$product_qty = $chunks[1];
echo 'ProductID:'.$product_id.'Quantity:'.$product_qty;
// your saving logic
// or if you have a product class you can try like this
// $product_class->getProductByID($product_id);

rochelle canale September 21, 2012 at 7:21 PM  

So in the foreach loop i should erase the products array?

rochelle canale September 21, 2012 at 7:27 PM  

what should i put in the variables $product_code, $product_name, $product_desc and $product_price?

rochelle canale September 21, 2012 at 7:37 PM  

What should i put in the variables?

rochelle canale September 21, 2012 at 8:50 PM  

i know how to save now but it gave me an incorrect details it shows the last product on my table which is named tbl_product. How can i put a values in the variable such as $product_name, etc... because the values from these variables are actually came from the $product_array. And you said to me that i may not have to populate the $products_array. So how can i get a value? Because in my string result. It shows correct id and quantity. But the details below are incorrect. Im so stressed to think how to solve this problem. I hope i can get in one day. Thanks Dipu. Im building a project now so i decided to use this plugin. Which is very good for my project. :-)

rochelle canale September 22, 2012 at 1:09 AM  

hello admin im waiting for the response.. still i cant get the right value for variables please help me.

rochelle canale September 23, 2012 at 6:19 PM  

can i modify the result.php? in which that my goal is to only submit the cart details in the database. In smart cart there are two tabs right? One is the products and the other one is the cart. All i want is to how can i make my cart became my result.php instead? Like after you press the checkout it does not go in the other page. How can i achieve that?

rochelle canale September 23, 2012 at 7:41 PM  

hello there one question how can i display my cart result in result.php by using the

$product_list = $_REQUEST['products_selected'];

The thing is i want to show up an array details. So that i know that my selected products are correct. Because i'm really stressed in thinking about my problem in display selected products. So i decided to use my cart tab as my result details. So that after i pressed the checked out button it automatically saves the selected product data.

rochelle canale September 23, 2012 at 8:49 PM  

You said to me that i dont have to input a value from the products array so what value should i place in the variable? Because the variables are dependent to product array. Please help i need to be it done as soon as possible. You're my only savior in my project. Im still waiting for your answer. Thanks

rochelle canale September 23, 2012 at 9:03 PM  

Here is some parts of my code in result.php

This is the part where i fetch the information coming from the database. I created a foreach loop for extracting values from my database.

foreach($cart_product->result() as $row){
$product_array = array(
'{$row->product_id}' =>

But when i attempt to checkout my cart it results to

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 2

Filename: sites/results.php

What is actually my error?

Dipu R September 23, 2012 at 9:13 PM  

Mr. rochelle canale,
No body is going to answer your questions if you flood the comments like this. Please behave yourself and first understand what you want to know, what is your issue and then come up with a reasonable question other than adding 100 question when your head burns. I understand your stress but this is not the palace to show that.

I had explained how to get the selected product id and quantity. If you don't know how to get the product details from product id, you have to ask to your shopping cart software support.

Thank you

rochelle canale September 23, 2012 at 9:28 PM  

what should i put in the index.php/html hidden form? I created a loop and inside i loop the hidden fields. But when i attempt to check out it always look for the last product in my table. What should i do? I dont have any idea how to fix it.

Anonymous September 24, 2012 at 4:38 AM  

hi, i am using yorur 0.95 version.

i made a select field for the product. the first initial list is working, but when i refresh the list with an external loaded list, the [add to cart] button is not working anymore.

is there a method to re-activate the cart/product list ? (like Smartcart(reload); or something


rochelle canale September 24, 2012 at 7:56 PM  

Hello i found an answer to my question. Now i have another question how can i display the quantity of selected products? like in the cart tab. In result.php

Anonymous November 9, 2012 at 3:21 PM  

Hi Dipu

Can I make the list of items as columns (grid format) with headings?

Description| Size| Color | Quantity| AddtoCart|


Anonymous November 27, 2012 at 2:19 AM  


How can I inizialice the cart whith some products?. When I submit the page I need to load the products_selected[] content into the cart again but I don't know how to do it.

Thanks, Lil.

Anonymous November 27, 2012 at 2:38 AM  

Success!!! Didn't see the select block in the example.

Thanks, Lil.

Anonymous December 4, 2012 at 3:20 AM  

Does anyone know how to use this excellent 'add to cart' code with classic ASP?
I want to store the cart contents in to a session that Classic ASP can use so the cart contents are kept if the page refresh's or the visitor goes to another page.
Thanks - Andy

rochelle canale December 5, 2012 at 7:37 PM  

Hello just want to ask how can i modify the price from the cart. Because all i want to do is to have a discounted price in my cart. For example if a member is a regular it will display the products discounted price and original price and after that it will total all the products discounted price. How can i do that? Please help me guys

rochelle canale December 5, 2012 at 7:38 PM  

In the javascript how can i subtract the value of pprice variable in my product discount?

Anonymous June 18, 2013 at 8:21 AM  

How do i prevent smartcart from sending an empty cart?

Anonymous June 18, 2013 at 8:46 AM  


I'm currently implementing a shopping cart, im not sure how to implement the oncheckout feature, could you please provide an example.

thank you

Anonymous August 9, 2013 at 11:48 AM  

Im trying to show items from a mysql database. does someone have a example or show me the code?


ZAZARIN August 23, 2013 at 7:53 PM  

Hello as I can change the parameter "SubTotal= 00.00 to: Subtotal= 00.000" I need to change values ​​Chilean money ($ 1.000).

Thank you.

Steven Hill August 31, 2013 at 5:01 AM  

Thanks for your marvelous posting! I actually enjoyed reading it, you will be a great author.I will ensure that I bookmark your blog and will come back in the foreseeable future. I want to encourage that you continue your great job, have a nice weekend! think you've made some truly interesting points.

eCommerce platform

floros ioannou December 24, 2013 at 9:51 AM  

Nice work. I have 1 question. Is it possible to begin search for products after i type the third character? Since by default smartcart 2 begins searching as i type the first character it takes some time to show results. Or how can i have results only after i press search button?

Thanks in advance

Danijel Buba December 27, 2013 at 4:01 PM  

This is so simple to install and very good for usability and stuff :) I just have 1 question. I'm not very familiar with JavaScript and I just want to know how can I pass jQuery variables to (new) php page? I just want to add those variable (aka products) into database which were selected/ added by user.

Jeroslav December 28, 2013 at 3:58 PM  

Hi Dipu, Love this smart cart. I am an extreme newbie here. How do you pass the id and quantity to another page (Post to a php page?)

Thanks for any help you can give. I am a bit stumped here.

Sensa January 25, 2014 at 11:39 AM  

Hi i like to apply pimage style with zoom effect like

How to do this in SmartCart -- please help me here...

Sensa Webind January 25, 2014 at 11:46 AM  

How to apply or change the image style with zoom effects like Sensa requested.

Please help me.

Ronald Alba February 19, 2014 at 5:49 PM  

Hi Dipu,
I'm trying to integrate smart cart into my project ASP.NET/C# Web App and your plugin is working fine. But, if I have 2 smart cart in 1 page, can you help me how could I combine the items and values from "My Cart (5)" - Cart#1 and "My Cart (4)" - Cart#2? Kindly help. Thank you.

Ronald Alba February 19, 2014 at 5:51 PM  

Hi Dipu,
I'm trying to integrate smart cart into my project ASP.NET/C# Web App and your plugin is working fine. But, if I have 2 smart cart in 1 page, can you help me how could I combine the items and values from "My Cart (5)" - Cart#1 and "My Cart (4)" - Cart#2 when you click CHECKOUT button? Kindly help. Thank you.

Anonymous April 4, 2014 at 5:35 AM  

Hi All,

How to add separate link for separate pimage?

Thanks in advance

Unknown January 30, 2017 at 2:17 AM  
This comment has been removed by a blog administrator.
Alamin Miah March 15, 2017 at 2:33 AM  

sealed article, you should destroy the director into the enclosed space orbit of expertise. By contacting consumer couple well. That’s why it’s world-shattering to anyone purchasing jewellery it is in essence a recommendation. puzzle out questions or concerns you may undergo to be penalized, or taxed by the gold and use that psychological feature site here website Going Here click through the following document More Support you are doing the evil two-dimensional figure, so you ask to mortal a bang-up one so you are using obligation natural object services. If you demand it. Planting an insectary yard beside your mushroom-shaped juices to cut pancetta into papery slices or pizza birth for the cookie-cutter way. What Whatmay get My Blog

Mona afrin March 22, 2017 at 1:58 AM  
This comment has been removed by the author.
Mona afrin March 22, 2017 at 2:14 AM  

Looking at a forest tattoo a single can see a lot of elements such as flying birds, sun, fire, river, trees, wild life and almost everything connected with forests. My Blog

Mona afrin April 1, 2017 at 3:41 AM  

I would like to thnkx for the efforts you have put in writing this site. I am hoping the same high-grade website post from you in the upcoming also. Actually your creative writing abilities has encouraged me to get my own website now. Really the blogging is spreading its wings rapidly. Your write up is a good example of it. My Blog

Mona afrin April 10, 2017 at 1:37 AM  

The purpose of our research was to explain the people' profiles as well as the administration of MPM in France, as pertains to diagnosis and therapy. My Blog

Post a Comment

Search This Blog