Hmm.. lets first try to understand what you are doing.
- You add an item, "Product 1" to the cart.
- On the cart page you want to see the normal cart, and below it you want to see 4 text boxes for that product:
Code: Select all
Product 1:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
- Now you add another item, "Product 2" to cart.
- On the cart page you want to see the normal cart with 2 items in it and 4 text boxes for each product
Code: Select all
Product 1:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
Product 2:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
Now if you update the qty for Product 1 on the cart page you want to see:
Code: Select all
Product 1:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
Product 1:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
Product 2:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
Is that right?
That being the case, you need a form submit to update those fields so you can either at them as part of the update button for the normal cart, or add their own button.
You'd also need to set those fields to match up with a product id so something in the tpl file as part of the foreach loop for products in the cart. Something like
Code: Select all
<?php $i = 0; ?>
<?php foreach ($products as $product) { ?>
..........
#### existing code ####
.........
<input type="text" name="textline[<?php echo $i; ?>][product_data][product_id][1]" value="">
<input type="text" name="textline[<?php echo $i; ?>][product_data][product_id][2]" value="">
<input type="text" name="textline[<?php echo $i; ?>][product_data][product_id][3]" value="">
<input type="text" name="textline[<?php echo $i; ?>][product_data][product_id][4]" value="">
<?php i++; ?>
</php } ?>
Then you can use
Code: Select all
if ($request->isPost()) {
.........
if ($request->gethtml('textline', 'post') != null) {
// do your code
}
.......
}
Really its messy. There's no identifier between products in the cart. If you have 10 product 1 items and 50 product 2 items you will have a huuuuuuge list of fields that will get absolutely confusing.
I think you are better off adding it to the product and giving a new proposal to your client...but I digress