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
  #41  
Old 08-28-2010, 10:38 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"?

Quote:
Originally Posted by cflsystems
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

Steve

I found the same type of code in /include/func/func.product.php but just further down

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

I also comment it out and still it was disabling the -1 products. As soon as a added the 3rd condition to turn the variable red and display "Discontinued" it all worked! Strange?

Furthermore the 3rd condition was only applied in product.tpl so product still disappear in product list but the part where you go into the product to view the details of the product is showing with "Discontinued" on it.

Should I also apply the 3rd condition in products.tpl? I don't think I need to because all my -1 (Discontinued) products will be changed to the status of "hidden but available for sale"
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #42  
Old 08-29-2010, 06:44 AM
  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"?

I keep my discountinued products "hidden". I have an extra field in place and a simple if statement in the templates to show/not message based on if the extra field has value or not. No meesing with php files trying to keep it simple. If what you did so far works then keep it like this. If you want to apply the condition to products_xxx.tpl you can but if you have these products "hidden" they won;t show in the list anyway
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #43  
Old 08-29-2010, 12:18 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"?

Quote:
Originally Posted by cflsystems
I keep my discountinued products "hidden". I have an extra field in place and a simple if statement in the templates to show/not message based on if the extra field has value or not. No meesing with php files trying to keep it simple. If what you did so far works then keep it like this. If you want to apply the condition to products_xxx.tpl you can but if you have these products "hidden" they won;t show in the list anyway

My setup now work as follow;

X-cart does not allow you to check out products that have 0 Qty in stock but I still wanted my customers to be able to buy those products because I can have any product back in stock within 2-3 working days, this way I don't loose a sale! As long as the customer is aware that the item they have bought is on pre-order there is no harm done. To make this all work without touching the original X-cart inventory tracking I have set my Qty in stock on all products to 100 000 so all products will check out and never run out of stock.

To know the amount of products that is actually in stock an extra field was added where you upload new products called Stock indicator.

The stock indicator has got 3 conditions

- If the Qty is 1 or above it will then display next to the product on shop front In Stock Now

- If the Qty is set to zero it will then display next to the product on shop front Pre-Order (these are for the products that are currently out of stock but my customers can still buy them)

- If the Qty is set to -1 it will then display on the details page of the product as Discontinued

*All the discontinued products I set the Xcart inventory tracking to zero Qty to prevent checkout and I set all these products as hidden but available for sale. This third condition was only implemented recently because in the past I use to delete discontinued products but then found out that the search engines still direct customers via those discontinued products to a page that does not exist. I deleted products because I was not educated in this matter and only found out of the negative impact that it has on your site after a year of deleting about 20-30 products daily.

Thanks to the Xcart community for putting me on the right path!

Special thanks to Steve and Amy for your support with the 3rd condition of above and for all the advice and guidance given - Much appreciated!
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #44  
Old 08-29-2010, 11:22 PM
  lewaff's Avatar 
lewaff lewaff is offline
 

eXpert
  
Join Date: Jun 2007
Location: Nuneaton-England
Posts: 225
 

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

Thats a Great Idea
Will this work on V4.3
and Could you tell me which bit of code has to be altered
I would love that mod
I find that sudenly that you get a product rated on google you get 2 or 3 customers try and buy to find you only have 1 in stock so i lose customers
this will give them the right information

Quote:
Originally Posted by Dan.roh
My setup now work as follow;

X-cart does not allow you to check out products that have 0 Qty in stock but I still wanted my customers to be able to buy those products because I can have any product back in stock within 2-3 working days, this way I don't loose a sale! As long as the customer is aware that the item they have bought is on pre-order there is no harm done. To make this all work without touching the original X-cart inventory tracking I have set my Qty in stock on all products to 100 000 so all products will check out and never run out of stock.

To know the amount of products that is actually in stock an extra field was added where you upload new products called Stock indicator.

The stock indicator has got 3 conditions

- If the Qty is 1 or above it will then display next to the product on shop front In Stock Now

- If the Qty is set to zero it will then display next to the product on shop front Pre-Order (these are for the products that are currently out of stock but my customers can still buy them)

- If the Qty is set to -1 it will then display on the details page of the product as Discontinued

*All the discontinued products I set the Xcart inventory tracking to zero Qty to prevent checkout and I set all these products as hidden but available for sale. This third condition was only implemented recently because in the past I use to delete discontinued products but then found out that the search engines still direct customers via those discontinued products to a page that does not exist. I deleted products because I was not educated in this matter and only found out of the negative impact that it has on your site after a year of deleting about 20-30 products daily.

Thanks to the Xcart community for putting me on the right path!

