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

1.4.0.1 Categories Display Incorrectly (Changed “&” to “& amp;") in Category Page Title. 
 
webscot
Sr. Member
 
Total Posts:  192
Joined:  2009-05-12
 

Had to put spaces in the amp symbol in the title and below because it actually shows properly in this message unlike as described below in our category pages.

Simple problem! Hopefully a simple fix. Help please.

In our categories we use the ampersand ( & ). Now after upgrade to 1.4.0.1 all ampersands show as ( & amp; ) in the category-head title line of the Category page. Breadcrumbs and navigation are not affected.

Categories no longer show as “Dogs & Cats”

Instead they show as “Dogs & amp; Cats”

Changing the ( & ) to ( & amp; ) also results in “Dogs & amp;amp; Cats”

Using the word “and” is also unacceptable...too long and looks stupid in the navigation.

Can we get Varien to weigh in on this one? Anybody else having this problem? Did you find a fix?

 
Magento Community Magento Community
Magento Community
Magento Community
 
annie987
Jr. Member
 
Total Posts:  16
Joined:  2009-05-20
 

Yes, I’m having the same problem.  Trying to find a fix now.
Upgrading to 1.4 has created a huge amount of unplanned work, I wish we hadn\’t bothered!

 
Magento Community Magento Community
Magento Community
Magento Community
 
annie987
Jr. Member
 
Total Posts:  16
Joined:  2009-05-20
 

I have solved this now for the attribute display. 

To display characters such as “&” correctly in the product attritues display edit the following file in your theme:

\template\catalog\product\view\attributes.phtml

and replace the line:

<td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>

with the following…

<?php if ($_product->getAttributeText($_data['code']) ):  ?>
<td class="data"><?php echo $_product->getAttributeText($_data['code']) ?></td>
<?php else: ?>
<td class="data"><?php echo $this->htmlEscape($this->__($_data['value']))?></td>
<?php endif; ?>

I’m sure that you can do something similar for the Category Names by editing your \template\catalog\product\view.phtml file but you will probably have to change the memu display too.  I have decided to remove all “&” from the category names, but I can’t do that for the attribute values.

 
Magento Community Magento Community
Magento Community
Magento Community
 
enyceexdanny
Member
 
Total Posts:  34
Joined:  2009-05-05
 

For now just remove htmlEscape in: catalog > category > view.phtml

Change below

echo $_helper->categoryAttribute($_category$this->htmlEscape($this->getCurrentCategory()->getName()), 'name');

To

echo $_helper->categoryAttribute($_category$this->getCurrentCategory()->getName(), 'name');
 
Magento Community Magento Community
Magento Community
Magento Community
 
Marcin85
Member
 
Avatar
Total Posts:  48
Joined:  2009-10-23
Worcester
 

Thank you.
Works for me now.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tamburra
Member
 
Total Posts:  46
Joined:  2009-12-02
 

I am also getting this problem.  I tried enyceexdanny’s technique but it did not do anything.  I am still receiving this problem.  The view.phtml file did not change since 1.3.2.4 it looks like.  This problem has to be located elsewhere I think.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cnymike
Jr. Member
 
Total Posts:  27
Joined:  2009-04-14
 

Yes, I am also having this problem but am seeing it in the Product Name otherwise the ampersand is being displayed normal everywhere else. But If I replace the ampersand in the Product Name with the code for ampersand, I end up with two ampersand codes when the site is viewed.. It’s a nuisance for sure. Any sure fix for this yet?

 
Magento Community Magento Community
Magento Community
Magento Community
 
loeffel
Guru
 
Avatar
Total Posts:  427
Joined:  2009-02-03
 

Thank you, annie!

I am using a tweak that allows me to link attributes, this is the code I used to make both edits work along:

<td class="data">
                    
<?php if ($myType == "ATTRIBUTE-CODE#1" || $myType == "ATTRIBUTE-CODE#2"): ?>    
                        <?php 
if($myBlock): ?>
                            <?php 
echo $myBlock?>
                        <?php 
else: ?>
                            <?php 
if ($_product->getAttributeText($_data['code']) ):  ?>
                                <?php 
echo $_product->getAttributeText($_data['code']?>
                            <?php 
else: ?>
                               <?php 
echo $this->htmlEscape($this->__($_data['value']))?>
                            <?php 
endif; ?> 
                        <?php 
endif; ?>
                    <?php 
else: ?>
                        <?php 
if ($_product->getAttributeText($_data['code']) ):  ?>
                            <?php 
echo $_product->getAttributeText($_data['code']?>
                        <?php 
else: ?>
                           <?php 
echo $this->htmlEscape($this->__($_data['value']))?>
                        <?php 
endif; ?> 
                    <?php 
endif; ?>                   
                
</td>
 
Magento Community Magento Community
Magento Community
Magento Community
 
webscot
Sr. Member
 
Total Posts:  192
Joined:  2009-05-12
 

We are currently upgraded to 1.4.0.1 and we got this fixed and made the following changes:

In app/design/frontend/default/YOUR-THEME/template/catalog/category/view.phtml

Original:

<h2><?php echo $_helper->categoryAttribute($_category$this->htmlEscape($_category->getName()), 'name'?></h2>

Change to:

<h2><?php echo $_helper->categoryAttribute($_category$this->getCurrentCategory()->getName(), 'name'?></h2>

This change had to be made in 3 places at approximately lines 49, 63, and 84.

In app/design/frontend/default/YOUR-THEME/template/catalog/product/view.phtml

Original on about line 52:

<?php echo $_helper->productAttribute($_product$this->htmlEscape($_product->getName()), 'name'?>

Change to:

<?php echo $_helper->productAttribute($_product$_product->getName(), 'name'?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
idsagency
Jr. Member
 
Total Posts:  4
Joined:  2009-11-23
 

Confiming “webscot” theory works. I only had to change product files

 
Magento Community Magento Community
Magento Community
Magento Community
 
idealiverybgz
Jr. Member
 
Total Posts:  5
Joined:  2009-02-25
 

how do i completely remove this image thing?

 
Magento Community Magento Community
Magento Community
Magento Community
 
abquaad
Jr. Member
 
Total Posts:  5
Joined:  2010-05-04
 

Hi
You can also try this before changing the code

go to Catalog>Attributes>Manage Attributes,
then click the “name” attribute code in the first column to open the properties window.
Scroll down in the window until you see “Allow HTML-tags on Front-end” and be sure to set the value to “Yes.”
Save your changes and then check your store.
This should fix the problem and you should now see “&” instead of “&” in the Product Name.

AB

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paine
Member
 
Total Posts:  73
Joined:  2010-01-25
 

@abquaad
That option is no longer available as of 1.4.0

 
Magento Community Magento Community
Magento Community
Magento Community
 
thiendru
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2010-10-01
 
enyceexdanny - 31 March 2010 03:42 PM

For now just remove htmlEscape in: catalog > category > view.phtml

Change below

echo $_helper->categoryAttribute($_category$this->htmlEscape($this->getCurrentCategory()->getName()), 'name');

To
echo $_helper->categoryAttribute($_category$this->getCurrentCategory()->getName(), 'name');

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
karldrei
Jr. Member
 
Total Posts:  6
Joined:  2008-02-17
 
Paine - 14 July 2010 05:27 AM

@abquaad
That option is no longer available as of 1.4.0

yes, it is available!

that solution works perfect!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cowboyup19c
Jr. Member
 
Total Posts:  2
Joined:  2011-10-27
 

I can also confirm that “webscot” theory works and I only had to change product file as well.

http://www.bkccooking.com

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