andersburn Posted March 11, 2014 Share Posted March 11, 2014 (edited) On my product-pages now, the stock quantity is shown like a number, 82, If I have 2 combinations with 7 in one combination and 75 in another combination it will show that, when toggling between the combinations. That's great. But I want it to show 100+ if the stock quantity is over 100 and when only a few is left I want the show "get it while we have the item in stock" or something. BTW this is the line that shows the stock level now: <span id="quantityAvailable">{$product->quantity|intval}</span> I tryed: <span id="quantityAvailable"> {if $product->quantity|intval < 100 || $product->quantity|intval > 7} {$product->quantity|intval} {elseif $product->quantity|intval >= 100} 100+ elseif{$product->quantity|intval <= 6 || $product->quantity|intval > 0} Only a few left! {/if} </span> But this only works for every item, not the specific combination How to Get the combination-stock-quantity in ror? Or is this a javascript thing? The site is: mackabler.dk Edited March 11, 2014 by andersburn (see edit history) Link to comment Share on other sites More sharing options...
andersburn Posted March 7, 2015 Author Share Posted March 7, 2015 <span id="quantityAvailable2"> {if $product->quantity|intval < 100 && $product->quantity|intval > 7} {$product->quantity|intval} 1 {elseif $product->quantity|intval > 100} 100+ 2 {elseif $product->quantity|intval <= 6 && $product->quantity|intval > 0} Only a few left! 3 {/if} </span> Link to comment Share on other sites More sharing options...
vkmaxx Posted November 9, 2015 Share Posted November 9, 2015 I was able to solve this by editing /themes/default-bootstrap/js/product.js In function updateDisplay(), about 481 line, after the following code if (!selectedCombination['unavailable'] && quantityAvailable > 0 && productAvailableForOrder == 1) { I added: if (quantityAvailable > 50) { quantityAvailable = '50+'; } And it works Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now