System example

sSystem $systemModule = null,
        ?ContextServiceInterface $contextService = null,
        ?AdditionalTextServiceInterface $additionalTextService = null
    ) {
        $this->db = $db ?: Shopware()->Db();
        $this->eventManager = $eventManager ?: Shopware()->Events();
        $this->snippetManager = $snippetManager ?: Shopware()->Snippets();
        $this->config = $config ?: Shopware()->Config();
        $this->session = $session ?: Shopware()->Session();
        $this->front = $front ?: Shopware()->Front();
        $this->moduleManager = $moduleManager ?: Shopware()->Modules();
        $this->sSYSTEM = $systemModule ?: Shopware()->System();

        $this->contextService = $contextService;
        $this->additionalTextService = $additionalTextService;
        $this->connection = Shopware()->Container()->get(Connection::class);

        if ($this->contextService === null) {
            $this->contextService = Shopware()->Container()->get(ContextServiceInterface::class);
        }

        if ($this->additionalTextService === null) {
            $this->additionalTextService = Shopware()->Container()->get(AdditionalTextServiceInterface::class);
        }
$this->export->sInitSmarty();

        // Export the feed         $this->export->executeExport($outputHandle);
    }

    /** * initialize the base class sExport */
    private function prepareExport()
    {
        $this->export->sSYSTEM = Shopware()->System();
        $this->export->sFeedID = (int) $this->Request()->feedID;
        $this->export->sHash = $this->Request()->hash;

        $this->export->sInitSettings();
    }

    /** * set feed specific options to the export and sets * the right header */
    private function sendHeaders()
    {
'sNotify' => '1',
                        'action' => 'notifyConfirm',
                        'number' => $notifyOrderNumber,
                    ]);

                    /** @var Shopware_Components_Modules $modules */
                    $modules = $this->get('modules');

                    $name = $modules->Articles()->sGetArticleNameByOrderNumber($notifyOrderNumber);

                    $basePath = $action->Front()->ensureRouter()->assemble(['sViewport' => 'index']);
                    $modules->System()->_POST['sLanguage'] = Shopware()->Shop()->getId();
                    $modules->System()->_POST['sShopPath'] = $basePath . Shopware()->Config()->get('sBASEFILE');

                    $sql = ' INSERT INTO s_core_optin (datum, hash, data, type) VALUES (NOW(), ?, ?, "swNotification") ';
                    $connection->executeQuery($sql[$hashserialize(Shopware()->System()->_POST->toArray())]);

                    $context = [
                        'sConfirmLink' => $link,
                        'sArticleName' => $name,
                    ];

    public function __construct()
    {
        $config = Shopware()->Container()->get(Shopware_Components_Config::class);

        $this->db = Shopware()->Container()->get('db');
        $this->manager = Shopware()->Container()->get(ModelManager::class);
        $this->repository = $this->manager->getRepository(CategoryModel::class);
        $this->baseUrl = $config->get('baseFile') . '?sViewport=cat&sCategory=';
        $this->blogBaseUrl = $config->get('baseFile') . '?sViewport=blog&sCategory=';
        $this->baseId = (int) Shopware()->Shop()->get('parentID');
        $this->customerGroupId = (int) (Shopware()->Modules()->System()->sUSERGROUPDATA['id'] ?? 0);
        $this->connection = Shopware()->Container()->get(Connection::class);
        $this->categoryService = Shopware()->Container()->get(CategoryServiceInterface::class);
        $this->contextService = Shopware()->Container()->get(ContextServiceInterface::class);
    }

    /** * Returns the category tree from the root until the category * with the provided id. Also loads siblings for elements in the * category path. * * @param int $id Id of the category to load * * @return array Tree of categories */
