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

Show variant "out of stock" on dropdown

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-30-2013, 08:17 PM
  proboscidian's Avatar 
proboscidian proboscidian is offline
 

Senior Member
  
Join Date: May 2005
Location: Clearwater, FL
Posts: 146
 

Default Show variant "out of stock" on dropdown

I am trying to show "out of stock" on the dropdown list for any variant that is not in stock. The products have only one variant; all other options are price modifiers. This is for a 4.6.1 x-cart. Does anyone have any ideas? If I have to I will just write it out on each dropdown, but it would be better if it was automatic.
__________________
Industrial Webworks
Various xcart versions from 4.1.19 gold - 4.7 gold
http://www.industrialwebworks.net
Reply With Quote
  #2  
Old 12-03-2013, 05:57 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Show variant "out of stock" on dropdown

Here is some old code that might at least point you in the right direction ("oos" is out of stock):
PHP Code:
{foreach from=$p.product_options item=v}
  {foreach 
from=$v.options item=o}
    {
assign var=oos value=0}
    {if 
$p.variants}
      {foreach 
from=$p.variants item=var}
        {foreach 
from=$var.options key=void item=vop}
          {if 
$void eq $o.optionid}
            {if 
$var.avail lt 1}
              {
assign var=oos value=1}
            {else}
              {
assign var=oos value=0}
            {/if}
          {/if}
        {/foreach}
      {/foreach}
    {/if} 
Then you can use the "oos" flag on the drop down to add a message or disable it. Here is an example:
PHP Code:
<option value="{$o.optionid}"{if $o.selected eq 'Y'selected="selected"{/if}{if $oosdisabled="disabled"{/if}>{if $oos}out of stock{/if} 
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
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 05:23 AM.

   

 
X-Cart forums © 2001-2020