translate image K2 using joomfish - joomla

In a standard Joomla+Joomfish installation, when translating an article, there is the option to upload a different image for the translation (e.g. French packaging vs. English packaging).
When translating K2 items, I do not see an option to provide a translated image to the item. Have I turned off a setting somewhere or is this standard Joomfish feature not available when working with K2?

I've found a possible solution. Maybe it's quite a trick, but it works.
Since K2 doesn't store the path to the image into the database, I've used other fields that are stored. In particular, I've used the image_credits field.
In that field I insert the path to the image (/images/myimage.jpg) that I've uploaded on the server via ftp or via any other means that allow you to upload a picture into the image folder.
Now I've made some minor modifications into the template overrides of the item, adding an else branch to the if that manage the image
<?php else:
if(!empty($this->item->image_credits)): ?>
<figure class="itemImageBlock">
<a class="itemImage modal" rel="{handler: 'image'}" href="<?php echo $this->item->image_credits; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>">
<img src="<?php echo $this->item->image_credits; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:100%; height:auto;" />
</a>
</figure>
<?php endif; ?>
That's it. Now I can "translate" the image using Joomfish

Related

MDVA-36832: Images duplicate on pages with 768px view width

I am using Magento 2.3.4 and have a problem with the site builder displaying 2 images. There is a patch available but it does not support Magento version 2.3.4.
Does anyone have a solution for this problem?
MDVA-36832: Images duplicate on pages with 768px view width
https://support.magento.com/hc/en-us/articles/4402390637453-MDVA-36832-Images-duplicate-on-pages-with-768px-view-width
By default Magento displays the search results through the template;
app/design/frontend/YOURPACKAGE/YOURTHEME/template/catalog/product/list.phtml
You wanted to change that then the best thing you could do is follow the advice in the following link and designate a custom template to display your results by copying and renaming the list.phtml file;
Magento design update to replace list.phtml on search results page only
You could then customise it however you want. The section you would change is the following code which, as you can see ( the ->resize(135) part) is resizing your small product image to 135px. Change that to 400 and assuming the small image itself is not smaller than 400px wide then it wants to be pixellated.
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

Magento 1.9.3 Display alternative image on hover on category page

I want to display an alternative image on hover on category page by assigning it in Product Information -> Images. I have created an attribute hover_image with the parameters Scope-Global, Catalog Input Type-Media Image, Apply to All Product Types. Added the attribute to the set. What should I do next? Thank you
To show the alternative hover image on category page. You need to make changes in Product Listing template in your current theme template/catalog/product/list.phtml.
As you have already created the media type attribute 'hover_image'. So you need to fetch hover_image type image like below:
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'hover_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'hover_image'), null, true) ?>" />
Now you need to use javascript to apply hover effect on product images to hide the original image and show hover image.

how to check availability of custom image attribute

i know this question is just being asked many times but i have some problem in custom image attribute i create new custom image(image180) attribute with magento admin & using this code to get image in frontend & this code working properly & showing image how to correct this & thanks in advance
<div class="rotate"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'image180'); ?>"></div>
but i have to check if this image is avabile then run the code if not avaible don't run this code because if this attribute not avaible fir specific product the product page is not load & show the error & i am using this code to check avability of custom image but not working what going wrong
<?php if ($_product->getimage180()):?>
<div class="rotate"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'image180'); ?>"></div>
<?php endif;?>
Please you try this
getImage180()):?>
helper('catalog/image')->init($_product, 'image180'); ?>">
You can try
if($_product->getData('image180')!=null && $_product>getData('image180')!='no_selection')
instead of if($_product->getimage180())
And if you use $_product->getimage180() then also it is invalid.
It should be $_product->getImage180()

Show intro-image and extra fields in Smart Search results in Joomla

I´m using Joomla Smart Search in my website and I´m want to show intro-image and some extrafields from the article in the search results.
Joomla Smart Search removes any html tags and I want to prevent to do this extra fields
in www\plugins\finder\content open content.php
then search for getListQuery , at the end of ->select list add ->select('a.images AS image'); save & close the file
in www\components\com_finder\views\search\tmpl open default_result.php
then search for class="result-title after the tag add these lines:
<?php $image=json_decode($this->result->image); ?>
<?php $aimage=$image->image_intro; ?>
<div class="search-img">
<a href="<?php echo JRoute::_($route); ?>">
<img src="/<?php echo $aimage; ?>" >
</a>
</div>
save & close
dont forget to purge & reindex the smart search
Smart search plugins say which fields should be indexed. You could replace some of the smart search plugins with ones of your own.
I have found a solution, not absolutly like I wanted but it works. The solution shows the intro-text and all inside the "read more" of the article in the search results (images, links and everything you want).
This solution was found here http://forum.joomla.org/viewtopic.php?p=2324152 and says something like this:
"You'll need to create a layout override for the components/com_finder/views/search /tmpl/default_result.php layout file using the steps described at http://docs.joomla.org/Understanding_Output_Overrides Once you've created the layout override, you should change"
<?php echo JHtml::_('string.truncate', $this->result->description, $this->params->get('description_length', 255)); ?>
in the layout file to:
<?php echo $this->result->summary; ?>
The location should be templates/template_name/html/com_finder/search/default_result.php
actually there is a very easy solution.
K2 saves the images based on the md5 hash of the id.
adding this:
<div class="search-img">
<img src="<?php echo JURI::base().'media/k2/items/cache/'.md5("Image".$this->result->id).'_M.jpg'; ?>" />
</div>
to the html override of the default_result.php will display the according k2 items (here in medium resolution)

How to disable image popup in magento

I am using magento 1.5.0.1 for one of my websites. In that, whenever a person mouseovers an image in grid view or list view, a bigger image window pop ups. Is there a way i can disable this and also get rid of the zooming functionality in product views
This is not core Magento functionality so there will be a 3rd party extension installed or perhaps even more simply, additional JavaScript and CSS files are being loaded. Since i have no way of knowing any more about your setup, i can only provide some general help...
3rd party extension
If the extensions sole purpose is to provide zoom functionality in the product list block then I would simply disable or remove it completely. If it offers other features beyond product zoom that you require then you may need to adjust the module to meet your needs.
If you do not know the modules name, have a look in the source code under app/etc/modules as a starting point. In here you will see a list xml files for all installed modules. If you can identify the module you can disable it by editing the active node in xml file:
From:
<active>true</active>
To:
<active>false</active>
then clear your cache.
If you cannot identify it from there, have a look through the admin section for some clues - most modules will provide some configuration options.
Additional JS and CSS files being loaded
If there are simply some extra JS and CSS files being loaded in order to provide this functionality. You will have to look through your layout.xml files in your theme:
app/design/your_package/your_theme/layout
There are a few different of ways to include js and css files so you would be looking for something similar to one of the following:
<action method="addJs"><script>js/yourjs.js</script></action>
<action method="addItem"><type>js</type><name>js/yourjs.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/yourjs.js</name></action>
If you can find the node responsible for including the js then simply remove it.
Go to template/catalog/product/view/media.phtml
Find this code:
<a onclick="popWin('<?php echo $this->helper('catalog/image')->init($_product, 'image') ?>', 'gallery', 'width=520,height=480,left=50,top=50,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" href="#">
<img id="image" title="<?php echo $this->htmlEscape($_product->getName()) ?>" src="<?php echo $this->helper('catalog/image')->init($_product, 'image')->resize(250,250); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
</a>
And replace it with this:
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" />
Thank you. It's very useful code.
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" title="<?php echo $_product->getName();?>" onclick="$('image').src = this.href; return false;">
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" />
</a>

Resources