當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ViewInterface::loadLayout方法代碼示例

本文整理匯總了PHP中Magento\Framework\App\ViewInterface::loadLayout方法的典型用法代碼示例。如果您正苦於以下問題:PHP ViewInterface::loadLayout方法的具體用法?PHP ViewInterface::loadLayout怎麽用?PHP ViewInterface::loadLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\App\ViewInterface的用法示例。


在下文中一共展示了ViewInterface::loadLayout方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getItems

 /**
  * Get wishlist items
  *
  * @return array
  */
 protected function getItems()
 {
     $this->view->loadLayout();
     $collection = $this->wishlistHelper->getWishlistItemCollection();
     $collection->clear()->setPageSize(self::SIDEBAR_ITEMS_NUMBER)->setInStockFilter(true)->setOrder('added_at');
     $items = [];
     foreach ($collection as $wishlistItem) {
         $items[] = $this->getItemData($wishlistItem);
     }
     return $items;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:16,代碼來源:Wishlist.php

示例2: getItems

 /**
  * Get wishlist items
  *
  * @return array
  */
 protected function getItems()
 {
     $this->view->loadLayout();
     $collection = $this->wishlistHelper->getWishlistItemCollection();
     $collection->clear()->setPageSize(self::SIDEBAR_ITEMS_NUMBER)->setInStockFilter(true)->setOrder('added_at');
     $items = [];
     foreach ($collection as $wishlistItem) {
         /** @var \Magento\Catalog\Model\Product $product */
         $product = $wishlistItem->getProduct();
         $this->productImageView->init($product, 'wishlist_sidebar_block', 'Magento_Catalog');
         $items[] = ['image' => ['src' => $this->productImageView->getUrl(), 'alt' => $this->productImageView->getLabel(), 'width' => $this->productImageView->getWidth(), 'height' => $this->productImageView->getHeight()], 'product_url' => $this->wishlistHelper->getProductUrl($wishlistItem), 'product_name' => $product->getName(), 'product_price' => $this->block->getProductPriceHtml($product, \Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, ['item' => $wishlistItem]), 'product_is_saleable_and_visible' => $product->isSaleable() && $product->isVisibleInSiteVisibility(), 'product_has_required_options' => $product->getTypeInstance()->hasRequiredOptions($product), 'add_to_cart_params' => $this->wishlistHelper->getAddToCartParams($wishlistItem), 'delete_item_params' => $this->wishlistHelper->getRemoveParams($wishlistItem)];
     }
     return $items;
 }
開發者ID:vasiljok,項目名稱:magento2,代碼行數:19,代碼來源:Wishlist.php

示例3: execute

 /**
  * Set data for response of frontend saveOrder action
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     /* @var $order \Magento\Sales\Model\Order */
     $order = $this->_coreRegistry->registry('hss_order');
     if ($order && $order->getId()) {
         $payment = $order->getPayment();
         if ($payment && in_array($payment->getMethod(), $this->_paypalHss->getHssMethods())) {
             $result = $observer->getData('result')->getData();
             if (empty($result['error'])) {
                 $this->_view->loadLayout('checkout_onepage_review', true, true, false);
                 $html = $this->_view->getLayout()->getBlock('paypal.iframe')->toHtml();
                 $result['update_section'] = ['name' => 'paypaliframe', 'html' => $html];
                 $result['redirect'] = false;
                 $result['success'] = false;
                 $observer->getData('result')->setData($result);
             }
         }
     }
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:25,代碼來源:SetResponseAfterSaveOrderObserver.php

示例4: setResponseAfterSaveOrder

 /**
  * Set data for response of frontend saveOrder action
  *
  * @param EventObserver $observer
  * @return $this
  */
 public function setResponseAfterSaveOrder(EventObserver $observer)
 {
     /* @var $order \Magento\Sales\Model\Order */
     $order = $this->_coreRegistry->registry('hss_order');
     if ($order && $order->getId()) {
         $payment = $order->getPayment();
         if ($payment && in_array($payment->getMethod(), $this->_paypalHss->getHssMethods())) {
             /* @var $controller \Magento\Framework\App\Action\Action */
             $controller = $observer->getEvent()->getData('controller_action');
             $result = $this->_coreData->jsonDecode($controller->getResponse()->getBody('default'));
             if (empty($result['error'])) {
                 $this->_view->loadLayout('checkout_onepage_review', true, true, false);
                 $html = $this->_view->getLayout()->getBlock('paypal.iframe')->toHtml();
                 $result['update_section'] = array('name' => 'paypaliframe', 'html' => $html);
                 $result['redirect'] = false;
                 $result['success'] = false;
                 $controller->getResponse()->clearHeader('Location');
                 $controller->getResponse()->representJson($this->_coreData->jsonEncode($result));
             }
         }
     }
     return $this;
 }
開發者ID:zhangjiachao,項目名稱:magento2,代碼行數:29,代碼來源:Observer.php


注:本文中的Magento\Framework\App\ViewInterface::loadLayout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。