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 firstname.lastname@example.org.
Ampersand Symbols showing in attributes after upgrade & - &
I’m having the same issue. I’ve managed to reproduce this via the CMS.
- Create an attribute of type ‘select’
- Add an option with an ampersand in it. E.g. “A & L”
- Save this attribute
The “A & L” becomes “A & L”. Saving this attribute again without modifying any of the values re-encodes the ampersand so that the result becomes “A &amp; L”.
Since we have automated importers many of these attributes are saved with no human intervention. I can write code in these importers to mitigate the symptoms, but it would be far better to attack the core problem. I suspect that even adding options to a select attribute triggers a re-encode on all attributes which should not otherwise need re-saving.
Note: This forum seems to have a similar HTML-encoding issue. Wish it wouldn’t encode my html escaped code for me. >_>
Line 168 of /app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
If we comment out $label = $helperCatalog->escapeHtml($label) or the loops surrounding it then that ‘fixes’ the issue.
Unfortunately this is a controller file, so you can’t just create a copy in local to override it, we would have to replicate it in our module and then override the route.
I commented out the function call to prevent the attributes being encoded again. It looks like the old code used ->stripTags instead of ->escapeHtml, which by default didn’t html encode the text. Perhaps the older code should have been kept.