Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2010
    Posts
    133
    Plugin Contributions
    0

    Default How do I replace the Buy Now button with an Add to Cart button?

    In the page created by the product entries I made in the Admin/Catalog/Categories / Products section, I see all of the entries, price & info.



    I also see a "Buy Now" button - I want an "Add to my Cart" button.

    After some searching, I found the following code in the "product_listing.php" file:
    (line 180 - 185)
    Code:
    // qty box with add to cart button
                if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
                  $lc_button= zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
                } else {
                  $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
                }
    If I comment out the '$lc_button = '<a href="' line (184), the button disappears.

    This appears to depend on the value of PRODUCT_LIST_PRICE_BUY_NOW - but I can find no code or panel in Admin where that switch is set...

    Of course, I could simply replace the "buy now" code with the "Add to my cart" code in line 182...but I'd really like a cleaner solution.

    Any suggestions?

  2. #2
    Join Date
    Jan 2008
    Location
    Portland, Oregon USA
    Posts
    356
    Plugin Contributions
    0

    Default Re: replacing Buy Now button

    Are you just trying to replace the graphic button with one that reads Add to my cart?

    If so, look under includes/templates/templates_default/buttons/english for the file button_buy_now.gif and replace that file with a graphic of your choosing, naming it button_buy_now.gif and leave all the code intact.
    Doug

  3. #3
    Join Date
    Jan 2010
    Posts
    133
    Plugin Contributions
    0

    Default Re: replacing Buy Now button

    Quote Originally Posted by pdxdoug View Post
    Are you just trying to replace the graphic button with one that reads Add to my cart?

    If so, look under includes/templates/templates_default/buttons/english for the file button_buy_now.gif and replace that file with a graphic of your choosing, naming it button_buy_now.gif and leave all the code intact.
    OK, thanks for the response. I'm assuming that's a typo (you suggested replacing 'button_buy_now.gif' with 'button_buy_now.gif') and you probably meant 'button_add_to_cart'...but won't the code still lead the user to the Buy Now cart? From the code I looked at, which has an if/else to set the image, there should be somewhere to make the condition be TRUE - which will engage the add to cart code. That's what I can't seem to find, the attribute I need to switch somewhere to make it TRUE. I can switch the code and it works...but I'd prefer a less brute-force method.

  4. #4
    Join Date
    Dec 2005
    Posts
    1,059
    Plugin Contributions
    2

    Default Re: How do I replace the Buy Now button with an Add to Cart button?

    Look in Admin/Configuration/All Listing. What setting do you have for Display Product Buy Now Button? 0 = off
    [FONT=Arial]Country Kitty Crafts[/FONT][FONT=Arial]
    [/FONT] [FONT=Garamond]
    [/FONT]

  5. #5
    Join Date
    Jan 2010
    Posts
    133
    Plugin Contributions
    0

    Default Re: How do I replace the Buy Now button with an Add to Cart button?

    Quote Originally Posted by TShooters View Post
    Look in Admin/Configuration/All Listing. What setting do you have for Display Product Buy Now Button? 0 = off
    That's correct, it is set to zero.

  6. #6
    Join Date
    Jan 2008
    Location
    Portland, Oregon USA
    Posts
    356
    Plugin Contributions
    0

    Default Re: How do I replace the Buy Now button with an Add to Cart button?

    Looking in the EZ Start Zen Cart Book, changes are made in the admin/configuration/product listing.

    There are several references to button settings in that section. Have you tried various settings to see if any of them have an effect?

    There is a setting:
    Display Product Add to Cart Button (0=off; 1=on;2=on with Qty Box per Product)

    What is it set for?
    Doug

  7. #7
    Join Date
    Jan 2010
    Posts
    133
    Plugin Contributions
    0

    Default Re: How do I replace the Buy Now button with an Add to Cart button?

    Quote Originally Posted by pdxdoug View Post
    Looking in the EZ Start Zen Cart Book, changes are made in the admin/configuration/product listing.

    There are several references to button settings in that section. Have you tried various settings to see if any of them have an effect?

    There is a setting:
    Display Product Add to Cart Button (0=off; 1=on;2=on with Qty Box per Product)

    What is it set for?
    Display Product Add to Cart Button is set to 1.

    I've checked every item in the Admin settings that I thought might have some influence, none seemed to change anything - I still get the Buy Now button.

  8. #8
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: How do I replace the Buy Now button with an Add to Cart button?

    OK, thanks for the response. I'm assuming that's a typo (you suggested replacing 'button_buy_now.gif' with 'button_buy_now.gif') and you probably meant 'button_add_to_cart'...but won't the code still lead the user to the Buy Now cart?
    There is no difference in the buy now and add to cart processes - if you want the button to say add to cart - just replace the image.
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  9. #9
    Join Date
    Jan 2010
    Posts
    133
    Plugin Contributions
    0

    Default Re: How do I replace the Buy Now button with an Add to Cart button?

    Quote Originally Posted by Kim View Post
    There is no difference in the buy now and add to cart processes - if you want the button to say add to cart - just replace the image.
    Hmmm...OK, I swapped the two lines of core out, and that is what happened...interesting.

    Thanks, I'll just use the line of code that gives me the "add to cart". I'd still like to figure out what settings control that if...else block - but this will work just fine.

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: How do I replace the Buy Now button with an Add to Cart button?

    "I'm assuming that's a typo (you suggested replacing 'button_buy_now.gif' with 'button_buy_now.gif') and you probably meant 'button_add_to_cart'"

    No typo - as Kim and pdxdoug said, replace the button image, but keep it the same filename so the code will still find it without having to edit the PHP file.

 

 

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. Change the Add to Cart button to Buy Now button
    By dastudio in forum Customization from the Admin
    Replies: 1
    Last Post: 24 Nov 2010, 09:44 PM
  3. Need Help, how to add PAYPAL BUY NOW button on the product page?
    By doug56patterson in forum General Questions
    Replies: 3
    Last Post: 14 Aug 2010, 07:53 PM
  4. Problem with Buy Now\Add To Cart button! Help please
    By Vista13 in forum General Questions
    Replies: 3
    Last Post: 31 Aug 2009, 11:57 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