Exemplo n.º 1
1
 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();
 }
 /**
  * {@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;
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
0
 /**
  * @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);
 }
 /**
  * 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;
 }
Exemplo n.º 6
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
 }
 /**
  * @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;
 }
Exemplo n.º 8
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;
 }
 /**
  * @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();
 }
Exemplo n.º 10
0
 /**
  * {@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 [];
 }
Exemplo n.º 11
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()]);
     }
 }
Exemplo n.º 12
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());
 }
Exemplo n.º 13
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;
 }
Exemplo n.º 14
0
 /**
  * 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];
 }
Exemplo n.º 15
0
 /**
  * Dispatch request
  *
  * @param \Magento\Framework\App\Action\Action $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function aroundDispatch(\Magento\Framework\App\Action\Action $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_appState->isInstalled()) {
         $this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
         $this->_response->setRedirect($this->_url->getUrl('install'));
         return $this->_response;
     }
     return $proceed($request);
 }
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function modifyMeta(array $meta)
 {
     $generalPanel = $this->getGeneralPanelName($meta);
     $meta = array_replace_recursive($meta, [self::CODE_BUNDLE_DATA => ['arguments' => ['data' => ['config' => ['label' => __('Bundle Items'), 'componentType' => isset($meta[$generalPanel]['componentType']) ? $meta[$generalPanel]['componentType'] : Form\Fieldset::NAME, 'dataScope' => '', 'sortOrder' => $this->getNextGroupSortOrder($meta, self::GROUP_CONTENT, self::SORT_ORDER), 'collapsible' => true, 'opened' => true]]], 'children' => ['modal' => ['arguments' => ['data' => ['config' => ['isTemplate' => false, 'componentType' => Modal::NAME, 'dataScope' => '', 'provider' => 'product_form.product_form_data_source', 'options' => ['title' => __('Add Products to Option'), 'buttons' => [['text' => __('Cancel'), 'class' => 'action-secondary', 'actions' => ['closeModal']], ['text' => __('Add Selected Products'), 'class' => 'action-primary', 'actions' => [['targetName' => 'index = bundle_product_listing', 'actionName' => 'save'], 'closeModal']]]]]]], 'children' => ['bundle_product_listing' => ['arguments' => ['data' => ['config' => ['autoRender' => false, 'componentType' => 'insertListing', 'dataScope' => 'bundle_product_listing', 'externalProvider' => 'bundle_product_listing.bundle_product_listing_data_source', 'selectionsProvider' => 'bundle_product_listing.bundle_product_listing.product_columns.ids', 'ns' => 'bundle_product_listing', 'render_url' => $this->urlBuilder->getUrl('mui/index/render'), 'realTimeLink' => false, 'dataLinks' => ['imports' => false, 'exports' => true], 'behaviourType' => 'simple', 'externalFilterMode' => true]]]]]], self::CODE_SHIPMENT_TYPE => $this->getShipmentType(), self::CODE_AFFECT_BUNDLE_PRODUCT_SELECTIONS => ['arguments' => ['data' => ['config' => ['componentType' => Form\Field::NAME, 'dataType' => Form\Element\DataType\Text::NAME, 'formElement' => Form\Element\Input::NAME, 'dataScope' => 'data.affect_bundle_product_selections', 'visible' => false, 'value' => '1']]]], self::CODE_BUNDLE_HEADER => $this->getBundleHeader(), self::CODE_BUNDLE_OPTIONS => $this->getBundleOptions()]]]);
     if (!empty($meta[$generalPanel]['children'][self::CODE_SHIPMENT_TYPE])) {
         unset($meta[$generalPanel]['children'][self::CODE_SHIPMENT_TYPE]);
     }
     return $meta;
 }
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return array
  */
 public function prepareDataSource(array $dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         foreach ($dataSource['data']['items'] as &$item) {
             $item[$this->getData('name')]['view'] = ['href' => $this->urlBuilder->getUrl(self::QUEUE_URL_PATH_VIEW, ['id' => $item['class_id']]), 'label' => __('Edit')];
         }
     }
     return $dataSource;
 }
Exemplo n.º 18
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);
 }
Exemplo n.º 19
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];
         }
     }
 }
Exemplo n.º 20
0
 /**
  * @param array $items
  * @return array
  */
 public function prepareItems(array &$items)
 {
     foreach ($items as &$item) {
         if (isset($item['block_id'])) {
             $item[$this->getData('name')] = ['edit' => ['href' => $this->urlBuilder->getUrl(static::URL_PATH, ['block_id' => $item['block_id']]), 'label' => __('Edit')]];
         }
     }
     return $items;
 }
Exemplo n.º 21
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return void
  */
 public function prepareDataSource(array &$dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         foreach ($dataSource['data']['items'] as &$item) {
             if (isset($item['entity_id'])) {
                 $item[$this->getData('name')] = ['view' => ['href' => $this->urlBuilder->getUrl(static::URL_PATH_VIEW, ['order_id' => $item['entity_id']]), 'label' => __('View')]];
             }
         }
     }
 }
Exemplo n.º 22
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return array
  */
 public function prepareDataSource(array $dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         $hidden = !$this->_authorization->isAllowed('Magefan_LoginAsCustomer::login_button');
         foreach ($dataSource['data']['items'] as &$item) {
             $item[$this->getData('name')]['edit'] = ['href' => $this->urlBuilder->getUrl('loginascustomer/login/login', ['customer_id' => $item['entity_id']]), 'label' => __('Login As Customer'), 'hidden' => $hidden, 'target' => '_blank'];
         }
     }
     return $dataSource;
 }
Exemplo n.º 23
0
 /**
  * @param Article $article
  * @return mixed
  */
 public function getArticleUrl(Article $article)
 {
     if ($urlKey = $article->getUrlKey()) {
         $prefix = $this->scopeConfig->getValue(self::URL_PREFIX_CONFIG_PATH, ScopeInterface::SCOPE_STORE);
         $suffix = $this->scopeConfig->getValue(self::URL_SUFFIX_CONFIG_PATH, ScopeInterface::SCOPE_STORE);
         $path = ($prefix ? $prefix . '/' : '') . $urlKey . ($suffix ? '.' . $suffix : '');
         return $this->urlBuilder->getUrl('', ['_direct' => $path]);
     }
     return $this->urlBuilder->getUrl('gemtoo_blog/article/view', ['id' => $article->getId()]);
 }
Exemplo n.º 24
0
 /**
  * @param Author $author
  * @return string
  */
 public function getAuthorUrl(Author $author)
 {
     if ($urlKey = $author->getUrlKey()) {
         $prefix = $this->scopeConfig->getValue(self::URL_PREFIX_CONFIG_PATH, ScopeInterface::SCOPE_STORE);
         $suffix = $this->scopeConfig->getValue(self::URL_SUFFIX_CONFIG_PATH, ScopeInterface::SCOPE_STORE);
         $path = ($prefix ? $prefix . '/' : '') . $urlKey . ($suffix ? '.' . $suffix : '');
         return $this->urlBuilder->getUrl('', ['_direct' => $path]);
     }
     return $this->urlBuilder->getUrl('sample_news/author/view', ['id' => $author->getId()]);
 }
Exemplo n.º 25
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return void
  */
 public function prepareDataSource(array &$dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         foreach ($dataSource['data']['items'] as &$item) {
             if (isset($item['block_id'])) {
                 $item[$this->getData('name')] = ['edit' => ['href' => $this->urlBuilder->getUrl(static::URL_PATH, ['block_id' => $item['block_id']]), 'label' => __('Edit')]];
             }
         }
     }
 }
Exemplo n.º 26
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return void
  */
 public function prepareDataSource(array &$dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         foreach ($dataSource['data']['items'] as &$item) {
             if (isset($item['id'])) {
                 $item[$this->getData('name')] = ['edit' => ['href' => $this->urlBuilder->getUrl(static::URL_PATH_EDIT, ['id' => $item['id']]), 'label' => __('Edit')], 'details' => ['href' => $this->urlBuilder->getUrl(static::URL_PATH_DETAILS, ['id' => $item['id']]), 'label' => __('Details')], 'delete' => ['href' => $this->urlBuilder->getUrl(static::URL_PATH_DELETE, ['id' => $item['id']]), 'label' => __('Delete'), 'confirm' => ['title' => __('Delete "${ $.$data.title }"'), 'message' => __('Are you sure you wan\'t to delete a "${ $.$data.title }" record?')]]];
             }
         }
     }
 }
Exemplo n.º 27
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return array
  */
 public function prepareDataSource(array $dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         foreach ($dataSource['data']['items'] as &$item) {
             if (isset($item['article_id'])) {
                 $item[$this->getData('name')] = ['edit' => ['href' => $this->_urlBuilder->getUrl(static::URL_PATH_EDIT, ['article_id' => $item['article_id']]), 'label' => __('Edit')], 'delete' => ['href' => $this->_urlBuilder->getUrl(static::URL_PATH_DELETE, ['article_id' => $item['article_id']]), 'label' => __('Delete'), 'confirm' => ['title' => __('Delete "${ $.$data.name }"'), 'message' => __('Are you sure you wan\'t to delete the Article "${ $.$data.name }" ?')]]];
             }
         }
     }
     return $dataSource;
 }
