How to get Magento 2 attribute value in cart?

I cannot get attribute value in checkout/cart in Magento 2.

I use the following code in customer orders page and I get the value but not in checkout/cart page.

This line return null : var_dump($ attribute->getFrontend()->getValue($ product));

$  _item = $  block->getItem(); $  product = $  _item->getProduct(); $  productAttributes = $  product->getAttributes(); $  attributeSetId = intval($  product->getAttributeSetId()); $  obj = \Magento\Framework\App\ObjectManager::getInstance(); /** @var \Magento\Catalog\Model\Config $  config */ $  config= $  obj->get('Magento\Catalog\Model\Config'); $  group_id = $  config->getAttributeGroupId($  attributeSetId, 'Display Attributes');  foreach ($  productAttributes as $  attribute) :     if ($  attribute->isInGroup($  attributeSetId, $  group_id)) :         var_dump($  attribute->getFrontendLabel());         var_dump($  attribute->getFrontend()->getValue($  product));     endif; endforeach; 

The attribute is visible for products lists and catalog.

Do you know why I can’t get the value in this page ?

Why doesn’t `btrfs send | btrfs receive` preserve the “no dump” file attribute?

Btrfs supports the “no dump” file attribute and it is preserved when taking snapshots. But after sending such a snapshot to another Btrfs using btrfs send and btrfs receive,` the values of the “no dump” attribute are lost. By contrast the “compress data” attribute values are preserved through that procedure. Why?

Add class to {{ link }} twig attribute

I’m trying to apply a button class to the {{ link }} attribute in code below.

<span{{attributes}}><a class="usa-button"{{ link }}</span> 

It displays correctly however the markup is not correct. I see an extra <a="" tag.

<a class="usa-button" <a="" href="http://sites.localhost/sites/default/files/Image%20styles%20for%20grid%20view_3.docx" type="application/vnd.openxmlformats-officedocument.wordprocessingml.document; length=14535">Image styles for grid view_3.docx</a> 

Any ideas on how to apply class cleanly?

Magento 2 import bulk products with custom attribute

i create 1 custom attribute (current_user_id) and save value when product is save. I have usecatalog_product_save_before event that save value for my custom attribute(current_user_id). code is

public function execute(\Magento\Framework\Event\Observer $  observer)     {         $  _product = $  observer->getProduct();  // you will get product object         $  current_users=$  this->authSession->getUser();         $  current_admin_id=$  current_users->getData('user_id');         $  _product->setCurrentUserId($  current_admin_id) ;     } 

it work perfect for add single product.

But now i want to add bulk products How this possible for import bulk product ?

I think we make custom attribute column in csv file and use which event that fire when import after check data. and foreach for setting value in custom attribute ? Please Guide me i want to save custom attribute value in bulk products Thanks

Getting Custom Image Attribute in Frontend

I’ve followed a tutorial found here:

With a slight modification which can be found in the InstallData, where I specified ‘visible_on_front’ :

<?php namespace Vendor\Module\Setup;  use \Magento\Framework\Setup\ModuleContextInterface; use \Magento\Framework\Setup\ModuleDataSetupInterface; use \Magento\Framework\Setup\InstallDataInterface; use \Magento\Eav\Setup\EavSetup; use \Magento\Eav\Setup\EavSetupFactory; use \Magento\Catalog\Setup\CategorySetupFactory;  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(             \Magento\Catalog\Model\Category::ENTITY, 'grid_image', [                 'type' => 'varchar',                 'label' => 'Grid Image',                 'input' => 'image',                 'visible_on_front' => true,                 'backend' => 'Magento\Catalog\Model\Category\Attribute\Backend\Image',                 'required' => false,                 'sort_order' => 9,                 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::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?

Super Attribute Position on Product Page Magento 1

Hello Good Day to All

I have Attribute “Malakas”,”Mahina”,”Payat”

On a Product Page it will Show

Malakas --Choose an Option-- Mahina --Choose an Option-- Payat --Choose an Option-- 

Is this a way to change the Postiton of Super Attribute so the Attribute “Payat” will be first ??

Payat --Choose an Option-- Malakas --Choose an Option-- Mahina --Choose an Option-- 

I already try the Position and still not working on product view Page only the Left side bar is working for Postion

the Option Drag and Drop while Create product can be use but is there a way to make it default attribute

or is there a ways to change the code on the configurable Product Option so to use Attribute Position ?


configurable product: display custom attribute value when all options are selected

in configurable products I need to display the value of a custom attribute when all select fields are filled.

It seems that only images and price are updated (js). In my case I need to display qtaxconf custom attribute. This attribute has values only in few simple products of configurable ones.

My code in Magento_ConfigurableProduct/templates/product/price/final_price.phtml

$  objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $  product = $  objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product echo $  product->getCustomAttribute('qtaxconf') 

Thank you.

why does anonymous user could access userPassword attribute of OpenLDAP?

Here is my ACL, openldap is v2.4.4.


dn: olcDatabase={0}config,cn=config changetype: modify add: olcAccess olcAccess: to attrs=userPassword by dn="cn=Manager,dc=ad,dc=pthl,dc=hk" write by anonymous auth by self write by * none olcAccess: to dn.base="" by * read olcAccess: to * by dn="cn=Manager,dc=ad,dc=pthl,dc=hk" write by * read  

and then I run

 ldapmodify -Y EXTERNAL -H ldapi:/// -f acl.ldif 

and I run

 ldapsearch -x -b ou=people,dc=ad,dc=pthl,dc=hk "(&(objectClass=posixAccount)(uid=someone))" -h 

which returns

# remove some lines # .....  userPassword:: e1NTSEE1MTJ9MUpGdjcyd0w4aWJZRHd2eHpacVYyb1c4Q1p0Z0JrdDNpdWJDcU9  pVjhmNVQ2QkgzWVNLQnVmNU03bnVwNFB2Q2NiaHR3UGcxOW51VitLMitaUk9WY2JLT0NOMDROWGlG