Skip to content

Instantly share code, notes, and snippets.

@anton-huz
Created July 10, 2018 16:59
Show Gist options
  • Select an option

  • Save anton-huz/25b7df2f845f0247fac639388d73c8e1 to your computer and use it in GitHub Desktop.

Select an option

Save anton-huz/25b7df2f845f0247fac639388d73c8e1 to your computer and use it in GitHub Desktop.
Magento's Product custom attribute
<?php
echo $this->helper('Magento\Catalog\Helper\Output')->productAttribute($product, $product->getConfigGroupCpLabel(), 'config_group_cp_label');
echo $product->getData(ProductAttributesInterface::CONFIG_GROUP_CP_LABEL);
echo '<br>z: ';
echo $this->helper('Magento\Catalog\Helper\Output')->productAttribute($product, $product->getConfigGroupCpOrder(), 'config_group_cp_order');
echo $product->getData(ProductAttributesInterface::CONFIG_GROUP_CP_ORDER);
echo '<br>y: ';
echo $this->getProduct()->getAttributeText('config_group_cp_order');
echo $product->getAttributeText('config_group_cp_order');
echo '<br>x: ';
echo $this->getProduct()
->getResource()
->getAttributeRawValue(
$product->getId(),
'config_group_cp_order',
$block->getStoreId()
);
echo $product
->getResource()
->getAttributeRawValue(
$product->getId(),
'config_group_cp_order',
$block->getStoreId()
);
echo '<br>w: ';
echo $this->getProduct()
->getResource()
->getAttribute('config_group_cp_order')
->getSource()
->getOptionText(
$product->getData('config_group_cp_order')
);
echo $product
->getResource()
->getAttribute('config_group_cp_order')
->getSource()
->getOptionText(
$product->getData('config_group_cp_order')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment