Announcement

Collapse
No announcement yet.

Display stock notices/banners on products on the Home Page

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

    Display stock notices/banners on products on the Home Page

    A client wished for stock notices to be displayed on the products on the Home Page - Best Sellers and New Products etc.

    Real Time Stock Control (RTS) only works on product page and section page as the scripts are blockif'd for these pages in Javascript Header Functions.

    However stock banners can be displayed on the home page products using BlockIfs.

    In addition the client wished for the option to not have stock monitoring for a product or to have it and also present custom 'In Stock' and 'Out Of Stock' Messages.

    For example for an 'In Stock' product you may wish to display 'See Delivery Details' and for an 'Out Of Stock' product you may wish to display 'Stock Coming Soon' - for example.

    Create two variables: 'CustomInStockMessage' and 'CustomOutOfStockMessage' set at Site and Product levels.

    Click image for larger version

Name:	HomePageStock01.jpg
Views:	167
Size:	132.2 KB
ID:	555599

    Add this code to the product layout styled as you wish, styles given here are an example:

    Code:
    <!-- Home Page Stock Bar -->
    <actinic:block if="%21%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20%26%26%20%3cactinic%3avariable%20name%3d%22RealTimeStockEnabled%22%20%2f%3e" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%3d%3d%20%27%27" ><span class="stock-bar in"><i class="fa fa-check-square-o"></i> <actinic:variable name="ProductInStockMessage" /></span></actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%21%3d%20%27%27" ><span class="stock-bar ask"><i class="fa fa-info-circle" aria-hidden="true"></i> <actinic:variable name="CustomInStockMessage" /></span></actinic:block>
    </actinic:block>
    <actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20%26%26%20%3cactinic%3avariable%20name%3d%22RealTimeStockEnabled%22%20%2f%3e%29%20AND%20%0d%3cactinic%3avariable%20name%3d%22StockLevel%22%20%2f%3e%20%3c%3d%200" >
    <span class="stock-bar <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomOutOfStockMessage%22%20%2f%3e%20%3d%3d%20%27%27">out</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22CustomOutOfStockMessage%22%20%2f%3e%20%21%3d%20%27%27" >query</actinic:block>"><i class="fa fa-times"></i> <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomOutOfStockMessage%22%20%2f%3e%20%3d%3d%20%27%27"><Actinic:Variable Name="OutOfStock"/></actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomOutOfStockMessage%22%20%2f%3e%20%21%3d%20%27%27" ><actinic:variable name="CustomOutOfStockMessage" /></actinic:block></span>
    </actinic:block>
    <actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20%26%26%20%3cactinic%3avariable%20name%3d%22RealTimeStockEnabled%22%20%2f%3e%29%20AND%20%0d%3cactinic%3avariable%20name%3d%22StockLevel%22%20%2f%3e%20%3e%3d%201" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%3d%3d%20%27%27" ><span class="stock-bar in"><i class="fa fa-check-square-o"></i> <actinic:variable name="ProductInStockMessage" /></span></actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%21%3d%20%27%27" ><span class="stock-bar ask"><i class="fa fa-info-circle" aria-hidden="true"></i> <actinic:variable name="CustomInStockMessage" /></span></actinic:block>        
    </actinic:block>    
    <actinic:block if="%21%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20%26%26%20%21%3cactinic%3avariable%20name%3d%22RealTimeStockEnabled%22%20%2f%3e" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%3d%3d%20%27%27" ><span class="stock-bar in"><i class="fa fa-check-square-o"></i> <actinic:variable name="ProductInStockMessage" /></span></actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%21%3d%20%27%27" ><span class="stock-bar ask"><i class="fa fa-info-circle" aria-hidden="true"></i> <actinic:variable name="CustomInStockMessage" /></span></actinic:block>    
    </actinic:block>
    <!-- End of Home Page Stock Bar -->
    and add to stylesheet - change to suit your own environment:

    Code:
    .instockbar {
    font-size:1..4em;
    border-bottom:1px solid grey;
    padding:1em;
    }
    .stock-bar {display: block; width: 100%;padding: 8px; line-height: 1; font-size: 14px; margin: 0; text-align: center; border: 1px solid <actinic:variable name="Palette3" />; border-bottom: none; color: <actinic:variable name="TextColor" />;}
    .stock-bar.in {color: #ffffff; background-color: #28A745;}
    .stock-bar.ask {color: #000; background-color: #FFC107;}
    .stock-bar.out {color: #ffffff; background-color: #DC3545;}
    .stock-bar.query {color: #ffffff; background-color: #EB8C95;}
    To give an example I added the following code to the top of the brochure page inner layout in a default site - https://www.graphiczdev.co.uk/hpstock/index.html:

    Code:
    <actinic:block type="EntireSectionList" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionID%22%20%2f%3e%20%3e%3d%201" >
        <actinic:block type="ProductList" >
        <p>
        <strong><actinic:variable formatting="h2" encoding="actinic" name="ProductName" /></strong><br />
    <div class="instockbar">
                <!-- Home Page Slider Stock Bar -->
    <actinic:block if="%21%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20%26%26%20%3cactinic%3avariable%20name%3d%22RealTimeStockEnabled%22%20%2f%3e" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%3d%3d%20%27%27" ><span class="stock-bar in"><i class="fa fa-check-square-o"></i> <actinic:variable name="ProductInStockMessage" /></span></actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%21%3d%20%27%27" ><span class="stock-bar ask"><i class="fa fa-info-circle" aria-hidden="true"></i> <actinic:variable name="CustomInStockMessage" /></span></actinic:block>
    </actinic:block>
    <actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20%26%26%20%3cactinic%3avariable%20name%3d%22RealTimeStockEnabled%22%20%2f%3e%29%20AND%20%0d%3cactinic%3avariable%20name%3d%22StockLevel%22%20%2f%3e%20%3c%3d%200" >
    <span class="stock-bar <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomOutOfStockMessage%22%20%2f%3e%20%3d%3d%20%27%27">out</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22CustomOutOfStockMessage%22%20%2f%3e%20%21%3d%20%27%27" >query</actinic:block>"><i class="fa fa-times"></i> <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomOutOfStockMessage%22%20%2f%3e%20%3d%3d%20%27%27"><Actinic:Variable Name="OutOfStock"/></actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomOutOfStockMessage%22%20%2f%3e%20%21%3d%20%27%27" ><actinic:variable name="CustomOutOfStockMessage" /></actinic:block></span>
    </actinic:block>
    <actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20%26%26%20%3cactinic%3avariable%20name%3d%22RealTimeStockEnabled%22%20%2f%3e%29%20AND%20%0d%3cactinic%3avariable%20name%3d%22StockLevel%22%20%2f%3e%20%3e%3d%201" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%3d%3d%20%27%27" ><span class="stock-bar in"><i class="fa fa-check-square-o"></i> <actinic:variable name="ProductInStockMessage" /></span></actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%21%3d%20%27%27" ><span class="stock-bar ask"><i class="fa fa-info-circle" aria-hidden="true"></i> <actinic:variable name="CustomInStockMessage" /></span></actinic:block>        
    </actinic:block>    
    <actinic:block if="%21%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20%26%26%20%21%3cactinic%3avariable%20name%3d%22RealTimeStockEnabled%22%20%2f%3e" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%3d%3d%20%27%27" ><span class="stock-bar in"><i class="fa fa-check-square-o"></i> <actinic:variable name="ProductInStockMessage" /></span></actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CustomInStockMessage%22%20%2f%3e%20%21%3d%20%27%27" ><span class="stock-bar ask"><i class="fa fa-info-circle" aria-hidden="true"></i> <actinic:variable name="CustomInStockMessage" /></span></actinic:block>    
    </actinic:block>
    <!-- End of Home Page Slider Stock Bar -->
                </div>    
    </actinic:block>
    </actinic:block>
    </actinic:block>
    There are four options (see image below) but in the first three cases in 'Business Settings' 'Options' 'Enable Online Stock Control' is checked.

    Option 1: 'Real Time Stock' is enabled but 'Stock Monitoring' is not enabled:
    Shows 'In Stock' or the custom 'In Stock Message'

    Option 2: 'Real Time Stock' is enabled and 'Stock Monitoring' is enabled and Stock Level <= 0:
    Shows 'Out Of Stock' or the custom 'Out Of Stock Message'

    Option 3: 'Real Time Stock' is enabled and 'Stock Monitoring' is enabled and Stock Level >= 1:
    Shows 'In Stock' or the custom 'In Stock Message'

    Option 4: 'Real Time Stock' is not enabled and 'Stock Monitoring' is not enabled:
    Shows 'In Stock' or the custom 'In Stock Message'

    Click image for larger version

Name:	HomePageStock02.jpg
Views:	77
Size:	260.9 KB
ID:	555600

    Use as you wish but posted on a goodwill basis only.



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