Announcement
Collapse
No announcement yet.
Show "out of stock" in search results
Collapse
X
-
I am loving this tweak. I have been looking for a way of doing this for a while. SO - how can we make it so that we can SORT on stock amount? Eg. show products with most items in stock first. etc ?
Also - with other stock things we have the tweak to say "More than 5 in stock" if stock > 5 - so as to not show all our cards to everyone. Can this tweak be added to this tweak, as currently displays the entire stock figure.
It would be really good to be able to do that.
Leave a comment:
-
I have found that you can add the icons:
Code:<script type="text/javascript"> function setsrstock(){ $( "p.srstock" ).each(function(){ $(this).css('color', ($(this).attr('data-srstock') - 0) > 0 ? 'green' : 'red'); $(this).css('background', ($(this).attr('data-srstock') - 0) > 0 ? 'url("in-stock.png")' : 'url("out-stock.png")'); }); } // redefine actinicsearch.js HideLoadingDialog to recheck stock after filtering is applied function HideLoadingDialog() { var loadingDialog = document.getElementById('loading-dialog'); if (loadingDialog) { loadingDialog.style.display = "none"; // hide the dialog } setsrstock(); // Norman patch to check stock } $(document).ready(function(){ setsrstock(); }); </script>
Code:.srstock { background-repeat: no-repeat!Important; padding-left: 1.8em; font-weight:bold; }
Leave a comment:
-
And for normal pages use plain StockLevel and BlockIf's:
Code:<p style="color:<actinic:block if="%3cactinic%3avariable%20name%3d%22StockLevel%22%20%2f%3e%20%3e%200">green</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22StockLevel%22%20%2f%3e%20%3c%3d%200">red</actinic:block>"><actinic:variable name="StockLevel" /> in stock</p>
- 1 like
Leave a comment:
-
BlockIf's are evaluated when the page is being built on your back office system. They're no use for dynamic content served to users like e.g. the search results.
You need code that will operate when the page is being loaded by the users browser. E.g.:
In layout Standard Search Results:
Code:<p data-srstock="<actinic:variable name="SearchResultStock" />" class="srstock"><actinic:variable name="SearchResultStock" /> in stock</p>
Then the following added to the bottom of layout Standard JavaScript Header Functions will run once the page has loaded to set the colour as required:
Code:<script type="text/javascript"> function setsrstock(){ $( "p.srstock" ).each(function(){ $(this).css('color', ($(this).attr('data-srstock') - 0) > 0 ? 'green' : 'red'); }); } // redefine actinicsearch.js HideLoadingDialog to recheck stock after filtering is applied function HideLoadingDialog() { var loadingDialog = document.getElementById('loading-dialog'); if (loadingDialog) { loadingDialog.style.display = "none"; // hide the dialog } setsrstock(); // norman patch to check stock } $(document).ready(function(){ setsrstock(); }); </script>
- 1 like
Leave a comment:
-
I tried to do this:
Code:<p<actinic:block if="%3cactinic%3avariable%20name%3d%22SearchResultStock%22%20%2f%3e%20%3d%3d%200"> style="color:red"</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22SearchResultStock%22%20%2f%3e%20%3e%3d%201"> style="color:green;"</actinic:block>><actinic:variable name="SearchResultStock" /> in stock</p>
Is there a way of changing the style if stock is zero?
https://www.webeg.uk/willit/acatalog...Jewellery.html
Thank you
Leave a comment:
-
Is there a variable to use that shows when the Stock Control / Monitoring box is ticked at product level?
[code]
- 1 like
Leave a comment:
-
This displays a message when stock is Zero whether the Stock Control / Monitoring box is ticked at product level or not.
Code:<actinic:block if="%3cactinic%3avariable%20name%3d%22SearchResultStock%22%20%2f%3e%20%3d%3d%200" > <span id="EnableIfOutOfStock_<actinic:variable name="SearchResultProductReference" />" class="ActinicRTS"><Actinic:Variable Name="OutOfStock"/></span> </actinic:block>
And product by product either show the instock message by default
Or choose to show the out of stock message
Is there a variable to use that shows when the Stock Control / Monitoring box is ticked at product level?
This would allow the message above to only display when <actinic:variable name="SearchResultStock" /> is Zero AND the the Stock Control / Monitoring box is ticked at product level.
i have searched but not yet found.
Thank you...
Leave a comment:
-
Forget all that 10 year old stuff. Nowadays use:
<actinic:variable name="SearchResultStock" />
- 1 like
Leave a comment:
-
How can this be modified to work in v18/Swift please?
The Standard search result is already wrapped in script tags...
Thank you
Leave a comment:
-
Cheers Norman,
I dont know what I didnt do last night but I got it working now
Cheers Mate
Leave a comment:
-
Daniel. It's very likely that you've simply failed to copy / paste the entire bit of code above, or you've overwritten some part of the Search Results Page Bulk Area instad of adding the code at the top.
You can do the two bits of code one at a time. There should be no effect if you do the first bit alone. The results should display as before. Once you get that, do the second bit and test again.
Leave a comment:
-
God knows what Im doing, I just presummed you could just copy and paste the html, did that and uploaded, but when I tested it, it said ie: 1 of 12 products found, but only one product was showing.
So tried inserting it as a block and it just keeps crashing actinic.
Told you I was a novice!
I'll have to live without it!
Leave a comment:
Leave a comment: