예제 #1
0
 /**
  * @return CheckoutSuccess
  */
 protected function _beforeToHtml()
 {
     parent::_beforeToHtml();
     if ($this->getInfo()->getMethod() === PaymentMethod::METHOD_CODE) {
         $this->shouldOutput = true;
     }
     return $this;
 }
예제 #2
0
파일: Totals.php 프로젝트: aiesh/magento2
 /**
  * Initialize self totals and children blocks totals before html building
  *
  * @return $this
  */
 protected function _beforeToHtml()
 {
     $this->_initTotals();
     foreach ($this->getLayout()->getChildBlocks($this->getNameInLayout()) as $child) {
         if (method_exists($child, 'initTotals') && is_callable([$child, 'initTotals'])) {
             $child->initTotals();
         }
     }
     return parent::_beforeToHtml();
 }
예제 #3
0
 /**
  * Prepare block text and determine whether block output enabled or not
  * Prevent blocks recursion if needed
  *
  * @return $this
  */
 protected function _beforeToHtml()
 {
     parent::_beforeToHtml();
     $blockId = $this->getData('block_id');
     $blockHash = get_class($this) . $blockId;
     if (isset(self::$_widgetUsageMap[$blockHash])) {
         return $this;
     }
     self::$_widgetUsageMap[$blockHash] = true;
     if ($blockId) {
         $storeId = $this->_storeManager->getStore()->getId();
         /** @var \Magento\Cms\Model\Block $block */
         $block = $this->_blockFactory->create();
         $block->setStoreId($storeId)->load($blockId);
         if ($block->isActive()) {
             $this->setText($this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent()));
         }
     }
     unset(self::$_widgetUsageMap[$blockHash]);
     return $this;
 }
예제 #4
0
    /**
     * Prepare block text and determine whether block output enabled or not
     * Prevent blocks recursion if needed
     *
     * @return $this
     */
    protected function _beforeToHtml()
    {
        $store = $this->_storeManager->getStore()->getId();
        if ($this->_scopeConfig->getValue(SliderModel::XMLSLIDERSTATUS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store)) {
            parent::_beforeToHtml();
            $sliderId = $this->getSliderId();
            if ($sliderId) {
                $storeId = $this->_storeManager->getStore()->getId();
                $slider = $this->_sliderFactory->create();
                $sliderData = $slider->load($sliderId);
                $sliderItemsData = $this->_slideritemsCollection->create()->addFieldToFilter('slideritem_slider', ['eq' => $sliderData->getId()])->addFieldToFilter('is_active', ['eq' => 1])->setOrder('slider_sort', 'desc');
                $responsive = implode(",", $slider->getResponsiveWidth());
                if ($sliderData->getSliderType() == 0) {
                    $sliderTemplate = new Fullwidth($this->_storeManager);
                }
                $sliderTemplate->setSliderResponsiveData($responsive);
                $sliderTemplate->setSliderData($sliderData);
                $sliderTemplate->setSlideritems($sliderItemsData);
                if ($sliderData->getStatus()) {
                    $output = $sliderTemplate->renderSliderLayout();
                    $output .= '<div class="slidercontainer';
                    $output .= $sliderData->getSliderHidexs() ? ' hidden-xs' : '';
                    $output .= '">';
                    $output .= '<div class="slider_' . $sliderData->getID() . '">';
                    $output .= $sliderTemplate->renderSlider();
                    $output .= '</div></div>';
                    $output .= '
							<script type="text/javascript">
							require([\'jquery\',\'sz/tbslider\'], function($) {
							});
							</script>';
                    $this->setText($output);
                }
            }
            return $this;
        }
    }
