コード例 #1
3
 public function preUpdate(PreUpdateEventArgs $eventArgs)
 {
     $order = $eventArgs->getEntity();
     if (!$order instanceof \Shopware\Models\Order\Order) {
         return;
     }
     //order or payment status changed?
     if ($eventArgs->hasChangedField('paymentStatus') || $eventArgs->hasChangedField('orderStatus')) {
         $historyData = array('userID' => null, 'change_date' => date('Y-m-d H:i:s'), 'orderID' => $order->getId());
         if (Shopware()->Auth()->getIdentity() && Shopware()->Auth()->getIdentity()->id) {
             $user = $eventArgs->getEntityManager()->find('Shopware\\Models\\User\\User', Shopware()->Auth()->getIdentity()->id);
             $historyData['userID'] = $user->getId();
         }
         //order status changed?
         if ($eventArgs->hasChangedField('orderStatus')) {
             $historyData['previous_order_status_id'] = $eventArgs->getOldValue('orderStatus')->getId();
             $historyData['order_status_id'] = $eventArgs->getNewValue('orderStatus')->getId();
         } else {
             $historyData['previous_order_status_id'] = $order->getOrderStatus()->getId();
             $historyData['order_status_id'] = $order->getOrderStatus()->getId();
         }
         //payment status changed?
         if ($eventArgs->hasChangedField('paymentStatus')) {
             $historyData['previous_payment_status_id'] = $eventArgs->getOldValue('paymentStatus')->getId();
             $historyData['payment_status_id'] = $eventArgs->getNewValue('paymentStatus')->getId();
         } else {
             $historyData['previous_payment_status_id'] = $order->getPaymentStatus()->getId();
             $historyData['payment_status_id'] = $order->getPaymentStatus()->getId();
         }
         $eventArgs->getEntityManager()->getConnection()->insert('s_order_history', $historyData);
     }
 }
