2013-10-22 38 views
1

我有一个客户想要为不同的客户收取不同的价格。有些产品折扣43%,其他产品折扣率为47%,促销代码仅适用于美元折扣或折扣。这是否有可能让客户根据他们的登录情况登录查看特殊价格?业务催化剂创建多个价格

回答

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 
    } 
});