Forums / Templates, Stylesheets, Page Layout / Move "Add to Cart" button to top of page.

Move "Add to Cart" button to top of page.

Locked

Started by jaztechnologies on 2 May 2007, 6:16 AM · Views: 11,053

Results 21 to 29 of 29
This thread is locked. New replies are disabled.
15 Jul 2007, 3:31 PM
#21
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Move "Add to Cart" button to top of page.

It won't exist in /your_template/templates/ until you put it there.
Copy it from /template_default/templates/, and edit it in your own template folder.

22 Dec 2008, 8:11 PM
#22
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Move "Add to Cart" button to top of page.

Gloria -

In response to your message, all your add button needs to move to the left is a change in the stylesheet.
Get rid of the float: right; and change the margins as shown.

#cartAdd {
	width:125px;
	text-align:center;
	margin:10px 0 10px 0;
	padding-right:10px;
	}

I used your instructions on the post dated Jun 07 in the thread "Move "Add to Cart" button to top of page" to relocate my add to cart button to below the product attributes which work great--thanks! My problem is that I want the button left aligned under the text. I saw your comment about tinkering with the <br class="clearBoth" /> but do not understand how to manipulate this information.

You can see the problem here at my draft shop:

http://www.myembroideryonline.com/ZenCart/index.php?main_page=product_info&cPath=66&products_id=184

I'd like the add to cart button to appear just below the price and be left aligned with the description and price.

On another note, I see you have both stylesheet.css and stylesheet_revised081221.css; it is a bad idea to leave an old version in the /css/ folder. Both will be applied and can cause confusion. If you want a backup, save it somewhere else or name it stylesheet.bak, and leave the current one as stylesheet.css.

13 Jul 2009, 7:53 PM
#23
mcarbone avatar

mcarbone

Zen Follower

Join Date:
Feb 2009
Location:
Simi Valley, CA
Posts:
99
Plugin Contributions:
0

Re: Move "Add to Cart" button to top of page.

Hi,

I moved the "add to cart" button as suggested by gjh421 in post #2 of this thread.

The move went fine, but whenever I try to change the quantity to more than 1, then "add to cart", the shopping cart does not retain the value I entered. For example: I input Quatity 3 - > add to cart -> shopping cart still says 1.

The "add to cart" function at the bottom works fine! HMMM!!
I wasn't exactly clear when gjh421 said to tinker with the
<br class="clearBoth"> tag to get it working right. Maybe this is the problem.

As always, thanks in advance for help!

MC

14 Jul 2009, 4:27 AM
#24
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Move "Add to Cart" button to top of page.

If you "moved" the add to cart button, there would not still be one at the bottom of the page. Having duplicates could well cause the quantity input from the first one to be overwritten by the (default) qty from the second one.

14 Jul 2009, 3:19 PM
#25
mcarbone avatar

mcarbone

Zen Follower

Join Date:
Feb 2009
Location:
Simi Valley, CA
Posts:
99
Plugin Contributions:
0

Re: Move "Add to Cart" button to top of page.

Hi Glenn,

Thanks so much for responding! That makes sense that since I duplicated the add to cart button, and didn't just "move" it, the one at the bottom would overwrite the quantity input at the top.

Do you think if I make the default quantity of the boxes 0 it would work? Or would I have to remove the one at the bottom all together?

Thanks again!

MC

14 Jul 2009, 3:47 PM
#26
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Move "Add to Cart" button to top of page.

I'm not an expert on forms, but I think you will need to remove the bottom add button, or at least only have one quantity box (top or bottom).

Making the default quantity 0 would result in nothing being added when you select a quantity in the top box.

14 Jul 2009, 4:35 PM
#27
mcarbone avatar

mcarbone

Zen Follower

Join Date:
Feb 2009
Location:
Simi Valley, CA
Posts:
99
Plugin Contributions:
0

Re: Move "Add to Cart" button to top of page.

For now I removed the 2nd add to cart all together, and it works great...even shortened the page length which I like. :D

At first I was trying to remove the quantity box, which would be ideal, but I didn't know where in this Add to cart fucntion to remove this. I tried removing the line of code in red and that didn't seem to work.