コード例 #2
0
 /**
  * This controller action is used to build the search index.
  */
 public function buildAction()
 {
     @set_time_limit(1200);
     $adapter = new Shopware_Components_Search_Adapter_Default(Shopware()->Db(), Shopware()->Cache(), new Shopware_Components_Search_Result_Default(), Shopware()->Config());
     $adapter->buildSearchIndex();
     $this->View()->assign(array('success' => true));
 }
    /**
     * Does the actual import
     */
    public function import()
    {
        $row = Shopware()->Db()->fetchAll('
			SELECT *
				FROM plenty_mapping_category
				WHERE plentyID LIKE "' . $this->Category->CategoryID . ';%"
				LIMIT 1
		');
        if (!$row) {
            // PyLog()->message('Sync:Item:Category', 'Skipping the category »' . $this->Category->Name . '« (not found)');
            return;
        }
        $index = explode(PlentymarketsMappingEntityCategory::DELIMITER, $row[0]['shopwareID']);
        $categoryId = $index[0];
        /** @var Shopware\Models\Category\Category $Category */
        $Category = Shopware()->Models()->find('Shopware\\Models\\Category\\Category', $categoryId);
        // If the shopware category wasn't found, something is terribly wrong
        if (!$Category) {
            PyLog()->message('Sync:Item:Category', 'Skipping the category »' . $this->Category->Name . '« (not found)');
            return;
        }
        // Update the category only if the name's changed
        if ($Category->getName() != $this->Category->Name || $Category->getPosition() != $this->Category->Position) {
            PyLog()->message('Sync:Item:Category', 'Updating the category »' . $this->Category->Name . '«');
            $Category->setName($this->Category->Name);
            $Category->setPosition($this->Category->Position);
            Shopware()->Models()->persist($Category);
            Shopware()->Models()->flush();
        }
    }
コード例 #4
0
ファイル: Form.php プロジェクト: GerDner/luck-docker
 /**
  * Internal helper function to get access to the form repository.
  *
  * @return Shopware\Models\Form\Repository
  */
 private function getRepository()
 {
     if ($this->repository === null) {
         $this->repository = Shopware()->Models()->getRepository('Shopware\\Models\\Form\\Form');
     }
     return $this->repository;
 }
コード例 #5
0
ファイル: CaptureAndRefund.php プロジェクト: nhp/shopware-4
	/**
	 *
	 * @param string $txid
	 * @return int
	 */
	public function nextSequenceNumber($txid) {
		$sql = 'select max(sequencenumber) from ' . self::TABLE_NAME .
						' where transaction_no="' . $txid . '"';
		$res = Shopware()->Db()->fetchOne($sql);

		return (int) ($res ? $res + 1 : 1);
	}
コード例 #6
0
/**
 * @param $params
 * @param $template
 * @return void
 * @throws Exception
 */
function smarty_function_compileLess($params, $template)
{
    $time = $params['timestamp'];
    $output = $params['output'];
    /**@var $pathResolver \Shopware\Components\Theme\PathResolver*/
    $pathResolver = Shopware()->Container()->get('theme_path_resolver');
    /**@var $shop \Shopware\Models\Shop\Shop*/
    $shop = Shopware()->Container()->get('shop');
    /**@var $settings \Shopware\Models\Theme\Settings*/
    $settings = Shopware()->Container()->get('theme_service')->getSystemConfiguration(\Doctrine\ORM\AbstractQuery::HYDRATE_OBJECT);
    /** @var $front Enlight_Controller_Front */
    $front = Enlight_Application::Instance()->Front();
    $secure = $front->Request()->isSecure();
    $file = $pathResolver->getCssFilePath($shop, $time);
    $url = $pathResolver->formatPathToUrl($file, $shop, $secure);
    if (!$settings->getForceCompile() && file_exists($file)) {
        // see: http://stackoverflow.com/a/9473886
        $template->assign($output, [$url]);
        return;
    }
    /**@var $compiler \Shopware\Components\Theme\Compiler*/
    $compiler = Shopware()->Container()->get('theme_compiler');
    $compiler->compileLess($time, $shop->getTemplate(), $shop);
    $template->assign($output, [$url]);
}
コード例 #7
0
ファイル: Bootstrap.php プロジェクト: GerDner/luck-docker
 /**
  * starts all product export for all active product feeds
  *
  * @throws RuntimeException
  * @return string
  */
 public function exportProductFiles()
 {
     $productFeedRepository = Shopware()->Models()->getRepository('Shopware\\Models\\ProductFeed\\ProductFeed');
     $activeFeeds = $productFeedRepository->getActiveListQuery()->getResult();
     $export = Shopware()->Modules()->Export();
     $export->sSYSTEM = Shopware()->System();
     $sSmarty = Shopware()->Template();
     $cacheDir = Shopware()->Container()->getParameter('kernel.cache_dir');
     $cacheDir .= '/productexport/';
     if (!is_dir($cacheDir)) {
         if (false === @mkdir($cacheDir, 0777, true)) {
             throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", "Productexport", $cacheDir));
         }
     } elseif (!is_writable($cacheDir)) {
         throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", "Productexport", $cacheDir));
     }
     foreach ($activeFeeds as $feedModel) {
         /** @var $feedModel Shopware\Models\ProductFeed\ProductFeed */
         if ($feedModel->getInterval() == 0) {
             continue;
         }
         $export->sFeedID = $feedModel->getId();
         $export->sHash = $feedModel->getHash();
         $export->sInitSettings();
         $export->sSmarty = clone $sSmarty;
         $export->sInitSmarty();
         $fileName = $feedModel->getHash() . '_' . $feedModel->getFileName();
         $handleResource = fopen($cacheDir . $fileName, 'w');
         $export->executeExport($handleResource);
     }
     return true;
 }
コード例 #8
0
 /**
  * Standard set up for every test - just disable auth
  */
 public function setUp()
 {
     parent::setUp();
     // disable auth and acl
     Shopware()->Plugins()->Backend()->Auth()->setNoAuth();
     Shopware()->Plugins()->Backend()->Auth()->setNoAcl();
 }
コード例 #9
0
 /**
  * Load action for the script renderer.
  */
 public function includeAction()
 {
     $oldPath = Shopware()->OldPath('engine');
     $module = basename($this->Request()->getParam('includeDir'));
     $module = preg_replace('/[^a-z0-9_.:-]/i', '', $module);
     if ($module !== '') {
         $module .= '/';
     }
     $include = (string) $this->Request()->getParam('include', 'skeleton.php');
     $query = parse_url($include, PHP_URL_QUERY);
     $include = parse_url($include, PHP_URL_PATH);
     $include = preg_replace('/[^a-z0-9\\/\\\\_.:-]/i', '', $include);
     if (file_exists($oldPath . 'local_old/modules/' . $module . $include)) {
         $location = 'engine/local_old/modules/' . $module . $include;
     } elseif (file_exists($oldPath . 'backend/modules/' . $module . $include)) {
         $location = 'engine/backend/modules/' . $module . $include;
     }
     if (!empty($location)) {
         if (!empty($query)) {
             $location .= '?' . $query;
         } elseif ($this->Request()->isPost()) {
             $location .= '?' . http_build_query($this->Request()->getPost(), '', '&');
         }
         $this->redirect($location);
     } else {
         $this->Response()->setHttpResponseCode(404);
     }
 }
コード例 #10
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $front = $this->container->get('front');
     if (!$front->Router()) {
         $front->setRouter('Enlight_Controller_Router_Default');
     }
     if (!$front->Request()) {
         $request = new \Enlight_Controller_Request_RequestHttp();
         $front->setRequest($request);
     }
     $productFeedRepository = $this->container->get('models')->getRepository('Shopware\\Models\\ProductFeed\\ProductFeed');
     $activeFeeds = $productFeedRepository->getActiveListQuery()->getResult();
     /** @var $export \sExport */
     $export = $this->container->get('modules')->Export();
     $export->sSYSTEM = $this->container->get('system');
     $export->sDB = Shopware()->AdoDb();
     $sSmarty = $this->container->get('template');
     foreach ($activeFeeds as $feedModel) {
         /** @var $feedModel ProductFeed */
         if ($feedModel->getInterval() == 0) {
             continue;
         }
         $output->writeln(sprintf('Refreshing cache for ' . $feedModel->getName()));
         $export->sFeedID = $feedModel->getId();
         $export->sHash = $feedModel->getHash();
         $export->sInitSettings();
         $export->sSmarty = clone $sSmarty;
         $export->sInitSmarty();
         $fileName = $feedModel->getHash() . '_' . $feedModel->getFileName();
         $handleResource = fopen(Shopware()->DocPath() . 'cache/productexport/' . $fileName, 'w');
         $export->executeExport($handleResource);
     }
     $output->writeln(sprintf('Product feed cache successfully refreshed'));
 }
