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)

artinion 02-27-2005 11:58 PM

"Buy Now" button without the "Quantity"
 
I would like to remove the "Quantity" drop down list. The purpose is to have users click on the "Buy Now" button with the default value of "1" to pass on to the shopping cart. How can that be done?

Searched for posts on this, haven't found any answers.

Please help. :(

Art

Jon 02-28-2005 12:03 AM

You can edit out the quantity areas of your templates and instead use:

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

artinion 02-28-2005 12:26 AM

RE: "Buy Now" button without the "Quantity&qu
 
I got it. Thanks. This is the code from "customer/main/buy_now.tpl".

Art :)

Code:


{* $Id: buy_now.tpl,v 1.8.2.2 2004/12/09 12:42:16 max Exp $ *}
{if $js_enabled}
<table border=0 width=100% cellpadding=0 cellspacing=0>
  {if ($active_modules.Product_Options ne "" and $product.product_options) or
  $product.price eq 0}
  <tr>
    <td height=25> <a href="product.php?productid={$product.productid}&cat={$cat}&page={$smarty.get.page|escape:"html"}">{include
      file="buttons/buy_now.tpl" style="button"}</a> </td>
    <td></td>
    <td></td>
  </tr>
  {else}
  <FORM name="orderform_{$product.productid}_{$product.add_date}" method=post action="cart.php?mode=add">
    <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"}">
    <tr> {if $product.distribution eq ""}
      <td height=25 width=5% nowrap>{$lng.lbl_quantity} </td>
      <td width=15%> {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}
                <input type=hidden name="amount" value="1">










        {/if} </td>
      {else}

      {/if}
      <td> </td>
    </tr>
    <tr>
      <td> <input type=hidden name=mode value=add>
        {include file="customer/main/product_prices.tpl"} {if $config.General.unlimited_products
        eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)}
        {if $js_enabled} <a href="javascript: document.orderform_{$product.productid}_{$product.add_date}.submit()">{include
        file="buttons/buy_now.tpl" style="button"}</a>  {if $login
        ne "" and $active_modules.Wishlist ne ""} <a href="javascript:document.orderform_{$product.productid}_{$product.add_date}.mode.value='add2wl'; document.orderform_{$product.productid}_{$product.add_date}.submit()">{include
        file="buttons/add_to_wishlist.tpl" style="button"}</a> {/if} {else} {include
        file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart} {/if} {/if}
  </FORM>
  {if $product.min_amount gt 1} </td> </tr>
  <tr>
    <td><FONT class=ProductDetailsTitle>{$lng.txt_need_min_amount} {$product.min_amount}
      {$lng.lbl_items}</FONT> </td>
  </tr>
  {/if} {/if}
</table>
{/if}



Jon 02-28-2005 12:32 AM

If you paste your entire ORIGINAL template I'll paste you back a version to use.

artinion 02-28-2005 01:38 AM

RE: "Buy Now" button without the "Quantity&qu
 
Okay, here it is "buy_now.tpl:

Code:


{* $Id: buy_now.tpl,v 1.8.2.2 2004/12/09 12:42:16 max Exp $ *}
{if $js_enabled}
<table border=0 width=100% cellpadding=0 cellspacing=0>
{if ($active_modules.Product_Options ne "" and $product.product_options) or $product.price eq 0}
<tr>
<td height=25>
{include file="buttons/buy_now.tpl" style="button"}
</td>
</tr>
{else}
<FORM name="orderform_{$product.productid}_{$product.add_date}" method=post action="cart.php?mode=add">
<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"}">
<tr>
{if $product.distribution eq ""}
<td height=25 width=15% nowrap>{$lng.lbl_quantity}
</td>
<td width=20%>
{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 height=25>
<input type=hidden name=mode value=add>
{include file="customer/main/product_prices.tpl"}
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)}
{if $js_enabled}
{include file="buttons/buy_now.tpl" style="button"}

{if $login ne "" and $active_modules.Wishlist ne ""}
{include file="buttons/add_to_wishlist.tpl" style="button"}
{/if}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart}
{/if}
{/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>
{/if}


Jon 02-28-2005 08:43 AM

Try this:

Code:

{* $Id: buy_now.tpl,v 1.8.2.2 2004/12/09 12:42:16 max Exp $ *}
{if $js_enabled}
<table border=0 width=100% cellpadding=0 cellspacing=0>
{if ($active_modules.Product_Options ne "" and $product.product_options) or $product.price eq 0}
<tr>
<td height=25>
{include file="buttons/buy_now.tpl" style="button"}
</td>
</tr>
{else}
<FORM name="orderform_{$product.productid}_{$product.add_date}" method=post action="cart.php?mode=add">
<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"}">
<input type=hidden name="amount" value="1">
<tr>
<td height=25>
<input type=hidden name=mode value=add>
{include file="customer/main/product_prices.tpl"}
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)}
{if $js_enabled}
{include file="buttons/buy_now.tpl" style="button"}
 
