public function startTransaction(Order $order, UrlInterface $url)
 {
     $config = new Config($this->_scopeConfig);
     $config->configureSDK();
     $total = $order->getGrandTotal();
     $items = $order->getAllVisibleItems();
     $orderId = $order->getIncrementId();
     $quoteId = $order->getQuoteId();
     $currency = $order->getOrderCurrencyCode();
     $returnUrl = $url->getUrl('paynl/checkout/finish/');
     $exchangeUrl = $url->getUrl('paynl/checkout/exchange/');
     $paymentOptionId = $this->getPaymentOptionId();
     $arrBillingAddress = $order->getBillingAddress()->toArray();
     $arrShippingAddress = $order->getShippingAddress()->toArray();
     $enduser = array('initials' => substr($arrBillingAddress['firstname'], 0, 1), 'lastName' => $arrBillingAddress['lastname'], 'phoneNumber' => $arrBillingAddress['telephone'], 'emailAddress' => $arrBillingAddress['email']);
     $address = array();
     $arrAddress = \Paynl\Helper::splitAddress($arrBillingAddress['street']);
     $address['streetName'] = $arrAddress[0];
     $address['houseNumber'] = $arrAddress[1];
     $address['zipCode'] = $arrBillingAddress['postcode'];
     $address['city'] = $arrBillingAddress['city'];
     $address['country'] = $arrBillingAddress['country_id'];
     $shippingAddress = array();
     $arrAddress2 = \Paynl\Helper::splitAddress($arrShippingAddress['street']);
     $shippingAddress['streetName'] = $arrAddress2[0];
     $shippingAddress['houseNumber'] = $arrAddress2[1];
     $shippingAddress['zipCode'] = $arrShippingAddress['postcode'];
     $shippingAddress['city'] = $arrShippingAddress['city'];
     $shippingAddress['country'] = $arrShippingAddress['country_id'];
     $data = array('amount' => $total, 'returnUrl' => $returnUrl, 'paymentMethod' => $paymentOptionId, 'description' => $orderId, 'extra1' => $orderId, 'extra2' => $quoteId, 'exchangeUrl' => $exchangeUrl, 'currency' => $currency);
     $data['address'] = $address;
     $data['shippingAddress'] = $shippingAddress;
     $data['enduser'] = $enduser;
     $arrProducts = array();
     foreach ($items as $item) {
         $arrItem = $item->toArray();
         if ($arrItem['price_incl_tax'] != null) {
             $product = array('id' => $arrItem['product_id'], 'name' => $arrItem['name'], 'price' => $arrItem['price_incl_tax'], 'qty' => $arrItem['qty_ordered'], 'tax' => $arrItem['tax_amount']);
         }
         $arrProducts[] = $product;
     }
     //shipping
     $shippingCost = $order->getShippingAddress()->getShippingInclTax();
     $shippingTax = $order->getShippingAddress()->getShippingTaxAmount();
     $shippingDescription = $order->getShippingAddress()->getShippingDescription();
     $arrProducts[] = array('id' => 'shipping', 'name' => $shippingDescription, 'price' => $shippingCost, 'qty' => 1, 'tax' => $shippingTax);
     // kortingen
     $discount = $order->getSubtotal() - $order->getSubtotalWithDiscount();
     if ($discount > 0) {
         $arrProducts[] = array('id' => 'discount', 'name' => __('Discount'), 'price' => $discount * -1, 'qty' => 1, 'tax' => 0);
     }
     $data['products'] = $arrProducts;
     if ($config->isTestMode()) {
         $data['testmode'] = 1;
     }
     $data['ipaddress'] = $order->getRemoteIp();
     $transaction = \Paynl\Transaction::start($data);
     return $transaction->getRedirectUrl();
 }
Example #2
0
 /**
  * Retrieve message text
  *
  * @return \Magento\Framework\Phrase
  */
 public function getText()
 {
     $url = $this->urlBuilder->getUrl('indexer/indexer/list');
     //@codingStandardsIgnoreStart
     return __('One or more <a href="%1">indexers are invalid</a>. Make sure your <a href="%2" target="_blank">Magento cron job</a> is running.', $url, 'http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html#config-cli-cron-bkg');
     //@codingStandardsIgnoreEnd
 }
Example #3
0
 /**
  * @param bool $isSecure
  * @param string $actionUrl
  * @param int $productId
  * @dataProvider getActionDataProvider
  */
 public function testGetAction($isSecure, $actionUrl, $productId)
 {
     $this->urlBuilder->expects($this->any())->method('getUrl')->with('review/product/post', ['_secure' => $isSecure, 'id' => $productId])->willReturn($actionUrl . '/id/' . $productId);
     $this->requestMock->expects($this->any())->method('getParam')->with('id', false)->willReturn($productId);
     $this->requestMock->expects($this->any())->method('isSecure')->willReturn($isSecure);
     $this->assertEquals($actionUrl . '/id/' . $productId, $this->object->getAction());
 }
 /**
  * @return array
  */
 public function getConfig()
 {
     // set to active
     $config = ['payment' => [self::CODE => ['isActive' => true, 'redirectUrl' => $this->_urlBuilder->getUrl('checkout/onepage/success/', ['_secure' => $this->_getRequest()->isSecure()])]]];
     $config['payment']['adyenSepa']['countries'] = $this->_adyenHelper->getSepaCountries();
     return $config;
 }
Example #5
0
 public function testGetRssData()
 {
     $rssData = ['title' => 'Pending product review(s)', 'description' => 'Pending product review(s)', 'link' => 'http://rss.magento.com', 'charset' => 'UTF-8', 'entries' => ['title' => 'Product: "Product Name" reviewed by: Product Nick', 'link' => 'http://product.magento.com', 'description' => ['rss_url' => 'http://rss.magento.com', 'name' => 'Product Name', 'summary' => 'Product Title', 'review' => 'Product Detail', 'store' => 'Store Name']]];
     $rssUrl = 'http://rss.magento.com';
     $productModel = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product', ['getStoreId', 'getId', 'getReviewId', 'getName', 'getDetail', 'getTitle', 'getNickname', 'getProductUrl'], [], '', false);
     $storeModel = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $this->storeManagerInterface->expects($this->once())->method('getStore')->will($this->returnValue($storeModel));
     $storeModel->expects($this->once())->method('getName')->will($this->returnValue($rssData['entries']['description']['store']));
     $this->urlBuilder->expects($this->any())->method('getUrl')->will($this->returnValue($rssUrl));
     $this->urlBuilder->expects($this->once())->method('setScope')->will($this->returnSelf());
     $productModel->expects($this->any())->method('getStoreId')->will($this->returnValue(1));
     $productModel->expects($this->any())->method('getId')->will($this->returnValue(1));
     $productModel->expects($this->once())->method('getReviewId')->will($this->returnValue(1));
     $productModel->expects($this->any())->method('getNickName')->will($this->returnValue('Product Nick'));
     $productModel->expects($this->any())->method('getName')->will($this->returnValue($rssData['entries']['description']['name']));
     $productModel->expects($this->once())->method('getDetail')->will($this->returnValue($rssData['entries']['description']['review']));
     $productModel->expects($this->once())->method('getTitle')->will($this->returnValue($rssData['entries']['description']['summary']));
     $productModel->expects($this->any())->method('getProductUrl')->will($this->returnValue('http://product.magento.com'));
     $this->rss->expects($this->once())->method('getProductCollection')->will($this->returnValue([$productModel]));
     $data = $this->block->getRssData();
     $this->assertEquals($rssData['title'], $data['title']);
     $this->assertEquals($rssData['description'], $data['description']);
     $this->assertEquals($rssData['link'], $data['link']);
     $this->assertEquals($rssData['charset'], $data['charset']);
     $this->assertEquals($rssData['entries']['title'], $data['entries'][0]['title']);
     $this->assertEquals($rssData['entries']['link'], $data['entries'][0]['link']);
     $this->assertContains($rssData['entries']['description']['rss_url'], $data['entries'][0]['description']);
     $this->assertContains($rssData['entries']['description']['name'], $data['entries'][0]['description']);
     $this->assertContains($rssData['entries']['description']['summary'], $data['entries'][0]['description']);
     $this->assertContains($rssData['entries']['description']['review'], $data['entries'][0]['description']);
     $this->assertContains($rssData['entries']['description']['store'], $data['entries'][0]['description']);
 }
