1
我有一個客戶想要爲不同的客戶收取不同的價格。有些產品折扣43%,其他產品折扣率爲47%,促銷代碼僅適用於美元折扣或折扣。這是否有可能讓客戶根據他們的登錄情況登錄查看特殊價格?業務催化劑創建多個價格
我有一個客戶想要爲不同的客戶收取不同的價格。有些產品折扣43%,其他產品折扣率爲47%,促銷代碼僅適用於美元折扣或折扣。這是否有可能讓客戶根據他們的登錄情況登錄查看特殊價格?業務催化劑創建多個價格
是的,你可以做到這一點。您需要爲每個帳戶類型設置不同的安全區域訂閱。涉及到一些編碼。
例如,您可以設置'零售'和'批發'安全區域。然後,通過一些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
}
});