setParam example

use Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface;
use Shopware\Components\Random;

class Shopware_Controllers_Frontend_Newsletter extends Enlight_Controller_Action
{
    /** * Index action method */
    public function indexAction()
    {
        $this->View()->assign('voteConfirmed', $this->isConfirmed());
        $this->Request()->setParam('voteConfirmed', $this->View()->voteConfirmed);
        $this->View()->assign('sUserLoggedIn', Shopware()->Modules()->Admin()->sCheckUser());

        $this->front->setParam('voteConfirmed', $this->View()->voteConfirmed);
        $this->front->setParam('optinNow', (new DateTime())->format('Y-m-d H:i:s'));

        if ($this->Request()->get('sUnsubscribe') !== null) {
            $this->View()->assign('sUnsubscribe', true);
        } else {
            $this->View()->assign('sUnsubscribe', false);
        }

        
private string $connectionName,
        string $sql,
        private ?Stopwatch $stopwatch = null,
    ) {
        parent::__construct($statement);

        $this->query = new Query($sql);
    }

    public function bindParam($param, &$variable$type = ParameterType::STRING, $length = null): bool
    {
        $this->query->setParam($param$variable$type);

        return parent::bindParam($param$variable$type, ...\array_slice(\func_get_args(), 3));
    }

    public function bindValue($param$value$type = ParameterType::STRING): bool
    {
        $this->query->setValue($param$value$type);

        return parent::bindValue($param$value$type);
    }

    
$type = array_shift($path);
        } else {
            $version = 1;
            $type = $tmp;
        }

        $id = !empty($path[0]) ? $path[0] : false;
        $subType = !empty($path[1]) ? $path[1] : false;
        $subId = !empty($path[2]) ? $path[2] : false;

        $request->setControllerName($type);
        $request->setParam('id', $id);
        $request->setParam('subId', $subId);
        $request->setParam('version', $version);

        $method = strtoupper($request->getParam('_method', $request->getMethod()));
        $action = 'invalid';

        if ($method === 'GET' && $id === false) {
            $action = 'index';
            $response->setStatusCode(SymfonyResponse::HTTP_OK);
        } elseif ($method === 'GET') {
            $action = 'get';
            
return $this->get(SearchTermPreProcessorInterface::class)->process($term);
    }

    private function setDefaultSorting()
    {
        if ($this->Request()->has('sSort')) {
            return;
        }

        $sortings = $this->container->get(Shopware_Components_Config::class)->get('searchSortings');
        $sortings = array_filter(explode('|', $sortings));
        $this->Request()->setParam('sSort', array_shift($sortings));
    }
}
protected $format = '';

    /** * @return void */
    public function preDispatch()
    {
        if ($this->Request()->has('format')) {
            $this->format = (string) $this->Request()->getParam('format');

            // Remove limit parameter to export all data.             $this->Request()->setParam('limit', null);
        }
        parent::preDispatch();
    }

    /** * @return void */
    public function init()
    {
        parent::init();
        $currency = Shopware()->Db()->fetchRow(
            
$exceptions = $response->getException();
        $exception = $exceptions[0];
        $error->offsetSet('exception', $exception);

        // Keep a copy of the original request         $error->offsetSet('request', clone $request);

        // Get a count of the number of exceptions encountered         $this->exceptionCountAtFirstEncounter = \count($exceptions);

        // Forward to the error handler         $request->setParam('error_handler', $error)
            ->setControllerName('error')
            ->setActionName('error')
            ->setDispatched(false);
    }

    private function isBotSession(ShopwareRequest $request): bool
    {
        if (!$request instanceof SymfonyRequest) {
            return false;
        }

        
'value' => $value,
                        'shopId' => $defaultShop->getId(),
                    ],
                ],
                'type' => 'number',
            ],
        ];

        $storeClient = $this->container->get(StoreClient::class);
        $storeClient->doTrackEvent('First Run Wizard completed');

        $this->Request()->setParam('elements', $requestElements);

        $this->forward('saveForm', 'Config');
    }

    /** * Saves the current wizard step to the database * * @return void */
    public function saveConfigurationAction()
    {
        
if (!$orderNumber) {
                throw new InvalidArgumentException('Argument ordernumber missing');
            }

            $categoryId = (int) $this->Request()->get('categoryId');
            if (!$categoryId) {
                throw new InvalidArgumentException('Argument categoryId missing');
            }

            if (!$this->Request()->has('sSort')) {
                $default = $this->container->get(Shopware_Components_Config::class)->get('defaultListingSorting');
                $this->Request()->setParam('sSort', $default);
            }

            $navigation = $this->container->get('modules')->Articles()->getProductNavigation($orderNumber$categoryId$this->Request());

            $linkRewriter = function D$link) {
                return $this->container->get('modules')->Core()->sRewriteLink($link);
            };

            if (isset($navigation['previousProduct'])) {
                $navigation['previousProduct']['href'] = $linkRewriter($navigation['previousProduct']['link']);
            }

            
