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)
-   -   Display Buy Now Button on Same Line as Quantity Box (buy_now.tpl) (https://forum.x-cart.com/showthread.php?t=25007)

sushob 09-17-2006 07:45 AM

Display Buy Now Button on Same Line as Quantity Box (buy_now.tpl)
 
Howdy All,

I know this is a really simple thing to do, but for the life of me I can't get it to work. I am using the two-column display for items on category and search pages, and I would like to move the "Add to Cart" and "Wish List" buttons up to be on the same row as the quantity box.

Current arrangement:
http://www.sushob.com/images/tempimages/original.jpg

Desired arrangement:
http://www.sushob.com/images/tempimages/originalmod.jpg

I think this is controlled by buy_now.tpl, since that's where I went to change the quantity box to a text box. If I'm wrong, please let me know :?

Here's my current buy_now.tpl:
Code:

{* $Id: buy_now.tpl,v 1.30.2.2 2006/06/14 11:06:25 max Exp $ *}
{if $product.price gt 0}
<form name="orderform_{$product.productid}_{$product.add_date}" method="post" action="{if $product.is_product_options eq 'Y' && $config.Product_Options.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}

<table 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}
{if $product.is_product_options ne 'Y' || $config.Product_Options.buynow_with_options_enabled ne 'Y'}
<tr>
{if $product.distribution eq "" and !($active_modules.Subscriptions ne "" and $products[product].catalogprice)}
    <td class="BuyNowQuantity">{$lng.lbl_quantity}</td>
    <td width="20%" nowrap="nowrap">
{if $config.General.unlimited_products ne "Y" and ($product.avail le 0 or $product.avail lt $product.min_amount)}
<b>{$lng.txt_out_of_stock}</b>
{else}
{if $config.General.unlimited_products eq "Y"}
{assign var="mq" value=$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.min_amount le 1}
{assign var="start_quantity" value=1}
{else}
{assign var="start_quantity" value=$product.min_amount}
{/if}
{if $config.General.unlimited_products eq "Y"}
{math equation="x+y" assign="mq" x=$mq y=$start_quantity}
{/if}
<input type="text" name="amount" size="4" value="{$product.min_amount}">
{/if}
    </td>
{else}
<tr style="display: none;">
    <td><input type="hidden" name="amount" value="1" /></td>
</tr>
{/if}
    <td class="BuyNowPrices">
<input type="hidden" name="mode" value="add" />
{include file="customer/main/product_prices.tpl" no_span=true}
    </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)}
<br />

<table 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 "" || $config.Wishlist.add2wl_unlogged_user eq 'Y') && $active_modules.Wishlist ne "" && $special_offers_add_to_cart eq "" && ($product.is_product_options ne 'Y' || $config.Product_Options.buynow_with_options_enabled ne 'Y')}
    <td style="padding-left: 20px;">
{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}
{else}
    <td>{include file="submit_wo_js.tpl" value=$lng.lbl_buy_now}</td>
{/if}
</tr>
</table>

{/if}
    </td>
</tr>
{if $product.min_amount gt 1}
<tr>
    <td colspan="3"><font class="ProductDetailsTitle">{$lng.txt_need_min_amount|substitute:"items":$product.min_amount}</font></td>
</tr>
{/if}
{/if}
</table>
{if $product.price gt 0}
</form>
{/if}


Thanks in advance for your time and help!!

inebriate 09-17-2006 04:10 PM

Re: Display Buy Now Button on Same Line as Quantity Box (buy_now.tpl)
 
find:
Code:

{include file="customer/main/product_prices.tpl" no_span=true}
    </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)}



change to:
Code:

{include file="customer/main/product_prices.tpl" no_span=true}
    </td>

{/if}

    <td colspan="3">
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)}


i think that should do it

sushob 09-17-2006 04:42 PM

Re: Display Buy Now Button on Same Line as Quantity Box (buy_now.tpl)
 
Thanks!

That got me to this point, but now the button and the quantity box overlap. The buttons also sit a little bit lower than the quantity box. Any idea what causes this?

http://www.sushob.com/images/tempimages/originalcurrent.jpg

inebriate 09-17-2006 08:42 PM

Re: Display Buy Now Button on Same Line as Quantity Box (buy_now.tpl)
 
trying changing the colspan="3" from the above code to another number...as for height, you could try adding a valign="top" or center

maximillian 02-07-2009 11:11 AM

Re: Display Buy Now Button on Same Line as Quantity Box (buy_now.tpl)
 
