Richard Castera - Explorations in Software Development
Richard Castera - Explorations in Software Development
Browsing Category
Archive
Resources Scripts

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

February 23, 2010 No Comments

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 chosenjQuery! 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:

JavaScript
1
2
3
if ($('id_of_element') != undefined) {
    alert('Object exists.');
}
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Check if a User is logged in

February 23, 2010 6 Comments

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
1
2
3
4
5
6
7
8
<?php
if ($this->helper('customer')->isLoggedIn()) {
    echo("Anonymous user");
}
else {
    echo("Authenticated user");
}
?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – How to Display the Product SKU

February 23, 2010 4 Comments

Magento is a pretty flexible platform. That flexibility comes with a price though; You have to be knowledgeable of the functions that are available to you to utilize. Finding or knowing them is a challenge though. Here is one of those such functions that you may need to display the product Sku on a category page.

PHP
1
<?php echo($_product->getSku()); ?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera

About me

Hello, my name is Richard Castera. I have more than 12 years of experience architecting, implementing, leading and launching large scale, high performance software products in a fast-paced agile environment.

Popular Posts

Magento – Display new products on the home page

May 20, 2009

How to Fix “Internet Explorer Cannot Open the Internet Site- Operation Aborted” Error

May 9, 2009

PHP – Convert Array to Object with stdClass

July 5, 2009

Categories

  • Home Automation
  • Resources
  • Scripts
  • SEO
  • Thoughts
  • Web Server

Tags

Apache Apple Bash CSS Drupal Free home automation htaccess Java Javascript Magento PHP raspberry pi SEO SQL thoughts Wordpress

© 2019 copyright Richard Castera // All rights reserved