예제 #5
0
 /**
  * @return \Magento\Framework\View\Element\AbstractBlock
  */
 protected function _beforeToHtml()
 {
     $result = parent::_beforeToHtml();
     $isInCatalog = $this->getIsInCatalogProduct();
     if (!$this->_shortcutValidator->validate($this->_paymentMethodCode, $isInCatalog)) {
         $this->_shouldRender = false;
         return $result;
     }
     $quote = $isInCatalog || !$this->_checkoutSession ? null : $this->_checkoutSession->getQuote();
     // set misc data
     $this->setShortcutHtmlId($this->_mathRandom->getUniqueHash('ec_shortcut_'))->setCheckoutUrl($this->getUrl($this->_startAction));
     // use static image if in catalog
     if ($isInCatalog || null === $quote) {
         $this->setImageUrl($this->config->getExpressCheckoutShortcutImageUrl($this->_localeResolver->getLocale()));
     } else {
         /**@todo refactor checkout model. Move getCheckoutShortcutImageUrl to helper or separate model */
         $parameters = ['params' => ['quote' => $quote, 'config' => $this->config]];
         $checkoutModel = $this->_checkoutFactory->create($this->_checkoutType, $parameters);
         $this->setImageUrl($checkoutModel->getCheckoutShortcutImageUrl());
     }
     return $result;
 }
예제 #6
0
 /**
  * Initialize data and prepare it for output
  *
  * @return string
  */
 protected function _beforeToHtml()
 {
     $this->_prepareLastOrder();
     return parent::_beforeToHtml();
 }
예제 #7
0
 /**
  * Retrieve payment method and assign additional template values
  *
  * @return $this
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 protected function _beforeToHtml()
 {
     $methodInstance = $this->_quote->getPayment()->getMethodInstance();
     $this->setPaymentMethodTitle($methodInstance->getTitle());
     $this->setShippingRateRequired(true);
     if ($this->_quote->getIsVirtual()) {
         $this->setShippingRateRequired(false);
     } else {
         // prepare shipping rates
         $this->_address = $this->_quote->getShippingAddress();
         $groups = $this->_address->getGroupedAllShippingRates();
         if ($groups && $this->_address) {
             $this->setShippingRateGroups($groups);
             // determine current selected code & name
             foreach ($groups as $code => $rates) {
                 foreach ($rates as $rate) {
                     if ($this->_address->getShippingMethod() == $rate->getCode()) {
                         $this->_currentShippingRate = $rate;
                         break 2;
                     }
                 }
             }
         }
         $canEditShippingAddress = $this->_quote->getMayEditShippingAddress() && $this->_quote->getPayment()->getAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_BUTTON) == 1;
         // misc shipping parameters
         $this->setShippingMethodSubmitUrl($this->getUrl("{$this->_controllerPath}/saveShippingMethod"))->setCanEditShippingAddress($canEditShippingAddress)->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod());
     }
     $this->setEditUrl($this->getUrl("{$this->_controllerPath}/edit"))->setPlaceOrderUrl($this->getUrl("{$this->_controllerPath}/placeOrder"));
     return parent::_beforeToHtml();
 }
예제 #8
0
 /**
  * Initialize data and prepare it for output
  *
  * @return string
  */
 protected function _beforeToHtml()
 {
     $this->prepareBlockData();
     return parent::_beforeToHtml();
 }
예제 #9
0
파일: Success.php 프로젝트: aiesh/magento2
 /**
  * Before rendering html, but after trying to load cache
  *
  * @return $this
  */
 protected function _beforeToHtml()
 {
     $this->_prepareLastRecurringPayments();
     return parent::_beforeToHtml();
 }
