Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Editing cart.phtml
 
tease
Sr. Member
 
Total Posts:  115
Joined:  2010-10-06
 

Hello everybody,

I hope somebody around here can help me out with a problem I have with my online shop.

I want to edit the shopping cart, so that only the selected options get displayed - not the titles (in my case the questions asked) of it.
Maybe you should take a look at my attached screenshots to get a better idea what I am trying to say.

On my site, you can select different options for every product. Now, when you put a product into the shopping cart, you see again the questions asked (marked bold) plus the option you selected.
Now, I want that only the selected option gets dsiplayed, not the qestions asked.

I tried to edit the cart.phtml, but don’t know to archieve it.

Heres a part of the code:

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <?php 
echo $this->getChildHtml('form_before'?>
    
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
        <
fieldset>
            <
table id="shopping-cart-table" class="data-table cart-table">
                <
col width="1" />
                <
col />
                <
col width="1" />
            
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
                
<col width="1" />
            
<?php endif ?>
            <?php 
if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                
<col width="1" />
            
<?php endif; ?>
            <?php 
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                
<col width="1" />
            
<?php endif; ?>
                
<col width="1" />
            
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                
<col width="1" />
            
<?php endif; ?>
            <?php 
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                
<col width="1" />
            
<?php endif; ?>
                
<col width="1" />

            
<?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 1); ?>
                
<thead>
                    <
tr>
                        <
th rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
                        <
th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Zusammenfassung Ihrer Bestellung'?></span></th>
                        <
th rowspan="<?php echo $mergedCells; ?>"></th>
                        
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
                        
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><span class="nobr"><?php echo $this->__('Move to Wishlist'?></span></th>
                        
<?php endif ?>
                        
<th class="a-center" colspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Unit Price'?></span></th>
                        <
th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Qty'?></th>
                        <
th class="a-center" colspan="<?php echo $mergedCells; ?>"><?php echo $this->__('Subtotal'?></th>
                        <
th rowspan="<?php echo $mergedCells; ?>" class="a-center">&nbsp;</th>
                    </
tr>
                    
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
                    
<tr>
                        <
th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false?></th>
                        <
th><?php echo $this->helper('tax')->getIncExcTaxLabel(true?></th>
                        <
th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false?></th>
                        <
th><?php echo $this->helper('tax')->getIncExcTaxLabel(true?></th>
                    </
tr>
                    
<?php endif; ?>
                
</thead>
                <
tfoot>
                    <
tr>
                        <
td colspan="50" class="a-right">
                            
<?php if($this->getContinueShoppingUrl()): ?>
                                
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping'?></span></span></button>
                            
<?php endif; ?>
                            
<button type="submit" title="<?php echo $this->__('Update Shopping Cart') ?>" class="button btn-update"><span><span><?php echo $this->__('Update Shopping Cart'?></span></span></button>
                        </
td>
                    </
tr>
                </
tfoot>
                <
tbody>
                
<?php foreach($this->getItems() as $_item): ?>
                    <?php 
echo $this->getItemHtml($_item?>
                <?php 
endforeach ?>
                
</tbody>
            </
table>
            <
script type="text/javascript">decorateTable('shopping-cart-table')</script>
        
</fieldset>
    </
form>

Any ideas? Any help is appreciated! Thanks a lot in advance!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lyonscg
Sr. Member
 
Avatar
Total Posts:  173
Joined:  2009-11-13
Chicago IL
 

I don’t remember off hand which phtml file contains the html for those options, but you’re too high up in the stack. You can do one of two things. Turn on template path hints which will show you where those options are coming from or if you use netbeans or eclipse (or something comparable) you can debug the code and follow it back to figure out where the html is coming from. Honestly though, template path hints is probably the way to go in this case.

In the admin panel, go to System -> Configuration -> Developer -> (Select store view from the top right corner drop down “Current Configuration Scope:") -> left col, “Debug” turn template path hints on.

Now go to the frontend and refresh the page. You will see a bunch of red boxes. Find the box around those options and it should tell you which phtml file is outputting the html.

If you still can’t find it with template path hints let me know and I’ll setup an instance similar to yours and find the code.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tease
Sr. Member
 
Total Posts:  115
Joined:  2010-10-06
 

Great tip, thank you!
I found out that the files responsible for the layout is template/checkout/cart/item/default.phtml

Now, I think it somewhere hidden in those lines:

.....
<
h2 class="product-name">
        
<?php if ($this->hasProductUrl()):?>
            
<a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->htmlEscape($this->getProductName()) ?></a>
        
<?php else: ?>
            <?php 
echo $this->htmlEscape($this->getProductName()) ?>
        <?php 
endif; ?>
        
</h2>
        
<?php if ($_options $this->getOptionList()):?>
        
<dl class="item-options">
            
<?php foreach ($_options as $_option) : ?>
            <?php $_formatedOptionValue 
$this->getFormatedOptionValue($_option?>
            
<dt><?php echo $this->htmlEscape($_option['label']?></dt>
            <
dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
                <?php 
if (isset($_formatedOptionValue['full_view'])): ?>
                
<div class="truncated_full_value">
                    <
dl class="item-options">
                        <
dt><?php echo $this->htmlEscape($_option['label']?></dt>
                        <
dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
                    </
dl>
                </
div>
                
<?php endif; ?>
            
</dd>
            
<?php endforeach; ?>
        
</dl>
        
<?php endif;?>
        <?php 
if ($messages $this->getMessages()): ?>
        <?php 
foreach ($messages as $message): ?>
            
<class="item-msg <?php echo $message['type'] ?>">* <?php echo $message['text'] ?></p>
        
<?php endforeach; ?>
        <?php 
endif; ?>
        <?php 
if ($addtInfoBlock $this->getProductAdditionalInformationBlock()):?>
            <?php 
echo $addtInfoBlock->setItem($_item)->toHtml() ?>
        <?php 
endif;?>
    
</td>
    <
td class="a-center">
        
<?php if ($isVisibleProduct): ?>
        
<a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo $this->__('Edit item parameters') ?>"><?php echo $this->__('Edit'?></a>
        
<?php endif ?>
    
</td>
    
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
    
<td class="a-center">
        
<?php if ($isVisibleProduct): ?>
        
<input type="checkbox" value="1" name="cart[<?php echo $_item->getId() ?>][wishlist]" title="<?php echo $this->__('Move to Wishlist') ?>" class="checkbox" />
        
<?php endif ?>
    
</td>
    
<?php endif ?>
and on and on

Any idea how to delete the title of the options?

Thanks!!!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top