I want to change search image in magento. On search in magento the image name is btn_search.gif. Right now it take image from skin/frontend/default/default/images. And the file is /app/design/frontend/default/default/template/catalogsearch/form.mini.phtml where mention this tag as
<input id="search-button" type="image" src="<?php echo $this->getSkinUrl('images/btn_search.gif') ?>" alt="<?php echo $this->__('Search') ?>" />
I check the code and i found that we can pass locale as _type in this as
<input id="search-button" type="image" src="<?php echo $this->getSkinUrl('images/btn_search.gif', array('_type'=>'local')) ?>" alt="<?php echo $this->__('Search') ?>" />
But when i check the code this will just check in locale directory that this file exist in that locale or not. If this exist then it will take skin image. I want to use that locale image instead of that skin image.
So when i click on french store i get the image which is i set in /app/design/frontend/default/default/locale/fr_FR/images/btn_search.gif
I check the code for getSkinUrl in /app/code/core/Mage/Core/Model/Design/Package.php. And i found that he check locale for file but it return skin url.
Is there any method which return locale url ?
I got the answer
This is how I have made the buttons language (locale) dependent within magento commerce
I started with the mini-search form on the homepage. The search image button for that form is defined in
/app/design/frontend///template/catalogsearch/form.mini.phtml
In that file i’ve changed the following line
<input type="image" src="<?php echo $this->getSkinUrl('images/btn_mini_search.gif') ?>" alt="<?php echo $this->__('Search') ?>"/>
to
<input type="image" src="<?php echo $this->getSkinUrl('images/btn_mini_search_'.$this->__('_LOCALE_BUTTON_').'.gif') ?>" alt="<?php echo $this->__('Search') ?>"/>
Then I added the translation for _LOCALE_BUTTON_ to all the the locale translate.csv files:
/app/design/frontend///locale//translate.csv:
I.e.
Locale en_GB: _LOCALE_BUTTON_,en_GB
Locale nl_NL: _LOCALE_BUTTON_,nl_NL
For each translation make sure you have the locale suffix button image files available in the /skin/frontend///images/ directory:
I.e.
btn_mini_search_en_GB.gif
btn_mini_search_nl_NL.gif
I think you can also make the translation for _LOCALE_BUTTON_ to represent a folder by changing the line mentioned above to:
<input type="image" src="<?php echo $this->getSkinUrl('images/locale/'.$this->__('_LOCALE_BUTTON_').'/btn_mini_search.gif') ?>" alt="<?php echo $this->__('Search') ?>"/>
but then you need to save the locale suffix button image files like this:
/skin/frontend///images/ locale/en_GB/btn_mini_search.gif and
/skin/frontend///images/ locale/nl_NL/btn_mini_search.gif
I haven’t tested the last method myself, but I don’t see any reasons why it shouldn’t work.
I’ve also been thinking about replacing the _LOCALE_BUTTON_ value with the regular ‘Search’ string (Not recommended!!)
The advantage of this method is that you don’t need to add seperate translations to the translate.csv files but then you run the risk that certain translations can be similar for multiple locales (duplicate keys). Besides that it can lead to issues, when non-ascii/utf-8 characters are used in the translations, but that depends on the operating/file system you are using.
Related
I want to be able to add an image next to the title of an article (and be able to select the image for each article - not just a one and done setting). I modified the /administrator/components/com_content/models/forms/article.xml file by adding these fields at the top of the section:
<field
name="titleImage"
type="media"
label="Title Image"
description="Image that will be displayed next to the article's title." />
<field
name="spacer0"
type="spacer"
hr="true"
/>
This adds the parameter to the Edit Article page and lets me select an image.
I added this code to my theme's com_content/article/default.php page (inside the if ($params->get('show_title')) block):
<?php if($this->params->get('titleImage')){ ?>
<img class="titleImage" src="<?php echo htmlspecialchars($images->titleImage); ?>" alt="Title Image" />
<?php } ?>
The image is not appearing on the page. I'm new to Joomla so it may be obvious, but what am I missing?
Thanks!
In 2.5 there is already a standardized image field (actually 2) and all you have to really do is make a layout override to put the images where you want them.
YOu should modify the form using a plugin if you go that route. I would modify the image field to add a third image if you are already using the two of hem.
After some testing I found out why it wasn't working:
Firstly, you need to ensure you add the field to a specific place in article.xml. I would suggest adding it before or after <field name="show_title"> on line 127
Then, you can call the parameter like so:
<?php if ($params->get('titleImage')) : ?>
<img class="titleImage" src="<?php echo JURI::root() . $params->get('titleImage'); ?>" alt="Title Image" />
<?php endif; ?>
Hope this helps
I uninstalled an extension and afterwards all of my product images displayed on category pages resized to 135x135 instead of 209x209. I checked the list.phtml and this is what I found:
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(209); ?>" width="209" height="209" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
Although this looks right to me I am also find a random css attribute that appears to be the culprit I just cannot find any source of the rule.
img[Attributes Style] {
width: 135px;
height: 135px;
}
You can see my problem here
An extension is overwriting the template for the product list, so the file you modified (list.phtml) isn't actually what's showing.
If you have any extensions affecting the product list pages, check to see if they have anything in the layout xml file that looks like this: <action method="setTemplate"><template>XXX.phtml</template></action>.
this is lazy trick..use a software has feature search text in file, then try search with search keyword "resize(135"
I've been able to put some code together and get a QR code to display on my site. Now I'm attempting to get the QR Code to open a larger version inside colorbox. This is the code I've got so far:
<a href="<?php echo $????; ?>" title="<?php echo $heading_title; ?>"
class="colorbox" rel="colorbox">
<img src="http://chart.apis.google.com/chart?chs=250x250&cht=qr&chld=L&chl=
<?php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; echo $url; ?>"
alt="Product QR Code" width="80" height="80" style="float: right" /></a>
All the code for colorbox is on this page already as I have products that use this very function. The original code said echo $popup but when I use that it shows me the main product image so that's no good. What I can't figure out is what to do with echo in the href section so it calls the image again in the pop-up box but in a larger size?
I've tried using the same url as with the img src but it only returns garbage characters in the pop-up box and doesn't know to turn it into an image instead.
Thanks for your time!
When you assign colorbox, set the photo property to true. Example:
$('a.example').colorbox({photo:true});
Colorbox normally uses a regex to determine if a link is pointing to an image or not, but the URL you are using isn't going to pass that regex.
I'm getting started using Kohana framework. How do I properly link images? I'm linking images using the usual way:
<img src="../../resources/images/img01.jpg" />
I'm using dreamweaver, and I can see that the link is correct. Since I can see an image in the preview:
The link is still the same when I reference the image based on the controller.
Best way to use full (base)paths:
<img src="<?php echo url::base() ?>resources/images/img01.jpg" />
or:
<img src="<?php echo url::site('resources/images/img01.jpg') ?>" />
You need to use absolute links. Either use html::image(), or prefix your image with url::base(), or use url::site(). There's lots of options, read the documentation.
I've installed some theme, which has header logo defined in header.phtml like this:
<img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" />
I don't really want to alter this template, also in that .phtml file it says not to edit it. How can I override this getLogoSrc most efficiently?
In the web admin, go to System>Configuration>Design and scroll down to Header>Logo Image Src. Insert the filename that you have saved in /skin/frontend/default/new_theme/images/ and click Save.
Go to your template's images folder e.g.: /skin/frontend/default/new_theme/images/
and replace the logo image in that folder with your new Logo