I'm using ExpressionEngine2.9 and CartThrob2.6. I Upgraded versions from EE2.6.1 and CT Pro2.3.5
The store was working previous to updating EE/addon, I updated a dev version of the site. After updating the add to cart tag isn't working correctly, it has a price modifier with a conditional to check the inventory amount. Based on inventory level being 1 or more the add to cart button shows, if less than 1 a message "product out of stock" shows instead of the add to cart button.
This code was working before the update:
{exp:cartthrob:add_to_cart_form secure_action="yes" entry_id="{entry_id}" return="shop/view_cart" no_tax="{no_tax}" no_shipping = "{no_shipping}"}
<!-- addtocart-form -->
<div class="addtocart-form">
{exp:cartthrob:item_options entry_id="{entry_id}"}
{if options_exist}
<!-- control-group -->
<div class="control-group">
<!-- controls -->
<div class="controls">
{select class="input-medium"}
<option {selected} value="{option_value}" {if {inventory} < 1} disabled="disabled" {/if}>
{option_name}
{if {inventory} < 1}
- Out of Stock!
{if:else}
{if option_price_numeric != 0} +{option_price}{/if}
{/if}
</option>
{/select}
</div><!-- /.controls -->
<label class="control-label" for="{option_field}">
{option_label}:
</label>
</div><!-- /.control-group -->
{/if}
<!-- control-group -->
<div class="control-group">
{if {inventory} ==0}
<h2>So Sorry!</h2>
<p>The specific size and style of the item you selected is currently out of stock.
Please check back soon for availability.</p>
{if:else}
<!-- controls -->
<div class="controls">
<input type="text" id="product_quantity" class="input-medium" placeholder='1' name="quantity" size="8" />
</div><!-- /.controls -->
<label for="product_quantity" class="control-label">
Quantity:
</label>
{/if}
</div><!-- /.control-group -->
<!-- add-to-cart-btn -->
<div class="add-to-cart-btn">
<!-- control-group -->
<div class="control-group">
<!-- form-actions -->
<div class="form-actions">
{if {option_value:select:inventory} ==0}
<h2>So Sorry! Out of Stock! :(</h2>
{if:else}
<button type="submit" class="btn btn-primary">
<img src="{site_url}button.png" />
</button>
{/if}
{/exp:cartthrob:item_options}
</div<!-- /.form-actions -->
</div><!-- /.control-group -->
</div><!-- /.add-to-cart-btn -->
</div><!-- /.addtocart-form -->
{/exp:cartthrob:add_to_cart_form}
In the control panel, in the price modifier field the product has suitable inventory levels though conditional acts as if it's "0" - happens on all products. I've tried updating the conditional using a different operator other than the lessthan operator - no success. It's been a while since I built this, but I believe this add to cart price modifier code is based on the template example that came with CT2.3.5.
Based on some other posts I've read (if I'm understanding things correctly) maybe CT isn't getting the inventory amounts correctly because of a change in template parsing, but I'm not sure if I'm incorrect in that. Anyone else have any experience with this? If so, is this a bug? Or due to changes in parser, etc?
Thanks in advance, Reuben