I have been manipulating and trying everything I can think of - I am a budding coder trying to figure it out- to get this quantity box and add to cart button to the xsells(and any other fields throughout a site) and have run into a brick wall - I simply am too ignorant with php code and logic to figure this out - and I have spent hours and hours tweaking and manipulating trying to get it to work but to no avail. If you go to http://www.drumfactorydirect.com/dru...8/1410c-9.html you will see that if you add any quantity of the main product it will add one of the first xsell products instead. If you add any amount of the other cross sells, besides the first cross sell, it will add the correct amount to the cart but it will redirect to that products' product listing page. If you add any amount to the first cross sell it will add the correct amount and keep you on the same page (which is what I was going for). Here is the code that I have tried, it comes from Paulm who has added many useful contribs. I have tried using the add to cart code from the featured/new/specials listings with partially successful results but the code below has seemed to have gotten closest to what I am trying to achieve which is to keep the customer on the same page while adding more related products to their cart. It seems to have something to do with having 'cart_quantity' in there since the main product listing also uses the same command and the xsell code seems to "bleed" into the main product listing code. I've tried changing the 'cart_quantity' to other values such as 'xsell_quantity' but it doesn't work. Am I on the right track?
Here's the code so far:
I'm sure that someone with more php experience than me can correct this in a few minutes. If anyone can please make this work I will happily package it up to put into the downloads section. I think having the ability to add quantities of the xsell products to the cart without leaving the initial page is a huge boon to many people to get extra upsells.Code:$myBuyNow = ''; $flag_show_product_info_in_cart_qty = 1; $myBuyNow .= zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($xsell_query->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $xsell_query->fields['products_id']), 'post', 'enctype="multipart/form-data"') . "\n"; $myBuyNow .= 'Quantity' . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($xsell_query->fields['products_id'])) . '" maxlength="6" size="4" />' . "\n"; $myBuyNow .= zen_draw_hidden_field('products_id', $xsell_query->fields['products_id']); $myBuyNow .= zen_image_submit(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT); $myBuyNow .= '</form>'; $myBuyNow .= (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($xsell_query->fields['products_id'])) ? '<p class="xsellProductsInCart">' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($xsell_query->fields['products_id']) . '</p>' : '');
Can anyone please help me sort this out?
Thanks!!
Matt



