Get images out of product description in phtml file - php

as the title might let you suggest I have trouble to get image URL's out of product descriptions in my custom phtml file (located in template folder).
In cms pages/blocks you can use
{{media url="wysywig/Banner/image.jpg"}}
which we do for parts (headlines) of our product descriptions.
Now when I try to display that description out of my phtml file with
<?php echo nl2br($productResult[$i]->getDescription()); ?>
the description gets loaded but the image URL's dont get converted to total
URL's like for example "/media/wysywig/banner".
I know that you have to use Mage::getUrl("media") in php/phtml files though this information doesn't help much in my situation.
The only idea I have is to set a string function to search for
{{media url="wysywig/banner/image.jpg"}}
and replace it with
Mage::getUrl("media/wysywig/image.jpg")
but I kinda feel like this isn't a very elegant solution.
Or is it the only way? Any help is appreciated.
Much thanks and greetings mpfmon

It doesn't work because it was not planned for the product description to have such media call:
{{media url="wysywig/Banner/image.jpg"}}
However there is nothing wrong doing this, to make it work, you have to filter your description with a widget function:
echo Mage::getSingleton('widget/template_filter')->filter($description);

You must enable "Allow Dynamic Media URLs in Products and Categories" setting in Catalog section of Magento configuration screen. (See attached image)

Related

how to make a product image clickable and redirect to product details site in wordpress/woocommenrce/uncode theme

I couldn't find a tutorial or hint regarding making a product image in the wordpress theme "uncode" clickable. when clicking on the product image, it only opens the image in full size but doesnt rather redirect to the details page.
I assume it isn't a big thing that needs to be changed/added, but finding it seems quite difficult, as I have no experience regarding this theme at all.
thanks upfront!
EDIT: What I am trying to find out, is how to make this (tutorial for another theme https://slocumthemes.com/2015/10/how-to-make-woocommerce-thumbnails-clickable/) for my theme, uncode.
can anybody help? I think I found the line of code in one of the php files, but I have no proper experience of php
You can override woocommerce template.
Create a folder named woocommerce in your uncode theme and further corresponding folders where relevant file is added in woocommmerce plugin. e.g woocommerce/templates/single-product/product-image.php.
In that overridden file you can customize the HTML i.e link your image.

How to update admin html for Catalog > Manage Products > Edit Product > Images

In Magento admin, Catalog -> Manage Products -> Edit product -> Images tab, I'm looking to update the html that is loaded to the right for updating the product images. Specifically, I want to edit the alt attribute on the image html tags that are loaded there. I cannot find the html for this. Would anyone mind helping me find this?
The template file is app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml.
You actually can't do that.
Your attribute "alt" doesn't set by there. Each case is on case, you should look for "phtml" who render that image and see how / where it catch the "alt" attribute.
All times i've saw that, it's the product name.
You can change it by do your own phtml.
Edit: I recommend you to use "template hints" to find exactlly witch phtml you should use.

NextGen Gallery: Display title in the gallery

I want to display the title in the NextGen gallery. The plugin does not offer an option for that, so I have to somehow go past it, and modify the code.
NextGen Version:2.0.33.
Has anyone got across the same problem? How can I solve it?
Stefan - The view folder is in the modules/ngglegacy folder. New version I guess.
As for the gallery title, I modified some code I found here,
http://psychopixi.com/tech/how-to-link-back-to-an-album-in-a-nextgen-gallery/
It's actually for showing breadcrumbs and providing a back button, but if you change the values of the iterators myi and myi2 in lines 10 and 13 it will just output with the title, which you can format as you wish.
As per their suggestion I used the plugin Shortcode Exec PHP to make shortcode which I then placed in my gallery page. You can then place the shortcode for your gallery after.
It's not an elegant solution, and it assumes that the url of your gallery has the name of the gallery in it.
Good luck.
<?php echo $gallery->title ?>
Place this in your gallery template file wherever it's needed.
I found a solution to this problem having searched all day on inet.
Your 'view' folder is in the ngglegacy folder of the plugin. You can add <?php echo $gallery->title ?> to that file. Then goto Gallery options in your admin area and select gallery.php to show for the Basic Thumbnails.
thats it!

How do I find and edit PHTML files in Magento Go?

May I know how do I find and edit PHTML files in Magento Go? Read some places in forums that PHTML files cannot be edited. Wanted to confirm if that's indeed the case.
Saw this on a forum when I was searching on how to get rid of white spaces on the left and right of a product image in the grid view:
http://www.magentocommerce.com/boards/viewthread/177178/
Secondly we will have to change the way the image is rendered or
displayed when requested by magento, the file we need is list.phtml
which can be found in
“app/design/frontend/your_theme/template/catalog/product/list.phtml”.
First, search for the code below and change the values of;
resize(170), width="170", height="170" in the values of your image.
Resize 170 specify’s height thus if you image is 210x170 it should
look like below.
It shows that I have to find and edit the list.phtml file, however, I can't seem to find it, less edit it. CSS is fine as I know I can edit the "edit custom.css" under Design Editor in Magento Admin. Can someone please help me regarding the phtml files? Desperately seeking help.
Really appreciate your time and thank you so much in advance!
Cheers,
Matt
Magento Go does not allow you to modify the phtml files.
However, for modifying the dimensions of your images, you can do that according to the Magento Go Documentation.
http://go.magento.com/support/kb/entry/name/changing-the-size-of-catalog-images/
Go to Design > Themes Editor > Customize (Theme) > Catalog Images
Modify the dimensions of your images, then save.

Need some help coding zen cart product layout

I am currently working on my ecommerce website. Having a lot of trouble and I do not know where can I start editing the positioning of the product lay out.
For example:
http://www.picaflor-azul.com/free-demos/index.php?main_page=product_info&cPath=1_4&products_id=2
Currently my product layout in page is like this.
What I would like to achieve is something like that:
https://jawbone.com/up
Something like the section of "Designed for everyday life"
I would like to place my product image on the right.
Currently because I have made the width of the page bigger, it was aligned on left. Is there any way I can do to make it center?
Is there any zen cart experts here to help? Because I do not know what file do I have to edit in order to achieve what I want..
You will need to edit the product info display template file to get the layout you want. It can be found under the templates folder in your custom template folder. tpl_product_info_display.php.
You can then style the elements on this page by modifying the main CSS stylesheet for your template.

Categories