Example #6
0
 /**
  * Get url for config settings where base url option can be changed
  *
  * @return string
  */
 protected function _getConfigUrl()
 {
     $output = '';
     $defaultUnsecure = $this->_config->getValue(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default');
     $defaultSecure = $this->_config->getValue(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, 'default');
     if ($defaultSecure == \Magento\Store\Model\Store::BASE_URL_PLACEHOLDER || $defaultUnsecure == \Magento\Store\Model\Store::BASE_URL_PLACEHOLDER) {
         $output = $this->_urlBuilder->getUrl('adminhtml/system_config/edit', array('section' => 'web'));
     } else {
         /** @var $dataCollection \Magento\Core\Model\Resource\Config\Data\Collection */
         $dataCollection = $this->_configValueFactory->create()->getCollection();
         $dataCollection->addValueFilter(\Magento\Store\Model\Store::BASE_URL_PLACEHOLDER);
         /** @var $data \Magento\Framework\App\Config\ValueInterface */
         foreach ($dataCollection as $data) {
             if ($data->getScope() == 'stores') {
                 $code = $this->_storeManager->getStore($data->getScopeId())->getCode();
                 $output = $this->_urlBuilder->getUrl('adminhtml/system_config/edit', array('section' => 'web', 'store' => $code));
                 break;
             } elseif ($data->getScope() == 'websites') {
                 $code = $this->_storeManager->getWebsite($data->getScopeId())->getCode();
                 $output = $this->_urlBuilder->getUrl('adminhtml/system_config/edit', array('section' => 'web', 'website' => $code));
                 break;
             }
         }
     }
     return $output;
 }
Example #7
0
 /**
  * @dataProvider checkUpdateDataProvider
  * @param bool $callInbox
  * @param string $curlRequest
  */
 public function testCheckUpdate($callInbox, $curlRequest)
 {
     $mockName = 'Test Product Name';
     $mockVersion = '0.0.0';
     $mockEdition = 'Test Edition';
     $mockUrl = 'http://test-url';
     $this->productMetadata->expects($this->once())->method('getName')->willReturn($mockName);
     $this->productMetadata->expects($this->once())->method('getVersion')->willReturn($mockVersion);
     $this->productMetadata->expects($this->once())->method('getEdition')->willReturn($mockEdition);
     $this->urlBuilder->expects($this->once())->method('getUrl')->with('*/*/*')->willReturn($mockUrl);
     $configValues = ['timeout' => 2, 'useragent' => $mockName . '/' . $mockVersion . ' (' . $mockEdition . ')', 'referer' => $mockUrl];
     $lastUpdate = 0;
     $this->cacheManager->expects($this->once())->method('load')->will($this->returnValue($lastUpdate));
     $this->curlFactory->expects($this->at(0))->method('create')->will($this->returnValue($this->curl));
     $this->curl->expects($this->once())->method('setConfig')->with($configValues)->willReturnSelf();
     $this->curl->expects($this->once())->method('read')->will($this->returnValue($curlRequest));
     $this->backendConfig->expects($this->at(0))->method('getValue')->will($this->returnValue('1'));
     $this->backendConfig->expects($this->once())->method('isSetFlag')->will($this->returnValue(false));
     $this->backendConfig->expects($this->at(1))->method('getValue')->will($this->returnValue('http://feed.magento.com'));
     $this->deploymentConfig->expects($this->once())->method('get')->with(ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE)->will($this->returnValue('Sat, 6 Sep 2014 16:46:11 UTC'));
     if ($callInbox) {
         $this->inboxFactory->expects($this->once())->method('create')->will($this->returnValue($this->inboxModel));
         $this->inboxModel->expects($this->once())->method('parse')->will($this->returnSelf());
     } else {
         $this->inboxFactory->expects($this->never())->method('create');
         $this->inboxModel->expects($this->never())->method('parse');
     }
     $this->feed->checkUpdate();
 }
 /**
  * @return void
  */
 public function prepare()
 {
     $config = $this->getData('config');
     if (isset($config['options'])) {
         $options = [];
         foreach ($config['options'] as $option) {
             $option['url'] = $this->urlBuilder->getUrl($option['url']);
             $options[] = $option;
         }
         $config['options'] = $options;
     }
     $store = $this->storeManager->getStore();
     $config['validationEnabled'] = $this->config->isAddressValidationEnabled($store);
     $hasChoice = $this->config->allowUserToChooseAddress($store);
     if ($hasChoice) {
         $instructions = $this->config->getAddressValidationInstructionsWithChoice($store);
     } else {
         $instructions = $this->config->getAddressValidationInstructionsWithOutChoice($store);
     }
     $config['instructions'] = $instructions;
     $config['errorInstructions'] = $this->config->getAddressValidationErrorInstructions($store);
     $config['countriesEnabled'] = $this->config->getAddressValidationCountriesEnabled($store);
     $config['baseUrl'] = $this->urlBuilder->getUrl(self::VALIDATE_ADDRESS_PATH);
     $this->setData('config', $config);
     parent::prepare();
 }
 /**
  * @param array $queryParams
  * @return string
  */
 public function getUrl(array $queryParams = [])
 {
     if (!$this->config->getValue('rss/config/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
         return '';
     }
     return $this->urlBuilder->getUrl('rss/feed/index', $queryParams);
 }
Example #10
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return array
  */
 public function prepareDataSource(array $dataSource)
 {
     if (!isset($dataSource['data']['items'])) {
         return $dataSource;
     }
     $hasSubscription = false;
     if ($subscription = $this->moduleFactory->create()->load('Swissup_SubscriptionChecker')) {
         $hasSubscription = (bool) $subscription->getLocal();
     }
     foreach ($dataSource['data']['items'] as &$item) {
         // add installer links
         $module = $this->moduleFactory->create()->load($item['code']);
         if ($module->getInstaller()->hasUpgradesDir()) {
             $item[$this->getData('name')]['installer'] = ['href' => $this->urlBuilder->getUrl(static::URL_PATH_INSTALL, ['code' => $item['code']]), 'label' => __('Open Installer')];
             if ($module->isInstalled() && $module->getInstaller()->getUpgradesToRun()) {
                 $item[$this->getData('name')]['upgrade'] = ['href' => $this->urlBuilder->getUrl(static::URL_PATH_UPGRADE, ['code' => $item['code']]), 'label' => __('Run Upgrades')];
             }
         }
         // add external links
         foreach ($this->getData('links') as $link) {
             if (empty($item[$link['key']])) {
                 continue;
             }
             if ($link['key'] === 'download_link' && !$hasSubscription) {
                 continue;
             }
             $item[$this->getData('name')][$link['key']] = ['href' => $item[$link['key']], 'label' => __($link['label'])];
         }
     }
     return $dataSource;
 }
 public function testGetCurrentSecureUrl()
 {
     $request = $this->getMockForAbstractClass('Magento\\Framework\\App\\RequestInterface', [], '', false, true, true, ['getPathInfo']);
     $request->expects($this->once())->method('getPathInfo')->willReturn('/info');
     $this->url->expects($this->once())->method('getBaseUrl')->with('link', true)->willReturn('localhost/');
     $this->assertEquals('localhost/info', $this->adminPathConfig->getCurrentSecureUrl($request));
 }
 /**
  * Set configuration for AdyenHPP payemnt method
  *
  * @return array
  */
 public function getConfig()
 {
     // set to active
     $config = ['payment' => [self::CODE => ['isActive' => true, 'redirectUrl' => $this->_urlBuilder->getUrl('adyen/process/redirect', ['_secure' => $this->_getRequest()->isSecure()])]]];
     // get customer
     if ($this->_customerSession->isLoggedIn()) {
         $gender = \Adyen\Payment\Model\Gender::getAdyenGenderFromMagentoGender($this->_customerSession->getCustomerData()->getGender());
         // format to calendar date
         $dob = $this->_customerSession->getCustomerData()->getDob();
         $dob = strtotime($dob);
         $dob = date('m/d/Y', $dob);
     } else {
         $gender = "";
         $dob = "";
     }
     // add to config
     $config['payment']['adyenHpp']['gender'] = $gender;
     $config['payment']['adyenHpp']['dob'] = $dob;
     // gender types
     $config['payment']['adyenHpp']['genderTypes'] = \Adyen\Payment\Model\Gender::getGenderTypes();
     $paymentMethodSelectionOnAdyen = $this->_adyenHelper->getAdyenHppConfigDataFlag('payment_selection_on_adyen');
     $config['payment']['adyenHpp']['isPaymentMethodSelectionOnAdyen'] = $paymentMethodSelectionOnAdyen;
     $config['payment']['adyenHpp']['showGender'] = $this->_adyenHelper->getAdyenHppConfigDataFlag('show_gender');
     $config['payment']['adyenHpp']['showDob'] = $this->_adyenHelper->getAdyenHppConfigDataFlag('show_dob');
     $config['payment']['adyenHpp']['showTelephone'] = $this->_adyenHelper->getAdyenHppConfigDataFlag('show_telephone');
     return $config;
 }
 public function testGetUrl()
 {
     $queryParams = ['queryParamsArray'];
     $url = 'sampleUrl';
     $this->urlBuilder->expects($this->once())->method('getUrl')->with('sampleservicecontractnew/feed/view', $queryParams)->willReturn($url);
     $this->assertEquals($url, $this->target->getUrl($queryParams));
 }
 /**
  * {@inheritdoc}
  */
 public function modifyMeta(array $meta)
 {
     if ($name = $this->getGeneralPanelName($meta)) {
         $meta[$name]['children']['attribute_set_id']['arguments']['data']['config'] = ['component' => 'Magento_Ui/js/form/element/ui-select', 'disableLabel' => true, 'filterOptions' => true, 'elementTmpl' => 'ui/grid/filters/elements/ui-select', 'formElement' => 'select', 'componentType' => Field::NAME, 'options' => $this->getOptions(), 'visible' => 1, 'required' => 1, 'label' => __('Attribute Set'), 'source' => $name, 'dataScope' => 'attribute_set_id', 'filterUrl' => $this->urlBuilder->getUrl('catalog/product/suggestAttributeSets', ['isAjax' => 'true']), 'sortOrder' => $this->getNextAttributeSortOrder($meta, [ProductAttributeInterface::CODE_STATUS], self::ATTRIBUTE_SET_FIELD_ORDER), 'multiple' => false];
     }
     return $meta;
 }
Example #15
0
 /**
  * @param \Magento\Framework\App\RequestInterface $request
  * @param UrlRewrite $rewrite
  * @return \Magento\Framework\App\ActionInterface|null
  */
 protected function processRedirect($request, $rewrite)
 {
     $target = $rewrite->getTargetPath();
     if ($rewrite->getEntityType() !== Rewrite::ENTITY_TYPE_CUSTOM || ($prefix = substr($target, 0, 6)) !== 'http:/' && $prefix !== 'https:') {
         $target = $this->url->getUrl('', ['_direct' => $target]);
     }
     return $this->redirect($request, $target, $rewrite->getRedirectType());
 }
Example #16
0
 public function testExecuteEmptyQuery()
 {
     $searchString = "";
     $this->request->expects($this->once())->method('getParam')->with('q')->will($this->returnValue($searchString));
     $this->url->expects($this->once())->method('getBaseUrl');
     $this->response->expects($this->once())->method('setRedirect');
     $this->controller->execute();
 }
 /**
  * {@inheritdoc}
  */
 public function getSectionData()
 {
     $customerId = $this->currentCustomer->getCustomerId();
     if ($this->paypalData->shouldAskToCreateBillingAgreement($this->config, $customerId)) {
         return ['askToCreate' => true, 'confirmUrl' => $this->escaper->escapeUrl($this->urlBuilder->getUrl($this->startAction, [\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => 1])), 'confirmMessage' => $this->escaper->escapeJsQuote(__('Would you like to sign a billing agreement to streamline further purchases with PayPal?'))];
     }
     return [];
 }
 /**
  * @param array $result
  * @param bool $expectedValue
  * @dataProvider getButtonDataProvider
  */
 public function testGetButtonData($result, $expectedValue)
 {
     $this->registryMock->expects($this->any())->method('registry')->willReturn(1);
     $this->customerRegistryMock->expects($this->once())->method('retrieve')->willReturn($this->customerModelMock);
     $this->customerModelMock->expects($this->once())->method('isCustomerLocked')->willReturn($expectedValue);
     $this->urlBuilderMock->expects($this->any())->method('getUrl')->willReturn('http://website.com/');
     $this->assertEquals($result, $this->block->getButtonData());
 }
 /**
  * @param array $data
  * @param array $dataSourceItems
  * @param array $expectedDataSourceItems
  * @param string $expectedUrlPath
  * @param array $expectedUrlParam
  * @dataProvider prepareDataSourceDataProvider
  */
 public function testPrepareDataSource($data, $dataSourceItems, $expectedDataSourceItems, $expectedUrlPath, $expectedUrlParam)
 {
     $this->model = $this->objectManager->getObject('Magento\\Sales\\Ui\\Component\\Listing\\Column\\ViewAction', ['urlBuilder' => $this->urlBuilder, 'data' => $data]);
     $this->urlBuilder->expects($this->once())->method('getUrl')->with($expectedUrlPath, $expectedUrlParam)->willReturn('url');
     $dataSource = ['data' => ['items' => $dataSourceItems]];
     $dataSource = $this->model->prepareDataSource($dataSource);
     $this->assertEquals($expectedDataSourceItems, $dataSource['data']['items']);
 }
 /**
  * Set redirect url for store view based on request path info
  *
  * @param \Magento\Store\Block\Switcher $switcher
  * @param \Magento\Store\Model\Store $store
  * @param array $data
  * @return array
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function beforeGetTargetStorePostData(\Magento\Store\Block\Switcher $switcher, \Magento\Store\Model\Store $store, $data = [])
 {
     $urlRewrite = $this->urlFinder->findOneByData([UrlRewrite::TARGET_PATH => $this->trimSlashInPath($this->request->getPathInfo()), UrlRewrite::STORE_ID => $store->getId()]);
     if ($urlRewrite) {
         $data[ActionInterface::PARAM_NAME_URL_ENCODED] = $this->urlHelper->getEncodedUrl($this->trimSlashInPath($this->urlBuilder->getUrl($urlRewrite->getRequestPath())));
     }
     return [$store, $data];
 }
 public function testGetGridUrlSuccessfulUrl()
 {
     $roleId = 1;
     $url = 'http://Success';
     $this->requestInterfaceMock->expects($this->once())->method('getParam')->willReturn($roleId);
     $this->urlInterfaceMock->expects($this->once())->method('getUrl')->willReturn($url);
     $this->assertEquals($url, $this->model->getGridUrl());
 }
Example #22
0
 /**
  * @covers \Magento\PageCache\Block\Javascript::getScriptOptions
  * @param bool $isSecure
  * @param string $url
  * @param string $expectedResult
  * @dataProvider getScriptOptionsDataProvider
  */
 public function testGetScriptOptions($isSecure, $url, $expectedResult)
 {
     $handles = ['some', 'handles', 'here'];
     $this->requestMock->expects($this->once())->method('isSecure')->willReturn($isSecure);
     $this->urlBuilderMock->expects($this->once())->method('getUrl')->willReturn($url);
     $this->layoutUpdateMock->expects($this->once())->method('getHandles')->willReturn($handles);
     $this->assertRegExp($expectedResult, $this->blockJavascript->getScriptOptions());
 }
Example #23
0
 /**
  * {@inheritdoc}
  */
 public function modifyMeta(array $meta)
 {
     if (!$this->locator->getProduct()->getId()) {
         return $meta;
     }
     $meta[static::GROUP_REVIEW] = ['children' => ['review_listing' => ['arguments' => ['data' => ['config' => ['autoRender' => true, 'componentType' => 'insertListing', 'dataScope' => 'review_listing', 'externalProvider' => 'review_listing.review_listing_data_source', 'selectionsProvider' => 'review_listing.review_listing.product_columns.ids', 'ns' => 'review_listing', 'render_url' => $this->urlBuilder->getUrl('mui/index/render'), 'realTimeLink' => false, 'behaviourType' => 'simple', 'externalFilterMode' => true, 'imports' => ['productId' => '${ $.provider }:data.product.current_product_id'], 'exports' => ['productId' => '${ $.externalProvider }:params.current_product_id']]]]]], 'arguments' => ['data' => ['config' => ['label' => __('Product Reviews'), 'collapsible' => true, 'opened' => false, 'componentType' => Form\Fieldset::NAME, 'sortOrder' => $this->getNextGroupSortOrder($meta, static::GROUP_CONTENT, static::SORT_ORDER)]]]];
     return $meta;
 }
Example #24
0
 /**
  * Prepare breadcrumbs
  *
  * @param \Magento\Cms\Model\Post $post
  * @throws \Magento\Framework\Exception\LocalizedException
  * @return void
  */
 protected function _addBreadcrumbs(\OsmanSorkar\Blog\Model\Post $post)
 {
     if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
         $breadcrumbsBlock->addCrumb('home', ['label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->_storeManager->getStore()->getBaseUrl()]);
         $breadcrumbsBlock->addCrumb('blog', ['label' => __("blog"), 'title' => __("Go to Blog"), 'link' => __($this->urlBuilder->getUrl("blog/"))]);
         $breadcrumbsBlock->addCrumb('blog_Post', ['label' => $post->getTitle(), 'title' => $post->getTitle()]);
     }
 }
Example #25
0
 /**
  * {@inheritdoc}
  * @return string
  * @throws \InvalidArgumentException
  */
 public function evaluate(array $data)
 {
     if (!isset($data['path'])) {
         throw new \InvalidArgumentException('URL path is missing.');
     }
     $urlPath = $data['path'];
     $urlParams = $this->paramsInterpreter->evaluate($data);
     return $this->urlResolver->getUrl($urlPath, $urlParams);
 }
Example #26
0
 public function testGetTargetStorePostData()
 {
     $store = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
     $store->expects($this->any())->method('getCode')->will($this->returnValue('new-store'));
     $storeSwitchUrl = 'stores/store/switch';
     $this->urlBuilder->expects($this->any())->method('getUrl')->with($storeSwitchUrl)->willReturnArgument(0);
     $this->corePostDataHelper->expects($this->any())->method('getPostData')->with($storeSwitchUrl, ['___store' => 'new-store']);
     $this->switcher->getTargetStorePostData($store);
 }
 public function testPrepareDataSource()
 {
     $dataSource = ['data' => ['items' => [['entity_id' => 1]]]];
     $expectedDataSource = ['data' => ['items' => [['entity_id' => 1, 'name' => ['edit' => ['href' => 'http://magento.com/customer/index/edit', 'label' => new \Magento\Framework\Phrase('Edit'), 'hidden' => false]]]]]];
     $this->context->expects($this->once())->method('getFilterParam')->with('store_id')->willReturn(null);
     $this->urlBuilder->expects($this->once())->method('getUrl')->with('customer/*/edit', ['id' => 1, 'store' => null])->willReturn('http://magento.com/customer/index/edit');
     $dataSource = $this->component->prepareDataSource($dataSource);
     $this->assertEquals($expectedDataSource, $dataSource);
 }
Example #28
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return void
  */
 public function prepareDataSource(array &$dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         $storeId = $this->context->getFilterParam('store_id');
         foreach ($dataSource['data']['items'] as &$item) {
             $item[$this->getData('name')]['edit'] = ['href' => $this->urlBuilder->getUrl('catalog/product/edit', ['id' => $item['entity_id'], 'store' => $storeId]), 'label' => __('Edit'), 'hidden' => false];
         }
     }
 }
Example #29
0
 /**
  * @param SessionManagerInterface $session
  * @return string
  */
 public function getSid(SessionManagerInterface $session)
 {
     $sidKey = null;
     $useSidOnFrontend = $this->scopeConfig->getValue(self::XML_PATH_USE_FRONTEND_SID, $this->_scopeType);
     if ($useSidOnFrontend && $this->request->getQuery($this->getSessionIdQueryParam($session), false) && $this->urlBuilder->isOwnOriginUrl()) {
         $sidKey = $this->request->getQuery($this->getSessionIdQueryParam($session));
     }
     return $sidKey;
 }
 public function testExecuteEmptyQuery()
 {
     $url = 'some url';
     $searchString = '';
     $this->request->expects($this->once())->method('getParam')->with('q')->will($this->returnValue($searchString));
     $this->url->expects($this->once())->method('getBaseUrl')->willReturn($url);
     $this->resultRedirectMock->expects($this->once())->method('setUrl')->with($url)->willReturnSelf();
     $this->assertSame($this->resultRedirectMock, $this->controller->execute());
 }