Jump to content


Corporate Sponsors


Latest News: (loading..)

drferrari

Member Since 17 Apr 2007
Offline Last Active May 10 2012, 12:05
-----

Topics I've Started

Square meter contrib

06 January 2012, 19:12

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.