コード例 #11
0
ファイル: Event.php プロジェクト: boxalino/plugin-shopware
 public function __construct($event, $params)
 {
     if (empty($event)) {
         Shopware()->PluginLogger()->debug("event must be set, received: '{$event}', event could not be tracked");
         return;
     }
     if (!array_key_exists('_a', $params)) {
         $params['_a'] = Shopware_Plugins_Frontend_Boxalino_P13NHelper::getAccount();
     }
     if (!array_key_exists('_ev', $params)) {
         $params['_ev'] = $event;
     }
     if (!array_key_exists('_t', $params)) {
         $params['_t'] = round(microtime(true) * 1000);
     }
     $cems = Shopware()->Front()->Request()->getCookie('cems');
     $cemv = Shopware()->Front()->Request()->getCookie('cemv');
     if (!array_key_exists('_bxs', $params)) {
         $params['_bxs'] = empty($cems) ? self::getSessionId() : $cems;
     }
     if (!array_key_exists('_bxv', $params)) {
         $params['_bxv'] = empty($cemv) ? self::getSessionId() : $cemv;
     }
     if (array_key_exists('referer', $params)) {
         $this->referer = $params['referer'];
         unset($params['referer']);
     } else {
         $this->referer = array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : '';
     }
     $this->params = $params;
 }
コード例 #12
0
ファイル: debit.php プロジェクト: nhp/shopware-4
 /**
  * DEPRECATED
  * @return array|bool
  */
 function sInit()
 {
     if (!$this->sSYSTEM->_POST["sDebitAccount"]) {
         $sErrorFlag["sDebitAccount"] = true;
     }
     if (!$this->sSYSTEM->_POST["sDebitBankcode"]) {
         $sErrorFlag["sDebitBankcode"] = true;
     }
     if (!$this->sSYSTEM->_POST["sDebitBankName"]) {
         $sErrorFlag["sDebitBankName"] = true;
     }
     if (empty($this->sSYSTEM->_POST["sDebitBankHolder"]) && isset($this->sSYSTEM->_POST["sDebitBankHolder"])) {
         $sErrorFlag["sDebitBankHolder"] = true;
     }
     $checkColumns = $this->sSYSTEM->sDB_CONNECTION->GetAll("SHOW COLUMNS FROM s_user_debit");
     $foundColumn = false;
     foreach ($checkColumns as $column) {
         if ($column["Field"] == "bankholder") {
             $foundColumn = true;
         }
     }
     if (empty($foundColumn)) {
         $this->sSYSTEM->sDB_CONNECTION->Execute("ALTER TABLE `s_user_debit` ADD `bankholder` VARCHAR( 255 ) NOT NULL ;");
     }
     if (count($sErrorFlag)) {
         $error = true;
     }
     if ($error) {
         $sErrorMessages[] = Shopware()->Snippets()->getNamespace('frontend/account/internalMessages')->get('ErrorFillIn', 'Please fill in all red fields');
         return array("sErrorFlag" => $sErrorFlag, "sErrorMessages" => $sErrorMessages);
     } else {
         return true;
     }
     return array();
 }
