0

I've created custom entity (EAV). I could see all fields on edit page. app/code/Klever/ProductPricing/Controller/Adminhtml/WallMaterial/Edit.php

public function execute()
{
    // 1. Get ID and create model
    $id = $this->getRequest()->getParam('entity_id');
    $model = $this->_objectManager->create(\Klever\ProductPricing\Model\WallMaterial::class);
    
    // 2. Initial checking
    if ($id) {
        $model->load($id);
        if (!$model->getId()) {
            $this->messageManager->addErrorMessage(__('This Wallmaterial no longer exists.'));
            /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
            $resultRedirect = $this->resultRedirectFactory->create();
            return $resultRedirect->setPath('*/*/');
        }
    }
    $this->_coreRegistry->register('klever_productpricing_wallmaterial', $model);
    
    // 3. Build edit form
    /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
    $resultPage = $this->resultPageFactory->create();
    $this->initPage($resultPage)->addBreadcrumb(
        $id ? __('Edit Wallmaterial') : __('New Wallmaterial'),
        $id ? __('Edit Wallmaterial') : __('New Wallmaterial')
    );
    $resultPage->getConfig()->getTitle()->prepend(__('Wallmaterials'));
    $resultPage->getConfig()->getTitle()->prepend($model->getId() ? __('Edit Wallmaterial %1', $model->getId()) : __('New Wallmaterial'));
    return $resultPage;
}

enter image description here

app/code/Klever/ProductPricing/Ui/Component/Listing/Column/Thumbnail.php

public function prepareDataSource(array $dataSource)
{
    if(isset($dataSource['data']['items'])) {
        $fieldName = $this->getData('name');
        foreach($dataSource['data']['items'] as & $item) {
            // TODO GET EAV ATTRIBUTE VALUE
            $attribute = $this->eavConfig->getAttribute(\Klever\ProductPricing\Model\WallMaterial::ENTITY, 'image');

But when I am on listing page I have an access just to main(?) attributes only:

enter image description here

How could I display all EAV fields on listing page?

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.