Exemplo n.º 1
0
 public function initializeWizard($strName, $strLanguage)
 {
     if ($strName == 'explain') {
         $objTypes = ProductType::findAll();
         if (null !== $objTypes) {
             foreach ($objTypes as $objType) {
                 $GLOBALS['TL_LANG']['XPL']['tl_iso_product.type'][$objType->id] = array($objType->name, $objType->description);
             }
         }
     }
 }
 /**
  * Get product type IDs with given attribute enabled
  *
  * @param string $attributeName
  * @param bool   $forVariants
  *
  * @return array
  */
 private function getProductTypeIdsByAttribute($attributeName, $forVariants = false)
 {
     static $cache;
     if (null === $cache) {
         /** @type ProductType[] $productTypes */
         $productTypes = ProductType::findAll();
         $cache = array();
         if (null !== $productTypes) {
             foreach ($productTypes as $type) {
                 foreach ($type->attributes as $attribute => $config) {
                     if ($config['enabled']) {
                         $cache['attributes'][$attribute][] = $type->id;
                     }
                 }
                 if ($type->variants) {
                     foreach ($type->variant_attributes as $attribute => $config) {
                         if ($config['enabled']) {
                             $cache['variant_attributes'][$attribute][] = $type->id;
                         }
                     }
                 }
             }
         }
         foreach ($cache as $property => $attributes) {
             foreach ($attributes as $attribute => $values) {
                 $cache[$property][$attribute] = array_unique($values);
             }
         }
     }
     if ($forVariants) {
         return (array) $cache['variant_attributes'][$attributeName];
     } else {
         return (array) $cache['attributes'][$attributeName];
     }
 }