Totally Zenned
- Join Date:
- Nov 2005
- Location:
- France
- Posts:
- 588
- Plugin Contributions:
- 1
Question for guru to answer please
When a product is added to cart, if i inspect the element of the add to cart button i see:
<div id="cartAdd"> <input type="hidden" name="cart_quantity" value="1"><input type="hidden" name="products_id" value="6"><input type="image" src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" title=" Add to Cart "> </div>Products id and qty are then, i assume, put into an array that can be read in the classes/shopping_cart.php file
if i add another hidden field to that so that it has:
<div id="cartAdd"> <input type="hidden" name="cart_quantity" value="1"><input type="hidden" name="products_id" value="6"><input type="hidden" name="offer" value="1"><input type="image" src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" title=" Add to Cart "> </div>where do i need to edit to get "gift" to be added to the array.
If i am in shopping_cart.php, specifically around line 100, i can use (int)$_POST['offer'] and it knows that it was 1 and i can set a new db field to show it as such in TABLE_CUSTOMERS_BASKET. But, if i try to use (int)$_POST['offer'] in function get_products, around line 1085 so that i can select a different field to populate $products_price var, it is always empty. Why can i get a result from (int)$_POST['offer'] in some places, but not others within the same file?
If i print_r($this); i see:
shoppingCart Object ( [contents] => Array ( [27] => Array ( [qty] => 1 ) [181] => Array ( [qty] => 1 ) [6] => Array ( [qty] => 1 ) ) which is a list of product id's and the qty of each. Now, i assume this is populated with each add to cart function, so what i want is to have [offer] added to this array. I haven't found where this array is built so don't even know for sure if i can add my 'offer' flag to it.
Is that the best way to be able to recall whether or not that product had a value of 1 posted with the add to cart, or is there another way i should be doing it?
Thanks for any help you can offer.