Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to pass new parameter to shopping cart


asianguyinaustin@yahoo.com

Recommended Posts

Hello Guys/Gals,

 

I added a new table called Product_Size to my database.

Product_Size fields are: Products_ID, Products_Size, Products_SizeCount

 

I have code in my categories.php page to allow adding sizes and quanity you have for a size to the table Product_Size

 

A product can have many sizes so you just keep adding sizes and the count for each.

*************************************************************************

 

On my product_info.php page I added the following code to create an array of sizes for a product.

 

$products_size_array = array(array('id' => '', 'size' => ''));

$products_size_query = tep_db_query("select products_id, products_size from " . product_size . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' order by products_size");

 

while ($products_size_detail = tep_db_fetch_array($products_size_query))

{

$products_size_array[] = array('id' => $products_size_detail['products_id'],

'size' => $products_size_detail['products_size']);

}

 

 

**********************************************************************

I wrote some code to create a dropdown list from the array

 

<SELECT name="size">

<?php

foreach ($products_size_array as $value)

echo "<OPTION value=\" $value \">$value</OPTION>\n";

?>

</SELECT>

**********************************************************************

 

When a customer clicks the Add to Cart button...I need to have the value of SIZE passed into the shopping cart too. How do I do that?

 

Thanks a bunch...

Link to comment
Share on other sites

The shopping cart functions are in /includes/application_top.php and then you have /includes/classes/shopping_cart.php.... further on for checkout you have the orders class also.

 

You also need to create a check in application_top.php to redirect to your product page when somebody tries to add a product with your parameters to the cart from the product listing page

 

 

There are actually contributions that do all you require, so you are reinventing the wheel

 

 

Sonia

Link to comment
Share on other sites

Why not use the product attributes instead?

 

 

Most people who deal with these kind of values find attributes impossible to deal with, both for actually adding them to their product and the fact that stock is not tracked

 

My recommendation is Master Products - used by Google and Mozilla and thousands of others on their osCommerce stores :)

 

 

Sonia

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...