Forums / Templates, Stylesheets, Page Layout / Add to cart button for new products?

Add to cart button for new products?

Views: 2,381

Results 1 to 15 of 15
5 Mar 2011, 6:42 PM
#1
toxee avatar

toxee

New Zenner

Join Date:
Nov 2010
Posts:
12
Plugin Contributions:
0

Add to cart button for new products?

I tried two versions of this addon DesignerMonthlyBoxes and Column Divider Pro after someone who asked the same thing was turned on to the addon. They work great, but I need the add to cart button under the image and text description. There's no bottom option. I'm at my wits end, I really need a good solution so new products and featured products have an add to cart button. Thanks in advance for any help or advice.

5 Mar 2011, 6:45 PM
#2
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,187
Plugin Contributions:
0

Re: Add to cart button for new products?

Toxee,
this will be the action to find the add to cart file so you can move it where you like..

https://www.zen-cart.com/tutorials/index.php?article=39
https://www.zen-cart.com/tutorials/index.php?article=5

  1. search for add to cart
  1. look for tpl.product_info_display.php

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

6 Mar 2011, 3:20 PM
#3
toxee avatar

toxee

New Zenner

Join Date:
Nov 2010
Posts:
12
Plugin Contributions:
0

Re: Add to cart button for new products?

Yeah I found the piece of code, but I have no idea where and in what file to paste

I don't know if it's the tpl file mentioned earlier. https://www.goamericabumperstickers.com See I want an add to cart button under every product listed on the main page. I'm not sure which new products php file to edit though since there is multiple. Thanks for the help. :)

7 Mar 2011, 9:06 PM
#4
toxee avatar

toxee

New Zenner

Join Date:
Nov 2010
Posts:
12
Plugin Contributions:
0

Re: Add to cart button for new products?

Anyone? Got the general idea but I'm so lost on how to implement.

7 Mar 2011, 10:31 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Add to cart button for new products?

That looks like the New Products Centerbox that you are referring to which is in the modules directory ...

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!

8 Mar 2011, 6:33 AM
#6
toxee avatar

toxee

New Zenner

Join Date:
Nov 2010
Posts:
12
Plugin Contributions:
0

Re: Add to cart button for new products?

new_products.php? I see the file and found this code <!--bof Add to Cart Box -->

<div id="cartAdd"> Add to Cart: <input type="text" name="cart_quantity" value="1" maxlength="6" size="4" /><br /><br /><input type="hidden" name="products_id" value="8" /><input type="image" src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" title=" Add to Cart " /> </div> <!--eof Add to Cart Box-->

for the add to cart button itself, if that's it how and where do I paste it in without breaking anything? Thanks in advance for help! :smile:

8 Mar 2011, 7:34 AM
#7
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Add to cart button for new products?

YOUR_TEMPLATE = name of your template

open includes/modules/YOUR_TEMPLATE/new_products.php

if it don't exist, create it. Copy from includes/modules/new_products.php

around line 72 find:

    '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);

this is where you would add your code to put in a buy now button. I would suggest looking at the code in the includes/modules/product_listing.php file for reference. Simply change all instances of $product_listing to $new_products

8 Mar 2011, 4:10 PM
#8
toxee avatar

toxee

New Zenner

Join Date:
Nov 2010
Posts:
12
Plugin Contributions:
0

Re: Add to cart button for new products?

Ok, sweet the buttons are finally up but they aren't clickable for some reason. Here's how I pasted the div in the block of code you mentioned.

'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<table cellpadding="1" cellspacing="1" border="0" width="100%"><tr><td valign="top" align="center"><a href="' . zen_href_link(zen_get_info_page($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></td></tr>') . '<tr><td valign="top" align="center"><a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price . '** <div class="addholder"><div id="cartAdd"><input class="lots" type="text" name="cart_quantity" value="1" maxlength="6" size="4" /><input type="hidden" name="products_id" value="8" /><input type="image" src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" title=" Add to Cart " /> </div></div>**</td></tr></table>');

The div with the class "addholder" was my own I threw in there to make the button and quantity box line up with eachother that I styled to do so, but even before that the add button wasn't working.

8 Mar 2011, 4:46 PM
#9
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Add to cart button for new products?

Did you look at the code in your includes/modules/product_listing.php file for reference?

Your button is not working cause you haven't told it what you want it to do.

Try using this for your button, never used qty box here before

'<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']) . '">' .

. '</a>'

think of your new, featured and special modules as impulse modules, also zen & tables not good mixture

8 Mar 2011, 7:16 PM
#10
toxee avatar

toxee

New Zenner

Join Date:
Nov 2010
Posts:
12
Plugin Contributions:
0

Re: Add to cart button for new products?

Yeah I think it was Designer Monthly Boxes that added the tables. I always use divs and styling. So uh...where do I put that code exactly? I don't know any php so I have no idea where to paste without breaking. Thank you so much for the help btw. :D

8 Mar 2011, 8:06 PM
#11
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Add to cart button for new products?

could try something like this:

$products_price . '<div class="addholder">' . '<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']) . '">' . '<img src="includes/templates/template_default/buttons/english/button_in_cart.gif" />' .  '</a></div></td></tr></table>';
9 Mar 2011, 5:11 AM
#12
toxee avatar

toxee

New Zenner

Join Date:
Nov 2010
Posts:
12
Plugin Contributions:
0

Re: Add to cart button for new products?

Sorry, but I'm still totally lost at this. Can you show me where in the block of code I pasted earlier your code goes? I tried to paste it and ended up with no products at all. Thanks for the help again :)

9 Mar 2011, 7:02 AM
#13
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Add to cart button for new products?

you had it right in your code as far as where to insert it, my code is the same except the <a> tags

'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<table cellpadding="1" cellspacing="1" border="0" width="100%"><tr><td valign="top" align="center"><a href="' . zen_href_link(zen_get_info_page($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></td></tr>') . '<tr><td valign="top" align="center"><a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price . '<br /><div class="addholder">' . '<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']) . '">' . '<img src="includes/templates/template_default/buttons/english/button_in_cart.gif" />' . '</a></div></td></tr></table>';

Anyone interested in see this in action

10 Mar 2011, 10:29 AM
#14
toxee avatar

toxee

New Zenner

Join Date:
Nov 2010
Posts:
12
Plugin Contributions:
0

Re: Add to cart button for new products?

Ok thanks a lot rbarbour, it's all good now. :D

10 Mar 2011, 1:27 PM
#15
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Add to cart button for new products?

glad I could help!