Magento 1.9.3.1 – Add images/icons to attribute options to replace placeholder image of your Magento products page

magento 1.9.3.1


view.phtml around line 100 replace the if statement

<?php if($_item->getColor()): ?>

<?php
$optionId = $_item->getColor();
$optionIdurl = Mage::helper('attributeoptionimage')->getAttributeOptionImage($optionId)
?>

<a href="#" class="color_swatch">

<?php if (strpos( $this->helper('catalog/image')->init($_item, 'small_image')->resize(100, 150), 'placeholder')) {
?>
<img src="<?php echo $optionIdurl; ?>" />
<?php
} else {
?>
<img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(100, 150); ?>" />
<?php } ?>

<?php endif; ?>

 

reference:
http://www.bubblecode.net/en/2012/02/05/magento-add-images-to-product-attribute-options/

https://github.com/aligent/magento-attribute-option-image

Shitty documentation installing magmi

When you install magmi and you access magmi/web/magmi.php initial login/pass will be “magmi/magmi”. After you setup db connection info it will use magento back office login/password.

create magmi/.htaccess

Order deny,allow
Deny from all

then create magmi/web/.htaccess

Order allow,deny
Allow from all
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.+)$
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

How to install magmi

extract magmi to your magento folder

go to magmi/web/

create htpasswd using ‘/usr/local/apache/bin/htpasswd -c .htpasswd itheadaches’

set owner to files ‘chown -R fill4style.fill4style itheadaches’

set permission to files

install php-mbstring, in my case I had to recompile apache with mbstring

 

 

Pagespeed higher score for magento with cache-control

Add this at the end of .htaccess file

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
ExpiresByType application/pdf "access 1 week"
ExpiresByType application/javascript "access 1 week"
ExpiresByType application/x-javascript "access 1 week"
ExpiresByType application/x-shockwave-flash "access 1 week"
ExpiresByType image/x-icon "access 1 week"
ExpiresDefault "access 1 week"
</IfModule>
<IfModule mod_headers.c>
 <FilesMatch ".(js|css|xml|gz|html)$">
   Header append Vary: Accept-Encoding
 </FilesMatch>
Header set Connection keep-alive
</IfModule>
## EXPIRES CACHING ##

 

 

Magento – Menu toggle dropdown broken in left column

design/frontend/mogan/default/template/catalog/layer/view.phtml

moved javascript to the very bottom

<script>
jQuery(document).ready(function(){
jQuery(document).on('click',"#shop-by-header",function(){
jQuery("#shop-by-content").slideToggle();
});
jQuery(document).on('click',"dt[data-toggle='true']",function(){

var elm=jQuery(this),name=jQuery(this).attr('data-name').split('-')[1];
console.log('dd[data-toggle="toggle-'+name+'"]');
jQuery('.toggle-'+name).slideToggle( "slow",function(){
if(elm.text()==='- '){
elm.find('span').text('+ ');
}else{
elm.find('span').text('- ');
}
});
});
});
</script>java