Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extra 'Add to Cart' Button


flemina

Recommended Posts

Hi, I was wondering if anyone could help me with a small problem I have :'(

 

I am trying to add an extra 'add to cart' button on the product_info.php page so in addition to having a 'Add to Cart' I would also have a 'Add Case to Cart' button. This new button would automatically increment the quantity of the product in the shopping cart by 6. I know there is a contribution for adding a quantity input box but I would really like to use the extra button. Every time I try to get it working both the buttons either return quantity 1 or 6 - I guess this is due to there only being one action for these buttons 'action=add_product'. Does anyone know how I can either add an extra action for one of the buttons or pass a different quantity depending on the button clicked??

 

Thanks

Link to comment
Share on other sites

Hi, I was wondering if anyone could help me with a small problem I have  :'(

 

I am trying to add an extra 'add to cart' button on the product_info.php page so in addition to having a 'Add to Cart' I would also have a 'Add Case to Cart' button.  This new button would automatically increment the quantity of the product in the shopping cart by 6.  I know there is a contribution for adding a quantity input box but I would really like to use the extra button. Every time I try to get it working both the buttons either return quantity 1 or 6 - I guess this is due to there only being one action for these buttons 'action=add_product'.  Does anyone know how I can either add an extra action for one of the buttons or pass a different quantity depending on the button clicked??

 

Thanks

 

It's possible to do, and would require you to use a similar method at the quantity contribution. You can use a hidden form field with the value 6. The trickiest part would be putting the new button in a different html form so that it doesn't conflict with the existing button. If you need additionaly help, I can provide more details later.

 

Good luck!

Link to comment
Share on other sites

It's possible to do, and would require you to use a similar method at the quantity contribution.  You can use a hidden form field with the value 6.  The trickiest part would be putting the new button in a different html form so that it doesn't conflict with the existing button.  If you need additionaly help, I can provide more details later. 

 

Good luck!

 

Hi, could you explain further - not too sure why I need a new form - is it not possible to have this on the same form? Just now I have the following which will only give a quantity of 1 if the case price does not exist (only show the one button)but 6 when a case price does exist (two buttons) - which ever button I press:

 

<td class="main" align="right"><?php

$HTTP_POST_VARS['quantity']['1'] ;

echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_hidden_field('quantity', '1') . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

<td class="main" align="right"><?php if (tep_not_null($products_case_price)){

$HTTP_POST_VARS['quantity']['6'] ;

echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_hidden_field('quantity', '6') . tep_image_submit('button_case_cart.gif', IMAGE_BUTTON_CASE_CART);

}?></td>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...