Exemplo n.º 28
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return array
  */
 public function prepareDataSource(array $dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         foreach ($dataSource['data']['items'] as &$item) {
             $name = $this->getData('name');
             $item[$name]['delete'] = ['href' => $this->urlBuilder->getUrl(self::SYNONYM_URL_PATH_DELETE, ['group_id' => $item['group_id']]), 'label' => __('Delete'), 'confirm' => ['title' => __('Delete'), 'message' => __('Are you sure you want to delete synonym group with id: %1?', $item['group_id'])]];
             $item[$name]['edit'] = ['href' => $this->urlBuilder->getUrl(self::SYNONYM_URL_PATH_EDIT, ['group_id' => $item['group_id']]), 'label' => __('View/Edit')];
         }
     }
     return $dataSource;
 }
Exemplo n.º 29
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function modifyMeta(array $meta)
 {
     $path = $this->arrayManager->findPath(static::CODE_BUNDLE_DATA, $meta, null, 'children');
     $meta = $this->arrayManager->merge($path, $meta, ['arguments' => ['data' => ['config' => ['dataScope' => '', 'opened' => true, 'sortOrder' => $this->getNextGroupSortOrder($meta, static::GROUP_CONTENT, static::SORT_ORDER)]]], 'children' => ['modal' => ['arguments' => ['data' => ['config' => ['isTemplate' => false, 'componentType' => Modal::NAME, 'dataScope' => '', 'provider' => 'product_form.product_form_data_source', 'options' => ['title' => __('Add Products to Option'), 'buttons' => [['text' => __('Cancel'), 'actions' => ['closeModal']], ['text' => __('Add Selected Products'), 'class' => 'action-primary', 'actions' => [['targetName' => 'index = bundle_product_listing', 'actionName' => 'save'], 'closeModal']]]]]]], 'children' => ['bundle_product_listing' => ['arguments' => ['data' => ['config' => ['autoRender' => false, 'componentType' => 'insertListing', 'dataScope' => 'bundle_product_listing', 'externalProvider' => 'bundle_product_listing.bundle_product_listing_data_source', 'selectionsProvider' => 'bundle_product_listing.bundle_product_listing.product_columns.ids', 'ns' => 'bundle_product_listing', 'render_url' => $this->urlBuilder->getUrl('mui/index/render'), 'realTimeLink' => false, 'dataLinks' => ['imports' => false, 'exports' => true], 'behaviourType' => 'simple', 'externalFilterMode' => true]]]]]], self::CODE_AFFECT_BUNDLE_PRODUCT_SELECTIONS => ['arguments' => ['data' => ['config' => ['componentType' => Form\Field::NAME, 'dataType' => Form\Element\DataType\Text::NAME, 'formElement' => Form\Element\Input::NAME, 'dataScope' => 'data.affect_bundle_product_selections', 'visible' => false, 'value' => '1']]]], self::CODE_BUNDLE_HEADER => $this->getBundleHeader(), self::CODE_BUNDLE_OPTIONS => $this->getBundleOptions()]]);
     //TODO: Remove this workaround after MAGETWO-49902 is fixed
     $bundleItemsGroup = $this->arrayManager->get($path, $meta);
     $meta = $this->arrayManager->remove($path, $meta);
     $meta = $this->arrayManager->set($path, $meta, $bundleItemsGroup);
     $meta = $this->modifyShipmentType($meta);
     return $meta;
 }
Exemplo n.º 30
0
 /**
  * {@inheritdoc}
  */
 public function modifyData(array $data)
 {
     $model = $this->locator->getProduct();
     $attributeSetId = $model->getAttributeSetId();
     $parameters = ['id' => $model->getId(), 'type' => $model->getTypeId(), 'store' => $model->getStoreId()];
     $actionParameters = array_merge($parameters, ['set' => $attributeSetId]);
     $reloadParameters = array_merge($parameters, ['popup' => 1, 'componentJson' => 1, 'prev_set_id' => $attributeSetId, 'type' => $this->locator->getProduct()->getTypeId()]);
     $submitUrl = $this->urlBuilder->getUrl($this->productUrls[self::KEY_SUBMIT_URL], $actionParameters);
     $validateUrl = $this->urlBuilder->getUrl($this->productUrls[self::KEY_VALIDATE_URL], $actionParameters);
     $reloadUrl = $this->urlBuilder->getUrl($this->productUrls[self::KEY_RELOAD_URL], $reloadParameters);
     return array_replace_recursive($data, ['config' => [self::KEY_SUBMIT_URL => $submitUrl, self::KEY_VALIDATE_URL => $validateUrl, self::KEY_RELOAD_URL => $reloadUrl]]);
 }