Announcement

Collapse
No announcement yet.

How to get Sellerdeck to display Out Of Stock when the add to cart button is hidden

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

    How to get Sellerdeck to display Out Of Stock when the add to cart button is hidden

    The forum won't let me post the original code with 'onclick' in it so I've added an X in front of it to get around the problem. This shouldn't affect anyone as the extra code at the bottom doesn't have the onclick so can be copied and pasted if required.


    *****************************************************************************

    I've been meaning to implement this for a while but haven't been able to find any details on how to do it. In the end it's not too difficult a thing to do.

    The problem: Sellerdeck Real Time Stock Control will hide the Add to Cart button when an item is out of stock. The problem is that this just leaves a page without an add to cart button which can confuse customers.

    The Solution: Edit the 'Add to Cart' layout code so that when the add to cart button is hidden an 'Out Of Stock' message is displayed in it's place.

    How to do it:

    We can do this by editing the 'Add to Cart Button' layout code. (in design view, preview a page, select the 'add to cart' button, select the layout tab).

    This is the original code:

    Code:
    <span id="RemoveIfOutOfStock_ATC_<actinic:variable name="ProductReference" selectable="false" />" class="ActinicRTS" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CartButtonVisibleToAllCustomers%22%20%2f%3e" >
    <!-- This code is used when the cart button is visible to all customers -->
    <span class="button-wrapper cart-button-wrapper"><input value="<Actinic:Variable Name="CartButtonText"/>" name="_<Actinic:Variable Name="ProductID"/>" type="submit" class="button cart-button" Xonclick="return ValidateChoices(&#34;<actinic:variable name="ProductID" />&#34;);"/></span>
    </actinic:block>
    
    <actinic:block if="%3cactinic%3avariable%20name%3d%22EnabledForCustomerGroupID%22%20%2f%3e%20%21%3d%20%22%22">
    <actinic:block if="%3cactinic%3avariable%20name%3d%22ProductPriceIsEnabled%22%20%2f%3e">
    <!-- This code is used when the cart button is visible to retail customers, but not all other customer groups -->
    <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />">
    <span class="button-wrapper cart-button-wrapper"><input value="<Actinic:Variable Name="CartButtonText"/>" name="_<Actinic:Variable Name="ProductID"/>" type="submit" class="button cart-button" Xonclick="return ValidateChoices(&#34;<actinic:variable name="ProductID" />&#34;);"/></span>
    </Actinic:ShowForPriceSchedule>
    </actinic:block>
    
    <actinic:block if="%3cactinic%3avariable%20name%3d%22ProductPriceIsEnabled%22%20%2f%3e%20%3d%3d%20FALSE" >
    <!-- This code is used when the cart button needs to hidden from retail customers -->
    <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />" HTML="<span class='button-wrapper cart-button-wrapper'><input value='<Actinic:Variable Name="CartButtonText"/>' name='_<Actinic:Variable Name="ProductID"/>' type='submit' class='button cart-button' Xonclick='return ValidateChoices(&#34;<actinic:variable name="ProductID" />&#34;);' /></span>"></Actinic:ShowForPriceSchedule>
    </actinic:block>
    </actinic:block>
    </span>
    You can see that the first line uses a span with 'RemoveIfOutOfStock' in it and this is what the RT display uses to hide the content if the item is out of stock.

    Fortunately, Sellerdeck also has two other options for doing similar things: 'EnableIfOutOfStock' and 'EnableIfInStock' which are fairly self explanatory. In this case we'll use the 'EnableIfOutOfStock' option.

    The code above covers three different options for showing the add to cart button to different customer groups but as I only use the first option I'll just create the code for that one. If you want to you can do the same thing for all other the customer options as well.

    All we have to do is add a new bit of code on the end of the existing code that has

    Code:
    <span id="EnableIfOutOfStock_ATC_<actinic:variable name="ProductReference" selectable="false" />" class="ActinicRTS" >
    <actinic:block if="%3cactinic%3avariable%20name%3d%22CartButtonVisibleToAllCustomers%22%20%2f%3e" >
    <!-- This code is used when the cart button is visible to all customers -->
    <span class="button-wrapper cart-button-wrapper"><font color="Green">Out Of Stock</font></span>
    </actinic:block>
    </span>
    You can change the styling, text etc that is displayed to suit your page design.

    Remember to apply the changes when you're done editing.

    And that's it. Do a publish to web to go live.

    You must have Stock Control enabled on the product for this to work, otherwise it shows both the add to cart and the out of stock message.
    Last edited by Mike Hughes; 12-Dec-2019, 02:52 PM.
    -----------------------------------------

    First Tackle - Fly Fishing and Game Angling

    -----------------------------------------
Working...
X