Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

product_info.php


zackr

Recommended Posts

I've substantially modified osCommerce for a new site (mind you it's the first time I've ever worked with osCommerce), and I have finally come upon a sticking point. I searched in the 'Search' function first, but it appears broken on these forums??

 

Anyway, if you view the Product Info page you will see by looking at the source that I want each "Box" checkbox to correspond to the Quantity next to it, and then for the ability to list the product in the shopping cart, with the ability to remove or change the quantity for each box inside that product. Basically, what I'm getting at is that in the shopping cart you should be able to have 1 to 3 boxes and be able to remove them and change their quantities.

 

For those of you who do not care to visit the source, this is what I've done for each box (as you can see, I've made the name look like an array - I don't think it's correct, so please feel free to correct me):

BOX 1 <input type="checkbox" name="box[0]" value="1"> QUANTITY <input style="width: 30px" type="text" name="cart_quantity[0]">

 

Now where the sticking point is is that in application_top.php with the case 'add product' (around line 357) it only passes in numeric quantities, not arrays... At least, I think that's what my text box is passing, an array. The code from product_info.php is below:

 

BOX <?php echo $boxes[$i]['box'] ?> <?php $t = $boxes[$i]['box']; $t = $t - 1; echo tep_draw_checkbox_field('box[' . $t . ']', $boxes[$i]['box']); ?> QUANTITY <input style="width: 30px" type="text" name="cart_quantity[<?php echo $t; ?>]">

 

case 'add product':

 

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

$cart->add_cart($HTTP_POST_VARS['products_id'], /*$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1*/$quantity, $HTTP_POST_VARS['id']);

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

 

Now what I would like explained is how product_info.php passes its checkbox and textbox data, whether I need arrays or not, and the best way to put the product with 1 to 3 boxes and quantities for each box in the shopping cart, allowing for removal of each box or updating each box's quantity. Please note that when the last box is removed that product is removed from the shopping cart. Also, at the moment shopping_cart.php does not add products due to $quantity not being numeric (I guess that is the case anyhow).

 

If somebody could help me with this knotty problem it would be much appreciated. Also, if you want the entire code from product_info.php and shopping_cart.php feel free to ask.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...