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)
-   -   How do I change the "out of stock" message to "sold out"? (https://forum.x-cart.com/showthread.php?t=55123)

cflsystems 08-23-2010 02:26 PM

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

Learner 08-24-2010 12:12 AM

Re: How do I change the "out of stock" message to "sold out"?
 
Please provide me the product.tpl and products.tpl file both.

Dan.roh 08-26-2010 09:23 AM

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

Dan.roh 08-26-2010 10:00 AM

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

cflsystems 08-26-2010 03:52 PM

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}

Dan.roh 08-27-2010 11:37 PM

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?

amy2203 08-28-2010 12:46 AM

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?

Dan.roh 08-28-2010 01:14 AM

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

amy2203 08-28-2010 01:18 AM

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,

Dan.roh 08-28-2010 01:21 AM

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>


All times are GMT -8. The time now is 07:18 AM.

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