1

How to display the POSTION NUMBER as filled in the Associated Products Table, i dont wanna use the Count function, as it gives me Serial Numbering, i want it to display the same number FILLED in the position Coloum.

  • I have just figured the way of doing the same. – user3577666 Apr 30 '14 at 20:26
  • add the following '<td><?php echo $this->htmlEscape($_item->getPosition()) ?></td>' in the line where you want to show the position – user3577666 Apr 30 '14 at 20:29
  • Feel free to add an answer to your own question, possibly with a full code snippet as it could help someone else out. – David Manners May 1 '14 at 20:26
2

Thanks david, Edit the Group.phtml under /app/design/frontend/YOURTHEME/default/template/catalog/product/view/type

i have added Ref No (Position), Part Number (SKU), Req(Default Qnty) and made the Qnty as 0 for the Customer, you can edit as per your requirement.

The Code is

    <?php $this->setPreconfiguredValue(); ?>
<?php $_product = $this->getProduct(); ?>
<?php $_associatedProducts = $this->getAssociatedProducts(); ?>
<?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
<?php echo $this->getChildHtml('product_type_data_extra') ?>
<table class="data-table grouped-items-table" id="super-product-table">
    <col />
    <col />
    <col width="1" />
    <thead>
        <tr>
                <th width="4%" class="a-left"><?php echo $this->__('Ref No.') ?></th>
        <th width="30%" class="a-left"><?php echo $this->__('Part No.') ?></th>
        <th width="44%" class="a-center"><?php echo $this->__('Product Name') ?></th>
        <th width="4%" class="a-center"><?php echo $this->__('Req') ?></th>
            <?php if ($this->getCanShowProductPrice($_product)): ?>
                <th width="12%" class="a-right"><?php echo $this->__('Price') ?></th>
            <?php endif; ?>
            <?php if ($_product->isSaleable()): ?>
                <th width="6%" class="a-right"><?php echo $this->__('Qty') ?></th>
            <?php endif; ?>
        </tr> 
    </thead>
    <tbody>
    <?php if ($_hasAssociatedProducts): ?>
    <?php $count = 1;  ?>
    <?php foreach ($_associatedProducts as $_item): ?>
        <?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?>
        <tr>

            <td><?php echo $this->htmlEscape($_item->getPosition()) ?></td>
            <td><?php echo $this->htmlEscape($_item->getSKU()) ?></td>
            <td><?php echo $this->escapeHtml($_item->getName()) ?></td>
            <td><?php echo $_item->getQty()*1 ?></td>
            <?php if ($this->getCanShowProductPrice($_product)): ?>
            <td class="a-right">
                <?php if ($this->getCanShowProductPrice($_item)): ?>
                <?php echo $this->getPriceHtml($_item, true) ?>
                <?php echo $this->getTierPriceHtml($_item) ?>
                <?php endif; ?>
            </td>
            <?php endif; ?>
            <?php if ($_product->isSaleable()): ?>
            <td class="a-center">
            <?php if ($_item->isSaleable()) : ?>
                <input type="text" name="super_group[<?php echo $_item->getId() ?>]" maxlength="12" value="<?php echo $_item->getQty()*0 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
            <?php else: ?>
                <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
            <?php endif; ?>
            </td>
            <?php endif; ?>
        </tr>
    <?php $count++; ?>
    <?php endforeach; ?>
    <?php else: ?>
       <tr>
           <td colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>"><?php echo $this->__('No options of this product are available.') ?></td>
       </tr>
    <?php endif; ?>
    </tbody>
</table>
<script type="text/javascript">decorateTable('super-product-table')</script>

I am not very good in Magento, but this works great for me as i needed this solution. Good Luck

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.