drferrari Posted January 6, 2012 Share Posted January 6, 2012 I try create my own square meter contrib, I have stuck. in products_info.php page I create <input type="text" id="widthValue" name="widthValue" value="" size="5"/> x <input type="text" id="heightValue" name="heightValue" value="" size="5"/> this value is goto my shopping cart. in shopping_cart.php page if($products[$i]['widthValue'] !== ''){ $totalSquereMeter = $products[$i]['widthValue'] * $products[$i]['heightValue']; $info_box_contents[] = array('params' => 'class="productListing-data2"', 'text' => '<br/>WIDTH:'.$products[$i]['widthValue'].' x HEIGHT:'.$products[$i]['heightValue'].' = '.$totalSquereMeter); AND THIS is if products have width and height. I don't wanna show quantity if I have add product with WIDTH and HEIGHT. if($products[$i]['widthValue'] == ''){ echo"NO width and height"; $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data2" valign="top"', 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id'])); }else{ echo"width and height"; $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data2" valign="top"', 'text' => $products[$i]['quantity']); } in file -> includes/aplication_top.php $cart->add_cart( $HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $HTTP_POST_VARS['widthValue'][$i], $HTTP_POST_VARS['heightValue'][$i], $attributes, false); the problem is when I add product to shopping cart with WIDTH and HEIGHT then I can't delete it. I try this 'text' => tep_draw_hidden_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id'])); NOW I can delete all my products BUT this is WRONG if I have product A (with = 2 height =3) and product B (no width and height) AND if I change quantity of my second product this qantity value goes to my first product. any Idea for this. Quote Link to comment Share on other sites More sharing options...
Guest Posted January 6, 2012 Share Posted January 6, 2012 There is an commercial add for this called Area Calculator 2.3.1 if you want to Google for it, or you can check my profile links. Chris Quote Link to comment Share on other sites More sharing options...
drferrari Posted January 6, 2012 Author Share Posted January 6, 2012 Thank you, chris I know your contrib, sorry but I wanna create my own. if you have any idea. in shopping_cart.php page I check tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'])); this goto aplication_top.php case 'update_product' $cart->remove($HTTP_POST_VARS['products_id'][$i]); and then this goto include/classes/shopping_cart.php function remove WHY THIS NOT WORK??? Quote Link to comment Share on other sites More sharing options...
drferrari Posted January 7, 2012 Author Share Posted January 7, 2012 forgot the above posts, it is Lenght * width = square metere value Look at my my attach files. (and make it work on your oscommerce) 1) product_info-1.php page (FOR ADD FIRST PRODUCTS WITH LENGHT AND WIDTH)-> rename to product_info.php for your first add to cart 2) product_info-2.php page (FOR ADD SECOND PRODUCTS NO LENGHT AND WIDTH only quantity e.g. 10)-> rename to product_info.php for your second add to cart 3) shopping_cart.php 4) includes/application_top.php 5) square-meter5.txt rename to -> square-meter5.js 6) includes/classes/shopping_cart.php look at : function update_quantity($products_id, $lenghtValue, $widthValue, $quantity = '', $attributes = '') { if you have product A with LENGHT AND WIDTH and product B with NO LENGHT AND WIDTH in your shopping cart and try change quantity of the product B you can't, if you change the function to: function update_quantity($products_id, $quantity = '', $lenghtValue, $widthValue, $attributes = '') { you can change the quantity BUT you loose LENGHT and WIDTH of your product A ANY IDEA HOW CAN I FIT IT. Quote Link to comment Share on other sites More sharing options...
drferrari Posted January 19, 2012 Author Share Posted January 19, 2012 I found it "YEAHHHH", wait for my square meter contrib. thanks all chat friend for advises. Quote Link to comment Share on other sites More sharing options...
fermoncho1969 Posted January 22, 2012 Share Posted January 22, 2012 Hi, drferrari. I'm very interested in your contrib. I'm not an php expert, but it would be fantastic for my carpet shop. Thanks in avance Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.