Total Pageviews

Thursday, May 9, 2013

Magento's theme hierarchy

Magento's theme hierarchy
1. If a custom theme is specified, the application looks for the requested file in:
  • 1. app/design/frontend/custom_package/custom_theme
  • 2. skin/frontend/custom_package/custom_theme
2. If the file is not found in the custom theme, the application moves up a level and
looks for it in:
  • 1. app/design/frontend/custom_package/default
  • 2. skin/frontend/custom_package/default
3. If not found in the default , the application looks for the requested file in:
  • 1. app/design/frontend/base/default
  • 2. skin/frontend/base/default
4. If not found, a rendering error will occur.

Wednesday, May 8, 2013

Password protect one or more directories with Basic HTTP Authentication using .htaccess


HTACCESS AUTHENTICATION

 Password protect one or more directories with Basic HTTP Authentication using .htaccess
Browse the link here

Thursday, February 7, 2013

Filtering categories in the permalink structure

 
The way to remove the parent category from a permalink when using the
 /%category%/%postname%/ custom structure 
 
 
add_filter( 'post_link', 'remove_parent_cats_from_link', 10, 3 );
function remove_parent_cats_from_link( $permalink, $post, $leavename )
{
 $permalink = str_replace( $parentcats, '', $permalink );
 }
$cats = get_the_category( $post->ID );
    
if ( $cats ) {
        
// Make sure we use the same start cat as the permalink generator
        
usort( $cats, '_usort_terms_by_ID' ); // order by ID
       
 $category = $cats[0]->slug;
       
 if ( $parent = $cats[0]->parent ) 
    
    {
   
// If there are parent categories, collect them and replace them in the link
            
$parentcats = get_category_parents( $parent, false, '/', true );
  
// str_replace() is not the best solution if you can have duplicates:
 
// myexamplesite.com/luxemburg/luxemburg/ will be stripped down to myexamplesite.com/
// But if you don't expect that, it should work
            
    }
    return $permalink;
}