문제

How can I programmatically build this url: http://127.0.0.1/magento2/sales/order/view/order_id/61/?

Im in a custom controller with the current Order object.

도움이 되었습니까?

해결책

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/order_id/'.$orderId;

You can pass $orderUrl in your external API.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top