Special thanks to Steve and Amy for your support with the 3rd condition of above and for all the advice and guidance given - Much appreciated!
__________________
Thank's
Lewis Afford
www.mobile-phone-batteries.eu X-cart v4.4.5 gold
www.mobile-phone-batteries.co.ukv4.4.5 gold
www.qualitechnic.co.uk v4.4.5 gold
Add-on: X-AOM (Advanced Order Management)
Reply With Quote
  #45  
Old 08-29-2010, 11:35 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"?

Lewis

Am sure it will work on V4.3 as it is only an extra field you would need to add in your admin and then a piece of code that call that field, the conditions is in the code that call the field so it is quite simple. Look at my site first and make sure it is what you are after!

Have a look at this whole thread from start to finish and you should get all the answers that you need.

I had a bit of issues with the 3rd condition only because my site was set up to auto disable products of -1 in stock indicator and had a bit of issues findind the code to disable it but yours should be straight forward as you will not have that issue
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #46  
Old 08-30-2010, 07:02 AM
  lewaff's Avatar 
lewaff lewaff is offline
 

eXpert
  
Join Date: Jun 2007
Location: Nuneaton-England
Posts: 225
 

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

Thanks Dan
What's your web address ?
I Tried the code but the first bit crashed the admin products

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


Quote:
Originally Posted by Dan.roh
Lewis

Am sure it will work on V4.3 as it is only an extra field you would need to add in your admin and then a piece of code that call that field, the conditions is in the code that call the field so it is quite simple. Look at my site first and make sure it is what you are after!

Have a look at this whole thread from start to finish and you should get all the answers that you need.

I had a bit of issues with the 3rd condition only because my site was set up to auto disable products of -1 in stock indicator and had a bit of issues findind the code to disable it but yours should be straight forward as you will not have that issue
__________________
Thank's
Lewis Afford
www.mobile-phone-batteries.eu X-cart v4.4.5 gold
www.mobile-phone-batteries.co.ukv4.4.5 gold
www.qualitechnic.co.uk v4.4.5 gold
Add-on: X-AOM (Advanced Order Management)
Reply With Quote
  #47  
Old 08-30-2010, 07:18 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 lewaff
Thanks Dan
What's your web address ?
I Tried the code but the first bit crashed the admin products

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

If you click on Dan.roh next to my Logo you will see my homepage listed there
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #48  
Old 08-30-2010, 09:48 AM
  lewaff's Avatar 
lewaff lewaff is offline
 

eXpert
  
Join Date: Jun 2007
Location: Nuneaton-England
Posts: 225
 

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

Looks Good
But Managed to get the first bit of code showing "availablity"
But nothing else

Quote:
Originally Posted by Dan.roh
If you click on Dan.roh next to my Logo you will see my homepage listed there
__________________
Thank's
Lewis Afford
www.mobile-phone-batteries.eu X-cart v4.4.5 gold
www.mobile-phone-batteries.co.ukv4.4.5 gold
www.qualitechnic.co.uk v4.4.5 gold
Add-on: X-AOM (Advanced Order Management)
Reply With Quote
  #49  
Old 08-30-2010, 10:59 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 lewaff
Looks Good
But Managed to get the first bit of code showing "availablity"
But nothing else

Lewis

Unfortunately I would not be able to provide you with the correct information as you don't have the same x-cart version than mine. I know nothing about V4.3

The first bit of code is to create your extra field in admin but in V4.3 I would not know where to place it - Mine is in skin1/main/product_details.tpl (Not anywhere, it is where I want the extra field to appear when I upload new products)

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>

The second piece of code is the code that call the extra field and once again I don't know where to place it in V4.3 - Mine is placed in skin1/customer/main/product.tpl near the bottom so that it will display under my product details under "details"

Code:
{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}

The third piece of code also call the extra field and once again I don't know where to place it in V4.3 - Mine is placed in skin1/customer/main/products.tpl (this code looks different from the second piece of code as I don't need a third condition because products that are discontinued I set to "hidden but available for sale and therefore the third condition would not be needed as Xcart will not display it in the product list in any case - the third condition was only implemented if a search engine directs a customer via a product that is discontinued to my site to prevent them from getting a blank page)

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>

You would need to create language vairables

lbl_stock_indicator
lbl_product_in_stock_now
lbl_product_out_of_stock
lbl_discontinued
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #50  
Old 08-30-2010, 02:13 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"?

Actually Dan that first bit of code is not for an extra field. It looks more like BCSE added "stock_indicator" field to your products table to hold that value so you are not using xcart extra fields. The code you provide will work even on 4.3 but the new field must be added directly to the products table.

If using xcart extra field no changes are required to php files or product_details in admin. And on customer side templates you have to call the field using $extra_fields array variable
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
lewaff (08-30-2010)
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 01:38 PM.

   

 
X-Cart forums © 2001-2020