I created an default template for items in the minicart. The difference to the default template should be shown only under a specific condition.
<!-- ko if: $parent.myvalueactive(product_sku)==true -->
some stuff
<!-- /ko -->
I added a function in my javascript file, that gets loaded with the minicart:
myvalueactive: function (target) {
console.log(target);
var aktiviert;
$.ajax({
method: "POST",
url: "mymodule/index/active",
data: { q: target},
async: false,
dataType: "json",
success : function(response){
if (response.aktiv=='true') {
aktiviert='true';
};
}
});
if (aktiviert=="true") {
return true;
}
else {
return false;
}
}
This works so far on the product pages and CMS-pages. However, it doesnt work in the checkout process - The content isnt loaded in the minicart on the cart-page nor on the checkout page. Did I mess up ajax or something. Im not even sure, what to search for, for debugging....