Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Square meter contrib


drferrari

Recommended Posts

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.

Link to comment
Share on other sites

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???

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...