if (@mkdir($this->cacheDir, 0777, true) === false) {
                throw new RuntimeException(sprintf("Unable to create directory '%s'\n", $this->cacheDir));
            }
        } elseif (!is_writable($this->cacheDir)) {
            throw new RuntimeException(sprintf("Unable to write in directory '%s'\n", $this->cacheDir));
        }

        $feedId = (int) $input->getOption('feed-id');

        $export = $this->container->get('modules')->Export();

        $export->sSYSTEM = $this->container->get('modules')->System();

        $this->sSmarty = $this->container->get(Enlight_Template_Manager::class);

        // Prevent notices to clutter generated files         $this->registerErrorHandler($output);

        $productFeedRepository = $this->container->get(ModelManager::class)->getRepository(ProductFeed::class);
        if (empty($feedId)) {
            $activeFeeds = $productFeedRepository->getActiveListQuery()->getResult();

            /** @var ProductFeed $feedModel */
            
$this->get(ShopRegistrationServiceInterface::class)->registerShop($shop);

        $session = $this->get('session');
        $session->clear();
        $session->migrate(true);

        Shopware()->Session()->offsetSet('sessionId', $session->getId());
        Shopware()->Container()->set('sessionid', $session->getId());

        Shopware()->Session()->set('Admin', true);
        Shopware()->System()->_POST = [
            'email' => $user['email'],
            'passwordMD5' => $user['password'],
        ];
        Shopware()->Modules()->Admin()->sLogin(true);

        $hash = $this->container->get(OptinServiceInterface::class)->add(OptinServiceInterface::TYPE_CUSTOMER_LOGIN_FROM_BACKEND, 300, [
            'sessionId' => Shopware()->Session()->get('sessionId'),
            'shopId' => $shop->getId(),
        ]);

        $url = $this->Front()->ensureRouter()->assemble([
            


    /** * Event listener method * * @return \Shopware_Components_Modules */
    public static function onInitResourceModules(Enlight_Event_EventArgs $args)
    {
        $modules = new Shopware_Components_Modules();
        Shopware()->Container()->set('modules', $modules);
        $modules->setSystem(Shopware()->System());

        return $modules;
    }

    /** * Returns capabilities */
    public function getCapabilities()
    {
        return [
            'install' => false,
            
sSystem $systemModule = null,
        ?Enlight_Template_Manager $template = null,
        ?Shopware_Components_Modules $moduleManager = null,
        ?SlugInterface $slug = null,
        ?ContextServiceInterface $contextService = null,
        ?ShopPageServiceInterface $shopPageService = null,
        ?Shopware_Components_Translation $translationComponent = null
    ) {
        $this->db = $db ?: Shopware()->Db();
        $this->config = $config ?: Shopware()->Config();
        $this->modelManager = $modelManager ?: Shopware()->Models();
        $this->sSYSTEM = $systemModule ?: Shopware()->System();
        $this->template = $template ?: Shopware()->Template();
        $this->moduleManager = $moduleManager ?: Shopware()->Modules();
        $this->slug = $slug ?: Shopware()->Container()->get('shopware.slug');
        $this->contextService = $contextService ?: Shopware()->Container()->get(ContextServiceInterface::class);
        $this->shopPageService = $shopPageService ?: Shopware()->Container()
            ->get('shopware_storefront.shop_page_service');
        $this->translationComponent = $translationComponent ?: Shopware()->Container()->get(Shopware_Components_Translation::class);
    }

    /** * Getter function for retrieving last ID from sCreateRewriteTableArticles() * * @return string|null */
throw new RuntimeException(sprintf("Shop '%s (id: %s)' has no document template.", $shop->getName()$shop->getId()));
        }
    }

    private function refreshCart(Shop $shop): void
    {
        $this->get(ShopRegistrationServiceInterface::class)->registerShop($shop);

        $modules = $this->get('modules');

        if (empty($this->get('session')->get('sUserId'))) {
            $modules->System()->sUSERGROUP = $shop->getCustomerGroup()->getKey();
            $modules->System()->sUSERGROUPDATA = $shop->getCustomerGroup()->toArray();
            $modules->System()->sCurrency = $shop->getCurrency()->toArray();
        }

        $this->get(ContextServiceInterface::class)->initializeContext();

        $shopContext = $this->get(ContextServiceInterface::class)->getShopContext();

        $modules->Basket()->sRefreshBasket();
        $modules->Admin()->sGetPremiumShippingcosts($shopContext->getCountry() ? $shopContext->getCountry()->jsonSerialize() : null);

        
CSRFTokenValidator $csrfTokenValidator = null,
        ?ShippingCostServiceInterface $shippingCostService = null
    ) {
        $this->db = $db ?: Shopware()->Db();
        $this->eventManager = $eventManager ?: Shopware()->Events();
        $this->config = $config ?: Shopware()->Config();
        $this->session = $session ?: Shopware()->Session();
        $this->front = $front ?: Shopware()->Front();
        $this->passwordEncoder = $passwordEncoder ?: Shopware()->PasswordEncoder();
        $this->snippetManager = $snippetManager ?: Shopware()->Snippets();
        $this->moduleManager = $moduleManager ?: Shopware()->Modules();
        $this->sSYSTEM = $systemModule ?: Shopware()->System();

        $mainShop = Shopware()->Shop()->getMain() !== null ? Shopware()->Shop()->getMain() : Shopware()->Shop();
        $this->scopedRegistration = $mainShop->getCustomerScope();

        $this->contextService = $contextService ?: Shopware()->Container()->get(ContextServiceInterface::class);
        $this->emailValidator = $emailValidator ?: Shopware()->Container()->get(EmailValidator::class);
        $this->subshopId = $this->contextService->getShopContext()->getShop()->getParentId();
        $this->attributeLoader = Shopware()->Container()->get(DataLoader::class);
        $this->translationComponent = $translationComponent ?: Shopware()->Container()->get(\Shopware_Components_Translation::class);
        $this->connection = $connection ?: Shopware()->Container()->get(Connection::class);
        $this->optInLoginService = $optInLoginService ?: Shopware()->Container()->get(OptInLoginService::class);
        
$template->assign('theme', $config);

        $templatePath = 'newsletter/index/' . $mailing['template'];

        if (!empty($mailing['plaintext'])) {
            $templatePath = 'newsletter/alt/' . $mailing['template'];
        }

        if (!$template->isCached($templatePath)) {
            $template->assign('sMailing', $mailing);
            $template->assign('sStart', ($shop->getSecure() ? 'https://' : 'http://') . $shop->getHost() . $shop->getBaseUrl());
            $template->assign('sUserGroup', Shopware()->System()->sUSERGROUP);
            $template->assign('sUserGroupData', Shopware()->System()->sUSERGROUPDATA);
            $template->assign('sMainCategories', Shopware()->Modules()->Categories()->sGetMainCategories());
        }

        return $template;
    }

    /** * @deprecated in 5.6, will be private in 5.8 * * Returns mailing data using the mailing id. * * @param int $id * * @return array */
$context = ['sConfirmLink' => $link, 'sArticle' => ['title' => $blogArticleData['title']]];
                    $mail = Shopware()->TemplateMail()->createMail('sOPTINBLOGCOMMENT', $context);
                    $mail->addTo($this->Request()->getParam('eMail'));
                    $mail->send();
                } else {
                    // Save comment                     $commentData = $this->Request()->getPost();
                    $this->sSaveComment($commentData$blogArticleId);
                }
            } else {
                $this->View()->assign('sFormData', Shopware()->System()->_POST->toArray());
                $this->View()->assign('sErrorFlag', $sErrorFlag);
            }
        }
        $this->forward('detail');
    }

    /** * @deprecated in 5.6, will be private in 5.8 * * Returns all data needed to display the date filter * * @param int[] $blogCategoryIds * @param array $selectedFilters * @param int|null $shopId * * @return array */


    /** * Returns current category id * * @param int $default * * @return int */
    public function getCategoryCurrent($default)
    {
        if (!empty(Shopware()->System()->_GET['sCategory'])) {
            return (int) Shopware()->System()->_GET['sCategory'];
        }

        if (Shopware()->Front()->Request()->get('sCategory')) {
            return (int) Shopware()->Front()->Request()->get('sCategory');
        }

        return (int) $default;
    }

    /** * Return current categories * * @param int $parentId * * @return array */


