Algolia_Algoliasearch_Helper_Config::getSortingIndices PHP Метод

getSortingIndices() публичный Метод

public getSortingIndices ( $storeId = null )
    public function getSortingIndices($storeId = null)
    {
        /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper $product_helper */
        $product_helper = Mage::helper('algoliasearch/entity_producthelper');
        $attrs = unserialize(Mage::getStoreConfig(self::SORTING_INDICES, $storeId));
        /** @var Mage_Customer_Model_Session $customerSession */
        $customerSession = Mage::getSingleton('customer/session');
        $group_id = $customerSession->getCustomerGroupId();
        foreach ($attrs as &$attr) {
            if ($this->isCustomerGroupsEnabled($storeId)) {
                if (strpos($attr['attribute'], 'price') !== false) {
                    $suffix_index_name = 'group_' . $group_id;
                    $attr['name'] = $product_helper->getIndexName($storeId) . '_' . $attr['attribute'] . '_' . $suffix_index_name . '_' . $attr['sort'];
                } else {
                    $attr['name'] = $product_helper->getIndexName($storeId) . '_' . $attr['attribute'] . '_' . $attr['sort'];
                }
            } else {
                if (strpos($attr['attribute'], 'price') !== false) {
                    $attr['name'] = $product_helper->getIndexName($storeId) . '_' . $attr['attribute'] . '_' . 'default' . '_' . $attr['sort'];
                } else {
                    $attr['name'] = $product_helper->getIndexName($storeId) . '_' . $attr['attribute'] . '_' . $attr['sort'];
                }
            }
        }
        if (is_array($attrs)) {
            return $attrs;
        }
        return array();
    }