コード例 #13
0
 public function save($request, $response)
 {
     $transactionLog = new \Shopware\CustomModels\MoptPayoneTransactionLog\MoptPayoneTransactionLog();
     $transactionLog->setStatus($request->getTxaction());
     if ($request->getMode() == 'live') {
         $transactionLog->setLiveMode(true);
     } else {
         $transactionLog->setLiveMode(false);
     }
     $transactionLog->setPortalId($request->getPortalid());
     $transactionLog->setCreationDate(date('Y-m-d\\TH:i:sP'));
     $transactionLog->setUpdateDate(date('Y-m-d\\TH:i:sP'));
     $transactionLog->setTransactionDate(date('Y-m-d\\TH:i:sP', $request->getTxtime()));
     $transactionLog->setTransactionId($request->getTxid());
     $transactionLog->setOrderNr($request->getReference());
     $transactionLog->setSequenceNr($request->getSequencenumber());
     $transactionLog->setPaymentId(Shopware()->Config()->mopt_payone__paymentId);
     if (is_null($request->getReceivable())) {
         $transactionLog->setClaim(0);
     } else {
         $transactionLog->setClaim($request->getReceivable());
     }
     if (is_null($request->getBalance())) {
         $transactionLog->setBalance(0);
     } else {
         $transactionLog->setBalance($request->getBalance());
     }
     $transactionLog->setDetails($this->buildParamDetails($request, $response));
     Shopware()->Models()->persist($transactionLog);
     Shopware()->Models()->flush();
 }
コード例 #14
0
 /**
  * @return Shopware\Models\Category\Repository
  */
 protected function getRepo()
 {
     if ($this->repo === null) {
         $this->repo = Shopware()->Models()->Category();
     }
     return $this->repo;
 }
コード例 #15
0
ファイル: Bootstrap.php プロジェクト: dnhsoft/swApacheGeoIP
 public function onPostDispatchIndexController(Enlight_Event_EventArgs $arguments)
 {
     $controller = $arguments->getSubject();
     $view = $controller->View();
     $view->addTemplateDir($this->Path() . 'Views/');
     $shopLang = Shopware()->Front()->Request()->getCookie('shopLang');
     //        $ip = $_SERVER['REMOTE_ADDR'];
     $ip = '195.149.248.130';
     //BG
     //        $ip = '194.50.69.124'; //DE
     //        $ip = '211.156.198.82'; //CN
     $gi = geoip_open(__DIR__ . '/GeoIp/db/GeoIP.dat', GEOIP_STANDARD);
     $countryCode = geoip_country_code_by_addr($gi, $ip);
     geoip_close($gi);
     if ($shopLang != strtolower($countryCode)) {
         $shopLang = strtolower($countryCode);
         Shopware()->Front()->Response()->setCookie('shopLang', $shopLang, 0);
         $builder = Shopware()->Container()->get('dbal_connection')->createQueryBuilder();
         $shopId = $builder->select('scs.id')->from('s_core_locales', 'scl')->innerJoin('scl', 's_core_shops', 'scs', 'scl.id = scs.locale_id')->where('scl.locale LIKE ?')->setParameter(0, $shopLang . '%')->execute()->fetch();
         if ($shopId) {
             $view->extendsTemplate('frontend/index/change_shop.tpl');
             $view->assign(array('shopId' => $shopId['id']));
         }
     }
 }
