Remove the item from the wishlist if it is already present,The change in the count should also reflect in the UI,For example if the item is available only in AU, NZ and USA, then it should be visible only for those domains. Remove from the other domains.
//Remove item from wishlist
_.extend(ProductListDisplayFullView.prototype, {
getContext: _.wrap(ProductListDisplayFullView.prototype.getContext, function (fn) {
var originalRet = fn.apply(this, _.toArray(arguments).slice(1));
var profile = ProfileModel.getInstance();
var subsidiary = profile.get('subsidiary');
var item = this.model.attributes.item.attributes
itemavailable;
if (!item[allowedSubsidiaries[subsidiary]]) {
var itemavailable = true;
}
originalRet.itemavailable = itemavailable;
return originalRet
})
});
_.extend(ListHeaderView.prototype, {
//This function is used to disable the addto cart button if the item is not checked in the subsidery
getContext: _.wrap(ListHeaderView.prototype.getContext, function (fn) {
let originalRet = fn.apply(this, _.toArray(arguments).slice(1));
let itemCollection = this.collection.models;
_.each(itemCollection, (item) => {
if (!item.get('item').get([allowedSubsidiaries[subsidiary]])) {
originalRet.disableSelectAll = true;
}
})
return originalRet;
})
});
_.extend(ProductListBulkActionsView.prototype, {
getContext: _.wrap(ProductListBulkActionsView.prototype.getContext, function (fn) {
var originalRet = fn.apply(this, _.toArray(arguments).slice(1));
var profile = ProfileModel.getInstance();
var subsidiary = profile.get('subsidiary');
var item = this.model.attributes.items.models
itemnotavailable;
if (!item[allowedSubsidiaries[subsidiary]]) {
var itemnotavailable = true;
}
originalRet.itemnotavailable = itemnotavailable;
return originalRet
})
});
{{# if itemnotavailable}}
<span class="someitems">some of the items in the list is not available in the current subsidiary.</span>
<div class="product-list-bulk-actions-button-group">
<button class="product-list-bulk-actions-button-addtocart" data-action="add-items-to-cart" {{#unless
isAddToCartEnabled}}disabled{{/unless}}>{{translate 'Add Items to Cart'}} </button>
<button class="product-list-bulk-actions-button-expander" data-toggle="dropdown" aria-expanded="false" {{#unless
isAtLeastOneItemChecked}}disabled{{/unless}}>
<i></i>
</button>
<ul class="product-list-bulk-actions-dropdown" role="menu">
<li>
<a href="#" data-action="delete-items">{{translate 'Remove Items'}}</a>
</li>
</ul>
</div>
{{else}}
<div class="product-list-bulk-actions-button-group">
<button class="product-list-bulk-actions-button-addtocart" data-action="add-items-to-cart" {{#unless
isAddToCartEnabled}}disabled{{/unless}}>{{translate 'Add Items to Cart'}}</button>
<button class="product-list-bulk-actions-button-expander" data-toggle="dropdown" aria-expanded="false" {{#unless isAtLeastOneItemChecked}}disabled{{/unless}}><i></i>
</button>
<ul class="product-list-bulk-actions-dropdown" role="menu">
<li>
<a href="#" data-action="delete-items">{{translate 'Remove Items'}}</a>
</li>
</ul>
</div>
