importFacetTranslations example

/** * {@inheritdoc} */
    public function up($modus)
    {
        $this->addModule();

        $this->addCategoryConfig();

        $this->importDefaultFacets();

        $this->importFacetTranslations();

        $this->createSearchFacets();

        $this->addNewCategoryFilterParam();
    }

    private function addModule()
    {
        $sql = <<<SQL CREATE TABLE IF NOT EXISTS `s_search_custom_facet` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `active` int(1) unsigned NOT NULL, `unique_key` varchar(100) NULL DEFAULT NULL, `display_in_categories` int(1) unsigned NOT NULL, `deletable` int(1) unsigned NOT NULL, `position` int(11) NOT NULL, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `facet` LONGTEXT NOT NULL, PRIMARY KEY (`id`), UNIQUE `unique_identifier` (`unique_key`), KEY `sorting` (`display_in_categories`,`position`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
public function up($modus)
    {
        $sql = <<<SQL INSERT IGNORE INTO `s_search_custom_facet` (`id`, `unique_key`, `active`, `display_in_categories`, `position`, `name`, `facet`, `deletable`) VALUES (NULL, 'VariantFacet', 0, 1, 11, 'Varianten', '{"Shopware\\\\\\\Bundle\\\\\\\SearchBundle\\\\\\\Facet\\\\\\\VariantFacet":{"groupIds":"", "expandGroupIds":""}}', 0) ; SQL;
        $this->addSql($sql);

        $id = (int) $this->connection->query('SELECT id FROM `s_search_custom_facet` WHERE `unique_key` = "VariantFacet"')->fetchColumn(0);

        $this->importFacetTranslations($id);
    }

    /** * @param int $facetId */
    private function importFacetTranslations($facetId)
    {
        $shops = $this->connection->query('SELECT shops.id, shops.main_id, shops.locale_id, locales.locale FROM s_core_shops shops INNER JOIN s_core_locales locales ON locales.id=shops.locale_id')
            ->fetchAll(PDO::FETCH_ASSOC);

        foreach ($shops as $shop) {
            
Home | Imprint | This part of the site doesn't use cookies.