Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Show OUT OF STOCK on products page?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-29-2004, 12:30 PM
 
jamtots jamtots is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 43
 

Default Show OUT OF STOCK on products page?

Is there a way to show that a product is out of stock on the products page so that they don't have to click on details only to find out that the product is out of stock?

I don't want the stock numbers showing as some numbers are 1000 because we don't count stock for them but others we do have limited stock of and I don't want customers to get frustrating trying to keep order items that are not instock!

By the way--I do not have the "Buy it now" button showing up either as some products have options and I want to make sure that they choose the options they want before adding the item to the cart and that seemed to be the only way to do that but I don't know if that is making a difference??

Any detailed help/ideas would be most appreciated! Thank you!

Holly
__________________
Holly Simard--X-Cart Newbie!!
JamTots Online Baby Store
http://www.jamtots.com
X-Cart Gold 4.0.4
Windows Server
Reply With Quote
  #2  
Old 11-30-2004, 03:01 AM
 
mikebo mikebo is offline
 

Advanced Member
  
Join Date: Feb 2004
Location: Ohio
Posts: 72
 

Default Show product out of stock

Hi Holly

I have this code in my skin1/customer/main/products.tpl file.

{if $products[product].avail > 0}

This item is available.
{else}
Sorry, this item is out of stock.

{/if}

Hope it helps,
Mike
__________________
Mike
X-Cart Gold
Version 4.6.0 PHP 5.2.17
Reply With Quote
  #3  
Old 11-30-2004, 07:00 AM
 
jamtots jamtots is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 43
 

Default

Hi Mike,

