Announcement

Collapse
No announcement yet.

Bootstrap quantity expression implementation in Swift

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

    Bootstrap quantity expression implementation in Swift

    Swift uses the Bootstrap grid but in the product layouts and only one of the quantity expressions has been rewritten for bootstrap. The others use original Smart coding which will result in double plus/minus in the quantity respective expression if displayed.

    There are three sets of quantity expression in the product layouts:

    -- This code is used when the quantity box is visible to all customers
    -- This code is used when the quantity box is visible to retail customers, but not all other customer groups
    -- This code is used when the quantity box needs to hidden from retail customers

    The first one (This code is used when the quantity box is visible to all customers) is OK:
    Code:
    <fieldset class="form-group quantity-box w-50 w-md-100">
                                <div class="row align-items-center">
                                    
                                    <div class="input-group col-12">
                                    <!-- This code is used when the quantity box is visible to all customers -->
                                        <label><actinic:variable name="QuantityPrompt" /></label>
                                        <input class="form-control input-number text-center input-lg" type="text" name="Q_<actinic:variable name="ProductID" />" value="<actinic:variable name="MinQuantityOrderable" />"  <actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20FALSE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >onpaste="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />)" onkeyup="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />)"</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >onpaste="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />, '<actinic:variable name="ShopID" selectable="false" />')" onkeyup="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />, '<actinic:variable name="ShopID" selectable="false" />')"</actinic:block>/>
                                    </div>
                                </div>
                            </fieldset>
    The other two must be changed thus:

    -- This code is used when the quantity box is visible to retail customers, but not all other customer groups
    Change:
    Code:
    <div class="input-group">
                                <!-- This code is used when the quantity box is visible to retail customers, but not all other customer groups -->
                                <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />">
                                <span class="input-group-btn">
                                    <button class="btn btn-lg btn-default btn-number inc quantityButton" type="button">
                                        <b>-</b>
                                    </button>
                                </span>
                                <input class="form-control text-center input-lg" type="number" name="Q_<actinic:variable name="ProductID" />" value="<actinic:variable name="DefaultQuantity" />" <actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20FALSE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >onpaste="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />)" onkeyup="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />)" onmouseup="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />)"</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >onpaste="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />, '<actinic:variable name="ShopID" />')" onkeyup="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />, '<actinic:variable name="ShopID" />')" onmouseup="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />, '<actinic:variable name="ShopID" />')"</actinic:block>/>
                                <span class="input-group-btn">
                                    <button class="btn btn-lg btn-default btn-number inc quantityButton" type="button">
                                        <b>+</b>
                                    </button>
                                </span>
                            </div>
    And replace with:

    Code:
    <div class="input-group">
                                <!-- This code is used when the quantity box is visible to retail customers, but not all other customer groups -->
                                <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />">
                                    <fieldset class="form-group quantity-box w-50 w-md-100">
                                        <div class="row align-items-center">
                                    
                                        <div class="input-group col-12">
                                    <!-- This code is used when the quantity box is visible to all customers -->
                                        <label><actinic:variable name="QuantityPrompt" /></label>
                                        <input class="form-control input-number text-center input-lg" type="text" name="Q_<actinic:variable name="ProductID" />" value="<actinic:variable name="DefaultQuantity" />" <actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20FALSE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >onpaste="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />)" onkeyup="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />)"</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >onpaste="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />, '<actinic:variable name="ShopID" selectable="false" />')" onkeyup="QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />, '<actinic:variable name="ShopID" selectable="false" />')"</actinic:block>/>
                                        </div>
                                    </div>
                                </fieldset>
                                </Actinic:ShowForPriceSchedule>
                            </div>
    Interestingly the closing 'Actinic:ShowForPriceSchedule' tag is missing in the original.

    -- This code is used when the quantity box needs to hidden from retail customers
    Change:
    Code:
    <div class="input-group">
                                <!-- This code is used when the quantity box needs to hidden from retail customers -->        
                                <span class="input-group-btn">
                                    <button class="btn btn-lg btn-default" type="button">
                                        <b>-</b>
                                    </button>
                                </span>                
                                <actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20FALSE%20OR%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20TRUE" >
                                <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />" HTML="<label><span class='actrequired'><actinic:variable name="QuantityPrompt" /></span></label><input  class="form-control input-lg text-center" type='number' name='Q_<actinic:variable name="ProductID" />' value='<actinic:variable name="DefaultQuantity" />' />"></Actinic:ShowForPriceSchedule>
                                </actinic:block>
                                <actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20FALSE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >
                                <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />" HTML="<label><span class='actrequired'><actinic:variable name="QuantityPrompt" /></span></label><input class="form-control input-lg text-center" type='number' name='Q_<actinic:variable name="ProductID" />' value='<actinic:variable name="DefaultQuantity" />' onpaste=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />) onkeyup=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />) onmouseup=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />)/>"></Actinic:ShowForPriceSchedule>
                                </actinic:block>
                                <actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >
                                <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />" HTML="<label><span class='actrequired'><actinic:variable name="QuantityPrompt" /></span></label><input class="form-control input-lg text-center" type='number' name='Q_<actinic:variable name="ProductID" />' value='<actinic:variable name="DefaultQuantity" />' onpaste=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />, '<actinic:variable name="ShopID" />') onkeyup=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />, '<actinic:variable name="ShopID" />') onmouseup=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" />', <actinic:variable name="SectionID" />, '<actinic:variable name="ShopID" />')/>"></Actinic:ShowForPriceSchedule>
                                </actinic:block>
                                <span class="input-group-btn">
                                    <button class="btn btn-lg btn-default" type="button">
                                            <b>+</b>
                                    </button>
                                </span>
                            </div>
    And replace with:

    Code:
    <fieldset class="form-group quantity-box w-50 w-md-100">
                            <div class="row align-items-center">                                
                            <div class="input-group col-12">
                                <!-- This code is used when the quantity box needs to hidden from retail customers -->                        
                            <actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20FALSE%20OR%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20TRUE" >
                            <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />" HTML="<label><span class='actrequired'><actinic:variable name="QuantityPrompt" /></span></label><input class='form-control input-number text-center input-lg' type='number' name='Q_<actinic:variable name="ProductID" />' value='<actinic:variable name="DefaultQuantity" />' />"></Actinic:ShowForPriceSchedule>
                            </actinic:block>
                            <actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20FALSE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >
                            <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />" HTML="<label><span class='actrequired'><actinic:variable name="QuantityPrompt" /></span></label><input class='form-control input-number text-center input-lg' type='number' name='Q_<actinic:variable name="ProductID" />' value='<actinic:variable name="DefaultQuantity" />' onpaste=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />) onkeyup=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />) onmouseup=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />)/>"></Actinic:ShowForPriceSchedule>
                            </actinic:block>
                            <actinic:block if="%3cactinic%3avariable%20name%3d%22UseDynamicPrices%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e%20%3d%3d%20TRUE%20AND%20%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20FALSE" >
                            <Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />" HTML="<label><span class='actrequired'><actinic:variable name="QuantityPrompt" /></span></label><input class='form-control input-number text-center input-lg' type='number' name='Q_<actinic:variable name="ProductID" />' value='<actinic:variable name="DefaultQuantity" />' onpaste=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />, '<actinic:variable name="ShopID" selectable="false" />') onkeyup=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />, '<actinic:variable name="ShopID" selectable="false" />') onmouseup=QuantityChanged(this, '<actinic:variable name="DynamicPriceCGIURL" selectable="false" />', <actinic:variable name="SectionID" selectable="false" />, '<actinic:variable name="ShopID" selectable="false" />')/>"></Actinic:ShowForPriceSchedule>
                            </actinic:block>
                            </div>
                            </div>
                            </fieldset>
    Posted in good faith but without warranty

    It can be difficult to 'see' Sellerdeck code in expanded Notepad form, so in Sellerdeck, Design, Library, Layouts, create a new Layout Selector 'My Layouts' and make new blank layouts in there to paste code from here and elsewhere, it will be much easier to 'read' and to copy from.

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