Forums / Templates, Stylesheets, Page Layout / add to cart button location?

add to cart button location?

Locked

Views: 3,955

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
20 Jun 2006, 7:34 PM
#1
gleek avatar

gleek

New Zenner

Join Date:
Jun 2006
Location:
New York, NY
Posts:
8
Plugin Contributions:
0

add to cart button location?

hi all,

i'm looking at the source for my product page and seeing a style applied to the "add to cart" button that i'd like to get rid of but i can't find the actual code!

this is what i see in the source:

<input class="cssButton button_in_cart" 
onmouseover="this.className='cssButtonHover button_in_cart button_in_cartHover'" 
onmouseout="this.className='cssButton button_in_cart'" 
type="submit" value="Add to Cart" style="width: 80px;" />

i want to get rid of that style tag... but this is what i see in tpl_product_info_display.php:

  <?php if ($display_qty != '' or $display_button != '') { ?>
    <div id="cartAdd">
    <?php
      echo $display_qty;
      echo $display_button;
       ?>
     </div>

where do i find the code that makes $display_button so that i can get rid of that style? i feel like i've been through every file in the site! :wacko:

20 Jun 2006, 9:02 PM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,678
Plugin Contributions:
0

Re: add to cart button location?

Exactly what are you wanting to do? Are you using CSS or graphical buttons?

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.

21 Jun 2006, 12:11 AM
#3
gleek avatar

gleek

New Zenner

Join Date:
Jun 2006
Location:
New York, NY
Posts:
8
Plugin Contributions:
0

Re: add to cart button location?

Kim:

Exactly what are you wanting to do? Are you using CSS or graphical buttons?

konbanwa, obaasan!

i'm using the CSS buttons. on the "add to cart" button in particular, there is this style="width: 80px;" that i want to get rid of. i have special styles applied to this button already in the stylesheet so don't want to restrict the width to 80px.

i'm trying to get rid of it, but can't find where it's coming from. it seems to be hard-coded into the variable $display_button that's in the php if statement.

21 Jun 2006, 7:16 PM
#4
gleek avatar

gleek

New Zenner

Join Date:
Jun 2006
Location:
New York, NY
Posts:
8
Plugin Contributions:
0

Re: add to cart button location?

ok, i figured out what's going on here. there is a file here that controls the width of these CSS buttons based on the language being used:

includes/functions/html_output.php

i really don't see the need to restrict the size based on the language when i can just restrict that in the CSS button stylesheet.

so i commented it out:

//    $style = ' style="width: ' . $width . 'px;"';
$style = '';

i left the original line in there in case i need it in the future. but i emptied out the $style variable so that it doesn't output anything.

i then modified the size of this button in the CSS.

15 Aug 2007, 1:31 AM
#5
joebankz avatar

joebankz

New Zenner

Join Date:
May 2004
Location:
Texas`
Posts:
36
Plugin Contributions:
0

Re: add to cart button location?

Thank you for posting your question. It has helped me immensely.

Paul aka joe

15 Aug 2007, 1:13 PM
#6
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: add to cart button location?

If you're using the CSS Buttons contribution rather than the built in css buttons (I know, it's confusing) then you can set the width of specific buttons in the CSS.

There are many advantages to using the contrib instead of the built-in. It would be worth your time to download it and read the readme.txt file at least.

Just a satisfied user,

Rob

Breakfast: the most important donut of the day.

10 Oct 2009, 9:50 PM
#7
soulman avatar

soulman

New Zenner

Join Date:
May 2009
Posts:
1
Plugin Contributions:
0

Re: add to cart button location?

I know this is an old post, but the title is what I keyed on rather than the content. I actually want to move the Add to Cart icon and box. Is this esily done in Zen Cart? I don't see an easy way to do this that I can find.

Zen Cart V1.3.8a
No add-ons
Brand new site in development mode

Thanks!

13 Oct 2009, 3:43 AM
#8
motopsycho avatar

motopsycho

New Zenner

Join Date:
Oct 2009
Posts:
7
Plugin Contributions:
0

Re: add to cart button location?

Zen 1.3.8

Clicky to store

I too would like to move the "add to cart" button. I just want it below attributes rather than above...

help please

18 Oct 2010, 3:18 AM
#10
ripvoid avatar

ripvoid

New Zenner

Join Date:
Apr 2010
Posts:
7
Plugin Contributions:
0

Re: add to cart button location?

gleek:

ok, i figured out what's going on here. there is a file here that controls the width of these CSS buttons based on the language being used:

includes/functions/html_output.php

i really don't see the need to restrict the size based on the language when i can just restrict that in the CSS button stylesheet.

so i commented it out:

// $style = ' style="width: ' . $width . 'px;"';
$style = '';

> 
> i left the original line in there in case i need it in the future. but i emptied out the $style variable so that it doesn't output anything.
> 
> i then modified the size of this button in the CSS.

can you send or add you html_out put and let us know how you commeted it out



/**
 * generate CSS buttons in the current language
 * concept from contributions by Seb Rouleau and paulm, subsequently adapted to Zen Cart
 * note: any hard-coded buttons will not be able to use this function
**/
  function zenCssButton($image = '', $text, $type, $sec_class = '', $parameters = '') {

    // automatic width setting depending on the number of characters
    $min_width = 90; // this is the minimum button width, change the value as you like
    $character_width = 6.5; // change this value depending on font size!
    // end settings
    // added html_entity_decode function to prevent html special chars to be counted as multiple characters (like &)
    $width = strlen(html_entity_decode($text)) * $character_width;
    $width = (int)$width;
    if ($width < $min_width) $width = $min_width;
    $style = ' style="width: ' . $width . 'px;"';
    // if no secondary class is set use the image name for the sec_class
    if (empty($sec_class)) $sec_class = basename($image, '.gif');
    if(!empty($sec_class))$sec_class = ' ' . $sec_class;
    if(!empty($parameters))$parameters = ' ' . $parameters;
    $mouse_out_class  = 'cssButton' . $sec_class;
    $mouse_over_class = 'cssButtonHover' . $sec_class . $sec_class . 'Hover';
    // javascript to set different classes on mouseover and mouseout: enables hover effect on the buttons
    // (pure css hovers on non link elements do work work in every browser)
    $css_button_js .=  'onmouseover="this.className=\''. $mouse_over_class . '\'" onmouseout="this.className=\'' . $mouse_out_class . '\'"';

    if ($type == 'submit'){
// form input button
   $css_button = '<input class="' . $mouse_out_class . '" ' . $css_button_js . ' type="submit" value="' .$text . '"' . $parameters . $style . ' />';
    }

    if ($type=='button'){
// link button
   $css_button = '<span class="' . $mouse_out_class . '" ' . $css_button_js . $style . ' > ' . $text . ' </span>'; // add $parameters ???
    }
    return $css_button;
  }