Magento 2 How can we get product url with product collection?
I am able to load product collection by using
[$objectManager->create('MagentoCatalogModelResourceModelProductCollection')]
in my phtml file.But in that collection product url is not there how can we get Product url also with that collection.
magento2 product-collection phtml product-urls
add a comment |
I am able to load product collection by using
[$objectManager->create('MagentoCatalogModelResourceModelProductCollection')]
in my phtml file.But in that collection product url is not there how can we get Product url also with that collection.
magento2 product-collection phtml product-urls
gist.github.com/thagxt/6efbabd952c4b32e1661c167143dafb0
– Jai
Dec 20 '16 at 11:28
1
Collection :blog.chapagain.com.np/magento-2-get-product-collection
– Jai
Dec 20 '16 at 11:30
@Jai Please see the below comment given to Rakesh
– shankar boss
Dec 20 '16 at 11:41
rakeshjesadiya.com/… you can check blog
– Rakesh Jesadiya
Jan 21 at 15:05
add a comment |
I am able to load product collection by using
[$objectManager->create('MagentoCatalogModelResourceModelProductCollection')]
in my phtml file.But in that collection product url is not there how can we get Product url also with that collection.
magento2 product-collection phtml product-urls
I am able to load product collection by using
[$objectManager->create('MagentoCatalogModelResourceModelProductCollection')]
in my phtml file.But in that collection product url is not there how can we get Product url also with that collection.
magento2 product-collection phtml product-urls
magento2 product-collection phtml product-urls
edited Dec 20 '16 at 11:30
Rakesh Jesadiya
29k1572120
29k1572120
asked Dec 20 '16 at 11:25
shankar bossshankar boss
58931229
58931229
gist.github.com/thagxt/6efbabd952c4b32e1661c167143dafb0
– Jai
Dec 20 '16 at 11:28
1
Collection :blog.chapagain.com.np/magento-2-get-product-collection
– Jai
Dec 20 '16 at 11:30
@Jai Please see the below comment given to Rakesh
– shankar boss
Dec 20 '16 at 11:41
rakeshjesadiya.com/… you can check blog
– Rakesh Jesadiya
Jan 21 at 15:05
add a comment |
gist.github.com/thagxt/6efbabd952c4b32e1661c167143dafb0
– Jai
Dec 20 '16 at 11:28
1
Collection :blog.chapagain.com.np/magento-2-get-product-collection
– Jai
Dec 20 '16 at 11:30
@Jai Please see the below comment given to Rakesh
– shankar boss
Dec 20 '16 at 11:41
rakeshjesadiya.com/… you can check blog
– Rakesh Jesadiya
Jan 21 at 15:05
gist.github.com/thagxt/6efbabd952c4b32e1661c167143dafb0
– Jai
Dec 20 '16 at 11:28
gist.github.com/thagxt/6efbabd952c4b32e1661c167143dafb0
– Jai
Dec 20 '16 at 11:28
1
1
Collection :blog.chapagain.com.np/magento-2-get-product-collection
– Jai
Dec 20 '16 at 11:30
Collection :blog.chapagain.com.np/magento-2-get-product-collection
– Jai
Dec 20 '16 at 11:30
@Jai Please see the below comment given to Rakesh
– shankar boss
Dec 20 '16 at 11:41
@Jai Please see the below comment given to Rakesh
– shankar boss
Dec 20 '16 at 11:41
rakeshjesadiya.com/… you can check blog
– Rakesh Jesadiya
Jan 21 at 15:05
rakeshjesadiya.com/… you can check blog
– Rakesh Jesadiya
Jan 21 at 15:05
add a comment |
1 Answer
1
active
oldest
votes
$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('MagentoCatalogModelResourceModelProductCollection') ->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
|
show 6 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f151111%2fmagento-2-how-can-we-get-product-url-with-product-collection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$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('MagentoCatalogModelResourceModelProductCollection') ->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
|
show 6 more comments
$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('MagentoCatalogModelResourceModelProductCollection') ->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
|
show 6 more comments
$productCollection = $productObj;
Gives from product collection url using loop the collection,
foreach($productCollection as $_product){
echo $_product->getProductUrl();
}
$productCollection = $productObj;
Gives from product collection url using loop the collection,
foreach($productCollection as $_product){
echo $_product->getProductUrl();
}
edited Jan 22 at 5:04
answered Dec 20 '16 at 11:30
Rakesh JesadiyaRakesh Jesadiya
29k1572120
29k1572120
Hi @Rakesh Actually I am loading collection in product detail page using this [$productCollection = $objectManager->create('MagentoCatalogModelResourceModelProductCollection') ->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
|
show 6 more comments
Hi @Rakesh Actually I am loading collection in product detail page using this [$productCollection = $objectManager->create('MagentoCatalogModelResourceModelProductCollection') ->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
Hi @Rakesh Actually I am loading collection in product detail page using this [$productCollection = $objectManager->create('MagentoCatalogModelResourceModelProductCollection') ->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
Hi @Rakesh Actually I am loading collection in product detail page using this [$productCollection = $objectManager->create('MagentoCatalogModelResourceModelProductCollection') ->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
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
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
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
plz share your full code
– Rakesh Jesadiya
Dec 20 '16 at 11:47
|
show 6 more comments
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f151111%2fmagento-2-how-can-we-get-product-url-with-product-collection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
gist.github.com/thagxt/6efbabd952c4b32e1661c167143dafb0
– Jai
Dec 20 '16 at 11:28
1
Collection :blog.chapagain.com.np/magento-2-get-product-collection
– Jai
Dec 20 '16 at 11:30
@Jai Please see the below comment given to Rakesh
– shankar boss
Dec 20 '16 at 11:41
rakeshjesadiya.com/… you can check blog
– Rakesh Jesadiya
Jan 21 at 15:05