Display the badge for the items in the Myaccount, cart and checkout when the item added under the sale category
view file
_.extend(TransactionLineViewsCellNavigableView.prototype, {
getContext: _.wrap(TransactionLineViewsCellNavigableView.prototype.getContext, function (fn) {
var profile =ProfileModel. ProfileModel.getInstance();
var isLoggedIn = '';
var profileLoggedIn = '';
if (profile.attributes.isLoggedIn == "T") {
profileLoggedIn = profile.attributes.isLoggedIn;}
else { profileLoggedIn = "F";}
if (profileLoggedIn === 'T') {
isLoggedIn = true;}
var sale = fn.apply(this, _.toArray(arguments).slice(1));
var checkoutbadge = this.model.attributes.item.attributes.custitem59;
sale.checkoutbadge= this.model.attributes.item.attributes.custitem59;
sale.isLoggedIn = isLoggedIn;
return sale;})
})
_.extend(TransactionLineViewsCellActionableView.prototype, {
getContext: _.wrap(TransactionLineViewsCellActionableView.prototype.getContext, function (fn) {
var profile =ProfileModel. ProfileModel.getInstance();
var isLoggedIn = '';
var profileLoggedIn = '';
if (profile.attributes.isLoggedIn == "T") {
profileLoggedIn = profile.attributes.isLoggedIn;
} else {profileLoggedIn = "F";}
if (profileLoggedIn === 'T') {
isLoggedIn = true;}
var badge= Utils.getAbsoluteUrl(getExtensionAssetsPath('img/badge.svg'))
var sale = fn.apply(this, _.toArray(arguments).slice(1));
var accountbadge = this.model.attributes.item.attributes.custitem59;
sale.accountbadge= this.model.attributes.item.attributes.custitem59;
sale.isLoggedIn = isLoggedIn;
return sale;
})
})
_.extend(CartLinesView.prototype, {
getContext: _.wrap(CartLinesView.prototype.getContext, function (fn) {
try {
var profile = ProfileModel.ProfileModel.getInstance();
// console.log('profile', profile)
var isLoggedIn = '';
var profileLoggedIn = '';
if (profile.attributes.isLoggedIn == "T") {
profileLoggedIn = profile.attributes.isLoggedIn;}
else {profileLoggedIn = "F";}
if (profileLoggedIn === 'T') {
isLoggedIn = true;
console.log("isLoggedIn", isLoggedIn);}
var sale = fn.apply(this, _.toArray(arguments).slice(1));
console.log('this22', this)
var cartbadge = this.model.attributes.item.attributes.custitem59;
sale.cartbadge = this.model.attributes.item.attributes.custitem59;
sale.isLoggedIn = isLoggedIn;
console.log('cartbadge22', cartbadge)
console.log('sale22', sale)
return sale;
}catch (e) {console.log(e);}
template
{{#if isLoggedIn}}
{{#if checkoutbadge}}
<div class="checkoutbadge11">
<span class="first-txtmi">sale</span>
<img src="{{getThemeAssetsPathWithDefault logoUrl 'img/badge.svg'}}" id="imageB" alt="">
</div>
{{/if}}
{{/if}}
Sass
.checkoutbadge11{
width: 20px !important;
height:20px;
float: right;
margin-right: 30px;
position: absolute;
z-index: 1;
right: -50px;
margin-top: 0px;
}
#imageB{
width:40px;
height:40px;
}
.first-txtmi {
position: absolute;
color: white;
margin:0;
font-size: 18px;
}