/** * Creates the configuration fields. * Selects first a row of the s_articles_attributes to get all possible article attributes. */ private function createConfiguration() { $shopFinder = new ShopFinder($this, $this->get("Models")); $subShops = $shopFinder->getSubShops(); $store = array(); foreach ($subShops as $subShop) { $store[] = array($subShop['id'], $subShop['name']); } $form = $this->Form(); $form->setElement('select', 'default', array('label' => 'Fallback-Sprachshop', 'store' => 'base.ShopLanguage', 'scope' => Shopware\Models\Config\Element::SCOPE_SHOP, 'required' => true, 'value' => null, 'description' => 'Auf diesen Shop wird weitergeleitet, wenn kein zu den Browsersprachen passender Shop existiert.')); $form->setElement('select', 'assignedShops', array('label' => 'Zugehörige Shops', 'store' => 'base.ShopLanguage', 'scope' => Shopware\Models\Config\Element::SCOPE_SHOP, 'required' => false, 'value' => null, 'description' => 'Auf diese Shops wird weitergeleitet, wenn die Browsersprache der Shopsprache entspricht.', 'multiSelect' => true)); $form->setElement('text', 'fallbackLanguage', array('label' => 'Fallback-Sprache für Modal', 'value' => 'en_GB', 'required' => true, 'description' => 'Dies ist die locale für die Übersetzung, auf die, wenn keine passende Übersetzung für die vom Benutzer gewählte Sprache existiert, zurückgegriffen wird, um die Infobox im Frontend zu übersetzen.')); $this->translateForm(); }
/** * This action displays the content of the modal box */ public function getModalAction() { $request = $this->Request(); $languages = $this->getBrowserLanguages($request); $subShopId = $this->shopFinder->getSubshopId($languages); $assignedShops = $this->pluginBootstrap->Config()->get("assignedShops"); $shopsToDisplay = $this->shopFinder->getShopsForModal($assignedShops); $snippets = $this->translator->getSnippets($languages); $this->View()->loadTemplate('responsive/frontend/plugins/swag_browser_language/modal.tpl'); $this->View()->assign("snippets", $snippets); $this->View()->assign("shops", $shopsToDisplay); $this->View()->assign("destinationShop", $this->shopFinder->getShopRepository($subShopId)->getName()); $this->View()->assign("destinationId", $subShopId); }