Announcement

Collapse
No announcement yet.

Show "out of stock" in search results

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NormanRouxel
    replied
    It's actually "Search Results Page Bulk Area" (I've amended my post above). Go to Design / Library / Layouts, right-click and use Find.

    Leave a comment:


  • toolman.co.uk
    replied
    Can the life of me find where the " Search Results Bulk Area" is??

    Please point me in the right direction in novice terms

    Leave a comment:


  • laura
    replied
    Nice idea, but this doesn't work on my site. I think its to do with the way the different size combinations have had to be set up. The stock level on the main product description is what the search sees not the stock level at the individual size level.

    Thanks anyway - I hope others have better success with this.

    Laura

    Leave a comment:


  • laura
    replied
    Thanks, Norman, I might just give that a try.

    Laura
    Last edited by laura; 10-Jan-2010, 02:57 PM. Reason: correcting mistypes

    Leave a comment:


  • NormanRouxel
    replied
    I can't think of a way of excluding them. You could probably adapt the above code to output code that hides the entire item. E.g. output for out-of-stock items

    <span style="display:none;">

    or for in-stock

    <span>

    Generate this at the start of each search item and put a </span> at the end.

    The full results lists HTML will then be used us usual but the out of stock items won't show on-screen as they're between <span style="display:none;"> and </span>.

    One quirk is that you will get sequence numbers with gaps (e.g. 1,2,4,5). And pages with all items out of stock won't show anything.

    Leave a comment:


  • laura
    replied
    Related to the above, is there any way of excluding items with zero stock levels from appearing in the search results list?

    Thanks,

    Laura

    Leave a comment:


  • martinkay
    replied
    Beautiful and relatively simple. Thanks Norman, you're a star as ever. That's now working at http://www.slotcarcentre.co.uk/acatalog/search.html, if you change the top radio button for digital plug cars to "YES" the message comes up for a fair few of them. Hopefully this will be useful for some other Actinic users too.

    Leave a comment:


  • NormanRouxel
    replied
    It's possible but isn't trivial. Here's how I'd go about it.

    Displaying OUT OF STOCK warning on search results.

    In layout Search Results Page Bulk Area, at the very top, add:
    Code:
    <actinic:block php="true">
    	$slhtml = <<<ENDOFCODE
    var ns = new Object();	
    <actinic:block type="EntireSectionList"><actinic:block type="ProductList"><actinic:block if="%28%3cactinic%3avariable%20name%3d%22ProductType%22%20%2f%3e%20%21%3d%202%29%20AND%20%3cactinic%3avariable%20name%3d%22IsOutOfStockShown%22%20%2f%3e" >
    ns["<actinic:variable name="EncodedProductAnchor" encoding="perl" selectable="false" />"]=1;</actinic:block></actinic:block></actinic:block>
    function searchstock(slink){
    	if ( ns[slink.replace(/.*#(.*)".*/, '$1')] ) document.write('<strong><span class="actrequired"><actinic:variable name="OutOfStock" encoding="perl" selectable="false" /></span></strong>');
    }
    ENDOFCODE;
    	$sl = fopen('outofstock.js', 'w');
    	fwrite($sl, $slhtml);
    	fclose($sl);
    </actinic:block>
    <script type="text/javascript" src="outofstock.js"></script>

    In layout Standard Search Result, where you want to display the stock warning (just above the final </p> line is a good place) insert:
    Code:
    <script type="text/javascript">searchstock('<Actinic:Variable Name="SearchResultLink"/>');</script>
    That's it.

    The code works by creating a JavaScript helper file "outofstock.js" that contains a list of product ID's for the out of stock entries only.

    This should make the file fairly small as it's likely that in stock products are in the majority.

    The file is only created once per upload when the Seach Results page is being parsed.

    JavaScript on the Standard Search Results layout, looks in the out of stock list for the current product ID and displays a warning if an entry is found.

    Leave a comment:


  • martinkay
    started a topic Show "out of stock" in search results

    Show "out of stock" in search results

    Is this possible, have looked around and it seems a most obvious thing to have as an option in the Search Settings, but have not been able to find an option or a script change to enable this to be included. Have had several requests from customers over Xmas irritated that they had to go down another level to find I was out of stock of the item they wanted.
Working...
X