Exemplo n.º 1
0
 /**
  * Return translated category name
  *
  * :KLUDGE: it's the hack to prevent execution of superflous queries
  *
  * @param array $category Category data
  *
  * @return string
  */
 protected function getCategoryName(array $category)
 {
     $name = null;
     $query = \XLite\Core\Translation::getLanguageQuery(\XLite\Core\Session::getInstance()->getLanguage()->getCode());
     foreach ($query as $code) {
         $data = \Includes\Utils\ArrayManager::searchInArraysArray($category['translations'], 'code', $code);
         if (!empty($data)) {
             $name = $data['name'];
             break;
         }
     }
     return $name;
 }
Exemplo n.º 2
0
 /**
  * Get attribute column data
  *
  * @param \XLite\Model\Product   $product   Product object
  * @param \XLite\Model\Attribute $attribute Attribute object
  *
  * @return array
  */
 protected function getAttributeValue($product, $attributeName)
 {
     $value = null;
     $attr = \Includes\Utils\ArrayManager::searchInArraysArray($this->getAttributesColumns(), 'attributeName', $attributeName);
     if ($attr) {
         $entity = \XLite\Core\Database::getRepo('XLite\\Model\\Attribute')->find($attr['attributeId']);
         if ($entity) {
             $value = $entity->getAttributeValue($product, true);
         }
         if ($value && is_array($value)) {
             $value = array_shift($value);
         }
     }
     return $value ?: '';
 }
Exemplo n.º 3
0
 /**
  * Return translated category name
  *
  * :KLUDGE: it's the hack to prevent execution of superflous queries
  *
  * @param array $category Category data
  *
  * @return string
  */
 protected function getCategoryName(array $category)
 {
     $data = \Includes\Utils\ArrayManager::searchInArraysArray($category['translations'], 'code', \XLite\Core\Session::getInstance()->getLanguage()->getCode());
     return empty($data) ? null : $data['name'];
 }