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)
-   -   Add to cart in Product list? (https://forum.x-cart.com/showthread.php?t=25066)

brucew 09-19-2006 08:57 AM

Add to cart in Product list?
 
In my store, when a customer clicks a category, they are shown a list of products. How can I make it so that the price and a simple "add to cart" or buy it now button is beneath the product thumbnail? No quantity box or anything. Just a simple add to cart button.

Thank you in advance!

pauldodman 09-19-2006 09:03 AM

Re: Add to cart in Product list?
 
Hi,
If you start with Webmaster mode, you will see which templates you need to edit. Then if you edit them in a decent ftp program you will see how to change the table structure round to lay the page out how you want.
You also need to edit the buy_now template, but don't just remove the quantity box, you need to still pass the amount to the cart, assuming you want to make this 1 each time.
That's the basics, needs a bit of html skills at least though.

inebriate 09-19-2006 10:46 AM

Re: Add to cart in Product list?
 
edit skin1/customer/main/products_t.tpl and remove or comment out where it says to "Uncomment if you need 'Buy Now' button"

if you dont want the quantitfy dropdown box then edit buy_now.tpl and comment out the <SELECT ... </SELECT>

brucew 09-20-2006 10:00 AM

Re: Add to cart in Product list?
 
Oh, wow, that was super helpful! The only issue I'm finding is that my "buy now" buttons are aligned to the left and are about 3 or 4 line breaks below the product thumb. I've been trying to fiddle with this code

Code:

<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>&nbsp;&nbsp;&nbsp;&nbsp;</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}


but nothing seems to do much good. Am I even on the right track?

brucew 09-21-2006 12:38 PM

Re: Add to cart in Product list?
 
Is there anyone that can help me alaign the Buy Now button?

balinor 09-21-2006 12:41 PM

Re: Add to cart in Product list?
 
You need to edit buy_now.tpl and center align the table that contains the button as well as the cell that contains the button on product.tpl

brucew 09-22-2006 08:31 AM

Re: Add to cart in Product list?
 
Quote:

Originally Posted by inebriate
if you dont want the quantitfy dropdown box then edit buy_now.tpl and comment out the <SELECT ... </SELECT>


If I comment out the "<select>" portion of the code, items no longer add to the cart. When I un-comment them, they add again. I guess the problem is that it isn't adding at least 1 item of the product to the cart...?

Heres what I was doing on that front--
Code:

{*** COMMENT OUT QUANTITY ***
<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>
*** COMMENT OUT QUANTITY ***}


suggestions?

balinor 09-22-2006 08:37 AM

Re: Add to cart in Product list?
 
Well you have to put something in to tell it how many or it won't work :) You need to add this if you are commenting out the select box:

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

brucew 09-22-2006 09:03 AM

Re: Add to cart in Product list?
 
Quote:

Originally Posted by balinor
Well you have to put something in to tell it how many or it won't work :) You need to add this if you are commenting out the select box:

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



That is there. That I didn't comment out. Should I maybe move it to a different place? Here's my whole code

Code:

{* $Id: buy_now.tpl,v 1.15.2.8 2005/11/07 09:17:46 svowl 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 "" and !($active_modules.Subscriptions ne "" and $products[product].catalogprice)}
{*** COMMENT OUT ***
<TD height="25" width="15%" nowrap>{$lng.lbl_quantity}&nbsp;&nbsp;
</TD>
*** COMMENT OUT ***}
<TD width="20%" 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"}
{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}
{*** COMMENT OUT QUANTITY ***
<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>
*** COMMENT OUT QUANTITY ***}
{/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)}
<BR>
<TABLE border="0" cellpadding="0" cellspacing="0" align="center"><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>&nbsp;&nbsp;&nbsp;&nbsp;</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>


Thanks for the help everyone. I really do appreciate it

brucew 09-22-2006 09:04 AM

Re: Add to cart in Product list?
 
Quote:

Originally Posted by balinor
You need to edit buy_now.tpl and center align the table that contains the button as well as the cell that contains the button on product.tpl


Balinor, are you sure it's product.tpl? product.tpl is for the details page of a product

balinor 09-22-2006 09:46 AM

Re: Add to cart in Product list?
 
Meant products_t.tpl or products.tpl. As for the commented out code in your template above, you need to replace the commented out code with the code I suggested. It looks like you have it as part of another {if} statement.

brucew 09-22-2006 11:01 AM

Re: Add to cart in Product list?
 
I'm sorry, I'm not getting this at all.

I went from this--
Code:

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


to just this...?

Code:

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

Nothings happening :\

balinor 09-22-2006 11:02 AM

Re: Add to cart in Product list?
 
You ahve an extra {if} statement at the end there...don't comment that out. it is very important to make sure that the {if} statements stay in tact.

brucew 09-22-2006 11:02 AM

Re: Add to cart in Product list?
 
oooh, wait, you mean the {/if} after </SELECT>?

balinor 09-22-2006 11:05 AM

Re: Add to cart in Product list?
 
Yes

