Skip to content

mvt:do - Check if customer is in availability group#


Description#

This snippet checks if a customer belongs to a specific availability group, such as “Wholesalers.” It uses the mvt:do tag to load and verify the customer’s membership in the group. If the customer is a member of the “Wholesalers” group, it sets a flag indicating their wholesale status and displays a corresponding message.

Snippet#

<mvt:comment><!-- Check if Customer is Wholesale --></mvt:comment>
<mvt:if expr="g.Basket:cust_id">
    <mvt:do name="l.result" file="g.Module_Feature_AGR_DB" value="AvailabilityGroup_Load_Name( 'Wholesalers', l.availgroup )" />
    <mvt:if expr="l.result">
        <mvt:do name="l.exists" file="g.Module_Feature_AGR_DB" value="AvailGroupXCustomer_Load( l.availgroup:id, g.Basket:cust_id, s.null )" />
        <mvt:if expr="l.exists">
            <mvt:assign name="g.basket:customer:is_wholesale" value="1" />
        </mvt:if>
    </mvt:if>
</mvt:if>

<mvt:if expr="g.basket:customer:is_wholesale">
    <h1>You are wholesale</h1>
<mvt:else>
    <h1>You are not wholesale</h1>
</mvt:if>