Thanks so much for the reply. I tried adding your code (wasn't sure exactly where to insert it but tried several different places within the products.tpl file) and it didn't seem to do anything?!?!

I'll post the code for my products.tpl file here in case you can give me a clue as to where to put it so that it will work--it looks very simple and I would be JUST ECSTATIC if we could get that to work. I don't want my customers to get so frustrated that they don't want to come back!

Code:
{* $Id: products.tpl,v 1.45.2.1 2004/08/23 05:24:43 max Exp $ *} {if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")} {include file="customer/main/products_t.tpl" products=$products} {else} {if $products} {section name=product loop=$products} {assign var="discount" value=0} <TABLE border="0" width="100%"> <TR><TD width="90" align="center" valign="top"> <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} {$lng.lbl_see_details}</A> </TD> <TD valign="top"> <FONT class="ProductTitle">{$products[product].product}</FONT> <FONT size="1"> {$products[product].descr|truncate:300:"...":true} </FONT> <HR size="1" noshade width="100%" align="left"> {if $products[product].product_type eq "C"} {include file="buttons/details.tpl" href="product.php?productid=`$products[product].productid`&cat=`$cat`&page=`$navigation_page`"} {else} {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="%d" 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> {/if} {/if} <FONT class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</FONT><FONT class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price_cad}</FONT>{if $discount gt 0}, {$lng.lbl_save_price} {$discount}%{/if} {if $products[product].taxes} <TABLE border="0"> <TR> <TD>[img]{$ImagesDir}/spacer.gif[/img]</TD> <TD>{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes} </TR> </TABLE> {/if} {else} <FONT class="ProductPrice">{$lng.lbl_enter_your_price}</FONT> {/if} {/if} {if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"} {include file="customer/main/buy_now.tpl" product=$products[product]} {/if} {/if} </TD></TR> </TABLE> {/section} {else} {$lng.txt_no_products_found} {/if} {/if}

Thanks again for your help--I really do appreciate it!!

Holly
__________________
Holly Simard--X-Cart Newbie!!
JamTots Online Baby Store
http://www.jamtots.com
X-Cart Gold 4.0.4
Windows Server
Reply With Quote
  #4  
Old 11-30-2004, 07:46 AM
 
mikebo mikebo is offline
 

Advanced Member
  
Join Date: Feb 2004
Location: Ohio
Posts: 72
 

Default

Hi

In my products.tpl I have it placed right below this code:



{$products[product].descr|truncate:300:"...":true}


</FONT>
<HR size="1" noshade width="100%" align="left">

Here is what I added:

{if $products[product].avail > 0}
This item is available.

{else}
Sorry, this item is out of stock.

{/if}

Hope this does it for you.
__________________
Mike
X-Cart Gold
Version 4.6.0 PHP 5.2.17
Reply With Quote
  #5  
Old 12-01-2004, 06:37 AM
 
jamtots jamtots is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 43
 

Default

Hi Mike!

I spent ages trying to get that to work and couldn't and then my husband tried putting it in the products_t.tpl file instead and it worked so thanks for your help!

I have now noticed that the detailed products page no longer says "Out of Stock" --it just doesn't have the "add to cart" button when something is out of stock so I think that I have somehow screwed that up! Anyone have any suggestions about that??

From what my husband said--he thinks that the products.tpl is the page to look at but adding the code that you gave me doesn't work for some reason!!? The code for that file is still listed above if anyone wants to take a stab at it!!

Thanks!

Holly
__________________
Holly Simard--X-Cart Newbie!!
JamTots Online Baby Store
http://www.jamtots.com
X-Cart Gold 4.0.4
Windows Server
Reply With Quote
  #6  
Old 12-01-2004, 04:20 PM
 
mikebo mikebo is offline
 

Advanced Member
  
Join Date: Feb 2004
Location: Ohio
Posts: 72
 

Default

Hi again,

Below is a skin1/customer/main/products.tpl file from 4.0.4. I included the code I mentioned above and it works fine when tested on my site (currently used for testing only). I am not using the "Buy Now" button either. Maybe having the entire file will help you, but if you use it, please make a backup of your current file.


{* $Id: products.tpl,v 1.45.2.1 2004/08/23 05:24:43 max Exp $ *}
{if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")}
{include file="customer/main/products_t.tpl" products=$products}
{else}
{if $products}
{section name=product loop=$products}
{assign var="discount" value=0}
<TABLE border="0" width="100%">
<TR><TD width="90" align="center" valign="top">
<A href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}">{i nclude file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url}
{$lng.lbl_see_details}</A>
</TD>
<TD valign="top">
<FONT class="ProductTitle">{$products[product].product}</FONT>
<FONT size="1">




{$products[product].descr|truncate:300:"...":true}


{if $products[product].avail > 0}

This item is available.

{else}

Sorry, this item has sold.

{/if}
</FONT>
<HR size="1" noshade width="100%" align="left">
{if $products[product].product_type eq "C"}
{include file="buttons/details.tpl" href="product.php?productid=`$products[product].productid`&cat=`$cat`&page=`$navigation_page`"}
{else}
{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="%d" 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>

{/if}
{/if}
<FONT class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</FONT><FONT class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</FONT>{if $discount gt 0}, {$lng.lbl_save_price} {$discount}%{/if}
{if $products[product].taxes}


<TABLE border="0">
<TR>
<TD>[img]{$ImagesDir}/spacer.gif[/img]</TD>
<TD>{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}
</TR>
</TABLE>
{/if}
{else}
<FONT class="ProductPrice">{$lng.lbl_enter_your_price}</FONT>
{/if}
{/if}
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{/if}
{/if}
</TD></TR>
</TABLE>






{/section}
{else}
{$lng.txt_no_products_found}
{/if}
{/if}

Hope this helps,
__________________
Mike
X-Cart Gold
Version 4.6.0 PHP 5.2.17
Reply With Quote
  #7  
Old 12-01-2004, 04:39 PM
 
mikebo mikebo is offline
 

Advanced Member
  
Join Date: Feb 2004
Location: Ohio
Posts: 72
 

Default

Below I listed a skin1/customer/main/products_t.tpl file as well. It seems you are displaying your items in more than one column.

Here it is with the additional code from above.

{* $Id: products_t.tpl,v 1.10.2.1 2004/08/23 05:27:36 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">

{$products[product].product}

<TABLE cellpadding="3" cellspacing="0" border="0"><TR><TD height="100">
{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}

</TD></TR>
</TABLE>
{$lng.lbl_see_details}

{if $products[product].avail > 0}
This item is available.

{else}
Sorry, this item has sold.

{/if}


{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="%d" 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>

{/if}
{/if}
<FONT class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</FONT>
<FONT class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</FONT>{if $discount gt 0}, save {$discount}%{/if}
{if $products[product].taxes}
{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}{/if}
{else}
<FONT class="ProductPrice">{$lng.lbl_enter_your_price}</FONT>
{/if}
{/if}
{*** Uncomment it if you need 'Buy Now' button ***
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{/if}
*** Uncomment it if you need 'Buy Now' button ***}
</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"></TD>
{/section}
</TR>
{/if}

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

Let me know if one of these takes care of the problem.
__________________
Mike
X-Cart Gold
Version 4.6.0 PHP 5.2.17
Reply With Quote
  #8  
Old 12-09-2004, 05:29 PM
 
jamtots jamtots is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 43
 

Default

Hi Mike,

No--they didn't seem to work and I emailed x-cart about it and they said "it's working fine" and didn't know what I was talking about-and yes it is working fine now so it's now a "mystery"?!?!

Anyway--thanks SO much for trying to help--I did get the undetailed product pages showing what items are out of stock with your help so thank you for that!!

Holly
__________________
Holly Simard--X-Cart Newbie!!
JamTots Online Baby Store
http://www.jamtots.com
X-Cart Gold 4.0.4
Windows Server
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:10 AM.

   

 
X-Cart forums © 2001-2020