Important
- For the pre-sale question, please feel free to contact us via live chat on Landofcoder.com ( From Monday to Friday 8:30 am - 5:30 pm GMT+7 ) or leave an offline message, we will give you a response asap.
- For technical questions, please submit a ticket below (recommended option) or send us an email via [email protected]. Our dev will support you within 24 hours since the submitted time (DO NOT support free extensions)
Hello Team,
I need to get the Seller name along with product list. To accomplish this, I joined the product collection with lof_marketplace_seller table: Please see my code here : https://magento.stackexchange.com/questions/193822/product-attribute-join-with-custom-table-magento-2-17-how-to-retrieve-custom-t
But i'm not able to get the seller_name using $value->getData('seller_name').
Can you please tell me how to get the seller name along with product list
Hi
Please change
That works. Thank you very much :)
I don't know why magneto dev docs not explaining the use of it's inner functions.
Hi
Yes,If you have any questions, just ask me
Thanks
Okay. Thank you.
Hi,
I have joined product collection with a custom table. From this i am getting product_id, seller_p_id(id of product assigned to seller), seller_id, and few more values.
Now i want to load customer data using seller_id(it is a customer id) to get customer name. please some tell me how to join these tables. I am very confused with the magento 2 joins.
here is the snippet of my join code:
/* Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollection; */
$collectionData = $productCollection->create();
$collectionData->addAttributeToSelect('*')->load();
$joinConditions = 'e.entity_id = marketplace_product.mageproduct_id';
$collectionData->getSelect()->joinLeft(
['marketplace_product'],
$joinConditions,
[]
)->columns(array('marketplace_product.mageproduct_id','marketplace_product.seller_id','e.entity_id'));
Hello Priti,
Have a nice day!
Please try to use the code:
/* Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollection; */
$collectionData = $productCollection->create();
$collectionData->addAttributeToSelect('*')->load();
$joinConditions = 'e.entity_id = marketplace_product.mageproduct_id';
$collectionData->getSelect()->joinLeft(
['marketplace_product'],
$joinConditions,
['marketplace_product.seller_id']
);
it will join left to table marketplace_product, then get the columns: seller_id, you can get all columns of the seller table by join left to the marketplace seller table, with join condition is seller_id.