I want to get all the location names from the Multi Source Inventory (MSI). How could I get a collection of all locations in my custom module?
Here I want to create a new multi-select product attribute name "place", which has the values of all source names as its attribute values.
i.e. if there are 3 sources "US, UK, IN" then attribute has the same values "US, UK, IN" in product form.
How could I achieve this functionality? Do anyone have an idea about it?
I have attribute script as below:
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); $eavSetup->addAttribute(Product::ENTITY, 'place', [ 'group' => 'General', 'sort_order' => 30, 'type' => 'text', 'backend' => '\Module\Name\Model\Backend\Place', 'frontend' => '', 'class' => '', 'label' => 'Place', 'input' => 'multiselect', 'source' => '', 'global' => ScopedAttributeInterface::SCOPE_GLOBAL, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => '', 'searchable' => true, 'filterable' => true, 'comparable' => false, 'visible_on_front' => true, 'used_in_product_listing' => true, 'unique' => false ] );
Thanks in advance.