I am able to load product collection by using


in my phtml file.But in that collection product url is not there how can we get Product url also with that collection.


1 Answer 1


$productCollection = $productObj;

Gives from product collection url using loop the collection,

foreach($productCollection as $_product){ 
   echo $_product->getProductUrl();
  • Hi @Rakesh Actually I am loading collection in product detail page using this [$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection') ->addAttributeToFilter('type_id','bundle') ->addAttributeToFilter('product_identifier',$productIdentifier);] If I print [$productCollection->getData()] it is not giving products urls. Dec 20, 2016 at 11:38
  • Here my need is I want to give other product links in this current product detail page. Dec 20, 2016 at 11:40
  • have you try with, $_product->getProductUrl()? Dec 20, 2016 at 11:42
  • yes I tried using [$productCollection->getProductUrl()] but it is not giving any thing. Dec 20, 2016 at 11:44
  • plz share your full code Dec 20, 2016 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.