<!--bof Add to Cart Box --> <?php if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') { // do nothing } else { ?>
        <?php
$display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
        if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
          // hide the quantity box and default to 1
          $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);
        }
$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);

?>

<?php if ($display_qty != '' or $display_button != '') { ?>
<div id="cartAdd">
<?php
  echo $display_qty;
  echo $display_button;
        ?>
      </div>
<?php } // display qty and button ?> <?php } // CUSTOMERS_APPROVAL == 3 ?> <!--eof Add to Cart Box-->

Thanks ...yet again for your help and quick response!

20 Jul 2009, 7:20 PM
#28
robertrhu avatar

robertrhu

New Zenner

Join Date:
Jul 2009
Posts:
20
Plugin Contributions:
0

Re: Move "Add to Cart" button to top of page.

Hi all!

I found this thread trying to do what you are all describing. I've made the changes you've suggested but to no avail.

I am trying to make the 'Product Name', 'Price' and 'Attributes' move up to just under the 'Category Heading' entitled 'Women's Shirts' and also trying to move the 'Add to Cart' to just under the logo.

Here's a link...

http://openheartthreads.com/products/index.php?main_page=product_info&cPath=2&products_id=4

It seems what is being described in this thread is exactly what I'm looking for. But when I make the suggested changes nothing happens to the product page.

Thanks in advance for your help!
Robert

Here are the changes I've made to tpl_modules_main_product_image.php

<div class="centerColumn" id="docProductDisplay"> <!--bof Form start--> <?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?> <!--eof Form start--> <?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?> <!--bof Category Icon --> <?php if ($module_show_categories != 0) {?> <?php /** * display the category icons */ require($template->get_template_dir('/tpl_modules_category_icon_display.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_icon_display.php'); ?> <?php } ?> <!--eof Category Icon --> <!--bof Prev/Next top position --> <?php if (PRODUCT_INFO_PREVIOUS_NEXT == 1 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?> <?php /** * display the product previous/next helper */ require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?> <?php } ?> <!--eof Prev/Next top position--> <!--bof Product Name--> <h1 id="productName" class="docProduct"><?php echo $products_name; ?></h1> <!--eof Product Name--> <!--bof Product Price block --> <h2 id="productPrices" class="docProduct"> <?php // base price if ($show_onetime_charges_description == 'true') { $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span>'; } else { $one_time = ''; } echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']); ?></h2> <!--eof Product Price block --> <!--bof free ship icon --> <?php if(zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?> <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div> <?php } ?> <!--eof free ship icon --> <!--bof Product description --> <?php if ($products_description != '') { ?> <div id="productDescription" class="docProduct biggerText"><?php echo stripslashes($products_description); ?></div> <?php } ?> <!--eof Product description --> <br class="clearBoth" /> <!--bof Add to Cart Box --> <?php if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') { // do nothing } else { ?>
        <?php
$display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
        if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
          // hide the quantity box and default to 1
          $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" />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
        }
$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);

?>

<?php if ($display_qty != '' or $display_button != '') { ?>
<div id="cartAdd">
<?php
  echo $display_qty;
  echo $display_button;
        ?>
      </div>
<?php } // display qty and button ?> <?php } // CUSTOMERS_APPROVAL == 3 ?> <!--eof Add to Cart Box--> <!--bof Attributes Module --> <?php if ($pr_attr->fields['total'] > 0) { ?> <?php /** * display the product atributes */ require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes.php'); ?> <?php } ?> <!--eof Attributes Module --> <!--bof Main Product Image --> <?php if (zen_not_null($products_image)) { ?> <?php /** * display the main product image */ require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?> <?php } ?> <!--eof Main Product Image-->
20 Jul 2009, 11:02 PM
#29
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Move "Add to Cart" button to top of page.

If "nothing" happens, then it's not a matter of what code changes you made; the edited file is not getting properly saved to your server.

Please verify the filename you are editing (tpl_modules_main_product_image.php is not the right one) and the exact folder path you are saving it to. You might look in your FTP program to see the last-saved date of the server file copy.