예제 #10
0
 /**
  * @return \Magento\Framework\View\Element\AbstractBlock
  */
 protected function _beforeToHtml()
 {
     $result = parent::_beforeToHtml();
     /** @var \Magento\Paypal\Model\Config $config */
     $config = $this->_paypalConfigFactory->create();
     $config->setMethod($this->_paymentMethodCode);
     $isInCatalog = $this->getIsInCatalogProduct();
     if (!$this->_shortcutValidator->validate($this->_paymentMethodCode, $isInCatalog)) {
         $this->_shouldRender = false;
         return $result;
     }
     $quote = $isInCatalog || !$this->_checkoutSession ? null : $this->_checkoutSession->getQuote();
     // set misc data
     $this->setShortcutHtmlId($this->_mathRandom->getUniqueHash('ec_shortcut_'))->setCheckoutUrl($this->getUrl($this->_startAction));
     // use static image if in catalog
     if ($isInCatalog || null === $quote) {
         $this->setImageUrl($config->getExpressCheckoutShortcutImageUrl($this->_localeResolver->getLocale()));
     } else {
         /**@todo refactor checkout model. Move getCheckoutShortcutImageUrl to helper or separate model */
         $parameters = ['params' => ['quote' => $quote, 'config' => $config]];
         $checkoutModel = $this->_checkoutFactory->create($this->_checkoutType, $parameters);
         $this->setImageUrl($checkoutModel->getCheckoutShortcutImageUrl());
     }
     // ask whether to create a billing agreement
     $customerId = $this->currentCustomer->getCustomerId();
     // potential issue for caching
     if ($this->_paypalData->shouldAskToCreateBillingAgreement($config, $customerId)) {
         $this->setConfirmationUrl($this->getUrl($this->_startAction, [\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => 1]));
         $this->setConfirmationMessage(__('Would you like to sign a billing agreement to streamline further purchases with PayPal?'));
     }
     return $result;
 }
예제 #11
0
파일: View.php 프로젝트: vasuscoin/brand
 /**
  * Need use as _prepareLayout - but problem in declaring collection from
  * another block (was problem with search result)
  * @return $this
  */
 protected function _beforeToHtml()
 {
     return parent::_beforeToHtml();
 }
예제 #12
0
 /**
  * @return \Magento\Framework\View\Element\AbstractBlock
  */
 protected function _beforeToHtml()
 {
     $result = parent::_beforeToHtml();
     $isInCatalog = $this->getIsInCatalogProduct();
     if (!$this->_shortcutValidator->validate($this->_paymentMethodCode, $isInCatalog)) {
         $this->_shouldRender = false;
         return $result;
     }
     /** @var \Magento\Paypal\Model\Express $method */
     $method = $this->_paymentData->getMethodInstance($this->_bmlMethodCode);
     if (!$method->isAvailable()) {
         $this->_shouldRender = false;
         return $result;
     }
     $this->setShortcutHtmlId($this->_mathRandom->getUniqueHash('ec_shortcut_bml_'))->setCheckoutUrl($this->getUrl($this->_startAction))->setImageUrl(self::SHORTCUT_IMAGE)->setAdditionalLinkImage(['href' => 'https://www.securecheckout.billmelater.com/paycapture-content/' . 'fetch?hash=AU826TU8&content=/bmlweb/ppwpsiw.html', 'src' => 'https://www.paypalobjects.com/webstatic/en_US/btn/btn_bml_text.png']);
     return $result;
 }
예제 #13
0
파일: View.php 프로젝트: vasuscoin/brand
 /**
  * Need use as _prepareLayout - but problem in declaring collection from
  * another block (was problem with search result)
  * @return $this
  */
 protected function _beforeToHtml()
 {
     $collection = $this->getCollection();
     $toolbar = $this->getToolbarBlock();
     // set collection to toolbar and apply sort
     if ($toolbar) {
         $itemsperpage = (int) $this->getConfig('group_page/item_per_page', 12);
         $toolbar->setData('_current_limit', $itemsperpage)->setCollection($collection);
         $this->setChild('group-toolbar', $toolbar);
     }
     return parent::_beforeToHtml();
 }
예제 #14
0
파일: Payments.php 프로젝트: aiesh/magento2
 /**
  * Set back Url
  *
  * @return \Magento\RecurringPayment\Block\Payments
  */
 protected function _beforeToHtml()
 {
     $this->setBackUrl($this->getUrl('customer/account/'));
     return parent::_beforeToHtml();
 }