Zen Cart Logo
Forums / General Questions / add one submit button on the shopping_cart page

add one submit button on the shopping_cart page

Locked

Views: 1,330

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
7 Apr 2008, 7:38 PM
#1
missvn avatar

missvn

New Zenner

Join Date:
Apr 2008
Posts:
6
Plugin Contributions:
0

add one submit button on the shopping_cart page

Hi all, I'm new on zen-cart. I have many problems that I hope all of you can help me.
I have an issue as following:
If I have a products list on the left of shopping-cart and with each product, customer can add it to cart.
I will have to create a submit button named 'order now'.
It means I will must create an other form with action is 'add_product'.
This is my code:

<tr> <td> <form id="id_form" action="<?php echo zen_href_link(FILENAME_SHOPPING_CART, 'action=add_product')?>" name="cart_quantity" method="POST"> print products list.... foreach ($leftmenus as $key => $value) { if ($value->indent == 1) { print '<tr><td class="ordernowradio" align="left"><input value="'.$value->id.'" type = "radio" name="products_id"><a href="' . $value->url . '" class="listproducts ">' . $value->desc . '</a></input></td></tr></br>'; } else { print '<tr><td align="left" class="leftmenu"><a href="' . $value->url . '" class="selleftmenu">' . $value->desc . '</a></td></tr>'; } } ..... </form> </td> <td> <?php echo zen_draw_form('cart_quantity', zen_href_link(FILENAME_SHOPPING_CART, 'action=update_product'));?> list all the products that customer selected. </td> <tr> <td> echo zen_inputimage_button(zen_imagename_button('<input type = "image" src ="../catalog/includes/templates/template_default/buttons/english/pady_b_ordernow0.gif" alt="Order Now" title = "Order Now" onclick="javascript:OrderButton();">',BUTTON_UPDATE_CART_ALT, '<input '), zen_imagemouse_action(BUTTON_IMAGE_ORDER_NOW_OVER,'BUTTON_ORDER_NOW_ALT')); ?> </td> <td> update cart button here... </td> </tr> </form>

my javascript function:
function OrderButton()
{
var oForm = document.getElementById('id_form');
oForm.submit();
return ;
}

After click on order now button, I get $_POST['product_id'].
But I don't know why the product can't be added to cart.
I do wrong any thing?
Sorry about my English.
Please tell me what I must do?
Thank in advance!

7 Apr 2008, 10:01 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: add one submit button on the shopping_cart page

This is builtin for the product listing and does not require code changes....

Why are you hacking the code?

8 Apr 2008, 1:57 AM
#3
missvn avatar

missvn

New Zenner

Join Date:
Apr 2008
Posts:
6
Plugin Contributions:
0

Re: add one submit button on the shopping_cart page

hi kobra. I want to changes something to understand more about zen-cart.
I want my shopping cart pages have content as following:

Header

Content:

product A | selected products list
product B |
product C |
product D |
product E |
product F |
|

                                                                           subtotal:

Order Now button Update cart continue shopping checkout

8 Apr 2008, 3:32 AM
#4
missvn avatar

missvn

New Zenner

Join Date:
Apr 2008
Posts:
6
Plugin Contributions:
0

Re: add one submit button on the shopping_cart page

yeah!! I have just done that.
I use submit method by javascript with the first form.
Now, It works well
Thanks................