{if $login ne "" and $active_modules.Wishlist ne ""}
{include file="buttons/add_to_wishlist.tpl" style="button"}
{/if}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart}
{/if}
{/if}
</td>
</tr>
</FORM> 
{/if}
</table>
{/if}


artinion 02-28-2005 04:30 PM

RE: "Buy Now" button without the "Quantity&qu
 
Thank you. That really helped.

Art

kirsten 03-01-2005 05:32 AM

I would also like to get rid of the drop down quantity field but my code is different than the above, I tried to use the code jon gave but it did not work on x cart version, because when you clicked on buy now it directed you back to the xcart entry page ?
Here is my /customer/main/buy_now.tpl , can anyone please tell me what to take out to get rid of the drop down quantity and have a default of one item placed into the cart

Quote:

{* $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`&c at=`$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}{els e}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.prod uctid`_`$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_amo unt} {$product.min_amount} {$lng.lbl_items}</FONT>
</TD>
</TR>
{/if}
{/if}
</TABLE>



Thanx
Kirsten

Jon 03-01-2005 01:20 PM

Hi Kirstin, I'm still awaiting your purchase of ezCheckout/ezUpsell ;)

Try this code. Be sure to back first as it's hard for me without testing the code.

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%" height="25" 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>{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><FONT class="ProductDetailsTitle">{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>
</TD>
</TR>
{/if}
{/if}
</TABLE>


kirsten 03-01-2005 01:45 PM

Thanx Jon that worked!!!

Just one small thing there is now a large break where the quantity drop down box used to be and the buy now button is not centered

How can i adjust this??


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


Thanx kirsten

Ps I will be contacting you regarding the ezupsell and ezzcheckout very soon, I just want to get all the small changes done here first

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.

interstellarsounds 07-24-2005 06:36 AM

Can anyone help with the request above...?

thank you

interstellarsounds 07-29-2005 03:11 PM

Someone MUST know how this can be done...???

Steele 09-14-2005 02:03 PM

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">


I'd like to do something like this, but only for certain products. Is there a way to limit this to particular produtcs only? To show the quantity for some and for others to set it to default of 1?

Thanks.

tron 10-05-2005 02:36 PM

this was excellent. worked nice.

anybody know how to remove quantity from product detailes.

Tron

maerik 10-07-2005 03:40 AM

Quote:

Originally Posted by Steele
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">


I'd like to do something like this, but only for certain products. Is there a way to limit this to particular produtcs only? To show the quantity for some and for others to set it to default of 1?

Thanks.


Hi all, I'm new to this forum.
See my code below - i know it isn't the best but it works :D

maerik 10-11-2005 04:07 AM

Quote:

Originally Posted by Steele

I'd like to do something like this, but only for certain products. Is there a way to limit this to particular produtcs only? To show the quantity for some and for others to set it to default of 1?

Thanks.




QUANTITY ONLY FOR CERTAIN PRODUCTS IN PRODUCT DESCRIPTION ONLY!

If the product ID is 666 or 667 the quanity dropdown menu will not apear! Customize at will!
You got to put 2x {if} tags in the "product.tpl".
But watch out - i worked on version 3.5.2!


The 1st one:

Code:

{if $product.productid eq 666 or $product.productid eq 667}

{else}<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>
{/if}


And the 2nd one (with the default amount variable = 1 before the {if} tag):

Code:


<input type=hidden name=amount value=1>
{if $product.productid eq 83 or $product.productid eq 84}

{else}
<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}



Quote:

Originally Posted by tron
anybody know how to remove quantity from product detailes.
Tron


To remove quantity from product details just comment out (HTML comment) or delete all the lines between the two {if} tags.

Hope i helped you guys out a bit!
Don't blame me for bad code - I'm a newbie to X-Cart.

harrismichael 10-11-2005 02:03 PM

Will this code pasted on the first page affect the categroy pages or the product pages .. or both ?


We wouldn't mind getting rid of the quantity dropdown on the category pages but are a bit hesitant to remove them from the product page.

maerik 10-11-2005 10:43 PM

Quote:

Originally Posted by harrismichael
Will this code pasted on the first page affect the categroy pages or the product pages .. or both ?


This code pasted in the correct place in "product.tpl" affects only the product description, not the category menu.

But if you add a "Product Option" to a product the quantity will disapear from the category menu too! If you wan't it to disappear from only certain products in the category menu you got to do it on your own :P

I think you can use the {if} tags in "buy_now.tpl" (like i did in "product.tpl") to remove the quantity.

harrismichael 10-12-2005 10:00 AM

Quote:

Originally Posted by maerik
Quote:

Originally Posted by harrismichael
Will this code pasted on the first page affect the categroy pages or the product pages .. or both ?


This code pasted in the correct place in "product.tpl" affects only the product description, not the category menu.



And how _do _ I get it to dissapear from only the category page ??

tron 10-13-2005 04:03 PM

[quote="maerik"][quote="Steele"]
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">


WORKS.

I replaced this code:

Code:

<SELECT id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_wholesale(this.value);"{/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>


with this:

Code:

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

and deleted this to delete the "Quantity" before the box.
Code:

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


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:03 AM.

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