Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2009
    Posts
    35
    Plugin Contributions
    0

    Default Adding a more info button alongside buy now button

    Hey everyone, I am having a tough time figuring out how to implement a "more info" button with the "buy now" button on the product listing page.

    The site is very simple; no attributes on any products so we would like the customer to be able to go to the product details page with a button. Currently it does this by clicking the product image, but having a button is a little more intuitive.

    I have been scanning the product_listing.php page around line 138 but I'm not really understanding this portion of the code.

    Can anyone give me a hint about how this can be done?

    Thanks,

    JW

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Adding a more info button alongside buy now button

    product_listing is the right place. It is modified by lots of mods but it looks like you are using the default version so I'll use those line numers:


    On line 115 find:

    Code:
              $lc_button = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
    This is a simple 'more info' link. It is assigned to the variable $lc_button here. Do not do anything yet as this is just to show you what the code for a 'more info' link looks like.

    If you just want the more info link to appear below the buy now or add to cart regardless of whether you are using cart quantities or not go to line 148:

    Code:
            $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
    This is (some of) where the final variable $lc_text (that is stored in an array and then output to the table in a different file) is created if we are in a price table cell.

    Then, just to see how it works add this(scroll left - the changes are in red):

    Code:
            $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']). '<br />'.'New Text Here' ;
    Now instead of the 'New Text Here' put in the code from line 115 (the bit after the equals sign) to get:

    Code:
            $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']). '<br />'.'<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>' ;
    There you go...

  3. #3
    Join Date
    Jun 2009
    Posts
    35
    Plugin Contributions
    0

    Default [Solved] Re: Adding a more info button alongside buy now button

    Righto, that worked perfectly thanks!

    JW

  4. #4
    Join Date
    Feb 2007
    Posts
    7
    Plugin Contributions
    0

    Default Re: Adding a more info button alongside buy now button

    Hi Niccol,

    If you're still watching. Can you tell me how to pull off the same thing in 'product all listing'?

    Wim

  5. #5
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Adding a more info button alongside buy now button

    In tpl_modules_products_all_listing about line 84, replace the existing code with:
    Code:
          if (PRODUCT_ALL_BUY_NOW != '0' and zen_get_products_allow_add_to_cart($products_all->fields['products_id']) == 'Y') {
            if (zen_has_product_attributes($products_all->fields['products_id'])) {
              $link = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
            } else {
    //          $link= '<a href="' . zen_href_link(FILENAME_PRODUCTS_ALL, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_all->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</a>';
              if (PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0 && $products_all->fields['products_qty_box_status'] != 0) {
    //            $how_many++;
                $link = TEXT_PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $products_all->fields['products_id'] . "]\" value=\"0\" size=\"4\" />".'<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
              } else {
                $link = '<a href="' . zen_href_link(FILENAME_PRODUCTS_ALL, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_all->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>&nbsp;'.'<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';;
              }
            }
    I think that should do it. If you need more precise instructions let me know. Basically replace everything between '// more info in place of buy now' and ' $the_button = $link;'

  6. #6
    Join Date
    Feb 2007
    Posts
    7
    Plugin Contributions
    0

    Default Re: Adding a more info button alongside buy now button

    Thats it.

    Thanks!

 

 

Similar Threads

  1. Remove buy now button/more info and max:1
    By julieoolie in forum Templates, Stylesheets, Page Layout
    Replies: 14
    Last Post: 26 Oct 2010, 12:34 AM
  2. Add More Info Button after Buy Now on category listing
    By gothstone in forum General Questions
    Replies: 46
    Last Post: 22 Jan 2009, 09:52 PM
  3. Change Buy Now Button to More Info on Product Listing Page
    By prosam in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 14 Jul 2008, 02:21 PM
  4. More Info Link and Buy Now Button
    By Toot4fun in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 30 Dec 2007, 05:57 AM
  5. why does product "buy Now" button changed to more info..
    By dhermanus in forum General Questions
    Replies: 2
    Last Post: 21 Oct 2006, 05:14 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR