javascriptc#nopcommerce

acces current SKU value productAttributeCombiantion nopcommerce


iam trying to acces SKU of current selected combination of attributes,

I found methods that are used to update,show SKU but those are inside JS script, which I cannot acces the data from outside the script,

https://github.com/nopSolutions/nopCommerce/blob/master/src/Presentation/Nop.Web/Views/Product/_ProductAttributes.cshtml#L447

Do you have any idea, how could I get value(number) of current selected product's attributes SKU ?


Solution

  • There is a custom trigger ($(document).trigger({ type: "product_attributes_changed", changedData: data });) in that js function. You can define your own function like this.

    $(document).on("product_attributes_changed", function (data) {
        //do something with 'data'
    });