コード例 #16
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var Manager $pluginManager */
     $pluginManager = $this->container->get('shopware.plugin_manager');
     $pluginName = $input->getArgument('plugin');
     try {
         $plugin = $pluginManager->getPluginByName($pluginName);
     } catch (\Exception $e) {
         $output->writeln(sprintf('Plugin by name "%s" was not found.', $pluginName));
         return 1;
     }
     if ($plugin->getInstalled()) {
         $output->writeln("The Plugin has to be uninstalled first.");
         return 1;
     }
     $pluginPath = Shopware()->AppPath(implode('_', array('Plugins', $plugin->getSource(), $plugin->getNamespace(), $plugin->getName())));
     if ($plugin->getSource() === "Default") {
         $message = "'Default' Plugins may not be deleted.";
     } elseif ($plugin->getInstalled() !== null) {
         $message = 'Please uninstall the plugin first.';
     } elseif (!$this->deletePath($pluginPath)) {
         $message = 'Plugin path "' . $pluginPath . '" could not be deleted.';
     } else {
         Shopware()->Models()->remove($plugin);
         Shopware()->Models()->flush();
     }
     if (isset($message)) {
         $output->writeln($message);
         return 1;
     } else {
         $output->writeln(sprintf('Plugin %s has been deleted successfully.', $pluginName));
     }
 }
コード例 #17
0
 /**
  * Cleaning up testData
  */
 protected function tearDown()
 {
     parent::tearDown();
     $sql = "UPDATE `s_articles` SET `laststock` = '0' WHERE `id` =?";
     Shopware()->Db()->query($sql, array(self::ARTICLE_ID));
     Shopware()->Api()->Import()->sDeleteArticle(array("ordernumber" => self::ORDER_NUMBER));
 }
コード例 #18
0
ファイル: VoteTest.php プロジェクト: GerDner/luck-docker
 public function testVoteAverage()
 {
     $number = 'testVoteAverage';
     $context = $this->getContext();
     $data = $this->getProduct($number, $context);
     $product = $this->helper->createArticle($data);
     $points = array(1, 2, 2, 3, 3, 3, 3, 3);
     $this->helper->createVotes($product->getId(), $points);
     $listProduct = Shopware()->Container()->get('shopware_storefront.list_product_service')->get($number, $context);
     $voteAverage = Shopware()->Container()->get('shopware_storefront.vote_service')->getAverage($listProduct, $context);
     $this->assertEquals(5, $voteAverage->getAverage());
     foreach ($voteAverage->getPointCount() as $pointCount) {
         switch ($pointCount['points']) {
             case 1:
                 $this->assertEquals(1, $pointCount['total']);
                 break;
             case 2:
                 $this->assertEquals(2, $pointCount['total']);
                 break;
             case 3:
                 $this->assertEquals(5, $pointCount['total']);
                 break;
         }
     }
 }
コード例 #19
0
ファイル: PayOne.php プロジェクト: nhp/shopware-4
    /**
     * Event listener method which fires when the order store is loaded. Returns an array of order data
     * which displayed in an Ext.grid.Panel. The order data contains all associations of an order (positions, shop, customer, ...).
     * The limit, filter and order parameter are used in the id query. The result of the id query are used
     * to filter the detailed query which created over the getListQuery function.
     */
    public function getListAction()
    {
        //read store parameter to filter and paginate the data.
        $limit = $this->Request()->getParam('limit', 20);
        $offset = $this->Request()->getParam('start', 0);
        $sort = $this->Request()->getParam('sort', null);
        $filter = $this->Request()->getParam('filter', array());
        $orderId = $this->Request()->getParam('orderID');
        
        if(!is_null($orderId)) {
            $orderIdFilter = array('property' => 'orders.id', 'value' => $orderId);
            $filter[] = $orderIdFilter;
        }
        
        $builder = Shopware()->Models()->createQueryBuilder();
        $builder->select(array('payment.id'))
                ->from('Shopware\Models\Payment\Payment', 'payment')
                ->where('payment.name = :name')
                ->setParameter('name', 'BuiswPaymentPayone')
                ->setFirstResult(0)
                ->setMaxResults(1);

        $payOneId = $builder->getQuery()->getOneOrNullResult(\Doctrine\ORM\AbstractQuery::HYDRATE_ARRAY);
        if (!empty($payOneId)) {
            $filter[] = array('property' => 'payment.id', 'value' => $payOneId['id']);
        }
        $list = $this->getList($filter, $sort, $offset, $limit);
        $this->View()->assign($list);
    }
