Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2012
    Posts
    109
    Plugin Contributions
    0

    Default Buy Now Button on main page for new products help

    Hi all, I am trying to to place a button 'Buy Now' button on the main page and which to have it underneath the product price on New Products. I found a mod for this and tried copying and pasting however it completely ruins the front back and I'm really stuck on how to get this work. Could somebody please help me.

    Here is my code on new_products.php

    $products_price = zen_get_products_display_price($new_products->fields['products_id']);
    if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']);

    $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price);

    and here is the code I have been told to paste in which will not work

    $products_price = zen_get_products_display_price($new_products->fields['products_id']);

    $products_desc = substr(strip_tags(trim(zen_get_products_description($new_products->fields['products_id'], $_SESSION['languages_id']))),0,100).'&hellip;';

    $buy_now_link = zen_get_buy_now_button($new_products->fields['products_id'],'<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) .'<br/>'.'</a>&nbsp;<br /');
    if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']);
    $list_box_contents[$row][$col] = array('params' =>'class="back"' . ' ' . 'style="width:' . $col_width .'%;">'.$buy_now_link,

    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">'.zen_image(DIR_WS_IMAGES .$new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a></div><p>') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a></p>'. $products_price);

    I have no idea where this is going wrong.

  2. #2
    Join Date
    Oct 2012
    Posts
    109
    Plugin Contributions
    0

    Default Re: Buy Now Button on main page for new products help

    Okay I've found a piece of code, however when I add this code, the product details on the main page such as Price and title are replaced with 2 buttons.

    I just want 'Add to Cart' under the product details on index.php

    if (zen_has_product_attributes($new_products->fields['products_id'])) {
    // show a more link for attributes
    $lc_button = '<a href="' . zen_href_link(zen_get_info_page($new_products->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 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_DESIGN, BUTTONS_IMAGE_DESIGN_ALT) . '</a>';

    } else {
    // show an add to cart choose one or the other
    $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>'.'<a href="'. zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' .zen_image_button(BUTTON_IMAGE_DETAILS, BUTTON_DETAILS_ALT).'</a>';

    }

    $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_LISTING_WIDTH, IMAGE_PRODUCT_NEW_LISTING_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $lc_button);

  3. #3
    Join Date
    Oct 2012
    Posts
    109
    Plugin Contributions
    0

    Default Re: Buy Now Button on main page for new products help

    After a couple of hours I have still not got very far. Could anybody give me a few pointers please? I just a button on Whats New under the product price and name that says 'More Info' and I cannot for the life of me get this to work.

  4. #4
    Join Date
    Oct 2012
    Posts
    109
    Plugin Contributions
    0

    Default Re: Buy Now Button on main page for new products help

    Quote Originally Posted by KenshiroU View Post
    After a couple of hours I have still not got very far. Could anybody give me a few pointers please? I just a button on Whats New under the product price and name that says 'More Info' and I cannot for the life of me get this to work.
    Scratched that I've done it!!!!

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Buy Now Button on main page for new products help

    Thanks for the update that you have this working now ... what was the final solution that worked for you?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #6
    Join Date
    Sep 2013
    Location
    Texas
    Posts
    304
    Plugin Contributions
    0

    Default Re: Buy Now Button on main page for new products help

    I have the same problem, It doesn;t work with ZC V 1.5.1

 

 

Similar Threads

  1. Buy now button in main page products
    By soki in forum All Other Contributions/Addons
    Replies: 28
    Last Post: 3 Jan 2016, 11:09 PM
  2. add buy now button main page products
    By marlon20 in forum General Questions
    Replies: 7
    Last Post: 26 Nov 2013, 07:12 AM
  3. buy now button - specials on main page
    By tcjay in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 24 Jan 2011, 10:19 PM
  4. Buy Now Button for Whats New Center box module?
    By wmorris in forum General Questions
    Replies: 0
    Last Post: 15 Jan 2008, 04:42 PM
  5. Remove buy now from new products for month on home page
    By mwoody in forum General Questions
    Replies: 2
    Last Post: 3 Sep 2007, 09:27 PM

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