$this->View()->assign('sCrossSimilarShown', $this->getSimilarShown($productId));
            }

            if (Shopware()->Config()->get('alsoBoughtShow', true)) {
                $this->View()->assign('sCrossBoughtToo', $this->getBoughtToo($productId));
            }
        } else {
            $this->session->offsetSet('sErrorMessages', $this->container->get('snippets')->getNamespace('frontend/basket/internalMessages')->get('WrongArticleNumberMessage', 'Please enter a valid article number'));
        }

        if ($this->Request()->getParam('isXHR') || !empty($this->Request()->callback)) {
            $this->Request()->setParam('sTargetAction', 'ajax_add_article');
        }

        if ($this->Request()->getParam('sAddAccessories')) {
            $this->forward('addAccessories');
        } else {
            if ($this->Request()->isXmlHttpRequest()) {
                $this->forward($this->Request()->getParam('sTargetAction', 'cart'));
            } else {
                $this->redirect(['action' => $this->Request()->getParam('sTargetAction', 'cart')]);
            }
        }
    }
return $products;
    }

    private function setDefaultSorting()
    {
        if ($this->Request()->has('sSort')) {
            return;
        }

        $sortings = $this->container->get(\Shopware_Components_Config::class)->get('searchSortings');
        $sortings = array_filter(explode('|', $sortings));
        $this->Request()->setParam('sSort', array_shift($sortings));
    }

    /** * @param string $term * * @return ProductSearchResult */
    private function search($term, Criteria $criteria, ShopContextInterface $context)
    {
        $result = null;

        

                }
            }
        }

        // Parse the json Params         if (\count($this->parseParams)) {
            foreach ($this->parseParams as $Param) {
                $value = $request->getParam($Param);
                if ($value !== null) {
                    $value = Zend_Json::decode($value);
                    $request->setParam($Param$value);
                }
            }
        }

        // Rests the configuration for the next dispatch         $this->parseInput = false;
        $this->parseParams = [];
        $this->padding = null;
    }

    /** * Enables parsing the json input in pre-dispatch. * Reads the data from PHP-stream "php://input". * * @param bool $parseInput * * @return $this */

        $condition = new CustomerGroupCondition(
            [$context->getCurrentCustomerGroup()->getId()]
        );
        $criteria->addBaseCondition($condition);
    }

    private function addOffset(Request $request, Criteria $criteria): void
    {
        $page = (int) $request->getParam('sPage', 1);
        $page = ($page > 0) ? $page : 1;
        $request->setParam('sPage', $page);

        $criteria->offset(
            ($page - 1) * $criteria->getLimit()
        );
    }

    private function addLimit(Request $request, Criteria $criteria): void
    {
        $limit = (int) $request->getParam('sPerPage', $this->config->get('articlesPerPage'));
        $max = $this->config->get('maxStoreFrontLimit');
        if ($max) {
            
private $export;

    /** * Init controller method * * Disables the authorization-checking and template renderer. */
    public function init()
    {
        Shopware()->Plugins()->Backend()->Auth()->setNoAuth();
        Shopware()->Front()->Plugins()->ViewRenderer()->setNoRender();
        $this->Front()->setParam('disableOutputBuffering', true);
        $this->export = Shopware()->Modules()->Export();
    }

    /** * Index action method * * Creates the export product. */
    public function indexAction()
    {
        $this->prepareExport();
        

    public function manufacturerAction(ShopContextInterface $context)
    {
        $manufacturerId = $this->Request()->getParam('sSupplier');

        if (!$this->Request()->getParam('sCategory')) {
            $categoryId = $context->getShop()->getCategory()->getId();

            $this->Request()->setParam('sCategory', $categoryId);

            $sortings = $this->customSortingService->getSortingsOfCategories([$categoryId]$context);

            $sortings = array_shift($sortings);

            $this->setDefaultSorting($sortings);

            $this->view->assign('sortings', $sortings);
        }

        $criteria = $this->storeFrontCriteriaFactory
            
return;
        }

        switch ($request->getControllerName()) {
            case 'sViewport,sale':
                $url = $args->getRequest()->getPathInfo();
                $url = trim($url, '/');

                foreach (explode('/', $url) as $part) {
                    $part = explode(',', $part);
                    if (!empty($part[0]) && !empty($part[1])) {
                        $request->setParam($part[0]$part[1]);
                    }
                }

                if ($request->getParam('sAction') && $request->getParam('sAction') === 'doSale') {
                    $request->setControllerName('checkout')->setActionName('finish')->setDispatched(false);
                } else {
                    $request->setControllerName('checkout')->setActionName('confirm')->setDispatched(false);
                }
                break;
            case 'cat':
                $request->setControllerName('listing')->setDispatched(false);
                
Home | Imprint | This part of the site doesn't use cookies.