コード例 #20
0
ファイル: Campaign.php プロジェクト: nhp/shopware-4
    public function indexAction()
    {
        if (Shopware()->Shop()->get('esi')) {
            $getMetaFields = Shopware()->Db()->fetchRow('
                SELECT seo_keywords, seo_description, name FROM s_emotion WHERE id = ?
            ', array($this->Request()->getParam('emotionId')));

            //$this->View()->extendsBlock('frontend_index_header_title', $getMetaFields['name'], null);
            $this->View()->assign('sBreadcrumb', array(0 => array('name' => $getMetaFields['name'])));
            $this->View()->assign('seo_keywords', $getMetaFields['seo_keywords']);
            $this->View()->assign('seo_description', $getMetaFields['seo_description']);

            $this->View()->assign('emotionId', intval($this->Request()->getParam('emotionId')));
        } else {
            // @deprecated - support for shopware 3.x campaigns
            $campaignId = (int)$this->Request()->sCampaign;
            if (empty($$campaignId)) {
                return $this->forward('index', 'index');
            }
            $campaign = Shopware()->Modules()->Marketing()->sCampaignsGetDetail($campaignId);
            if (empty($campaign['id'])) {
                return $this->forward('index', 'index');
            }
            $this->View()->loadTemplate("frontend/campaign/old.tpl");
            $this->View()->sCampaign = $campaign;
        }
    }
コード例 #21
0
 public function createProducts($products, ProductContext $context, Category $category)
 {
     $articles = parent::createProducts($products, $context, $category);
     Shopware()->Container()->get('shopware_searchdbal.search_indexer')->build();
     Shopware()->Container()->get('cache')->clean('all', array('Shopware_Modules_Search'));
     return $articles;
 }
コード例 #22
0
ファイル: Search.php プロジェクト: Goucher/shopware
 /**
  * Default search
  */
 public function defaultSearchAction()
 {
     if (!$this->Request()->has('sSort')) {
         $this->Request()->setParam('sSort', 7);
     }
     $term = $this->getSearchTerm();
     // Check if we have a one to one match for ordernumber, then redirect
     $location = $this->searchFuzzyCheck($term);
     if (!empty($location)) {
         return $this->redirect($location);
     }
     $this->View()->loadTemplate('frontend/search/fuzzy.tpl');
     $minLengthSearchTerm = $this->get('config')->get('minSearchLenght');
     if (strlen($term) < (int) $minLengthSearchTerm) {
         return;
     }
     /**@var $context ProductContextInterface*/
     $context = $this->get('shopware_storefront.context_service')->getProductContext();
     $criteria = Shopware()->Container()->get('shopware_search.store_front_criteria_factory')->createSearchCriteria($this->Request(), $context);
     /**@var $result ProductSearchResult*/
     $result = $this->get('shopware_search.product_search')->search($criteria, $context);
     $articles = $this->convertProducts($result);
     if ($this->get('config')->get('traceSearch', true)) {
         $this->get('shopware_searchdbal.search_term_logger')->logResult($criteria, $result, $context->getShop());
     }
     $pageCounts = $this->get('config')->get('fuzzySearchSelectPerPage');
     $request = $this->Request()->getParams();
     $request['sSearchOrginal'] = $term;
     /** @var $mapper \Shopware\Components\QueryAliasMapper */
     $mapper = $this->get('query_alias_mapper');
     $this->View()->assign(array('term' => $term, 'criteria' => $criteria, 'facets' => $result->getFacets(), 'sPage' => $this->Request()->getParam('sPage', 1), 'sSort' => $this->Request()->getParam('sSort', 7), 'sTemplate' => $this->Request()->getParam('sTemplate'), 'sPerPage' => array_values(explode("|", $pageCounts)), 'sRequests' => $request, 'shortParameters' => $mapper->getQueryAliases(), 'pageSizes' => array_values(explode("|", $pageCounts)), 'ajaxCountUrlParams' => ['sCategory' => $context->getShop()->getCategory()->getId()], 'sSearchResults' => array('sArticles' => $articles, 'sArticlesCount' => $result->getTotalCount()), 'productBoxLayout' => $this->get('config')->get('searchProductBoxLayout')));
 }
コード例 #23
0
 public function uninstall()
 {
     $cacheManager = Shopware()->Container()->get('shopware.cache_manager');
     $cacheManager->clearThemeCache();
     $this->secureUninstall();
     return true;
 }
コード例 #24
0
 /**
  * This Action loads the loggingdata from the datebase into the backendview
  */
 public function loadStoreAction()
 {
     $start = intval($this->Request()->getParam("start"));
     $limit = intval($this->Request()->getParam("limit"));
     $orderId = $this->Request()->getParam("orderId");
     if (!is_null($orderId)) {
         $transactionId = Shopware()->Db()->fetchOne("SELECT `transactionId` FROM `s_order` WHERE `id`=?", array($orderId));
         $sqlTotal = "SELECT COUNT(*) FROM `rpay_ratepay_logging` WHERE `transactionId`=?";
         $sql = "SELECT log.*, `s_user_billingaddress`.`firstname`,`s_user_billingaddress`.`lastname` FROM `rpay_ratepay_logging` AS `log` " . "LEFT JOIN `s_order` ON `log`.`transactionId`=`s_order`.`transactionID`" . "LEFT JOIN `s_user_billingaddress` ON `s_order`.`userID`=`s_user_billingaddress`.`userID`" . "WHERE `log`.`transactionId`=?" . "ORDER BY `id` DESC";
         $data = Shopware()->Db()->fetchAll($sql, array($transactionId));
         $total = Shopware()->Db()->fetchOne($sqlTotal, array($transactionId));
     } else {
         $sqlTotal = "SELECT COUNT(*) FROM `rpay_ratepay_logging`";
         $sql = "SELECT log.*, `s_user_billingaddress`.`firstname`,`s_user_billingaddress`.`lastname` FROM `rpay_ratepay_logging` AS `log` " . "LEFT JOIN `s_order` ON `log`.`transactionId`=`s_order`.`transactionID`" . "LEFT JOIN `s_user_billingaddress` ON `s_order`.`userID`=`s_user_billingaddress`.`userID`" . "ORDER BY `id` DESC " . "LIMIT {$start},{$limit}";
         $data = Shopware()->Db()->fetchAll($sql);
         $total = Shopware()->Db()->fetchOne($sqlTotal);
     }
     $store = array();
     foreach ($data as $row) {
         $matchesRequest = array();
         preg_match("/(.*)(<\\?.*)/s", $row['request'], $matchesRequest);
         $row['request'] = $matchesRequest[1] . "\n" . $this->formatXml(trim($matchesRequest[2]));
         $matchesResponse = array();
         preg_match("/(.*)(<response xml.*)/s", $row['response'], $matchesResponse);
         $row['response'] = $matchesResponse[1] . "\n" . $this->formatXml(trim($matchesResponse[2]));
         $store[] = $row;
     }
     $this->View()->assign(array("data" => $store, "total" => $total, "success" => true));
 }
コード例 #25
0
 /**
  * @param $data
  * @return mixed|ProfileEntity
  * @throws \Enlight_Exception
  * @throws \Exception
  */
 public function createProfileModel($data)
 {
     $event = Shopware()->Events()->notifyUntil('Shopware_Components_SwagImportExport_Factories_CreateProfileModel', ['subject' => $this, 'data' => $data]);
     if ($event && $event instanceof \Enlight_Event_EventArgs && $event->getReturn() instanceof ProfileEntity) {
         return $event->getReturn();
     }
     if (!isset($data['name'])) {
         throw new \Exception('Profile name is required');
     }
     if (!isset($data['type'])) {
         throw new \Exception('Profile type is required');
     }
     if (isset($data['hidden']) && $data['hidden']) {
         $tree = TreeHelper::getTreeByHiddenProfileType($data['type']);
     } else {
         if (isset($data['baseProfile'])) {
             $tree = TreeHelper::getDefaultTreeByBaseProfile($data['baseProfile']);
         } else {
             $tree = TreeHelper::getDefaultTreeByProfileType($data['type']);
         }
     }
     $profileEntity = new ProfileEntity();
     $profileEntity->setName($data['name']);
     $profileEntity->setBaseProfile($data['baseProfile']);
     $profileEntity->setType($data['type']);
     $profileEntity->setTree($tree);
     if (isset($data['hidden'])) {
         $profileEntity->setHidden($data['hidden']);
     }
     $this->modelManager->persist($profileEntity);
     $this->modelManager->flush();
     return $profileEntity;
 }
コード例 #26
0
ファイル: ResourceTest.php プロジェクト: GerDner/luck-docker
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     Shopware()->Models()->clear();
     $this->resource = $this->getMockForAbstractClass('\\Shopware\\Components\\Api\\Resource\\Resource');
     $this->resource->setManager(Shopware()->Models());
 }
