Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Aug 2008
    Posts
    18
    Plugin Contributions
    0

    Default How do I add an "add to cart " button to the front page in featured products

    How do I add an "add to cart " button to the front page in featured products

  2. #2
    Join Date
    Jun 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: How do I add an "add to cart " button to the front page in featured products

    This might help you, i'm not sure. good luck.


    $disc_prod_image_id = " product id number"

    $lc_button = '<a href="'.zen_href_link($_GET['main_page'],zen_get_all_get_params(array('action')).'action=buy_now&products_id='.$disc_pro d_image_id).'">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';

    echo $lc_button;

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

    Default Re: How do I add an "add to cart " button to the front page in featured products

    You will need to clean up the look of this, but the peices and parts are here and the logic for working with the featured products centerbox and adding either a buy now button or the add to cart with quantity box, plus the more info for products with attributes ...

    PHP Code:
        if (zen_has_product_attributes($featured_products->fields['products_id'])) {
          
    // show a more link for attributes
          
    $lc_button '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $featured_products->fields['products_id']) . '">' MORE_INFO_TEXT '</a>';
          
    $lc_button2 '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $featured_products->fields['products_id']) . '">' MORE_INFO_TEXT '</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=' $featured_products->fields['products_id']) . '">' zen_image_button(BUTTON_IMAGE_BUY_NOWBUTTON_BUY_NOW_ALT'class="listingBuyNowButton"') . '</a>';
          
    $lc_button2zen_draw_form('cart_quantity'zen_href_link(zen_get_info_page($featured_products->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' $featured_products->fields['products_id']), 'post''enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($featured_products->fields['products_id'])) . '" maxlength="6" size="4" /><br />' zen_draw_hidden_field('products_id'$featured_products->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CARTBUTTON_IN_CART_ALT) . '</form>';
        }

        
    $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' ' ' 'style="width:' $col_width '%;"',
        
    'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' $featured_products->fields['products_id']) . '">' zen_image(DIR_WS_IMAGES $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTHIMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' $featured_products->fields['products_id']) . '">' $featured_products->fields['products_name'] . '</a><br />' $products_price '<br />' $lc_button '<br />' $lc_button2); 
    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!]
    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!

  4. #4
    Join Date
    Aug 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: How do I add an "add to cart " button to the front page in featured products

    Quote Originally Posted by Ajeh View Post
    You will need to clean up the look of this, but the peices and parts are here and the logic for working with the featured products centerbox and adding either a buy now button or the add to cart with quantity box, plus the more info for products with attributes ...

    PHP Code:
        if (zen_has_product_attributes($featured_products->fields['products_id'])) {
          
    // show a more link for attributes
          
    $lc_button '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $featured_products->fields['products_id']) . '">' MORE_INFO_TEXT '</a>';
          
    $lc_button2 '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $featured_products->fields['products_id']) . '">' MORE_INFO_TEXT '</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=' $featured_products->fields['products_id']) . '">' zen_image_button(BUTTON_IMAGE_BUY_NOWBUTTON_BUY_NOW_ALT'class="listingBuyNowButton"') . '</a>';
          
    $lc_button2zen_draw_form('cart_quantity'zen_href_link(zen_get_info_page($featured_products->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' $featured_products->fields['products_id']), 'post''enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($featured_products->fields['products_id'])) . '" maxlength="6" size="4" /><br />' zen_draw_hidden_field('products_id'$featured_products->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CARTBUTTON_IN_CART_ALT) . '</form>';
        }

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

    what is the name of the file that I have to change

  5. #5
    Join Date
    Aug 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: How do I add an "add to cart " button to the front page in featured products

    Quote Originally Posted by coolman View Post
    This might help you, i'm not sure. good luck.


    $disc_prod_image_id = " product id number"

    $lc_button = '<a href="'.zen_href_link($_GET['main_page'],zen_get_all_get_params(array('action')).'action=buy_now&products_id='.$disc_pro d_image_id).'">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';

    echo $lc_button;
    what is the name of the file I have to change

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

    Default Re: How do I add an "add to cart " button to the front page in featured products

    I'd look to change the module for the featured_products.php ...
    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!]
    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!

  7. #7
    Join Date
    Aug 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: How do I add an "add to cart " button to the front page in featured products

    Thanks

    I inserted the text however it shows 2 "add to cart " buttons
    on each item




    Quote Originally Posted by Ajeh View Post
    You will need to clean up the look of this, but the peices and parts are here and the logic for working with the featured products centerbox and adding either a buy now button or the add to cart with quantity box, plus the more info for products with attributes ...

    PHP Code:
        if (zen_has_product_attributes($featured_products->fields['products_id'])) {
          
    // show a more link for attributes
          
    $lc_button '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $featured_products->fields['products_id']) . '">' MORE_INFO_TEXT '</a>';
          
    $lc_button2 '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $featured_products->fields['products_id']) . '">' MORE_INFO_TEXT '</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=' $featured_products->fields['products_id']) . '">' zen_image_button(BUTTON_IMAGE_BUY_NOWBUTTON_BUY_NOW_ALT'class="listingBuyNowButton"') . '</a>';
          
    $lc_button2zen_draw_form('cart_quantity'zen_href_link(zen_get_info_page($featured_products->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' $featured_products->fields['products_id']), 'post''enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($featured_products->fields['products_id'])) . '" maxlength="6" size="4" /><br />' zen_draw_hidden_field('products_id'$featured_products->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CARTBUTTON_IN_CART_ALT) . '</form>';
        }

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

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

    Default Re: How do I add an "add to cart " button to the front page in featured products

    The code I gave you has 2 ways to do the button ...

    You can have the buy now button or the add to cart button with a quantity box ...

    You need to include the code you want or don't want from what I gave you ...

    I used $lc_button1 and $lc_button2 for this code ...
    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!]
    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!

  9. #9
    Join Date
    Aug 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: How do I add an "add to cart " button to the front page in featured products

    Quote Originally Posted by Ajeh View Post
    The code I gave you has 2 ways to do the button ...

    You can have the buy now button or the add to cart button with a quantity box ...

    You need to include the code you want or don't want from what I gave you ...

    I used $lc_button1 and $lc_button2 for this code ...
    thanks, it worked

  10. #10
    Join Date
    Sep 2008
    Posts
    3
    Plugin Contributions
    0

    Default Re: How do I add an "add to cart " button to the front page in featured products

    hi there - thanks for this too!! i'm very close to having this working but when i add it to my code i'm getting the page breaking at the point where this point loads. just going to white. just wondering if you can see anything fishy in here:

    PHP Code:
    if (zen_has_product_attributes($featured_products->fields['products_id'])) {
          
    // show a more link for attributes
          
    $lc_button1 '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $featured_products->fields['products_id']) . '">' MORE_INFO_TEXT '</a>';
        } else {
          
    // show an add to cart choose one or the other
          
    $lc_button2 '<a href="' zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' $featured_products->fields['products_id']) . '">' zen_image_button(BUTTON_IMAGE_BUY_NOWBUTTON_BUY_NOW_ALT'class="listingBuyNowButton"') . '</a>';
        }
        
    $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' ' ' 'style="width:' $col_width '%;"',
        
    'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' $featured_products->fields['products_id']) . '">' zen_image(DIR_WS_IMAGES $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTHIMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' $featured_products->fields['products_id']) . '">' $featured_products->fields['products_name'] . '</a><br />' $products_price '<br />' $lc_button1 '<br />' $lc_button2); 

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h How do I hide the "Add to Cart" button on selective products?
    By jgold723 in forum General Questions
    Replies: 3
    Last Post: 21 Nov 2013, 11:39 PM
  2. ADD BUTTON "add to cart on the products listing page"
    By gloerick in forum General Questions
    Replies: 0
    Last Post: 24 Oct 2011, 09:28 PM
  3. Adding "add to cart" button to featured products
    By Sheehan in forum Basic Configuration
    Replies: 12
    Last Post: 25 May 2011, 08:49 AM
  4. Replies: 0
    Last Post: 17 Mar 2010, 05:24 PM
  5. Replies: 0
    Last Post: 9 Sep 2008, 03:44 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