use Shopware\Components\Random;
use Shopware\Components\Validator\EmailValidator;

class Shopware_Controllers_Frontend_Tellafriend extends Enlight_Controller_Action
{
    public $sSYSTEM;

    public function init()
    {
        $this->sSYSTEM = Shopware()->System();
    }

    public function preDispatch()
    {
        $config = $this->container->get(\Shopware_Components_Config::class);

        if (!$config->get('showTellAFriend')) {
            throw new Enlight_Controller_Exception('Tell a friend is not activated for the current shop', 404);
        }
    }

    
public function __construct(
        ?Category $category = null,
        $translationId = null,
        $customerGroupId = null
    ) {
        $container = Shopware()->Container();

        $this->category = $category ?: Shopware()->Shop()->getCategory();
        $this->categoryId = $this->category->getId();
        $this->translationId = $translationId ?: (!Shopware()->Shop()->getDefault() ? Shopware()->Shop()->getId() : null);
        $this->customerGroupId = $customerGroupId ?: ((int) Shopware()->Modules()->System()->sUSERGROUPDATA['id']);

        $this->config = $container->get(Shopware_Components_Config::class);
        $this->db = $container->get('db');
        $this->connection = $container->get(Connection::class);
        $this->eventManager = $container->get('events');
        $this->contextService = $container->get(ContextServiceInterface::class);
        $this->listProductService = $container->get(ListProductServiceInterface::class);
        $this->productService = $container->get(ProductServiceInterface::class);
        $this->productNumberSearch = $container->get(ProductNumberSearchInterface::class);
        $this->configuratorService = $container->get(ConfiguratorServiceInterface::class);
        $this->propertyService = $container->get(PropertyServiceInterface::class);
        
Home | Imprint | This part of the site doesn't use cookies.