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.


$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. – shankar boss Dec 20 '16 at 11:38
  • Here my need is I want to give other product links in this current product detail page. – shankar boss Dec 20 '16 at 11:40
  • have you try with, $_product->getProductUrl()? – Rakesh Jesadiya Dec 20 '16 at 11:42
  • yes I tried using [$productCollection->getProductUrl()] but it is not giving any thing. – shankar boss Dec 20 '16 at 11:44
  • plz share your full code – Rakesh Jesadiya Dec 20 '16 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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