本文整理汇总了PHP中Magento\Backend\Model\View\Result\ForwardFactory类的典型用法代码示例。如果您正苦于以下问题:PHP ForwardFactory类的具体用法?PHP ForwardFactory怎么用?PHP ForwardFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ForwardFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:31,代码来源:NewAction.php
示例2: 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;
}
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:37,代码来源:Void.php
示例3: 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;
}
开发者ID:mageplaza,项目名称:magento-2-blog-extension,代码行数:12,代码来源:NewAction.php
示例4: 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;
}
开发者ID:rafaelstz,项目名称:magento2,代码行数:40,代码来源:NewAction.php
示例5: 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;
}
}
开发者ID:nblair,项目名称:magescotch,代码行数:29,代码来源:PrintAction.php
示例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;
}
}
开发者ID:nblair,项目名称:magescotch,代码行数:31,代码来源:View.php
示例7: 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');
}
}
开发者ID:nblair,项目名称:magescotch,代码行数:28,代码来源:PrintAction.php
示例8: 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');
}
开发者ID:nblair,项目名称:magescotch,代码行数:12,代码来源:Add.php
示例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;
}
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:15,代码来源:View.php
示例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');
}
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:View.php
示例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;
}
开发者ID:nblair,项目名称:magescotch,代码行数:17,代码来源:View.php
示例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');
}
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:PrintAction.php
示例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]);
}
开发者ID:opexsw,项目名称:magento2,代码行数:19,代码来源:Email.php
示例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]);
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:Email.php
示例15: testExecuteNoInvoice
/**
* @return void
*/
public function testExecuteNoInvoice()
{
$invoiceId = 2;
$this->requestMock->expects($this->once())
->method('getParam')
->with('invoice_id')
->will($this->returnValue($invoiceId));
$invoiceRepository = $this->getMockBuilder('Magento\Sales\Api\InvoiceRepositoryInterface')
->disableOriginalConstructor()
->getMock();
$invoiceRepository->expects($this->any())
->method('get')
->willReturn(null);
$this->objectManagerMock->expects($this->once())
->method('create')
->with('Magento\Sales\Api\InvoiceRepositoryInterface')
->willReturn($invoiceRepository);
$resultForward = $this->getMockBuilder('Magento\Backend\Model\View\Result\Forward')
->disableOriginalConstructor()
->getMock();
$resultForward->expects($this->once())->method('forward')->with(('noroute'))->will($this->returnSelf());
$this->resultForwardFactoryMock->expects($this->once())
->method('create')
->will($this->returnValue($resultForward));
$this->assertSame($resultForward, $this->controller->executeInternal());
}
开发者ID:nblair,项目名称:magescotch,代码行数:35,代码来源:CaptureTest.php
示例16: testExecuteNoCreditmemo
/**
* @return void
*/
public function testExecuteNoCreditmemo()
{
$this->requestMock->expects($this->once())->method('getParam')->with('creditmemo_id')->willReturn(null);
$this->resultForwardFactoryMock->expects($this->once())->method('create')->willReturn($this->resultForwardMock);
$this->resultForwardMock->expects($this->once())->method('forward')->with('noroute')->willReturnSelf();
$this->assertInstanceOf('Magento\\Backend\\Model\\View\\Result\\Forward', $this->controller->execute());
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:CancelTest.php
示例17: testEmailNoInvoice
public function testEmailNoInvoice()
{
$invoiceId = 10000031;
$this->request->expects($this->once())
->method('getParam')
->with('invoice_id')
->willReturn($invoiceId);
$invoiceRepository = $this->getMockBuilder('Magento\Sales\Api\InvoiceRepositoryInterface')
->disableOriginalConstructor()
->getMock();
$invoiceRepository->expects($this->any())
->method('get')
->willReturn(null);
$this->objectManager->expects($this->at(0))
->method('create')
->with('Magento\Sales\Api\InvoiceRepositoryInterface')
->willReturn($invoiceRepository);
$this->resultForwardFactory->expects($this->any())
->method('create')
->willReturn($this->resultForward);
$this->resultForward->expects($this->once())
->method('forward')
->with('noroute')
->willReturnSelf();
$this->assertInstanceOf('Magento\Backend\Model\View\Result\Forward', $this->invoiceEmail->executeInternal());
}
开发者ID:nblair,项目名称:magescotch,代码行数:29,代码来源:EmailTest.php
示例18: testExecuteNoCreditmemoId
/**
* @covers \Magento\Sales\Controller\Adminhtml\Order\Creditmemo\PrintAction::execute
*/
public function testExecuteNoCreditmemoId()
{
$this->prepareTestExecute();
$this->resultForwardFactoryMock->expects($this->once())->method('create')->willReturn($this->resultForwardMock);
$this->resultForwardMock->expects($this->once())->method('forward')->with('noroute')->willReturnSelf();
$this->assertInstanceOf('Magento\\Backend\\Model\\View\\Result\\Forward', $this->printAction->execute());
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:PrintActionTest.php
示例19: testExecuteAjax
/**
* @covers \Magento\Customer\Controller\Adminhtml\Index\Index::execute
*/
public function testExecuteAjax()
{
$this->prepareExecute(true);
$this->resultForwardFactoryMock->expects($this->once())->method('create')->willReturn($this->resultForwardMock);
$this->resultForwardMock->expects($this->once())->method('forward')->with('grid')->willReturnSelf();
$this->assertInstanceOf('Magento\\Backend\\Model\\View\\Result\\Forward', $this->indexController->execute());
}
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:IndexTest.php
示例20: testExecuteNoInvoice
/**
* @return void
*/
public function testExecuteNoInvoice()
{
$invoiceId = 2;
$this->requestMock->expects($this->once())->method('getParam')->with('invoice_id')->will($this->returnValue($invoiceId));
$this->invoiceRepository->expects($this->once())->method('get')->willReturn(null);
$resultForward = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Forward')->disableOriginalConstructor()->setMethods([])->getMock();
$resultForward->expects($this->once())->method('forward')->with('noroute')->will($this->returnSelf());
$this->resultForwardFactoryMock->expects($this->once())->method('create')->will($this->returnValue($resultForward));
$this->assertSame($resultForward, $this->controller->execute());
}
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:CancelTest.php
注:本文中的Magento\Backend\Model\View\Result\ForwardFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论