New answers tagged

0

Please get website's base URL from this code: public $_storeManager; public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, ..... ) { ... $this->_storeManager=$storeManager; } $url = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB); $orderUrl = $url.'sales/order/view/...


0

Try like this: <?php protected $checkoutSession; /** * Constructor * * @param Session $checkoutSession */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession ) { $this->checkoutSession = $checkoutSession; } public function getOrderInfo() { $orderId = $this-...


0

Try this :- public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Checkout\Model\Session $checkoutSession, array $data = [] ) { $this->checkoutSession = $checkoutSession; parent::__construct($context, $data); } // close bracket public function getLastOrder() ...


0

You can use the Integration tokens Use the following steps to generate an access token: Log in to Admin and click System > Extensions > Integrations to display the Integrations page. Click Add New Integration to display the New Integration page. Enter a unique name for the integration in the Name field. Then enter your admin password in the Your ...


0

A general practice in many frameworks is that if you want to reuse the same function in multiple places you write the function in a lightweight helper If you want a function that is there in a controller and you want to reuse it in a block, it would be best to move that function in a helper class and inject the object of the helper class in the constructor ...


0

Please follow the below step to call the controller function in the block. Step 1: Create a function in the controller file like below. Vendor\Module\Controller\Index\ControllerName.php public function getControllerFunction() { return __('Controller Function'); } After that call controller class in block construct and call controller function like ...


0

You can display your images in the model of magento. You can refer to this article: https://www.mageplaza.com/magento-2-module-development/view-block-layout-template-magento-2.html


1

Try with replacing below code for template and controller Template <form class="upload-form" name="UploadFrom" action="<?php echo $this->getUrl('investment/documents/index'); ?>" id="upload-form" method="post" enctype='multipart/form-data' autocomplete="off"> <fieldset class="...


Top 50 recent answers are included