brucew 09-22-2006 11:15 AM

Re: Add to cart in Product list?
 
Quote:

Originally Posted by balinor
Yes


Balinor. You're a life saver! Totally worked. What I keept doing was placing the new code over two {/if} statements. Why, I don't know.

You don't have to help me anymore, BUUUTTTTT if you could point me in the right direction for getting the prices to show up in the product list, you'd save my weekend. But you've been a tremendous help!

balinor 09-22-2006 11:19 AM

Re: Add to cart in Product list?
 
They prices should show up in the product list by default? Check the original file (in skin1_original) vs your file and make sure you didn't delete the whole pricing code.

brucew 09-22-2006 11:57 AM

Re: Add to cart in Product list?
 
There doesn't seem to be any refrence to price in skin1.css. There are losts of refrences to price in products_t.tpl, though.
I am taking over a website, and having to sort through someone elses work.

balinor 09-22-2006 12:00 PM

Re: Add to cart in Product list?
 
Price wouldn't be on skin1.css, that only controls the style, not the display of the item. Again, have a look at the original template file in skin1_original and see what is missing.

brucew 09-22-2006 12:21 PM

Re: Add to cart in Product list?
 
Sorry, what is the name of the file I'm looking for in skin1_original? It seems like everything is there. Do you have a theory as to what could be missing?

balinor 09-22-2006 12:37 PM

Re: Add to cart in Product list?
 
customer/main/products_t.tpl if you are using producst in multiple columns, customer/main/products.tpl if you are using one per row.

brucew 09-22-2006 01:59 PM

Re: Add to cart in Product list?
 
I spoke with another webmaster, and it seems that I am missing something.

The original designer of my layout seems to have removed the prices. Something to do with font class="MarketPrice"?

balinor 09-22-2006 02:03 PM

Re: Add to cart in Product list?
 
The font tag has nothing to do with the display of the price, just how it looks.

Here's the easy way to solve this:

1. Rename your current products_t.tpl to products_t.tpl.old via FTP

2. Copy and paste the one from skin_original into the same folder as the above template, again via FTP. If you see the price, re-do your edits to that template.

brucew 09-22-2006 02:52 PM

Re: Add to cart in Product list?
 
...THANK YOU BALINOR!!!!

It's damn near perfect!

Code:

{* $Id: products_t.tpl,v 1.10.2.10 2005/10/17 07:54:19 max Exp $ *}
<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td class="TableThumbnailBorder">

<table border="0" width="100%" cellpadding="5" cellspacing="1">

{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"}

{section name=product loop=$products}
{assign var="discount" value=0}

{if %product.index% is div by $config.Appearance.products_per_row}
<tr>
{assign var="cell_counter" value=0}
{/if}

{math equation="x+1" x=$cell_counter assign="cell_counter" }

<td align="center" valign="top" width="{$width}%" class="DialogBox">
<br>
{*$lng.lbl_sku*} {*$products[product].productcode*}
{if $active_modules.Special_Offers ne "" and $products[product].have_offers}
{include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$products[product]}
{else}
<TABLE cellpadding="3" cellspacing="0" border="0"><TR><TD height="100">
<A href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}">{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url}</A><BR>
</TD></TR>
</TABLE>
{/if}
<A href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}">{$lng.lbl_see_details}</A><BR><BR>
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $products[product].taxed_price ne 0}
{if $products[product].list_price gt 0 and $products[product].taxed_price lt $products[product].list_price}
{math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%3.0f" assign=discount}
{if $discount gt 0}
<FONT class="MarketPrice">{$lng.lbl_market_price}: <S>
{include file="currency.tpl" value=$products[product].list_price}
</S></FONT><BR>
{/if}
{/if}
<FONT class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</FONT><BR><FONT class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</FONT>{if $discount gt 0}{if $config.General.alter_currency_symbol ne ""}, {/if}{$lng.lbl_save_price} {$discount}%{/if}
{if $products[product].taxes}<BR>{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}{/if}
{else}
<FONT class="ProductPrice">{$lng.lbl_enter_your_price}</FONT>
{/if}
{/if}
{if $active_modules.Feature_Comparison ne '' && $products[product].fclassid > 0}
<BR>
{include file="modules/Feature_Comparison/compare_checkbox.tpl" id=$products[product].productid}
{/if}
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{/if}
</TD>
{capture name=prod_index}
{math equation="index+x+1" index=%product.index% x=$config.Appearance.products_per_row}
{/capture}
{if $smarty.capture.prod_index is div by $config.Appearance.products_per_row }
</TR>
{/if}
{/section}
{if $cell_counter lt $config.Appearance.products_per_row}
{section name=rest_cells loop=$config.Appearance.products_per_row start=$cell_counter}
<TD class="DialogBox">&nbsp;</TD>
{/section}
</TR>
{/if}
</TABLE>
</TD></TR></TABLE>
{if $active_modules.Feature_Comparison ne '' && $products && $printable ne 'Y'}
{include file="modules/Feature_Comparison/compare_selected_button.tpl"}
{/if}



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

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