Getting Custom Image Attribute in Frontend Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Magento2: How to add pre defined data (installData.php) for Custom ModuleHow to get the value of an EAV attribute from a model class in Magento2main.CRITICAL: Plugin class doesn't existinstallation stopping at 51%Magento 2 add custom product attribute validation from install scriptMagento 2.1.5 How to create Module which can use Eav functionalities (addAttribute in my case)I have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridHaving trouble exporting products from Magento 2.x. Fatal error: Uncaught Error: Call to a member function getName()Magento offline custom Payment method with drop down listMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?
How do I stop a creek from eroding my steep embankment?
Book where humans were engineered with genes from animal species to survive hostile planets
Identifying polygons that intersect with another layer using QGIS?
Why is "Consequences inflicted." not a sentence?
How to call a function with default parameter through a pointer to function that is the return of another function?
List of Python versions
Do I really need recursive chmod to restrict access to a folder?
Extract all GPU name, model and GPU ram
Why did the Falcon Heavy center core fall off the ASDS OCISLY barge?
In predicate logic, does existential quantification (∃) include universal quantification (∀), i.e. can 'some' imply 'all'?
Should I discuss the type of campaign with my players?
Why are there no cargo aircraft with "flying wing" design?
Check which numbers satisfy the condition [A*B*C = A! + B! + C!]
Align equal signs while including text over equalities
Is there a (better) way to access $wpdb results?
What LEGO pieces have "real-world" functionality?
Why is my conclusion inconsistent with the van't Hoff equation?
What does this icon in iOS Stardew Valley mean?
How can I make names more distinctive without making them longer?
English words in a non-english sci-fi novel
How can I (re)show post-installation notes?
Why do people hide their license plates in the EU?
How would the world control an invulnerable immortal mass murderer?
Why aren't air breathing engines used as small first stages
Getting Custom Image Attribute in Frontend
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Magento2: How to add pre defined data (installData.php) for Custom ModuleHow to get the value of an EAV attribute from a model class in Magento2main.CRITICAL: Plugin class doesn't existinstallation stopping at 51%Magento 2 add custom product attribute validation from install scriptMagento 2.1.5 How to create Module which can use Eav functionalities (addAttribute in my case)I have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridHaving trouble exporting products from Magento 2.x. Fatal error: Uncaught Error: Call to a member function getName()Magento offline custom Payment method with drop down listMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've followed a tutorial found here: https://webkul.com/blog/add-custom-image-attribute-category-magento-2/
With a slight modification which can be found in the InstallData, where I specified 'visible_on_front' :
<?php
namespace VendorModuleSetup;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoCatalogSetupCategorySetupFactory;
class InstallData implements InstallDataInterface
protected $_eavSetupFactory;
protected $_categorySetupFactory;
public function __construct(
EavSetupFactory $eavSetupFactory,
CategorySetupFactory $categorySetupFactory
)
$this->_eavSetupFactory = $eavSetupFactory;
$this->_categorySetupFactory = $categorySetupFactory;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);
$setup = $this->_categorySetupFactory->create(['setup' => $setup]);
$setup->addAttribute(
MagentoCatalogModelCategory::ENTITY, 'grid_image', [
'type' => 'varchar',
'label' => 'Grid Image',
'input' => 'image',
'visible_on_front' => true,
'backend' => 'MagentoCatalogModelCategoryAttributeBackendImage',
'required' => false,
'sort_order' => 9,
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'group' => 'Content',
]
);
However, I am unable to access the actual attribute in the frontend. I'm grabbing the current category via the Registry, and find that the attribute simply isn't attached (tried checking using $category->debug()). Any ideas for how I can get access to it on the frontend?
magento2 category category-attribute
New contributor
Darius Treator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I've followed a tutorial found here: https://webkul.com/blog/add-custom-image-attribute-category-magento-2/
With a slight modification which can be found in the InstallData, where I specified 'visible_on_front' :
<?php
namespace VendorModuleSetup;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoCatalogSetupCategorySetupFactory;
class InstallData implements InstallDataInterface
protected $_eavSetupFactory;
protected $_categorySetupFactory;
public function __construct(
EavSetupFactory $eavSetupFactory,
CategorySetupFactory $categorySetupFactory
)
$this->_eavSetupFactory = $eavSetupFactory;
$this->_categorySetupFactory = $categorySetupFactory;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);
$setup = $this->_categorySetupFactory->create(['setup' => $setup]);
$setup->addAttribute(
MagentoCatalogModelCategory::ENTITY, 'grid_image', [
'type' => 'varchar',
'label' => 'Grid Image',
'input' => 'image',
'visible_on_front' => true,
'backend' => 'MagentoCatalogModelCategoryAttributeBackendImage',
'required' => false,
'sort_order' => 9,
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'group' => 'Content',
]
);
However, I am unable to access the actual attribute in the frontend. I'm grabbing the current category via the Registry, and find that the attribute simply isn't attached (tried checking using $category->debug()). Any ideas for how I can get access to it on the frontend?
magento2 category category-attribute
New contributor
Darius Treator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I've followed a tutorial found here: https://webkul.com/blog/add-custom-image-attribute-category-magento-2/
With a slight modification which can be found in the InstallData, where I specified 'visible_on_front' :
<?php
namespace VendorModuleSetup;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoCatalogSetupCategorySetupFactory;
class InstallData implements InstallDataInterface
protected $_eavSetupFactory;
protected $_categorySetupFactory;
public function __construct(
EavSetupFactory $eavSetupFactory,
CategorySetupFactory $categorySetupFactory
)
$this->_eavSetupFactory = $eavSetupFactory;
$this->_categorySetupFactory = $categorySetupFactory;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);
$setup = $this->_categorySetupFactory->create(['setup' => $setup]);
$setup->addAttribute(
MagentoCatalogModelCategory::ENTITY, 'grid_image', [
'type' => 'varchar',
'label' => 'Grid Image',
'input' => 'image',
'visible_on_front' => true,
'backend' => 'MagentoCatalogModelCategoryAttributeBackendImage',
'required' => false,
'sort_order' => 9,
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'group' => 'Content',
]
);
However, I am unable to access the actual attribute in the frontend. I'm grabbing the current category via the Registry, and find that the attribute simply isn't attached (tried checking using $category->debug()). Any ideas for how I can get access to it on the frontend?
magento2 category category-attribute
New contributor
Darius Treator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I've followed a tutorial found here: https://webkul.com/blog/add-custom-image-attribute-category-magento-2/
With a slight modification which can be found in the InstallData, where I specified 'visible_on_front' :
<?php
namespace VendorModuleSetup;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoCatalogSetupCategorySetupFactory;
class InstallData implements InstallDataInterface
protected $_eavSetupFactory;
protected $_categorySetupFactory;
public function __construct(
EavSetupFactory $eavSetupFactory,
CategorySetupFactory $categorySetupFactory
)
$this->_eavSetupFactory = $eavSetupFactory;
$this->_categorySetupFactory = $categorySetupFactory;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);
$setup = $this->_categorySetupFactory->create(['setup' => $setup]);
$setup->addAttribute(
MagentoCatalogModelCategory::ENTITY, 'grid_image', [
'type' => 'varchar',
'label' => 'Grid Image',
'input' => 'image',
'visible_on_front' => true,
'backend' => 'MagentoCatalogModelCategoryAttributeBackendImage',
'required' => false,
'sort_order' => 9,
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'group' => 'Content',
]
);
However, I am unable to access the actual attribute in the frontend. I'm grabbing the current category via the Registry, and find that the attribute simply isn't attached (tried checking using $category->debug()). Any ideas for how I can get access to it on the frontend?
magento2 category category-attribute
magento2 category category-attribute
New contributor
Darius Treator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Darius Treator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Darius Treator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 18 mins ago
Darius TreatorDarius Treator
112
112
New contributor
Darius Treator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Darius Treator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Darius Treator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Darius Treator is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270374%2fgetting-custom-image-attribute-in-frontend%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Darius Treator is a new contributor. Be nice, and check out our Code of Conduct.
Darius Treator is a new contributor. Be nice, and check out our Code of Conduct.
Darius Treator is a new contributor. Be nice, and check out our Code of Conduct.
Darius Treator is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270374%2fgetting-custom-image-attribute-in-frontend%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown