CSS – Cross Browser Opacity

A little hack to set Cross-Browser opacity.

.setOpacity {
      opacity: .75; /* Standard: FF gt 1.5, Opera, Safari */
      filter: alpha(opacity=75); /* IE lt 8 */
      -ms-filter: "alpha(opacity=75)"; /* IE 8 */
      -khtml-opacity: .75; /* Safari 1.x */
      -moz-opacity: .75; /* FF lt 1.5, Netscape */
}

WordPress – Disable Auto Save

WordPress’s Auto-Save feature is a really nice but there are some drawbacks… this feature increases your database usage. So for those of you that are on really bad shared hosting accounts or just want to turn it off, here’s a quick way of doing it.

Open and insert the following line in your wp-config.php file.

define('WP_POST_REVISIONS', false);

Another method is to remove all of the entries from the database from time to time. You can do tun this query to do it::

DELETE FROM wp_posts WHERE post_type = "revision"; 

Prototype JS – Determine if an object exists in the page loaded

I’m so use to using jQuery that I usually don’t have to look up documentation on how to use certain functions. They almost come naturally because it’s so English-like! Unfortunately Magento uses Prototype as it’s native choice of Javascript Frameworks. I sure wish they would have chosen jQuery! I think they would have more people jumping on their platform. I’m sure they have a good choice for it. Anyway, here’s how to check:

if($('id_of_element') != undefined) {
    alert('Object exists.');
}

Magento – Check if a User is logged in

You may want to check if a user is logged in with Magento, possibly to display a link or promotional item. Here’s how to do it:

<?php
if ($this->helper('customer')->isLoggedIn()) {
    echo("Anonymous user");
}
else {
    echo("Authenticated user");
}
?>

Magento – How to Display the Product SKU

Sometime you may need to display the product Sku on the category page. This is easily achieved:

<?php echo($_product->getSku()); ?>