Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {{block class="MagentoFrameworkViewElementTemplate" template="mytemplate.phtml"}}
- require_once($_SERVER['DOCUMENT_ROOT'].'/app/bootstrap.php');
- $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
- $obj = $bootstrap->getObjectManager();
- $state = $obj->get('MagentoFrameworkAppState');
- $state->setAreaCode('frontend');
- function getExistingOptions( $object_Manager,$option) {
- $eavConfig = $object_Manager->get('MagentoEavModelConfig');
- $attribute = $eavConfig->getAttribute('catalog_product', $option);
- $options = $attribute->getSource()->getAllOptions();
- $optionsExists = array();
- foreach($options as $option) {
- $optionsExists[] = ["value"=>$option['value'],"label"=>$option['label']];
- }
- return $optionsExists;
- }
- $options=array();
- $options['custom_option1']=getExistingOptions($obj,"custom_option1");
Add Comment
Please, Sign In to add comment