Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Image button for Add to Cart only

Image button for Add to Cart only

Locked

Views: 1,307

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
12 Jul 2010, 11:36 PM
#1
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Image button for Add to Cart only

I have CSS buttons turned on, and it's my understanding that to override a single CSS button with an image, I just need to put the button image in my includes/templates/custom/buttons/english folder, but I have done that and I am still getting the css add to cart button. What am I missing?

My page link is: http://www.zinniasnyc.com/index.php?main_page=product_info&cPath=2_10&products_id=8

Thanks!

15 Jul 2010, 3:06 PM
#2
blindside avatar

blindside

Totally Zenned

Join Date:
Sep 2004
Posts:
1,237
Plugin Contributions:
1

Re: Image button for Add to Cart only

The button looks customized to me. Did you figure it out since posting this? If you're still seeing the old button, try clearing your cache.

15 Jul 2010, 3:32 PM
#3
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Image button for Add to Cart only

Yes, sorry, I should have posted here again. I did try clearing my cache, even tried it on a completely different computer where I had never viewed the site before. I don't know what the issue is, but maybe I'm just misunderstanding something. I thought image buttons could override css buttons the way I mentioned in my first post, but it never worked. Anyways, I finally just had to change the code in tpl_product_info_display.php from this:

$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
} else {
// show the quantity box
$the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
}

to this:

$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '<input type="image" class="cartAddButton" src="/includes/templates/custom/buttons/english/button_in_cart.gif" />';
} else {
// show the quantity box
$the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '<input type="image" class="cartAddButton" src="/includes/templates/custom/buttons/english/button_in_cart.gif" />';
}

15 Jul 2010, 5:54 PM
#4
blindside avatar

blindside

Totally Zenned

Join Date:
Sep 2004
Posts:
1,237
Plugin Contributions:
1

Re: Image button for Add to Cart only

BUTTON_IMAGE_IN_CART is a define in includes\languages\english\button_names.php. Hardcoded defiens can't be overridden, which means your approach is the right approach.

Without digging into it, I know there are ways to make what you coded a little more dynamic (i.e. when switching templates), but other than that I'd take what you did, throw it in the override folder, and move on.

15 Jul 2010, 5:56 PM
#5
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Image button for Add to Cart only

OK, good thanks! It is in the override folder for sure.