本文整理汇总了PHP中Magento\Backend\Model\View\Result\ForwardFactory::create方法的典型用法代码示例。如果您正苦于以下问题:PHP ForwardFactory::create方法的具体用法?PHP ForwardFactory::create怎么用?PHP ForwardFactory::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Model\View\Result\ForwardFactory
的用法示例。
在下文中一共展示了ForwardFactory::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Create new product page
*
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
if (!$this->getRequest()->getParam('set')) {
return $this->resultForwardFactory->create()->forward('noroute');
}
$product = $this->productBuilder->build($this->getRequest());
$productData = $this->getRequest()->getPost('product');
if (!$productData) {
$sessionData = $this->_session->getProductData(true);
if (!empty($sessionData['product'])) {
$productData = $sessionData['product'];
}
}
if ($productData) {
$stockData = isset($productData['stock_data']) ? $productData['stock_data'] : [];
$productData['stock_data'] = $this->stockFilter->filter($stockData);
$product = $this->getInitializationHelper()->initializeFromData($product, $productData);
}
$this->_eventManager->dispatch('catalog_product_new_action', ['product' => $product]);
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
$resultPage = $this->resultPageFactory->create();
if ($this->getRequest()->getParam('popup')) {
$resultPage->addHandle(['popup', 'catalog_product_' . $product->getTypeId()]);
} else {
$resultPage->addHandle(['catalog_product_' . $product->getTypeId()]);
$resultPage->setActiveMenu('Magento_Catalog::catalog_products');
$resultPage->getConfig()->getTitle()->prepend(__('Products'));
$resultPage->getConfig()->getTitle()->prepend(__('New Product'));
}
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
if ($block) {
$block->setStoreId($product->getStoreId());
}
return $resultPage;
}
示例2: executeInternal
/**
* @return ResponseInterface|\Magento\Backend\Model\View\Result\Forward
*/
public function executeInternal()
{
/** @see \Magento\Sales\Controller\Adminhtml\Order\Invoice */
$creditmemoId = $this->getRequest()->getParam('creditmemo_id');
if ($creditmemoId) {
$creditmemo = $this->creditmemoRepository->get($creditmemoId);
if ($creditmemo) {
$pdf = $this->_objectManager->create(
'Magento\Sales\Model\Order\Pdf\Creditmemo'
)->getPdf(
[$creditmemo]
);
$date = $this->_objectManager->get('Magento\Framework\Stdlib\DateTime\DateTime')->date('Y-m-d_H-i-s');
return $this->_fileFactory->create(
'creditmemo' . $date . '.pdf',
$pdf->render(),
DirectoryList::VAR_DIR,
'application/pdf'
);
}
} else {
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('noroute');
return $resultForward;
}
}
示例3: executeInternal
/**
* Add new category form
*
* @return \Magento\Backend\Model\View\Result\Forward
*/
public function executeInternal()
{
$this->_objectManager->get('Magento\\Backend\\Model\\Auth\\Session')->unsActiveTabId();
/** @var \Magento\Backend\Model\View\Result\Forward $resultForward */
$resultForward = $this->resultForwardFactory->create();
return $resultForward->forward('edit');
}
示例4: executeInternal
/**
* @return ResponseInterface|\Magento\Backend\Model\View\Result\Forward
*/
public function executeInternal()
{
$shipmentId = $this->getRequest()->getParam('shipment_id');
if ($shipmentId) {
$shipment = $this->_objectManager->create('Magento\Sales\Model\Order\Shipment')->load($shipmentId);
if ($shipment) {
$pdf = $this->_objectManager->create(
'Magento\Sales\Model\Order\Pdf\Shipment'
)->getPdf(
[$shipment]
);
$date = $this->_objectManager->get('Magento\Framework\Stdlib\DateTime\DateTime')->date('Y-m-d_H-i-s');
return $this->_fileFactory->create(
'packingslip' . $date . '.pdf',
$pdf->render(),
DirectoryList::VAR_DIR,
'application/pdf'
);
}
} else {
/** @var \Magento\Backend\Model\View\Result\Forward $resultForward */
$resultForward = $this->resultForwardFactory->create();
return $resultForward->forward('noroute');
}
}
示例5: execute
/**
* forward to edit
*
* @return \Magento\Backend\Model\View\Result\Forward
*/
public function execute()
{
$this->_getSession()->unsMageplazaBlogCategoryActiveTabId();
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('edit');
return $resultForward;
}
示例6: executeInternal
/**
* Creditmemo information page
*
* @return \Magento\Backend\Model\View\Result\Page|\Magento\Backend\Model\View\Result\Forward
*/
public function executeInternal()
{
$this->creditmemoLoader->setOrderId($this->getRequest()->getParam('order_id'));
$this->creditmemoLoader->setCreditmemoId($this->getRequest()->getParam('creditmemo_id'));
$this->creditmemoLoader->setCreditmemo($this->getRequest()->getParam('creditmemo'));
$this->creditmemoLoader->setInvoiceId($this->getRequest()->getParam('invoice_id'));
$creditmemo = $this->creditmemoLoader->load();
if ($creditmemo) {
$resultPage = $this->resultPageFactory->create();
$resultPage->getLayout()->getBlock('sales_creditmemo_view')
->updateBackButtonUrl($this->getRequest()->getParam('come_from'));
$resultPage->setActiveMenu('Magento_Sales::sales_creditmemo');
if ($creditmemo->getInvoice()) {
$resultPage->getConfig()->getTitle()->prepend(
__("View Memo for #%1", $creditmemo->getInvoice()->getIncrementId())
);
} else {
$resultPage->getConfig()->getTitle()->prepend(__("View Memo"));
}
return $resultPage;
} else {
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('noroute');
return $resultForward;
}
}
示例7: execute
/**
* Creditmemo create page
*
* @return \Magento\Backend\Model\View\Result\Page|\Magento\Backend\Model\View\Result\Forward
*/
public function execute()
{
$this->creditmemoLoader->setOrderId($this->getRequest()->getParam('order_id'));
$this->creditmemoLoader->setCreditmemoId($this->getRequest()->getParam('creditmemo_id'));
$this->creditmemoLoader->setCreditmemo($this->getRequest()->getParam('creditmemo'));
$this->creditmemoLoader->setInvoiceId($this->getRequest()->getParam('invoice_id'));
$creditmemo = $this->creditmemoLoader->load();
if ($creditmemo) {
if ($comment = $this->_objectManager->get('Magento\\Backend\\Model\\Session')->getCommentText(true)) {
$creditmemo->setCommentText($comment);
}
$resultPage = $this->resultPageFactory->create();
$resultPage->setActiveMenu('Magento_Sales::sales_order');
$resultPage->getConfig()->getTitle()->prepend(__('Credit Memos'));
if ($creditmemo->getInvoice()) {
$resultPage->getConfig()->getTitle()->prepend(__("New Memo for #%1", $creditmemo->getInvoice()->getIncrementId()));
} else {
$resultPage->getConfig()->getTitle()->prepend(__("New Memo"));
}
return $resultPage;
} else {
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('noroute');
return $resultForward;
}
}
示例8: execute
/**
* Void creditmemo action
*
* @return \Magento\Backend\Model\View\Result\Redirect|\Magento\Backend\Model\View\Result\Forward
*/
public function execute()
{
$this->creditmemoLoader->setOrderId($this->getRequest()->getParam('order_id'));
$this->creditmemoLoader->setCreditmemoId($this->getRequest()->getParam('creditmemo_id'));
$this->creditmemoLoader->setCreditmemo($this->getRequest()->getParam('creditmemo'));
$this->creditmemoLoader->setInvoiceId($this->getRequest()->getParam('invoice_id'));
$creditmemo = $this->creditmemoLoader->load();
if ($creditmemo) {
try {
$creditmemo->void();
$transactionSave = $this->_objectManager->create('Magento\\Framework\\DB\\Transaction');
$transactionSave->addObject($creditmemo);
$transactionSave->addObject($creditmemo->getOrder());
if ($creditmemo->getInvoice()) {
$transactionSave->addObject($creditmemo->getInvoice());
}
$transactionSave->save();
$this->messageManager->addSuccess(__('You voided the credit memo.'));
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addError(__('We can\'t void the credit memo.'));
}
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setPath('sales/*/view', ['creditmemo_id' => $creditmemo->getId()]);
return $resultRedirect;
} else {
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('noroute');
return $resultForward;
}
}
示例9: execute
/**
* Invoice information page
*
* @return \Magento\Backend\Model\View\Result\Forward
*/
public function execute()
{
$resultForward = $this->resultForwardFactory->create();
if ($this->getRequest()->getParam('invoice_id')) {
$resultForward->setController('order_invoice')->setParams(['come_from' => 'invoice'])->forward('view');
} else {
$resultForward->forward('noroute');
}
return $resultForward;
}
示例10: execute
/**
* Shipment information page
*
* @return \Magento\Backend\Model\View\Result\Forward
*/
public function execute()
{
/** @var \Magento\Backend\Model\View\Result\Forward $resultForward */
$resultForward = $this->resultForwardFactory->create();
if ($this->getRequest()->getParam('shipment_id')) {
$resultForward->setController('order_shipment')->setModule('admin')->setParams(['come_from' => 'shipment'])->forward('view');
return $resultForward;
} else {
return $resultForward->forward('noroute');
}
}
示例11: executeInternal
/**
* Creditmemo information page
*
* @return \Magento\Backend\Model\View\Result\Forward
*/
public function executeInternal()
{
$resultForward = $this->resultForwardFactory->create();
if ($this->getRequest()->getParam('creditmemo_id')) {
$resultForward->setController('order_creditmemo');
$resultForward->setParams(['come_from' => 'sales_creditmemo']);
$resultForward->forward('view');
} else {
$resultForward->forward('noroute');
}
return $resultForward;
}
示例12: execute
/**
* @return ResponseInterface|void
*/
public function execute()
{
$invoiceId = $this->getRequest()->getParam('invoice_id');
if ($invoiceId) {
$invoice = $this->_objectManager->create('Magento\\Sales\\Model\\Order\\Invoice')->load($invoiceId);
if ($invoice) {
$pdf = $this->_objectManager->create('Magento\\Sales\\Model\\Order\\Pdf\\Invoice')->getPdf([$invoice]);
$date = $this->_objectManager->get('Magento\\Framework\\Stdlib\\DateTime\\DateTime')->date('Y-m-d_H-i-s');
return $this->_fileFactory->create('invoice' . $date . '.pdf', $pdf->render(), DirectoryList::VAR_DIR, 'application/pdf');
}
} else {
return $this->resultForwardFactory->create()->forward('noroute');
}
}
示例13: execute
/**
* Notify user
*
* @return \Magento\Backend\Model\View\Result\Forward|\Magento\Backend\Model\View\Result\Redirect
*/
public function execute()
{
$invoiceId = $this->getRequest()->getParam('invoice_id');
if (!$invoiceId) {
return $this->resultForwardFactory->create()->forward('noroute');
}
$invoice = $this->_objectManager->create('Magento\\Sales\\Model\\Order\\Invoice')->load($invoiceId);
if (!$invoice) {
return $this->resultForwardFactory->create()->forward('noroute');
}
$this->_objectManager->create('Magento\\Sales\\Model\\Order\\InvoiceNotifier')->notify($invoice);
$this->messageManager->addSuccess(__('We sent the message.'));
return $this->resultRedirectFactory->create()->setPath('sales/invoice/view', ['order_id' => $invoice->getOrder()->getId(), 'invoice_id' => $invoiceId]);
}
示例14: execute
/**
* Notify user
*
* @return \Magento\Backend\Model\View\Result\Forward|\Magento\Backend\Model\View\Result\Redirect
*/
public function execute()
{
$invoiceId = $this->getRequest()->getParam('invoice_id');
if (!$invoiceId) {
return $this->resultForwardFactory->create()->forward('noroute');
}
$invoice = $this->_objectManager->create('Magento\\Sales\\Api\\InvoiceRepositoryInterface')->get($invoiceId);
if (!$invoice) {
return $this->resultForwardFactory->create()->forward('noroute');
}
$this->_objectManager->create('Magento\\Sales\\Api\\InvoiceManagementInterface')->notify($invoice->getEntityId());
$this->messageManager->addSuccess(__('You sent the message.'));
return $this->resultRedirectFactory->create()->setPath('sales/invoice/view', ['order_id' => $invoice->getOrder()->getId(), 'invoice_id' => $invoiceId]);
}
示例15: execute
/**
* Shipment information page
*
* @return void
*/
public function execute()
{
$this->shipmentLoader->setOrderId($this->getRequest()->getParam('order_id'));
$this->shipmentLoader->setShipmentId($this->getRequest()->getParam('shipment_id'));
$this->shipmentLoader->setShipment($this->getRequest()->getParam('shipment'));
$this->shipmentLoader->setTracking($this->getRequest()->getParam('tracking'));
$shipment = $this->shipmentLoader->load();
if ($shipment) {
$resultPage = $this->resultPageFactory->create();
$resultPage->getLayout()->getBlock('sales_shipment_view')->updateBackButtonUrl($this->getRequest()->getParam('come_from'));
$resultPage->setActiveMenu('Magento_Sales::sales_shipment');
$resultPage->getConfig()->getTitle()->prepend(__('Shipments'));
$resultPage->getConfig()->getTitle()->prepend("#" . $shipment->getIncrementId());
return $resultPage;
} else {
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('noroute');
return $resultForward;
}
}