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
  #51  
Old 08-30-2010, 02:34 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"?

Thank you For that I did try a extra field but not quite sure how to code it to work with the stock inventry
so give up for now
till i get some ideas
but thanks i will keep listening
lewis
Quote:
Originally Posted by cflsystems
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
__________________
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
  #52  
Old 08-30-2010, 02:50 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

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

Try this, replace "in_stock" with the name of the field you created. This goes in skin1/customer/main/product_details.tpl for 4.3

Code:
{foreach from=$extra_fields item=v} {if $v.active eq "Y" && $v.name eq "in_stock"} {if $v.field_value eq "0"} {* no items in stock *} SHOW MESSAGE FOR ITEM OUT OF STOCK {elseif $v.field_value eq "-1"} {* item discontinued *} SHOW MESSAGE FOR ITEM DISCONTINUED {else} {* any value (or no value, empty field), except 0 and -1 *} SHOW MESSAGE ITEM IN STOCK {/if} {/if} {/foreach}
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #53  
Old 08-30-2010, 10:38 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"?

Thanks again
I have tried this My extra field shows "stock_indicator"
but it dont show any messages
I did fix the sintax error /if*}

{foreach from=$extra_fields item=v}
{if $v.active eq "Y" && $v.name eq "stock_indicator"}
{if $v.field_value eq "0"}
{* no items in stock *}
SHOW MESSAGE FOR ITEM OUT OF STOCK
{elseif $v.field_value eq "-1"}
{* item discontinued *}
SHOW MESSAGE FOR ITEM DISCONTINUED
{else}
{* any value (or no value, empty field), except 0 and -1 *}
SHOW MESSAGE ITEM IN STOCK
{/if}
{/if}
{/foreach}

also I want it to work with "Quantity in stock (items):" field which works with the live stock levels on the store
If you see what i mean
thanks again
lewis
Quote:
Originally Posted by cflsystems
Try this, replace "in_stock" with the name of the field you created. This goes in skin1/customer/main/product_details.tpl for 4.3

Code:
{foreach from=$extra_fields item=v} {if $v.active eq "Y" && $v.name eq "in_stock"} {if $v.field_value eq "0"} {* no items in stock *} SHOW MESSAGE FOR ITEM OUT OF STOCK {elseif $v.field_value eq "-1"} {* item discontinued *} SHOW MESSAGE FOR ITEM DISCONTINUED {else} {* any value (or no value, empty field), except 0 and -1 *} SHOW MESSAGE ITEM IN STOCK /if} {/if} {/foreach}
__________________
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
  #54  
Old 08-31-2010, 02:06 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 cflsystems
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

That is correct Steve. Sorry I called it an "Extra Field" and I should have called it an "Input Field" or as you would say "Stock Indicator Field". I have noticed now how it can confuse one as Xcart has already got something called "Extra Fields". Sorry my bad
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #55  
Old 08-31-2010, 03:03 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

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

I fixed the error in my original post, sorry about that. Try with the service name of the field - replace "
{if $v.active eq "Y" && $v.name eq "stock_indicator"}"
with
{if $v.active eq "Y" && $v.service_name eq "WHATEVER THE FIELD SERVICE NAME IS"}

Quote:
Originally Posted by lewaff
also I want it to work with "Quantity in stock (items):" field which works with the live stock levels on the store

Not sure I follow - you want it to use product quantity field or you want it to show instead of it? If you want it to use product quantity field you don't need any of the above. Just do

Code:
{if $product.avail gt 0} SHOW MESSAGE ITEM IN STOCK {else} SHOW MESSAGE FOR ITEM OUT OF STOCK {/if}
You can't have "discontinued" message unless you use extra field
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #56  
Old 08-31-2010, 03:30 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"?

Sorry For confusing you
Yes i did want to use the Product Quantity field
and that bit of code works perfectly
but i also would like the customers still to be able to pre order when stock level 0
but it removes the the buy button
I am sure i have missed somthing simple(A bit long in the Tooth)

But I must say thanks and thanks to all this help on the forum it reminds me why i changed from CCP Carts now
lewis
Quote:
Originally Posted by cflsystems
I fixed the error in my original post, sorry about that. Try with the service name of the field - replace "
{if $v.active eq "Y" && $v.name eq "stock_indicator"}"
with
{if $v.active eq "Y" && $v.service_name eq "WHATEVER THE FIELD SERVICE NAME IS"}



Not sure I follow - you want it to use product quantity field or you want it to show instead of it? If you want it to use product quantity field you don't need any of the above. Just do

Code:
{if $product.avail gt 0} SHOW MESSAGE ITEM IN STOCK {else} SHOW MESSAGE FOR ITEM OUT OF STOCK {/if}
You can't have "discontinued" message unless you use extra field
__________________
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
  #57  
Old 08-31-2010, 04:10 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"?

xcart doesn't allow you to sell products that have zero in stock, this is why we have all these mods!

there's 2 things, you can disable inventory tracking completely, then it will just keep selling everything, it has no idea if it's in stock or not, or you can work with the inventory tracking.

there's mods like this, or you could do something like add 5 to y our quantities available, and if qty is less than five show it as pre-order, that way xcart thinks you have it in stock, so it will continue to sell it, but you show your customers that it's pre-order at the moment. The actual number you can vary, as long as it's the same in both areas, as in the amount you add on, (5 or 5000) and the amount at which it shows 'Pre-ORder'

hope that helps,
__________________
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
  #58  
Old 08-31-2010, 04:35 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

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

Yep, can't do this with quantity field. If you want to preorder then you have to use the first idea with the extra field and keep quantity high
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #59  
Old 08-31-2010, 05:08 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 For That
so I have now change it so with 1 item in stock you get this messeage

Please Note Stock Low !! BUT New Stock on its Way

Quote:
{if $product.avail gt 1}
ITEM IN STOCK NOW
{else}
Please Note Stock Low !! BUT New Stock on its Way
{/if}

again thanks for your assistance

Quote:
Originally Posted by amy2203
xcart doesn't allow you to sell products that have zero in stock, this is why we have all these mods!

there's 2 things, you can disable inventory tracking completely, then it will just keep selling everything, it has no idea if it's in stock or not, or you can work with the inventory tracking.

there's mods like this, or you could do something like add 5 to y our quantities available, and if qty is less than five show it as pre-order, that way xcart thinks you have it in stock, so it will continue to sell it, but you show your customers that it's pre-order at the moment. The actual number you can vary, as long as it's the same in both areas, as in the amount you add on, (5 or 5000) and the amount at which it shows 'Pre-ORder'

hope that helps,
__________________
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
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 04:11 PM.

   

 
X-Cart forums © 2001-2020