3

Broken Links from wysiwyg on frontend of Magento store.

The URL's on broken pages are like below:

Admin -

<img src="{{media url="wysiwyg/image.png"}}" alt="image" />

Frontend -

<img src="{{media url=" wysiwyg="" image.png"}}"="" alt="image">

My Urls created from Wysiwyg seem to be fine within admin and are only broken on category and product pages where the shortcodes seem to fail. however they still seem to be working on CMS Pages.

I have looked at the template files and am wondering if they need changing since recent SUPEE 6822 update (however I updated months ago and it didn't seem to be a problem then initially). As other questions have been solved by processing html content like below in the case of a cms page:

    $html_content = $content_from_db['content'];$html_content =          Mage::helper('cms')->getPageTemplateProcessor()->filter($html_content); echo $html_content;`

Also have considered that the permissions introduced in SUPEE 6822 may be effecting parts of the pages ability to translate shortcodes like in this issue with static blocks however I feel the category and product pages should have permission as default:

https://community.magento.com/t5/Technical-Issues/Static-block-shortcodes-not-working-1-9-2-2/td-p/20096

3
  • magento.stackexchange.com/questions/85310/… check here Commented Jan 12, 2016 at 12:52
  • I have looked at this, it seems very similar, i just cant figure out the solution of "Before echo this statement, the html content should be process by the processor from helper "cms". " Below is the code: $html_content = $content_from_db['content'];$html_content = Mage::helper('cms')->getPageTemplateProcessor()->filter($html_content); echo $html_content;`
    – harri
    Commented Jan 12, 2016 at 17:44
  • I understand that the shortcodes {{ are not translating somehow but in my case its effecting my category and product pages all of a sudden and not cms pages. I suppose I need to know what causes the shortcodes to be translated in category and product pages and run that helper on the code as it must of stopped working somehow?
    – harri
    Commented Jan 12, 2016 at 17:54

3 Answers 3

1

Check that System -> Configuration -> Catalog -> Frontend -> "Allow Dynamic Media URLs in Products and Categories" is set to YES.

0

Try this:

<img alt="" src="{{media url='wysiwyg/image.png'}}">

And make sure that the media/wysiwyg folder has the correct permissions

1
  • I have tried this with no luck. Also I have not messed with any of the img elements recently ( they were all working perfectly) and all seemed to have broken at the same time randomly but only on category and product pages leading me to believe its an issue with how this media tag is not being processed properly under these conditions.
    – harri
    Commented Jan 12, 2016 at 14:00
0

Two years late, but after a lot of failed google-fu I had to find the answer for this, so here:

In backend the content is as follows:

 img src="{{media url='wysiwyg/foo.jpg'}}" 
 img src="{{media url="wysiwyg/foo.jpg"}}" 

Either of the above (single/double quotes) should work fine when parsed, but if the content is not properly parsed they will look different, though equally broken.

Let's look in THEME/THEME/template/catalog/product/list.phtml and change

<?php echo $_product->getShortDescription() ?>

to

<?php $_helper = $this->helper('catalog/output');  ?>
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description'); ?>

You likely need to check in THEME/THEME/template/catalog/product/view.phtml if the shortcodes do not show properly when viewing a product. Look for $_product->getShortDescription() and edit it to something like this:

<div class="short-description">
  <h2><?php echo $this->__('Quick Overview') ?></h2>
  <div class="std"><?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?></div>
</div>

One last place to look is the template for the (non-short) description, it is most likely at:

frontend/base/default/template/catalog/product/view/description.phtml

and if that is the one actually being used, then it should work fine. But if it does not display properly then your theme has overriden it, in which case use magento's template path hints to discover it's location... it might actually be a block under product/view/tabs.phtml or not a distinct block at all.

If you came here looking for a fix for shortcodes in cms pages, go here: Cannot display image inserted by WYSIWYG editor

Your Answer

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

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