• Magento 2

    magento2 get base url and media url and static url

    magento2 get base url and media url and static url magento2 get base url and media url and static url. Whenever you are working on  magento2 then a lot of times you need to get base URL and media URL and static url. From this blog, you base url, media url, static content url in Magento2.Magento2 basically, use interface [crayon-5bc5b956467e9615772937/] And this class have a function  Store()  which is provide store data. After that,  using getBaseUrl() over Store()  you can get base url  and also get Media URL. [crayon-5bc5b956467f0256304710/] Where $storeManager is the instance of Magento\Store\Model\StoreManagerInterface. If you want to get Base Url without Index.php then click here. For Getting Media Url Use Below code: [crayon-5bc5b956467f3288357121/] Get Static content Url [crayon-5bc5b956467f5873452606/] But I…

  • Magento2 get cart and checkout link in block or phtml
    Magento 2

    Magento2 get cart and checkout link in block or phtml

    Magento2 get cart and checkout link in block or phtml In Magento2 get cart and checkout link in block or phtml then you need to call getUrl() method.It is every easy to get those url at Phtml or block class. Also, there is no need to write layout xml code for getting cart and checkout page url at magento 2. If want to get cart & checkout link at PHTML file then try below code: Checkout Url [crayon-5bc5b956470d5576990523/] Cart Url [crayon-5bc5b956470db881341687/]   If you want to call at block class try with Checkout link: [crayon-5bc5b956470dd241143799/]   and Cart link: [crayon-5bc5b956470de128953146/] I hope this will help lots. More Import Blogs: Magento2…