Get Backend Base Url in JS file Magento 2?

You can get base URL of the backend/admin panel in javascript(JS) file to fetch Custom URL of a site to call ajax request in backend area.

‘mage/url’ widget is not used to fetch backend base URL in Magento 2.

You need to create a template file using layout XML and define the base URL of the backend under the template file. Continue reading “Get Backend Base Url in JS file Magento 2?”

How to get Custom, Base URL in JS file Magento 2?

You can get the custom or base URL of the store in a javascript(JS) file for the frontend area using the 'mage/url' widgets.

You have to pass the 'mage/url' widget as a dependency in a define([]) or require([]) function of the javascript file. Continue reading “How to get Custom, Base URL in JS file Magento 2?”

How to Get Category Product Relation Table name Dynamically Magento 2?

You can get the category product table name dynamically using the Magento 2 Catalog module.

catalog_category_product table used for category-product relation.

The table contains entity_id, category_id, product_id, and position fields to manage relationships with products. Continue reading “How to Get Category Product Relation Table name Dynamically Magento 2?”