Business Catalyst创建多个价格

时间:2013-10-22 02:01:22

标签: adobe business-catalyst

我有一个客户想要为不同的客户收取不同的价格。部分产品折扣43%,其他产品折扣47%,促销代码仅适用于美元折扣或折扣%。这是否可以让客户登录以查看基于他们登录的特价?

1 个答案:

答案 0 :(得分:3)

是的,你可以这样做。您需要为每种帐户类型设置不同的安全区域订阅。有一些编码涉及。

例如,您可以设置“零售”和“批发”安全区域。然后,使用一些javascript / jQuery,您可以通过将{module_subscriptions}标记粘贴在隐藏的div中来确定用户的订阅级别。当用户登录时,标签将输出用户订阅的安全区域列表,然后您可以使用它来确定要显示的价格。

HTML:

   <!--stick this before the closing body tag in your template-->
    <div id="userSecureZones" style="display: none;">
        <!--outputs all secure zone subscriptions when logged in -->
        {module_subscriptions}
    </div>

   <!--When the page loads, BC will replace the {module_subscriptions} 
   with something like this-->
    <div id="userSecureZones" style="display: none;">
       <li>
         <ul>
            <!--each one of these represents a zone a user is subscribed to-->
           <li class="zoneName">
             <a href="/Default.aspx?PageID=14345490">Retail Zone</a>
           </li>
           <li class="zoneName">
             <a href="/Default.aspx?PageID=15904302">Wholesale Zone</a>
           </li> 
         </ul>
       </li>
    </div>

代码:

function getSecureZone() {
    var loggedIn = !!parseInt('{module_isloggedin}');//true or false
    if (!loggedIn)//user is not logged in
        return false;//

    var subscription = "";
    var zonesList = new Array();

    //grab the zones from our hidden div
    var $zones = $('#userSecureZones .zoneName a');

    //add each zone a user is subscribed to the zonesList array
    $zones.each(function () {
        var zoneName = $(this).text().toUpperCase();
        //add each one to the array
        zonesList.push(zoneName);
    });


    //set the subscription variable to the zone the user is subscribed to
    //if a user can only be subscribed to one zone, then this part is simple
    //if a user is subscribed to multiple zones then list the zone
            //you want to take precedence last.
    if (zonesList.indexOf("RETAIL ZONE")!=-1){
        subscription = "RETAIL";
    }
    if (zonesList.indexOf("WHOLESALE ZONE")!=-1){
        subscription = "WHOLESALE";
    }
    return subscription;//return the zone
}

使用中:

$(function(){
    var plan = getSecureZone();

    if(plan=="RETAIL"){
      //your code here
    }
    if(plan=="WHOLESALE"){
     //your code here
    }
});