getDescription in the slide down panel
I am trying to display the description for each product in the slide down panel. I am using a slider to display product images where I have a on hover buttons first one adds the product to basket and the second one triggers the slide down panel. It displays random products description not the one I click on.
<div id="owl-demo" class="owl-carousel">
<?php $categoryId = 4; // this is the category holding your products
$category = Mage::getModel('catalog/category')->load($categoryId);
$products = Mage::getModel('catalog/product')
->getCollection()
->addCategoryFilter($category);
$products->addAttributeToSelect(array(
'image',
'name',
'description',
'short_description',
'sku',
'asin'
))
->addFieldToFilter('visibility', array(
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
));
//$products->load();
foreach ($products as $product) {
?>
<div class="item">
<img class="lazyOwl" src="<?php echo $localHelper->getImageUrl($product); ?>" alt="img" />
<button type="button" title="<?php echo $this->__() ?>"
class="addp" onclick="setLocation
('<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')">
<span><span><?php echo $this->__() ?></span></span></button>
<button type="button" class="info" data-target='t1'>
<?php
$description = $product->getDescription();
?>
</button>
</div>
<?php
}
?>
</div>
<div class="toggles" data-target='t1'>
<p> <?php echo $description; ?> </p>
</div>
I would like to get Description for each products I click on no the same one for all of them.
magento-1.9 product php ce-1.9.0.1 jquery
add a comment |
I am trying to display the description for each product in the slide down panel. I am using a slider to display product images where I have a on hover buttons first one adds the product to basket and the second one triggers the slide down panel. It displays random products description not the one I click on.
<div id="owl-demo" class="owl-carousel">
<?php $categoryId = 4; // this is the category holding your products
$category = Mage::getModel('catalog/category')->load($categoryId);
$products = Mage::getModel('catalog/product')
->getCollection()
->addCategoryFilter($category);
$products->addAttributeToSelect(array(
'image',
'name',
'description',
'short_description',
'sku',
'asin'
))
->addFieldToFilter('visibility', array(
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
));
//$products->load();
foreach ($products as $product) {
?>
<div class="item">
<img class="lazyOwl" src="<?php echo $localHelper->getImageUrl($product); ?>" alt="img" />
<button type="button" title="<?php echo $this->__() ?>"
class="addp" onclick="setLocation
('<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')">
<span><span><?php echo $this->__() ?></span></span></button>
<button type="button" class="info" data-target='t1'>
<?php
$description = $product->getDescription();
?>
</button>
</div>
<?php
}
?>
</div>
<div class="toggles" data-target='t1'>
<p> <?php echo $description; ?> </p>
</div>
I would like to get Description for each products I click on no the same one for all of them.
magento-1.9 product php ce-1.9.0.1 jquery
add a comment |
I am trying to display the description for each product in the slide down panel. I am using a slider to display product images where I have a on hover buttons first one adds the product to basket and the second one triggers the slide down panel. It displays random products description not the one I click on.
<div id="owl-demo" class="owl-carousel">
<?php $categoryId = 4; // this is the category holding your products
$category = Mage::getModel('catalog/category')->load($categoryId);
$products = Mage::getModel('catalog/product')
->getCollection()
->addCategoryFilter($category);
$products->addAttributeToSelect(array(
'image',
'name',
'description',
'short_description',
'sku',
'asin'
))
->addFieldToFilter('visibility', array(
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
));
//$products->load();
foreach ($products as $product) {
?>
<div class="item">
<img class="lazyOwl" src="<?php echo $localHelper->getImageUrl($product); ?>" alt="img" />
<button type="button" title="<?php echo $this->__() ?>"
class="addp" onclick="setLocation
('<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')">
<span><span><?php echo $this->__() ?></span></span></button>
<button type="button" class="info" data-target='t1'>
<?php
$description = $product->getDescription();
?>
</button>
</div>
<?php
}
?>
</div>
<div class="toggles" data-target='t1'>
<p> <?php echo $description; ?> </p>
</div>
I would like to get Description for each products I click on no the same one for all of them.
magento-1.9 product php ce-1.9.0.1 jquery
I am trying to display the description for each product in the slide down panel. I am using a slider to display product images where I have a on hover buttons first one adds the product to basket and the second one triggers the slide down panel. It displays random products description not the one I click on.
<div id="owl-demo" class="owl-carousel">
<?php $categoryId = 4; // this is the category holding your products
$category = Mage::getModel('catalog/category')->load($categoryId);
$products = Mage::getModel('catalog/product')
->getCollection()
->addCategoryFilter($category);
$products->addAttributeToSelect(array(
'image',
'name',
'description',
'short_description',
'sku',
'asin'
))
->addFieldToFilter('visibility', array(
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
));
//$products->load();
foreach ($products as $product) {
?>
<div class="item">
<img class="lazyOwl" src="<?php echo $localHelper->getImageUrl($product); ?>" alt="img" />
<button type="button" title="<?php echo $this->__() ?>"
class="addp" onclick="setLocation
('<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')">
<span><span><?php echo $this->__() ?></span></span></button>
<button type="button" class="info" data-target='t1'>
<?php
$description = $product->getDescription();
?>
</button>
</div>
<?php
}
?>
</div>
<div class="toggles" data-target='t1'>
<p> <?php echo $description; ?> </p>
</div>
I would like to get Description for each products I click on no the same one for all of them.
magento-1.9 product php ce-1.9.0.1 jquery
magento-1.9 product php ce-1.9.0.1 jquery
edited 3 mins ago
Teja Bhagavan Kollepara
3,01241949
3,01241949
asked Nov 2 '15 at 12:17
Bako GdaniecBako Gdaniec
1241115
1241115
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
you have to echo description inside the loop. you are echo it outside the so it is showing last description.
$description='';
foreach ($products as $product) {
?>
<div class="item">
<img class="lazyOwl" src="<?php echo $localHelper->getImageUrl($product); ?>" alt="img" />
<button type="button" title="<?php echo $this->__() ?>"
class="addp" onclick="setLocation
('<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')">
<span><span><?php echo $this->__() ?></span></span></button>
<button type="button" class="info" data-target='t<?php echo $product->getId() ?>'>
<?php
$description .= $product->getDescription().'<br />';
?>
</button>
</div>
<?php
}
?>
</div>
<?php foreach ($products as $product) { ?>
<div class="toggles" data-target='t<?php echo $product->getid()?>'>
<p> <?php echo $product->getDescription(); ?> </p>
</div>
<?php } ?>
When I do that the whole slider messes up , as there is only 1 product in the slider and the rest of the products are underneath it. However they display correct description which is a good thing
– Bako Gdaniec
Nov 2 '15 at 12:27
check the update answer...
– Qaisar Satti
Nov 2 '15 at 12:29
The latest edit displays all of the product descriptions at once , when I click the button of the certain product in the dropdown there are all of the descriptions
– Bako Gdaniec
Nov 2 '15 at 12:36
update the answer follow that
– Qaisar Satti
Nov 2 '15 at 12:42
add a comment |
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%2f88566%2fgetdescription-in-the-slide-down-panel%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
you have to echo description inside the loop. you are echo it outside the so it is showing last description.
$description='';
foreach ($products as $product) {
?>
<div class="item">
<img class="lazyOwl" src="<?php echo $localHelper->getImageUrl($product); ?>" alt="img" />
<button type="button" title="<?php echo $this->__() ?>"
class="addp" onclick="setLocation
('<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')">
<span><span><?php echo $this->__() ?></span></span></button>
<button type="button" class="info" data-target='t<?php echo $product->getId() ?>'>
<?php
$description .= $product->getDescription().'<br />';
?>
</button>
</div>
<?php
}
?>
</div>
<?php foreach ($products as $product) { ?>
<div class="toggles" data-target='t<?php echo $product->getid()?>'>
<p> <?php echo $product->getDescription(); ?> </p>
</div>
<?php } ?>
When I do that the whole slider messes up , as there is only 1 product in the slider and the rest of the products are underneath it. However they display correct description which is a good thing
– Bako Gdaniec
Nov 2 '15 at 12:27
check the update answer...
– Qaisar Satti
Nov 2 '15 at 12:29
The latest edit displays all of the product descriptions at once , when I click the button of the certain product in the dropdown there are all of the descriptions
– Bako Gdaniec
Nov 2 '15 at 12:36
update the answer follow that
– Qaisar Satti
Nov 2 '15 at 12:42
add a comment |
you have to echo description inside the loop. you are echo it outside the so it is showing last description.
$description='';
foreach ($products as $product) {
?>
<div class="item">
<img class="lazyOwl" src="<?php echo $localHelper->getImageUrl($product); ?>" alt="img" />
<button type="button" title="<?php echo $this->__() ?>"
class="addp" onclick="setLocation
('<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')">
<span><span><?php echo $this->__() ?></span></span></button>
<button type="button" class="info" data-target='t<?php echo $product->getId() ?>'>
<?php
$description .= $product->getDescription().'<br />';
?>
</button>
</div>
<?php
}
?>
</div>
<?php foreach ($products as $product) { ?>
<div class="toggles" data-target='t<?php echo $product->getid()?>'>
<p> <?php echo $product->getDescription(); ?> </p>
</div>
<?php } ?>
When I do that the whole slider messes up , as there is only 1 product in the slider and the rest of the products are underneath it. However they display correct description which is a good thing
– Bako Gdaniec
Nov 2 '15 at 12:27
check the update answer...
– Qaisar Satti
Nov 2 '15 at 12:29
The latest edit displays all of the product descriptions at once , when I click the button of the certain product in the dropdown there are all of the descriptions
– Bako Gdaniec
Nov 2 '15 at 12:36
update the answer follow that
– Qaisar Satti
Nov 2 '15 at 12:42
add a comment |
you have to echo description inside the loop. you are echo it outside the so it is showing last description.
$description='';
foreach ($products as $product) {
?>
<div class="item">
<img class="lazyOwl" src="<?php echo $localHelper->getImageUrl($product); ?>" alt="img" />
<button type="button" title="<?php echo $this->__() ?>"
class="addp" onclick="setLocation
('<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')">
<span><span><?php echo $this->__() ?></span></span></button>
<button type="button" class="info" data-target='t<?php echo $product->getId() ?>'>
<?php
$description .= $product->getDescription().'<br />';
?>
</button>
</div>
<?php
}
?>
</div>
<?php foreach ($products as $product) { ?>
<div class="toggles" data-target='t<?php echo $product->getid()?>'>
<p> <?php echo $product->getDescription(); ?> </p>
</div>
<?php } ?>
you have to echo description inside the loop. you are echo it outside the so it is showing last description.
$description='';
foreach ($products as $product) {
?>
<div class="item">
<img class="lazyOwl" src="<?php echo $localHelper->getImageUrl($product); ?>" alt="img" />
<button type="button" title="<?php echo $this->__() ?>"
class="addp" onclick="setLocation
('<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')">
<span><span><?php echo $this->__() ?></span></span></button>
<button type="button" class="info" data-target='t<?php echo $product->getId() ?>'>
<?php
$description .= $product->getDescription().'<br />';
?>
</button>
</div>
<?php
}
?>
</div>
<?php foreach ($products as $product) { ?>
<div class="toggles" data-target='t<?php echo $product->getid()?>'>
<p> <?php echo $product->getDescription(); ?> </p>
</div>
<?php } ?>
edited Nov 2 '15 at 12:42
answered Nov 2 '15 at 12:19
Qaisar SattiQaisar Satti
27k1256109
27k1256109
When I do that the whole slider messes up , as there is only 1 product in the slider and the rest of the products are underneath it. However they display correct description which is a good thing
– Bako Gdaniec
Nov 2 '15 at 12:27
check the update answer...
– Qaisar Satti
Nov 2 '15 at 12:29
The latest edit displays all of the product descriptions at once , when I click the button of the certain product in the dropdown there are all of the descriptions
– Bako Gdaniec
Nov 2 '15 at 12:36
update the answer follow that
– Qaisar Satti
Nov 2 '15 at 12:42
add a comment |
When I do that the whole slider messes up , as there is only 1 product in the slider and the rest of the products are underneath it. However they display correct description which is a good thing
– Bako Gdaniec
Nov 2 '15 at 12:27
check the update answer...
– Qaisar Satti
Nov 2 '15 at 12:29
The latest edit displays all of the product descriptions at once , when I click the button of the certain product in the dropdown there are all of the descriptions
– Bako Gdaniec
Nov 2 '15 at 12:36
update the answer follow that
– Qaisar Satti
Nov 2 '15 at 12:42
When I do that the whole slider messes up , as there is only 1 product in the slider and the rest of the products are underneath it. However they display correct description which is a good thing
– Bako Gdaniec
Nov 2 '15 at 12:27
When I do that the whole slider messes up , as there is only 1 product in the slider and the rest of the products are underneath it. However they display correct description which is a good thing
– Bako Gdaniec
Nov 2 '15 at 12:27
check the update answer...
– Qaisar Satti
Nov 2 '15 at 12:29
check the update answer...
– Qaisar Satti
Nov 2 '15 at 12:29
The latest edit displays all of the product descriptions at once , when I click the button of the certain product in the dropdown there are all of the descriptions
– Bako Gdaniec
Nov 2 '15 at 12:36
The latest edit displays all of the product descriptions at once , when I click the button of the certain product in the dropdown there are all of the descriptions
– Bako Gdaniec
Nov 2 '15 at 12:36
update the answer follow that
– Qaisar Satti
Nov 2 '15 at 12:42
update the answer follow that
– Qaisar Satti
Nov 2 '15 at 12:42
add a comment |
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%2f88566%2fgetdescription-in-the-slide-down-panel%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