web4infinity Posted April 23, 2012 Share Posted April 23, 2012 Hi guys, I want to insert a form in blockcart.tpl. It has to be visible only when I add products in the cart. The problem is I need to refresh the page, after I add a product to display it. On the other hand when I delete the product from the cart it disappears straight away. Here is one input from the form I want to add <input type="text" name="quantity_{$i}" value="{$product.cart_quantity}"> Can you help me? Thanks Link to comment Share on other sites More sharing options...
CartExpert.net Posted April 24, 2012 Share Posted April 24, 2012 Hi, you need to edit ajax-cart.js and blockcart-json.tpl too Link to comment Share on other sites More sharing options...
web4infinity Posted April 24, 2012 Author Share Posted April 24, 2012 I managed to insert it in ajax-cart.js like this var content = '<dt class="hidden" id="cart_block_product_' + domIdProduct + '">'; content += '<input type="text" name="quantity_'+i+'" value="' + this.quantity + '">'; I still have 2 issues: - update quantity (now only says 1 and when I buy the product again it doesn't update - increment var i Can somebody help me? Link to comment Share on other sites More sharing options...
web4infinity Posted April 24, 2012 Author Share Posted April 24, 2012 I solved with the quantity. How do I increment a variable $i each time a new different product is being added in the cart? I want to change name="quantity_'+i+'" like name="quantity_1", name="quantity_2" etc Link to comment Share on other sites More sharing options...
web4infinity Posted April 24, 2012 Author Share Posted April 24, 2012 When an item is being removed from the cart all the var i needs to update. e.g. name="quantity_1", name="quantity_2", name="quantity_3" if I delete the first item then the counting should start from 1 again name="quantity_1", name="quantity_2" Link to comment Share on other sites More sharing options...
web4infinity Posted April 24, 2012 Author Share Posted April 24, 2012 I used name="item_name_'+jsonData.nbTotalProducts+'" which is working fine as long as I add products. When I remove them it's a problem. Link to comment Share on other sites More sharing options...
web4infinity Posted April 24, 2012 Author Share Posted April 24, 2012 So I basically want to count the number of lines from the cart (not the number of products) and update all the numbers when a line is removed. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now