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)

neonrider 10-16-2005 05:10 PM

Thank you
 
Thank you for the info.

hyratech 10-24-2005 07:43 PM

Here's my Buy_now.tpl, can anyone reply with a code i can use?
I want remove the quantity and make default 1, and also center the Buy NOW button.. any help will be appreciated very much
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>
{if $product.distribution eq ""}
<TD height="25" width="15%" nowrap>{$lng.lbl_quantity}
</TD>
<TD width="20%" nowrap>
{if $config.General.unlimited_products ne "Y" and ($product.avail le 0 or $product.avail lt $product.min_amount)}
{$lng.txt_out_of_stock}
{else}
{if $config.General.unlimited_products eq "Y"}
{math equation="x+1" assign="mq" x=$config.Appearance.max_select_quantity}
{else}
{math equation="x/y" x=$config.Appearance.max_select_quantity y=$product.min_amount assign="tmp"}
{if $tmp<2}
{assign var="minamount" value=$product.min_amount}
{else}
{assign var="minamount" value=1}
{/if}
{math equation="min(maxquantity+minamount, productquantity+1)" assign="mq" maxquantity=$config.Appearance.max_select_quantity minamount=$minamount productquantity=$product.avail}
{/if}
<SELECT name="amount">
{if $product.min_amount le 1}
{assign var="start_quantity" value=1}
{else}
{assign var="start_quantity" value=$product.min_amount}
{/if}
{section name=quantity loop=$mq start=$start_quantity}
<OPTION value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</OPTION>
{/section}
</SELECT>
{/if}
</TD>
{else}
<INPUT type="hidden" name="amount" value="1">
{/if}
<TD width="100%" height="25" valign="middle">
<INPUT type="hidden" name="mode" value="add">
{include file="customer/main/product_prices.tpl"}
</TD>
</TR>
{/if}
<TR>
<TD colspan="3">
{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>{include file="buttons/add_to_cart.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}</TD>
{else}
<TD>{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>{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 colspan="3"><FONT class="ProductDetailsTitle">{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>
</TD>
</TR>
{/if}
{/if}
</TABLE>


elviselviselvis 10-31-2005 08:29 AM

Guys, im confused i dont have anything like this
 
My buy_now.tpl look like this
{include file="buttons/button.tpl" button_title=$lng.lbl_buy_now href=$href title=$title style=$style}

It there a mod or add on that i am missing?

Would love to eliminate the quanity option when selecting buy it now.
But some people reference the products.tpl and others are working on the buttons.tpl file. While this thread deals with the buy_now.tpl

Help please.... :roll:
xcart- 4.0.16

balinor 10-31-2005 08:33 AM

You need to read the whole thread...there is code that you need to replace in order to hide the quantity select box.

elviselviselvis 10-31-2005 08:37 AM

Balinor,
I have read the whole thread a couple of times checking to see where changes have been made but my original .tpl files dont look like any posted here. I have also cut and pasted code to try these changes to only get a big server error message.
I have tried modifying the button, buy_now and product tpl files but i cant get them to work.

Newbie here seeks enlightnment. 8O

elviselviselvis 10-31-2005 09:19 AM

Ok,
Well i found that there are a couple of buy_now.tpl, after geting the correct one, "customer, Main, ..... buy_now.tpl i pasted the code from Jon and it appeared to work except when i hit the buy now button it would goto the store home.php and not the summary page. :?:

thundernugs 07-30-2006 03:43 PM

to remove qty dropdown and text, i found it much easier to do it this way:

create your own buy now or add to cart gif

include it where you want it in product.tpl

use this code for your hyperlink
[img]{$ImagesDir}/addtocart.gif[/img]

then just comment out or erase this entire table
Code:

<!--
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0">

{if $active_modules.Product_Options ne ""}
{ include file="modules/Product_Options/customer_options.tpl"}
{/if}

<TR><TD height="25" width="30%">{$lng.lbl_quantity}{if $product.min_amount gt 1}
<FONT class="ProductDetailsTitle">{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>{/if}</TD>
<TD>
{if $config.General.unlimited_products eq "N" and ($product.avail le 0 or $product.avail lt $product.min_amount) and $variants eq ''}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
var min_avail = 1;
var avail = 0;
var product_avail = 0;
</SCRIPT>
{$lng.txt_out_of_stock}
{else}
{if $config.General.unlimited_products eq "Y"}
{math equation="x+1" assign="mq" x=$config.Appearance.max_select_quantity}
{else}
{math equation="x/y" x=$config.Appearance.max_select_quantity y=$product.min_amount assign="tmp"}
{if $tmp<2}
{assign var="minamount" value=$product.min_amount}
{else}
{assign var="minamount" value=1}
{/if}
{math equation="min(maxquantity+minamount, productquantity+1)" assign="mq" maxquantity=$config.Appearance.max_select_quantity minamount=$minamount productquantity=$product.avail}
{/if}
{if $product.distribution eq "" and !($active_modules.Subscriptions ne "" and $subscription)}
{if $product.min_amount le 1}
{assign var="start_quantity" value=1}
{else}
{assign var="start_quantity" value=$product.min_amount}
{/if}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
var min_avail = {$start_quantity|default:1};
var avail = {$mq|default:1}-1;
var product_avail = {$product.avail|default:"0"};
</SCRIPT>
{*
<SELECT id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_options();"{/if}>
{section name=quantity loop=$mq start=$start_quantity}
<OPTION value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</OPTION>
{/section}
</SELECT>
*}
{else}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
var min_avail = 1;
var avail = 1;
var product_avail = 1;
</SCRIPT>
<FONT class="ProductDetailsTitle">1</FONT><INPUT type="hidden" name="amount" value="1"> {if $product.distribution ne ""}{$lng.txt_product_downloadable}{/if}
{/if}
{/if}
</TD></TR>
<TR><TD colspan="2">
<INPUT type="hidden" name="mode" value="add">
{if $variants eq ''}
{include file="customer/main/product_prices.tpl"}
{/if}
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)}
{if $js_enabled}


{if $smarty.get.pconf ne ""}
<INPUT type="hidden" name="slot" value="{$smarty.get.slot}">
<INPUT type="hidden" name="addproductid" value="{$product.productid}">
{include file="buttons/button.tpl" button_title=$lng.lbl_pconf_add_to_configuration style="button" href="javascript:if (FormValidation()) `$ldelim`document.orderform.productid.value='`$smarty.get.pconf`';document.orderform.action='pconf.php';document.orderform.submit()`$rdelim`"}



{/if}


{*
{if $product.forsale ne "B"}
{include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"}

{if $login ne "" and $active_modules.Wishlist ne ""}
{include file="customer/add2wl.tpl"}
{/if}
{else}
{$lng.txt_pconf_product_is_bundled}
{/if}
*}


{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart}
{/if}
{/if}

{if $active_modules.Feature_Comparison ne ""}
{include file="modules/Feature_Comparison/product_buttons.tpl"}
{/if}



</TD>
</TR></TABLE>
-->


this will affect your wishlist stuff, feature comparisons and downloadable products, but if you don't use these it shouldn't be a problem.

works well in 4.0.18, and seems to be an easier solution that the others i saw, and you can incorporate your custom add to cart button, b/c the default x-cart ones are lame.

-mike[/code]


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

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