Esempio n. 1
0
 /**
  * Get product modifier types
  *
  * @return array
  */
 protected function getProductModifierTypes()
 {
     $additional = null;
     if (!isset($this->productModifierTypes) && $this->getProduct()->hasVariants()) {
         $additional = \XLite\Core\Database::getRepo('XLite\\Module\\XC\\ProductVariants\\Model\\ProductVariant')->getModifierTypesByProduct($this->getProduct());
     }
     $result = parent::getProductModifierTypes();
     if (isset($additional)) {
         $result += $additional;
         if (!$result['price'] && $additional['price']) {
             $result['price'] = true;
         }
         if (!$result['weight'] && $additional['weight']) {
             $result['weight'] = true;
         }
         $this->productModifierTypes = $result;
     }
     return $result;
 }
 /**
  * Get product modifier types
  *
  * @return array
  */
 protected function getProductModifierTypes()
 {
     $additional = null;
     $additionalVariants = null;
     $wholesale = null;
     if (!isset($this->productModifierTypes)) {
         if (\Includes\Utils\ModulesManager::isActiveModule('XC\\ProductVariants')) {
             // ProductVariants module detected
             $additional = \XLite\Core\Database::getRepo('XLite\\Module\\XC\\ProductVariants\\Model\\ProductVariant')->getModifierTypesByProduct($this->getProduct());
             $additionalVariants = \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\Wholesale\\Model\\ProductVariantWholesalePrice')->getModifierTypesByProduct($this->getProduct());
         }
         if ((!isset($additional) || empty($additional['price'])) && (!isset($additionalVariants) || empty($additionalVariants['price']))) {
             // ProductVariants module is not detected or product has not variants
             $wholesale = \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\Wholesale\\Model\\WholesalePrice')->getModifierTypesByProduct($this->getProduct());
         }
     }
     $result = parent::getProductModifierTypes();
     foreach (array($additional, $additionalVariants, $wholesale) as $modifierTypes) {
         if (isset($modifierTypes)) {
             $result += $modifierTypes;
             if (!$result['price'] && $modifierTypes['price']) {
                 $result['price'] = true;
             }
             $this->productModifierTypes = $result;
         }
     }
     return $result;
 }