X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   "Buy Now" button without the "Quantity" (https://forum.x-cart.com/showthread.php?t=12466)

Jon 03-01-2005 01:53 PM

Look forward to hearing from you. I'm not sure if the result of the space is in this template, or if it's in currently template. But try the code below and see if it fixes it.



Code:

{* $Id: buy_now.tpl,v 1.15.2.7 2004/12/01 15:15:49 mclap Exp $ *}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0" >
{if $product.price eq 0}
<TR>
<TD height="25">
{assign var="button_href" value=$smarty.get.page|escape:"html"}
{include file="buttons/buy_now.tpl" style="button" href="product.php?productid=`$product.productid`&cat=`$cat`&page=`$button_href`"}
</TD>
</TR>
{else}
<FORM name="orderform_{$product.productid}_{$product.add_date}" method="post" action="{if $product.is_product_options eq 'Y' && $config.Appearance.buynow_with_options_enabled eq 'Y'}product.php?productid={$product.productid}{else}cart.php?mode=add{/if}">
<INPUT type="hidden" name="productid" value="{$product.productid}">
<INPUT type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}">
<INPUT type="hidden" name="page" value="{$smarty.get.page|escape:"html"}">
{if $product.is_product_options ne 'Y' || $config.Appearance.buynow_with_options_enabled ne 'Y'}
<TR>
<INPUT type="hidden" name="amount" value="1">
<TD width="100%" valign="middle">
<INPUT type="hidden" name="mode" value="add">
{include file="customer/main/product_prices.tpl"}
</TD>
</TR>
{/if}
<TR>
<TD>
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)} 
<TABLE border="0" cellpadding="0" cellspacing="0"><TR>
{if $js_enabled}
{if $special_offers_add_to_cart eq 'Y'}
<TD align="center">{include file="buttons/add_to_cart.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}</TD>
{else}
<TD align="center">{include file="buttons/buy_now.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}</TD>
{/if}
{if $login ne "" and $active_modules.Wishlist ne "" and $special_offers_add_to_cart eq ""}
{if $product.is_product_options ne 'Y' || $config.Appearance.buynow_with_options_enabled ne 'Y'}
<TD></TD>
<TD>{include file="buttons/add_to_wishlist.tpl" style="button" href="javascript:document.orderform_`$product.productid`_`$product.add_date`.mode.value='add2wl'; document.orderform_`$product.productid`_`$product.add_date`.submit()"}</TD>
{/if}
{/if}
{else}
<TD align="center">{include file="submit_wo_js.tpl" value=$lng.lbl_buy_now}</TD>
{/if}
</TR></TABLE>
{/if}
</TD>
</TR>
</FORM>
{if $product.min_amount gt 1}
<TR>
<TD><FONT class="ProductDetailsTitle">{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>
</TD>
</TR>
{/if}
{/if}
</TABLE>


kirsten 03-01-2005 02:42 PM

Okay that did the trick to get rid of the gap however the button is still aligning to the left hand side of the box and is not centered under the pricing details

Also if a customer is logged in both the buy now and wishlist buttons fall on the same line side by side I would like them to fall under one another and be centerred, with the buy now button on top

maybe it is the whislist button that is somehow causing the buy now button to default to the left hand side ??

What do you suggest?

Thanx
Kirsten

Jon 03-01-2005 02:51 PM

Try this :)

Code:

{* $Id: buy_now.tpl,v 1.15.2.7 2004/12/01 15:15:49 mclap Exp $ *}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0" >
{if $product.price eq 0}
<TR>
<TD height="25">
{assign var="button_href" value=$smarty.get.page|escape:"html"}
{include file="buttons/buy_now.tpl" style="button" href="product.php?productid=`$product.productid`&cat=`$cat`&page=`$button_href`"}
</TD>
</TR>
{else}
<FORM name="orderform_{$product.productid}_{$product.add_date}" method="post" action="{if $product.is_product_options eq 'Y' && $config.Appearance.buynow_with_options_enabled eq 'Y'}product.php?productid={$product.productid}{else}cart.php?mode=add{/if}">
<INPUT type="hidden" name="productid" value="{$product.productid}">
<INPUT type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}">
<INPUT type="hidden" name="page" value="{$smarty.get.page|escape:"html"}">
{if $product.is_product_options ne 'Y' || $config.Appearance.buynow_with_options_enabled ne 'Y'}
<TR>
<INPUT type="hidden" name="amount" value="1">
<TD width="100%" valign="middle">
<INPUT type="hidden" name="mode" value="add">
{include file="customer/main/product_prices.tpl"}
</TD>
</TR>
{/if}
<TR>
<TD align="center">
<div align="center">
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)} 
<TABLE border="0" cellpadding="0" cellspacing="0"><TR>
{if $js_enabled}
{if $special_offers_add_to_cart eq 'Y'}
<TD align="center"><center>{include file="buttons/add_to_cart.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}</TD>
{else}
<TD align="center"><center>{include file="buttons/buy_now.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}
{/if}
{if $login ne "" and $active_modules.Wishlist ne "" and $special_offers_add_to_cart eq ""}
{if $product.is_product_options ne 'Y' || $config.Appearance.buynow_with_options_enabled ne 'Y'}

{include file="buttons/add_to_wishlist.tpl" style="button" href="javascript:document.orderform_`$product.productid`_`$product.add_date`.mode.value='add2wl'; document.orderform_`$product.productid`_`$product.add_date`.submit()"}
</center>
</TD>
{/if}
{/if}
{else}
<TD align="center">{include file="submit_wo_js.tpl" value=$lng.lbl_buy_now}</TD>
{/if}
</TR></TABLE></div>
{/if}
</TD>
</TR>
</FORM>
{if $product.min_amount gt 1}
<TR>
<TD><FONT class="ProductDetailsTitle">{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>
</TD>
</TR>
{/if}
{/if}
</TABLE>


kirsten 03-01-2005 03:17 PM

Okay Jon almost there

This new tpl edit works fine for both the buy now and wishlist buttons and it now centered correctly for both logged in and guest customers

However I have one other issue that it does not work for

I have some items which are available for purchase by special order so instead of having a no price or please enter your price showing there I changed the language on this to read

Special Order Email Us for more details.

with a link to email me straight away

So is it possible to not have the buy now button or the add to cart buttons attach itself to those products with no price but still have the ability to have them added to wishlist if the customer is logged in???
As ideally that is the way I would like them to work

If you have a look at my home page I have one product there that has a no price but with the email link and i do not want the buy now button or add to cart button if the customer goes to see more details to be an option for this item

www.silverimports.com.au/shop/home.php

Thanx
Kirsten

Jon 03-01-2005 03:25 PM

Try this:

Code:

{* $Id: buy_now.tpl,v 1.15.2.7 2004/12/01 15:15:49 mclap Exp $ *}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0" >
{if $product.price eq 0}
<TR>
<TD height="25" align="center">
{if $login ne "" and $active_modules.Wishlist ne "" and $special_offers_add_to_cart eq ""}
{if $product.is_product_options ne 'Y' || $config.Appearance.buynow_with_options_enabled ne 'Y'}

{include file="buttons/add_to_wishlist.tpl" style="button" href="javascript:document.orderform_`$product.productid`_`$product.add_date`.mode.value='add2wl'; document.orderform_`$product.productid`_`$product.add_date`.submit()"}
{/if}
{/if}
</TD>
</TR>
{else}
<FORM name="orderform_{$product.productid}_{$product.add_date}" method="post" action="{if $product.is_product_options eq 'Y' && $config.Appearance.buynow_with_options_enabled eq 'Y'}product.php?productid={$product.productid}{else}cart.php?mode=add{/if}">
<INPUT type="hidden" name="productid" value="{$product.productid}">
<INPUT type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}">
<INPUT type="hidden" name="page" value="{$smarty.get.page|escape:"html"}">
{if $product.is_product_options ne 'Y' || $config.Appearance.buynow_with_options_enabled ne 'Y'}
<TR>
<INPUT type="hidden" name="amount" value="1">
<TD width="100%" valign="middle">
<INPUT type="hidden" name="mode" value="add">
{include file="customer/main/product_prices.tpl"}
</TD>
</TR>
{/if}
<TR>
<TD align="center">
<div align="center">
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)} 
<TABLE border="0" cellpadding="0" cellspacing="0"><TR>
{if $js_enabled}
{if $special_offers_add_to_cart eq 'Y'}
<TD align="center"><center>{include file="buttons/add_to_cart.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}</TD>
{else}
<TD align="center"><center>{include file="buttons/buy_now.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}
{/if}
{if $login ne "" and $active_modules.Wishlist ne "" and $special_offers_add_to_cart eq ""}
{if $product.is_product_options ne 'Y' || $config.Appearance.buynow_with_options_enabled ne 'Y'}

{include file="buttons/add_to_wishlist.tpl" style="button" href="javascript:document.orderform_`$product.productid`_`$product.add_date`.mode.value='add2wl'; document.orderform_`$product.productid`_`$product.add_date`.submit()"}
</center>
</TD>
{/if}
{/if}
{else}
<TD align="center">{include file="submit_wo_js.tpl" value=$lng.lbl_buy_now}</TD>
{/if}
</TR></TABLE></div>
{/if}
</TD>
</TR>
</FORM>
{if $product.min_amount gt 1}
<TR>
<TD><FONT class="ProductDetailsTitle">{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>
</TD>
</TR>
{/if}
{/if}
</TABLE>


kirsten 03-01-2005 03:47 PM

Well almost done

The buy now button does not show for products that have no price
the wishlist button does show for customers that are logged in for items with no price , but the link does not work to actually add it to the wishlist

If you look at this page you will see the details of products that have no price, there I have the add to cart button showing which I do not want to show up for items with no price and for all products i do not want that quantity drop down menu to show up just have it set as a default of one when a person clicks on add to cart
www.silverimports.com.au/shop/product.php?productid=16192&cat=0&page=1

The last minor thing I want to do is for the products with no price ,
if a customer clicks on email us is it possible to have a default subject enterred for the email that relates to the product they are interested in so that there is no confusion as to what product they are enquiring about and saves the customer time to type in item # and name?? if this is so how do i add this to the href link for the email?

Thanx
Kirsten

balinor 03-01-2005 03:51 PM

Wow, I hope Jon is getting paid for this :)

Jon 03-01-2005 03:56 PM

If the wishlist does not work to add the product to the cart, then it is a limitation of x-cart which would require extra programming and cannot be provided through instructions as testing to find the correct code would be required.

In order to edit the product pages and remove the add to cart button on those pages, you'd have to edit product.tpl

You'll have to work some of this out yourself or purchase some custom programming :)

You can use this in a mail tag:

<a href="mailto:Company Name <youremail@domain.com>?subject=EMAIL TITLE - {$product.product} - {$product.productid}">

kirsten 03-01-2005 05:59 PM

Yes Jon has been extremely helpful!!

He has helped me achieve some changes that I would not have been able to do without many fatal errors of which I have become accustomed, and have then had to inlist the techs at Qualiteam to ressurrect my site! But slowly I am getting some order into the way I want my site to run and look even though it is still very much a straight x cart site with no major changes in the original template design wise. For that I will definately need to commission a design expert, but in the meantime.....

I am feeling a bit better about my site now and I think I have come quite a long way in just over three weeks ( although very arduous and stressful ones!! )

LOL I am sure most of the experts here laugh and think omg how dumb is this woman at some of the posts and questions I have made

BUT - you never know some of my little questions and dilemmas may actually be of help to others whom also have no knowledge or experience :D

Thanx again to all the ppl who have given me advice and have helped me by answerring some of my questions

Kirsten
This is how my eyes are 8O after too many long nights!

interstellarsounds 07-18-2005 10:42 AM

Quote:

Originally Posted by Jon
You can edit out the quantity areas of your templates and instead use:

<input type="hidden" name="amount" value="1">


Hi. I have made this change as suggested and it works fine. However, when an item has sold out, obviously the 'Buy Now' button is no longer shown which is fine, but I still need the 'Out of Stock' text to show instead of just a blank space where the 'Buy Now' button was. How can I achieve this?

I also need to make exactly the same changes (ie. to lose the 'quantity dropdown' and yet still display 'out of stock' when sold out) to the 'Add to Cart' button displayed in the individual product listings.

I have searched and searched the forum but cannot find anything that applies to this particular issue.


All times are GMT -8. The time now is 02:04 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.