0

Im currently using Magento CE 1.9 and I want to display the individual stock quantities of all the simple products associated with the configurable product.

When you click the "Only X Left" message on the product page on the front end these products display as per /template/cataloginventory/stockqty/composite.phtml

However only the quantities are showing but the simple product titles are note displaying.

Can anyone suggest why the titles aren't displaying and how to fix this?

Also how can you get this table to display showing all the quantities to display without having to click on the message?

2
  • please mention magento version
    – Amit Bera
    May 9, 2016 at 8:03
  • It says Magento CE 1.9
    – Klettseb
    May 9, 2016 at 8:13

1 Answer 1

0

In the template

/template/cataloginventory/stockqty/composite.phtml

the table on line 35 got css-class "no-display":

<table id="<?php echo $this->getDetailsPlaceholderId() ?>" class="availability-only-details no-display">

override the template in your design and delete the "no-display" css-class... and then format the table to fit your needs. If you do, you can also remove the javscript at the bottom of the template-file from line 56 to 65

<script type="text/javascript">
//<![CDATA[
$('<?php echo $this->getPlaceholderId() ?>').observe('click', function(event){
    this.toggleClassName('expanded');
    $('<?php echo $this->getDetailsPlaceholderId() ?>').toggleClassName('no-display');
    event.stop();
    decorateTable('<?php echo $this->getDetailsPlaceholderId() ?>');
});
//]]>
</script>
4
  • Thanks for that the table is now displaying as expected - do you have any ideas/suggestions on why the simple product names are not displaying in the table but the quantities are?
    – curtisc
    May 9, 2016 at 10:02
  • The table has the following: <?php foreach ($this->getChildProducts() as $childProduct) : ?> <?php $childProductStockQty = $this->getProductStockQty($childProduct); ?> <?php if ($childProductStockQty > 0) : ?> <tr> <td><?php echo $childProduct->getName() ?></td> <td class="a-center"><?php echo $childProductStockQty ?></td> </tr> <?php endif ?> <?php endforeach ?>
    – curtisc
    May 9, 2016 at 10:03
  • maybe the attribute for the name of the product is not "name"?=
    – roman204
    May 9, 2016 at 10:29
  • and please dont forget to mark my answer as useful.
    – roman204
    May 9, 2016 at 10:30

Your Answer

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

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