New answers tagged

0 votes
Accepted

How to change the value "is_required" in the table eav_attribute in the entity_type_id "2" and with the attribute_code "lastname" programmatically

Better to use Data Patch for this like: app/code/Acme/StackExchange/Setup/Patch/Data/UpdateCustomerAddressLastname.php <?php declare(strict_types=1); namespace Acme\StackExchange\Setup\Patch\Data; ...
user avatar
0 votes

Better Magento2 data management

You should understand for what reason your are going to use color attributes. If you want to show this attributes on detailed page - better to have different color attributes and it's allows to manage ...
user avatar
0 votes

how to get error message if QTY exceed ask QTY

Update your Attributes.php with <?php namespace extendAttribute\showAttribute\Block\Product\View; use Magento\Catalog\Block\Product\View\Attributes as ExtendAttribute; use Magento\Catalog\Model\...
user avatar
0 votes

how to get error message if QTY exceed ask QTY

Your issue is related to incorrect logic of extend original classes. Your are trying to copy paste target (\Magento\Catalog\Block\Product\View\Attributes) class and extend from the same target class (\...
user avatar
0 votes

how to get attribute value to show on error message

I have try this code to get attribute values but it not working. $product->getResource()->getAttributeRawValue($product->getId(), 'attribute_code', $product->getStoreId());
user avatar
  • 61
0 votes

how to get attribute value to show on error message

As you defined $product = $this->loadMyProduct($sku); in your code then you just need to getData of it with using attribute_code $product = $this->loadMyProduct($sku); // add attribute code ...
user avatar
0 votes

EAV attrubute load value from DB - low level code

You can load product in Magento with 2 ways, load single product and load collection. As I correct understand you are interest how Magento EAV works for single load. In this case: The following ...
user avatar
0 votes

Magneto2 : Add color swatch attribute option with colorcode value programmatically

You can add one color option this way: <?php namespace Vendor\Module\Model; use Magento\Catalog\Api\Data\ProductAttributeInterface; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\...
user avatar

Top 50 recent answers are included