Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Posts
    158
    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
    158
    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

 

 

Bookmarks

Posting Permissions

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