コード例 #27
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $progress = $input->getOption('offset');
     $limit = $input->getOption('limit') ?: 1000;
     /** @var CategoryDenormalization $component */
     $component = Shopware()->CategoryDenormalization();
     // Cleanup before the first call
     if ($progress == 0) {
         $output->writeln("Removing orphans");
         $component->removeOrphanedAssignments();
         $output->writeln("Rebuild path info");
         $component->rebuildCategoryPath();
         $output->writeln("Removing assignments");
         $component->removeAllAssignments();
     }
     // Get total number of assignments to build
     $output->write("Counting…");
     $count = $component->rebuildAllAssignmentsCount();
     $output->writeln("\rCounted {$count} items");
     /** @var ProgressHelper $progressHelper */
     $progressHelper = $this->getHelper('progress');
     $progressHelper->setFormat(ProgressHelper::FORMAT_VERBOSE);
     $progressHelper->start($output, $count);
     $progressHelper->advance($progress);
     // create the assignments
     while ($progress < $count) {
         $component->rebuildAllAssignments($limit, $progress);
         $progress += $limit;
         $progressHelper->advance($limit);
     }
     $progressHelper->finish();
     $output->writeln("\rDone");
 }
コード例 #28
-1
 /**
  * Tests if width, length and height will be return by the sGetPromotionById method
  */
 public function testGetPromotionById()
 {
     $articlePromotionData = Shopware()->Modules()->Articles()->sGetPromotionById('fix', 0, self::ARTICLE_DETAIL_ORDER_NUMBER);
     $this->assertEquals('2.010', $articlePromotionData["width"]);
     $this->assertEquals('4.330', $articlePromotionData["length"]);
     $this->assertEquals('3.020', $articlePromotionData["height"]);
 }
