0

I have override widget_recently_viewed.xml in my theme in Magento_Catalog with

<?xml version="1.0" encoding="UTF-8"?>

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="widget_columns">
        <column name="brand" component="MyVendor_MyModule/js/product/brand" sortOrder="2" displayArea="details-area">
            <settings>
                <label translate="true">Brand</label>
                <bodyTmpl>MyVendor_MyModule/product/brand</bodyTmpl>
            </settings>
        </column>
    </columns>
</listing>
proj/app/MyVendor_MyModule/product/brand.html

proj/app/code/MyVendor/Product/view/base/web/js/product/brand.js


<!-- get it from Magento_Catalog/js/product/name -->

define([
    'Magento_Ui/js/grid/columns/column',
    'Magento_Catalog/js/product/list/column-status-validator'
], function (Column, columnStatusValidator) {
    'use strict';

    return Column.extend({
        /**
         * Depends on this option, product name can be shown or hide. Depends on  backend configuration
         *
         * @returns {Boolean}
         */
        isAllowed: function () {
            return columnStatusValidator.isValid(this.source(), 'brand', 'show_attributes');
        }
    });
});

proj/app/code/MyVendor/Product/view/base/web/template/product/brand.html

<strong if="isAllowed()"
        class="product-item-brand">
    <a attr="href: $row().url" html="$col.getLabel($row())"/>
</strong>

and it even renders the HTML but without brand(custom attribute) value

enter image description here

how can I make this thing works? (render the value of the custom attribute, should I dig around data provider?)

Appreciate for any help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.