I want to do the same, tried to do it myself, but no success :(
I also tried to use tip from inebriate, but I guess it's not applicable to my version of x-cart.
I know I should remove some of <table>, <tr> and <td> tags, so that the quantity box and add to cart button are in the same line, but couldn't figure out which ones.
Below is buy_now.tpl

Code:

{* $Id: buy_now.tpl,v 1.30.2.12 2008/07/22 07:58:28 ferz Exp $ *}
{if $product.price gt 0 or ($active_modules.Special_Offers ne "" and $product.use_special_price ne "")}
{if $config.Product_Options.buynow_with_options_enabled eq 'Y' || ($product.avail eq 0 && $product.variantid && $product.product_type ne 'C')}
{assign var="buynow_enabled" value=false}
{else}
{assign var="buynow_enabled" value=true}
{/if}
<form name="orderform_{$product.productid}_{$product.add_date}" method="post" action="{if $product.is_product_options eq 'Y' && !$buynow_enabled}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}
<table cellpadding="0" cellspacing="0">
{if $product.price eq 0 and not ($active_modules.Special_Offers ne "" and $product.use_special_price ne "")}
<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}
{if $product.is_product_options ne 'Y' || $buynow_enabled || $product.variantid}
<tr>
 <td{if $style eq "list"} align="center"{/if} height="35">
<table cellpadding="0" cellspacing="0">
<tr>
{if $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount) && $product.variantid}
 <td class="BuyNowQuantity">{$lng.lbl_quantity}</td>
 <td nowrap="nowrap"><b>{$lng.txt_out_of_stock}</b></td>
{elseif $product.distribution eq "" && !($active_modules.Subscriptions ne "" and $products[product].catalogprice)}
 <td class="BuyNowQuantity">{$lng.lbl_quantity}</td>
 <td width="20%" nowrap="nowrap">
{if $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount)}
<b>{$lng.txt_out_of_stock}</b>
{else}
{if $config.General.unlimited_products eq "Y"}
{assign var="mq" value=$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.min_amount le 1}
{assign var="start_quantity" value=1}
{else}
{assign var="start_quantity" value=$product.min_amount}
{/if}
{if $config.General.unlimited_products eq "Y"}
{math equation="x+y" assign="mq" x=$mq y=$start_quantity}
{/if}
<select name="amount">
{section name=quantity loop=$mq start=$start_quantity}
 <option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected"{/if}>{%quantity.index%}</option>
{/section}
</select>
{/if}
 </td>
{else}
 <td style="display: none;"><input type="hidden" name="amount" value="1" /></td>
{/if}
 <td class="BuyNowPrices">
<input type="hidden" name="mode" value="add" />
{include file="customer/main/product_prices.tpl" no_span=true}
 </td>
</tr>
</table>
 </td>
</tr>
{elseif $product.distribution eq "" && !($active_modules.Subscriptions ne "" and $products[product].catalogprice) && $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount) && !$product.variantid}
<tr>
 <td colspan="3" height="25"><b>{$lng.txt_out_of_stock}</b></td>
</tr>
{/if}
<tr>
 <td colspan="3"{if $style eq "list"} align="center"{/if}>
{if $config.General.unlimited_products eq "Y" || ($product.avail gt 0 and $product.avail ge $product.min_amount) || ($product.variantid and $product.avail gt 0)}
<table cellpadding="0" cellspacing="0">
<tr{if $style eq "list"} align="center"{/if}>
{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(); return false;"}</td>
{/if}
{if ($login ne "" || $config.Wishlist.add2wl_unlogged_user eq 'Y') && $active_modules.Wishlist ne "" && $special_offers_add_to_cart eq "" && ($product.is_product_options ne 'Y' || $buynow_enabled)}
{if $style eq "list"}
</tr>
<tr>
 <td height="32" valign="bottom">
{else}
 <td>���</td>
 <td>
{/if}
{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()" button_style="menu"}
 </td>
{/if}
{else}
 <td>{include file="submit_wo_js.tpl" value=$lng.lbl_buy_now}</td>
{/if}
</tr>
</table>
{/if}
 </td>
</tr>
{if $product.min_amount gt 1}
<tr>
 <td colspan="3"><font class="ProductDetailsTitle">{$lng.txt_need_min_amount|substitute:"items":$product.min_amount}</font></td>
</tr>
{/if}
{/if}
</table>
{if $product.price gt 0 or ($active_modules.Special_Offers ne "" and $product.use_special_price ne "")}
</form>
{/if}


Can anyone help, pls? Thanks in advance...

AusNetIT 05-09-2009 11:23 PM

Re: Display Buy Now Button on Same Line as Quantity Box (buy_now.tpl)
 
1 Attachment(s)
HI,

How do i align "Buy Now" button to bottom of my products box like attached pic?

thanks


All times are GMT -8. The time now is 03:23 AM.

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