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)

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

Re: How do I change the "out of stock" message to "sold out"?
 
I think I got it! I tested it on the old code and I get the same results. It seems like every time a -1 is in stock indicator it auto disable the product from my site.

I personally think it has something to do with the part below in "BOLD"?? Am I correct?

{/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>

cflsystems 08-28-2010 07:15 AM

Re: How do I change the "out of stock" message to "sold out"?
 
No, this is not it.
What is the condition you are putting in for -1?

Dan.roh 08-28-2010 07:44 AM

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

I am using your code that you supplied on my question when I asked that I want a 3rd condition. The BOLD one below is suppose to appear when I have my stock indicator set to -1

As soon as I set the stock indicator field to -1 it then disable that product from my shop front, so my guess it there must be some other code somewhere that makes that happen as this is what I originally wanted when I asked BCS to set it up for me. Obviously now there is a change of plan and I donâ–“t want the -1 to disable the product from my shop. The question is where would that piece of code be that disables my product as soon as -1 is in stock indicator?


{if $product.stock_indicator ge 1}
<span style="color: green; font-size: 12px; font-weight: bold;">{$lng.lbl_product_in_stock_now|regex_replac e:"/<br[^>]*>/iS":" "}</span>
{elseif $product.stock_indicator lt 0}
<span style="color: red; font-size: 12px; font-weight: bold;">{$lng.lbl_discontinued|regex_replace:"/<br[^>]*>/iS":" "}</span>
{else}
<span style="color: orange; font-size: 12px; font-weight: bold;">{$lng.lbl_out of stock|regex_replace:"/<br[^>]*>/iS":" "}</span>
{/if}

amy2203 08-28-2010 09:04 AM

Re: How do I change the "out of stock" message to "sold out"?
 
I would guess the code that disables it in the storefront (I assume that means it doesn't appear) is in a php file.

Does it set the status of the product, to disabled or anything, or is the status still avaailable but it still doesn't appear?

If it changes the status, i would guess there's something in the product modify code,so when it changes product details, it also changes the status based on the extra field,

if it doesn't change the status, i'd look in the files that select the products for display and see if it's excluding disabled products and those with -1 in the extra field,

hth

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

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

Originally Posted by amy2203
I would guess the code that disables it in the storefront (I assume that means it doesn't appear) is in a php file.

Does it set the status of the product, to disabled or anything, or is the status still avaailable but it still doesn't appear?

If it changes the status, i would guess there's something in the product modify code,so when it changes product details, it also changes the status based on the extra field,

if it doesn't change the status, i'd look in the files that select the products for display and see if it's excluding disabled products and those with -1 in the extra field,

hth


Hi Amy

I have been at it since this morning to try and find out where is the piece of code that disables the product from storefront when -1 is in stock indicator and am still at it and can't find it.

Strange, it does not change the status of the product as it still stay as available for sale but the product just disappears from storefront as if it goes invisible once stock indicator is -1

amy2203 08-28-2010 10:09 AM

Re: How do I change the "out of stock" message to "sold out"?
 
In that case I would expect that the php file that selects the products for display from the database is also excluding products with -1

Have yu used webmaster mode to see if you can see which file selects the products and see if there'sanything there?

Dan.roh 08-28-2010 10:16 AM

Re: How do I change the "out of stock" message to "sold out"?
 
Tried it all - It's like a hidden gem!

cflsystems 08-28-2010 10:32 AM

Re: How do I change the "out of stock" message to "sold out"?
 
amy2003 is right - it is most likely the php file that sets the indicator value. You need to look in product.php and products.php. There will be a SQL statement selecting all extra fields and their values and then some line that sets the indicator based on its extra field value (code could be in /modules/Extra_Fields/extra_fields.php or in one of the products related functions in include/func/func.product.php). There could also be a clause in the SQL to say "select all products where indicator is greater then 0" so like amy2003 says products with less then 0 indicator may not be selected at all

Dan.roh 08-28-2010 12:09 PM

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

Originally Posted by cflsystems
amy2003 is right - it is most likely the php file that sets the indicator value. You need to look in product.php and products.php. There will be a SQL statement selecting all extra fields and their values and then some line that sets the indicator based on its extra field value (code could be in /modules/Extra_Fields/extra_fields.php or in one of the products related functions in include/func/func.product.php). There could also be a clause in the SQL to say "select all products where indicator is greater then 0" so like amy2003 says products with less then 0 indicator may not be selected at all



Firstly - Thank you Steve and Amy for trying to help me! Much appreciated!

I found in /include/func/func.product.php the following and not sure what is does or if it can be changed but the word stock_indicator is present so I guess this must be it as stock_indicator is a custom field that was added and I do not know of anything else in xcart with that name

#BCSE Begin
if($current_area == 'C')
$where[] = "$sql_tbl[products].stock_indicator >= 0";
#BCSE End


It is very hard looking for something if you are not sure what it is you are looking for

cflsystems 08-28-2010 05:17 PM

Re: How do I change the "out of stock" message to "sold out"?
 
This is the pice of code that tells the script only products with indicator 0 and up to be included. If you comment it out all products will be included. Place # in front of the lines


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

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