Results 1 to 10 of 10
  1. #1
    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:
    HTML Code:
    <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:
    HTML Code:
      <?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!

  2. #2
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: add to cart button location?

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

  3. #3
    Join Date
    Jun 2006
    Location
    New York, NY
    Posts
    8
    Plugin Contributions
    0

    Default Re: add to cart button location?

    Quote Originally Posted by 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.

  4. #4
    Join Date
    Jun 2006
    Location
    New York, NY
    Posts
    8
    Plugin Contributions
    0

    Default 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:

    HTML Code:
    //    $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.

  5. #5
    Join Date
    May 2004
    Location
    Texas`
    Posts
    39
    Plugin Contributions
    0

    Idea or Suggestion Re: add to cart button location?

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

    Paul aka joe

  6. #6
    Join Date
    Nov 2006
    Location
    Dartmouth, NS Canada
    Posts
    2,378
    Plugin Contributions
    0

    Default 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

  7. #7
    Join Date
    May 2009
    Posts
    1
    Plugin Contributions
    0

    Default 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!

  8. #8
    Join Date
    Oct 2009
    Posts
    7
    Plugin Contributions
    0

    Default 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

  9. #9
    Join Date
    Oct 2009
    Posts
    7
    Plugin Contributions
    0

    Default Re: add to cart button location?

    A bit more searching yielded the answer...

    http://www.zen-cart.com/forum/showpo...53&postcount=6

  10. #10
    Join Date
    Apr 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: add to cart button location?

    Quote Originally Posted by gleek View Post
    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:

    HTML Code:
    //    $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 &amp;)
    $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 . ' >&nbsp;' . $text . '&nbsp;</span>'; // add $parameters ???
    }
    return $css_button;
    }
    Last edited by ripvoid; 18 Oct 2010 at 04:22 AM. Reason: add more content

 

 

Similar Threads

  1. Change button location in cart
    By fusionsp in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 Jun 2010, 08:29 PM
  2. Moving Add to Cart Location
    By mfsuchta in forum Basic Configuration
    Replies: 2
    Last Post: 30 Aug 2008, 07:16 AM
  3. shopping cart button location
    By Natallia in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 1 Aug 2008, 08:55 AM
  4. attributes and add to cart location modification help
    By MachaNeko in forum Basic Configuration
    Replies: 2
    Last Post: 8 May 2008, 01:46 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