Hey
Is it possible to change the location of the "add to cart" button (along with the quanity in stock etc) to the top of the products page, instead of at the bottom? (so above the description)
Printable View
Hey
Is it possible to change the location of the "add to cart" button (along with the quanity in stock etc) to the top of the products page, instead of at the bottom? (so above the description)
Got it! Finally after 1 hour of searching.
Mods may delete this post.
Might be an idea to post where you found info you requiredQuote:
Got it! Finally after 1 hour of searching.
so other visitors here can benefit
:wink2:
For any other members looking to move add to cart button, details
can be found at
http://www.zen-cart.com/forum/showth...ve+cart+button
:thumbsup:
i have a question along the same lines..
i'd like to move my add to cart button within the add-to-cart box, so that it sits next to the quantities box, rather than below it. ive taken a look at the tpl_product_info_display.php and can't locate a break or anything that is forcing the button to sit below the quantity box.
thanks,
mel
:smile: just figured it out. i took the two <br />'s out of the Add to Cart Box section within the tpl_product_info_display.php. check out the bolded code below:
// 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);
I'm really tired of going through all these posts on the site and everyone says it is so simple to just move the <!--bof Add to Cart Box --> through the <!--eof Add to Cart Box --> to move the Add to Cart button somewhere else on the page.
It doesn't work for me. I can take it off the page and it still shows up. I have even deleted the tpl_product_info_display.php from the site from both my custom template directory and the template_default yet the page still shows up unless... there are no attributes on the page, then it disappears.
What the heck is going on? Why can't I move the Add to cart button under the Attributes box?
http://rememberthewater.com/zencart/...roducts_id=183
This is very frustrating.
So, deleting the product_info_display.php probably wont solve the problem of moving the attributes box to below the Add to Cart box. You are right, you should be able to select from <!--bof Add to Cart Box --> through the <!--eof Add to Cart Box -->, cut it, and then paste it below <!--eof Attributes Module --> in your tpl_product_info_display.php. that template file is the page that determines the ordering of your product info pages. so thats where you should move code around to get the display order you like. maybe try cutting and pasting again, just make sure youre cutting all the code you need and then pasting in the right place.
sorry to hear youre having so much trouble!
Hi,
I am not sure if this thread is still open, however, if enybody who knows how to solve the problem, finds this posting, I would really appreciate the answer.
My server admin uploaded the zen template from some clothing store including all of their pics and banners. I deleted all of their stuff, and now that I've set up my own store and merchandise, I don't have the add to cart button on my zen cart. I made all the connections to the mechant services and everything is ready to go, but I just can't figure out how to get the add to cart button on the page. Can somebody help me with that?:wacko:
Admin>Configuration>MyStore>StoreMode>
When I get to "MyStore", there is no option for Store Mode:no:. What do I do now?
Sorry - I called it the wrong thing -
Store Status
What is your Store Status
0= Normal Store
1= Showcase no prices
2= Showcase with prices
Store status is 2.
That is WHY you have no add to cart buttons - change it back to 0- normal store!
When I change it back to 0, I get "sold out" button.
Fix your stock settings - Admin> Configuration> Stock
Thanks a lot.:D It works.:clap:
Found it.
Open
/public_html/YOURSTORE/includes/templates/YOUR TEMPLATE OVERIDES/templates/tpl_product_info_display.php
Changing text in RED to the path to your template file.
I copied the whole section of add to cart code from
<!--bof Add to Cart Box -->
to
<!--eof Add to Cart Box-->
and pasted it between
<!--eof Category Icon -->
Paste here (as shown in RED below)
<br clear="all" />
<!--bof Main Product Image -->
And I now have two Add to Cart buttons, with this mod there will be one at the top of the page. If you only wanted one, the original code could be removed.
*********************************************
<!--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 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-->
<br clear="all" />
<!--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_jquery_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_jquery_image.php'); ?>
<?php
}
?>
<!--eof Main Product Image-->
Hope this helps :smile:
This REALLY helped me! THANK YOU! :)
I have made it so that I have 2 Add to Cart buttons, which I want in most instances on my site. Alot of the time my products have alot of attributes and I wanted the customer to be able to add to cart at the top of them and below them.
ie:
See here.
http://www.nappyshoppe.com/store/hap...per-p-187.html
However, there are some situations where I only want one add to cart button. When there are no attributes. I am not sure how to write the code to check for if there are attributes, only show the top add to cart box and hide the bottom one.
Like here.
http://www.nappyshoppe.com/store/fli...rts-p-645.html
Thanks in advance for any help.
Sharni
You could check to see if the product has attributes with a function in the functions_lookups.php for:
Code:/*
* Check if product has attributes values
*/
function zen_has_product_attributes_values($products_id) {
Ok So I'm Having some trouble with this. I'm trying to make it where my pictures are on top of the description along with the add button and product details no matter what I do it is not working. I'm using a pure green template. I have set the <br> codes to remove and it is still not working? Some one please help. Thank You.
How would you implement using this code.
Do you use the line you quoted, or all of the function as follows:
/*
* Check if product has attributes values
*/
function zen_has_product_attributes_values($products_id) {
global $db;
$attributes_query = "select sum(options_values_price) as total
from " . TABLE_PRODUCTS_ATTRIBUTES . "
where products_id = '" . (int)$products_id . "'";
$attributes = $db->Execute($attributes_query);
if ($attributes->fields['total'] != 0) {
return true;
} else {
return false;
}
}
I have my add to cart button located in tpl_modules_attributes.php in order to get the look I wanted. I now have some products that do not have any attributes so tpl_modules_attributes.php is not being called and therefore neither is my add to cart.
Therefore if I could check for attributes and then call the add to cart only when attributes are not present (in the file tpl_shopping_cart_default.php) it would be very helpful.
All attempts of inserting your code breaks the cart, could you provide some advice?
Thank You
Sorry, my bad ...
You could use:
Code:if (zen_has_product_attributes($_GET['products_id'])) {
// show second button code
}
I do not understand where to use this in the code, it renders the text exactly as you stated on the product page unless I wrap it with
<?php ?>
I tried this:
<php
if (zen_has_product_attributes($_GET['products_id'])) {
// show second button code
}
<!--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-->
?>
Then it shows the add to cart and ?>
Then it still shows on products that have attributes and products that do not have attributes. Could you clue me in on where I am going wrong?
Thanks
oops, I added the question mark and moved the bracket to the bottom, but then I got a blank page?
To make the Add to Cart code not show when there are attributes, take out that code and change the one line:
to read:Code:if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
and the Add to Cart button will not show ...Code:if (zen_has_product_attributes($_GET['products_id']) || CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
I will have to install a fresh cart and try. If I use the one line you gave I get words on the page, If I use the entire add to cart code and replace the line I get the cart button with or without attributes.
I must have changed it somehow while customizing the cart, it has lots of modifications. I can't switch to default because it wants files for PWAS that are not installed on template default.
I appreciate your trying to help.
Thanks
Thanks for steering me in the right direction. I actually had to change your replacement code toIt needed the brackets separating the conditions to get it to work.Code:if ((zen_has_product_attributes($_GET['products_id'])) || (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '')) {
Good catch ... thanks for the update that you have this working now ... :smile:
YES, thats very usefull there is no message there
im getting this message:
rtyfugkj, you do not have permission to access this page. This could be due to one of several reasons:
1. Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
2. If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Log Out Home
Yes its true, other people would like to know how to move the ad to cart button. so why not post the info here? To help people? Im getting this stupid message:
vBulletin Message
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
1. You are not logged in. Fill in the form at the bottom of this page and try again.
2. You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
3. If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Log in
User Name:
Password:
Forgotten Your Password? Remember Me?
The administrator may have required you to register before you can view this page.
I get the same as rtyfugkj, and have done on some other occasions, despite seeming to have a User Name (which is auto entered, my familiar and usual username) and a Password. I'll try re-registering, but my impression is that there is some problem with the discussion boards' access. Still love the whole Zen cart thing though :smile:
I re-quoted the originally posted code and message for clarity. In order to NOT display one of the two buttons in the absence of attributes (which I think was the gist of the original request) I believe the NOT operator is required like so:
Code:if (!(zen_has_product_attributes($_GET['products_id'])) || CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
im not sure if this is the right place to post but i couldn t find anything to help..
on my site the add to cart button is a icon and i want it to be a button, like a css button .. how do i change it ?