Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Posts
    229
    Plugin Contributions
    0

    Default how to insert Add to cart button ?

    Hello,

    I'm trying to ease the order process (not for customers) thru
    the printable pricelist mod. This mod shows a complete list of
    products with prices.

    I would like to add to this list an "Add to cart button",
    the same button we find in the products list.
    I'm sure this must be a simple copy/paste of code
    but I don't know where to find the code to copy :-)

    Can someone help find this few lines that shows
    "Add to cart" when the product has no attributes
    or "More options..." when it has some attributes.

    I'm quite sure to find the place where to paste these lines.

    Thanks for help

    Regards

    Hubert

  2. #2
    Join Date
    Mar 2005
    Posts
    229
    Plugin Contributions
    0

    Default Re: how to insert Add to cart button ?

    OK soI begun to try to help myself but I still need help...


    I found that I needed to modify
    /includes/modules/pages/pricelist/header_php.php

    after line 557
    Code:
    $prodRow .= '<td class="prdPL"><div><a href="' . zen_href_link($handler_page, 'products_id=' . $products_id) . '" target="_blank">' . $cats[$cat_index][$prod_index]['products_name'] . '</a></div></td>' . "\n";
    I added
    Code:
    $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($products_id)) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($products_id) . '</p>' : '');
                  // show the quantity box
                  $prodRow .='<td>' . zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($products_id), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data" . " target="_Cartpage"') . "\n" . $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($products_id)) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$products_id) . '<br />' . zen_draw_hidden_field('products_id', (int)$products_id) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT). '</form></td>';
    and it works, it adds the product showing the cart in a new window or a new tab (depends how your browser is configured).

    BUT, don't think I'm a PHP guru, I don't know anything about PHP, I just played with copy/paste and many trials to get to the result.

    So I would like a PHP guru to be kind enough to take a look at these few lines, and correct them to make it clean PHP syntax and clean regarding the zen guidelines.

    Thanks

    Hubert

 

 

Similar Threads

  1. v151 How do I replace the add-to-cart button with a PayPal *Donate* button?
    By picandnix in forum Addon Payment Modules
    Replies: 7
    Last Post: 29 Apr 2014, 02:52 PM
  2. How to diplay add to cart button?
    By soft1700 in forum General Questions
    Replies: 12
    Last Post: 3 Mar 2010, 04:12 AM
  3. How do I replace the Buy Now button with an Add to Cart button?
    By OrcaSoul in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 19 Feb 2010, 05:36 AM
  4. How can I insert links below "Add to cart" in the product infor page?
    By ttmb33 in forum Customization from the Admin
    Replies: 0
    Last Post: 5 Aug 2009, 07:42 AM
  5. Replies: 2
    Last Post: 9 Jan 2009, 12:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg