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

How do I change the "out of stock" message to "sold out"?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #21  
Old 08-23-2010, 02:26 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: How do I change the "out of stock" message to "sold out"?

All you have to do is add an extra field, then in products_t.tpl (products_list.tpl, whichever you use) and product.tpl (for 4.3.x it may be in product_details.tpl) call that extra field and place an if statement to show green or red text/image depending on the value of the field. If you search the forum for extra fields you find many post how to call it in different files and for different versions
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #22  
Old 08-24-2010, 12:12 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: How do I change the "out of stock" message to "sold out"?

Please provide me the product.tpl and products.tpl file both.
__________________
4.6.1 Platinum


Reply With Quote
  #23  
Old 08-26-2010, 09:23 AM
  Dan.roh's Avatar 
Dan.roh Dan.roh is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 397
 

Default Re: How do I change the "out of stock" message to "sold out"?

In skin1/main/product_details.tpl the code that was added to create the extra field in your "Add new product" is as follows. You would need to add it where you want your extra field to appear

Code:
{/if} <tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[stock_indicator]" /></td>{/if} <td class="FormButton" nowrap="nowrap">{$lng.lbl_stock_indicator}</td> <td class="ProductDetails"> <input type="text" name="stock_indicator" size="2" value="{$product.stock_indicator}" /> </td> </tr>


In skin1/customer/main/product.tpl this code was added

Code:
<tr> <td>Availabilty:</td> <td> {if $product.stock_indicator ge 1} <span style="color: green; font-size: 12px; font-weight: bold;">{$lng.lbl_product_in_stock_now|regex_replace:"/<br[^>]*>/iS":" "}</span> {else} <span style="color: orange; font-size: 12px; font-weight: bold;">{$lng.lbl_product_out_of_stock|regex_replace:"/<br[^>]*>/iS":" "}</span> {/if} </td> </tr>


In skin1/customer/mainproducts.tpl this was added

Code:
{if $products[product].stock_indicator ge 1} <span style="color: green; font-size: 12px; font-weight: bold;">{$lng.lbl_product_in_stock_now}</span> {else} <span style="color: orange; font-size: 12px; font-weight: bold;">{$lng.lbl_product_out_of_stock}</span> {/if} </td>



Don't ask me where to place the code as mine would be different from yours as our products layout is different. You would also need to create lanuage variables
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #24  
Old 08-26-2010, 10:00 AM
  Dan.roh's Avatar 
Dan.roh Dan.roh is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 397
 

Default Re: How do I change the "out of stock" message to "sold out"?

Does anyone know how I can add a 3rd condition?

If stock indicator = -1

I would like it to display "No longer Available"

This would be used if I set products to "Hidden but available for sale" , for products that are discontinued

Thanks your help would be appreciated
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #25  
Old 08-26-2010, 03:52 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: How do I change the "out of stock" message to "sold out"?

{if $product.stock_indicator ge 1}
CONDITION IF MORE THEN 1
{elseif $product.stock_indicator lt 0}
CONDITION IF LESS THEN 0
{else}
ALL OTHER
{/if}
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #26  
Old 08-27-2010, 11:37 PM
  Dan.roh's Avatar 
Dan.roh Dan.roh is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 397
 

Default Re: How do I change the "out of stock" message to "sold out"?

Thanks Steve

Unfortunately it is not working. When I make my "stock indicator" field -1 then the product does not display at all. The stock indicator does not like -1 for some reason. Any suggestion for a fix?
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #27  
Old 08-28-2010, 12:46 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: How do I change the "out of stock" message to "sold out"?

have you got it set to disable out of stock products? in the settings?
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #28  
Old 08-28-2010, 01:14 AM
  Dan.roh's Avatar 
Dan.roh Dan.roh is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 397
 

Default Re: How do I change the "out of stock" message to "sold out"?

Quote:
Originally Posted by amy2203
have you got it set to disable out of stock products? in the settings?

Hi Amy

This should not matter because the "stock indicator" is a custom field that was added and if set on 0 it will display a language variable "Pre-Order" and if 1 it will display "in stock now" and what I am trying to do now is add a third condition if -1 it must display "discontinued". For some reason it does not display the product at all when it is set to -1
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #29  
Old 08-28-2010, 01:18 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: How do I change the "out of stock" message to "sold out"?

sorry, misunderstood, I thought you were talking about the standard stock field.

I'd maybe look at how it's stored in the db, is it a text field or something? maybe it can't accept negative numbers? I don't do a lot with extra fields so i'm not much help i'm afraid,
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #30  
Old 08-28-2010, 01:21 AM
  Dan.roh's Avatar 
Dan.roh Dan.roh is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 397
 

Default Re: How do I change the "out of stock" message to "sold out"?

Quote:
Originally Posted by amy2203
sorry, misunderstood, I thought you were talking about the standard stock field.

I'd maybe look at how it's stored in the db, is it a text field or something? maybe it can't accept negative numbers? I don't do a lot with extra fields so i'm not much help i'm afraid,

Yes it is an text field, I think?

{/if}

<tr>
{if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[stock_indicator]" /></td>{/if}
<td class="FormButton" nowrap="nowrap">{$lng.lbl_stock_indicator}</td>
<td class="ProductDetails">
<input type="text" name="stock_indicator" size="2" value="{$product.stock_indicator}" />
</td>
</tr>
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 02:50 PM.

   

 
X-Cart forums © 2001-2020