コード例 #29
-1
ファイル: Session.php プロジェクト: ClaudioThomas/shopware-4
 /**
  * @param Container $container
  * @return \Enlight_Components_Session_Namespace
  */
 public function factory(Container $container)
 {
     $sessionOptions = Shopware()->getOption('session', array());
     if (!empty($sessionOptions['unitTestEnabled'])) {
         \Enlight_Components_Session::$_unitTestEnabled = true;
     }
     unset($sessionOptions['unitTestEnabled']);
     if (\Enlight_Components_Session::isStarted()) {
         \Enlight_Components_Session::writeClose();
     }
     /** @var $shop \Shopware\Models\Shop\Shop */
     $shop = $container->get('Shop');
     $name = 'session-' . $shop->getId();
     $sessionOptions['name'] = $name;
     if (!isset($sessionOptions['save_handler']) || $sessionOptions['save_handler'] == 'db') {
         $config_save_handler = array('db' => $container->get('Db'), 'name' => 's_core_sessions', 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'expiry');
         \Enlight_Components_Session::setSaveHandler(new \Enlight_Components_Session_SaveHandler_DbTable($config_save_handler));
         unset($sessionOptions['save_handler']);
     }
     \Enlight_Components_Session::start($sessionOptions);
     $container->set('SessionID', \Enlight_Components_Session::getId());
     $namespace = new \Enlight_Components_Session_Namespace('Shopware');
     $namespace->offsetSet('sessionId', \Enlight_Components_Session::getId());
     return $namespace;
 }
コード例 #30
-1
ファイル: Front.php プロジェクト: GerDner/luck-docker
 /**
  * Loads the Zend resource and initials the Enlight_Controller_Front class.
  * After the front resource is loaded, the controller path is added to the
  * front dispatcher. After the controller path is set to the dispatcher,
  * the plugin namespace of the front resource is set.
  *
  * @param Container $container
  * @param \Shopware_Bootstrap $bootstrap
  * @param \Enlight_Event_EventManager $eventManager
  * @param array $options
  * @throws \Exception
  * @return \Enlight_Controller_Front
  */
 public function factory(Container $container, \Shopware_Bootstrap $bootstrap, \Enlight_Event_EventManager $eventManager, array $options)
 {
     /** @var $front \Enlight_Controller_Front */
     $front = \Enlight_Class::Instance('Enlight_Controller_Front', array($eventManager));
     $front->setDispatcher($container->get('Dispatcher'));
     $front->Dispatcher()->addModuleDirectory(Shopware()->AppPath('Controllers'));
     $front->setRouter($container->get('Router'));
     $front->setParams($options);
     /** @var $plugins  \Enlight_Plugin_PluginManager */
     $plugins = $container->get('Plugins');
     $plugins->registerNamespace($front->Plugins());
     $front->setParam('bootstrap', $bootstrap);
     if (!empty($options['throwExceptions'])) {
         $front->throwExceptions((bool) $options['throwExceptions']);
     }
     try {
         $container->load('Cache');
         $container->load('Db');
         $container->load('Plugins');
     } catch (\Exception $e) {
         if ($front->throwExceptions()) {
             throw $e;
         }
         $front->Response()->setException($e);
     }
     return $front;
 }