Guest User

Untitled

a guest
Dec 15th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. {{block class="MagentoFrameworkViewElementTemplate" template="mytemplate.phtml"}}
  2.  
  3. require_once($_SERVER['DOCUMENT_ROOT'].'/app/bootstrap.php');
  4. $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
  5. $obj = $bootstrap->getObjectManager();
  6.  
  7. $state = $obj->get('MagentoFrameworkAppState');
  8. $state->setAreaCode('frontend');
  9.  
  10. function getExistingOptions( $object_Manager,$option) {
  11.  
  12. $eavConfig = $object_Manager->get('MagentoEavModelConfig');
  13. $attribute = $eavConfig->getAttribute('catalog_product', $option);
  14. $options = $attribute->getSource()->getAllOptions();
  15.  
  16. $optionsExists = array();
  17.  
  18. foreach($options as $option) {
  19. $optionsExists[] = ["value"=>$option['value'],"label"=>$option['label']];
  20. }
  21. return $optionsExists;
  22. }
  23.  
  24. $options=array();
  25. $options['custom_option1']=getExistingOptions($obj,"custom_option1");
Add Comment
Please, Sign In to add comment