Announcement

Collapse
No announcement yet.

Show "out of stock" in search results

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

    #16
    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>
    Some clients will have Online Stock Control Enabled

    Click image for larger version

Name:	47119-01.jpg
Views:	199
Size:	46.6 KB
ID:	553202

    And product by product either show the instock message by default

    Click image for larger version

Name:	47119-02.jpg
Views:	149
Size:	29.5 KB
ID:	553203

    Or choose to show the out of stock message

    Click image for larger version

Name:	47119-03.jpg
Views:	160
Size:	31.6 KB
ID:	553204

    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...
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    Comment


      #17
      Is there a variable to use that shows when the Stock Control / Monitoring box is ticked at product level?
      Variable IsStockMonitored does that but it's not available in the search results. Significant Perl patching would be required or a variation on my post #2 might help.
      [code]


      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #18
        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>
        But the BlockIf is ignored and the colour is red regardless of the value of <actinic:variable name="SearchResultStock" />

        Is there a way of changing the style if stock is zero?

        https://www.webeg.uk/willit/acatalog...Jewellery.html

        Thank you
        Jonathan Chappell
        Website Designer
        SellerDeck Website Designer
        Actinic to SellerDeck upgrades
        Graphicz Limited - www.graphicz.co.uk

        Comment


          #19
          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>
          This will add the stock count as a data-srstock attribute to the tag around the stock level.

          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>
          Note: If you use filtering then Standard Search Results is used when a filter is applied so the above code also runs whenever a filter selection completes.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #20
            Brilliant. Thank you Norman.
            Jonathan Chappell
            Website Designer
            SellerDeck Website Designer
            Actinic to SellerDeck upgrades
            Graphicz Limited - www.graphicz.co.uk

            Comment


              #21
              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>
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #22
                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>
                This needs to go at the bottom of the stylesheet:

                Code:
                .srstock {
                background-repeat: no-repeat!Important;
                padding-left: 1.8em;
                font-weight:bold;
                }
                Jonathan Chappell
                Website Designer
                SellerDeck Website Designer
                Actinic to SellerDeck upgrades
                Graphicz Limited - www.graphicz.co.uk

                Comment


                  #23
                  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.

                  Comment


                    #24
                    I am afraid I do not know, hopefully someone else can help
                    Jonathan Chappell
                    Website Designer
                    SellerDeck Website Designer
                    Actinic to SellerDeck upgrades
                    Graphicz Limited - www.graphicz.co.uk

                    Comment

                    Working...
                    X