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

Magento – Display new products on the home page

May 20, 2009 103 Comments

If you’ve ever wanted to add new products in your Magento home page, it’s fairly easy to implement. Go to “CMS” then “Manage Pages” and select “Home Page” from the list of pages. Now paste this code snippet to show products labeled as “new” on your front page:

XHTML
1
{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}

(Note that you must have some new products in your catalog for anything to show when you do this. This doesn’t mean that you’ve recently added them; only products explicitly marked as new using “Set Product as New from Date” and “Set Product as New to Date” options in the “General” product information page in the admin tool will be shown.)

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Re-ordering Block items

May 19, 2009 18 Comments

Magento has lots of blocks that display in the left and right columns (based on your layout). Changing the order in which they are displayed or sorted is easy. Navigate to the folder “app\design\frontend\default\YOUR_THEME\layout”. In this folder, there are several XML files which are called Layouts.

Magento Layouts are the tools with which you can assign content blocks to each structural block you create. Layout exists in the form of XML text-file and by modifying the layout you are able to move blocks around in a page and assign templates to the content blocks to produce markup for the structural blocks.

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Adding Static Block content to a Page

May 17, 2009 37 Comments

Add Magento static blocks to your page easily! Simply copy this line of code below where you want the static block to appear and change the ‘identifier’ to the identifier of the static block you created. That’s it!

PHP
1
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('identifier')->toHtml() ?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

How to Delete Test Orders from Magento

May 15, 2009 36 Comments

Deleting your test orders currently requires running a script directly on your Database. Make sure you fully backup your database before doing anything! This script will delete all orders in the database and reset all order counters!

Continue reading
Reading time: 2 min
Share:
Written by: rcastera
Resources Scripts

WordPress – List your most popular Posts

May 14, 2009 15 Comments

This function below creates a list of links of the top commented posts on your WordPress blog. It builds this list based on the posts that have the most comments. Place it in your footer or sidebar item!

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
function listPopularPosts() {
    global $wpdb;
    $strBuidler = '';
    
    $result = $wpdb->get_results("SELECT comment_count, ID, post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5");
    
    foreach ($result as $post) {
    setup_postdata($post);
    $postId = $post->ID;
    $title = $post->post_title;
    $commentCount = $post->comment_count;
        
    if ($commentCount != 0) {
        $strBuidler .= '<li>';
        $strBuidler .= '<a href="' . get_permalink($postId) . '" title="' . $title . '">' . $title . '</a> ';
        $strBuidler .= '(' . $commentCount . ')';
        $strBuidler .= '</li>';
    }
    }  
    
    return $strBuidler;
}
?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Update your Twitter status using PHP

May 13, 2009 18 Comments

Twitter is an awesome service! I use it on a daily basis and have grown addicted to it. Posting to twitter VIA an application is something that I’m sure you’ll need to do at some point. Using this simple little script below, you can post updates to twitter accounts fairly easily. Don’t forget to add your username, password and message below.

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Groovy – a programming language to look into

May 12, 2009 1 Comment

So what is Groovy? Groovy is like a super version of Java. It can leverage Java’s enterprise capabilities but also has cool productivity features like closures, builders and dynamic typing. If you are a developer, tester or script guru, you have to love Groovy. Below are some of it’s features.

  • Is an agile and dynamic language for the Java Virtual Machine
  • Builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk
  • Makes modern programming features available to Java developers with almost-zero learning curve
  • Supports Domain-Specific Languages and other compact syntax so your code becomes easy to read and maintain
  • Makes writing shell and build scripts easy with its powerful processing primitives, OO abilities and an Ant DSL
  • Increases developer productivity by reducing scaffolding code when developing web, GUI, database or console applications
  • Simplifies testing by supporting unit testing and mocking out-of-the-box
  • Seamlessly integrates with all existing Java objects and libraries
  • Compiles straight to Java bytecode so you can use it anywhere you can use Java
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

J-Crop – the jQuery image cropping plugin

May 10, 2009 No Comments

Jcrop is the quick and easy way to add image cropping functionality to your web application. It combines the ease-of-use of a typical jQuery plugin with a powerful cross-platform DHTML cropping engine that is faithful to familiar desktop graphics applications.

Feature Overview

  • Attaches unobtrusively to any image
  • Supports aspect ratio locking
  • Supports minSize/maxSize setting
  • Callbacks for selection done, or while moving
  • Keyboard support for nudging selection
  • API features to create interactivity, including animation
  • Support for CSS styling
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

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

May 9, 2009 91 Comments

This error shows up when the page loads (or tries to load). There are many scenarios that can cause this error which occurs in IE. Microsoft has even issued a patch for solving it.

This error is being caused by calling a piece of Javascript within a page (after the tag). Adding the defer=”defer” tag to the script quickly resolves the issue.

JavaScript
1
<script defer="defer" type="text/javascript" src="src goes here">/*code goes here*/</script>

Hope this helps someone! 🙂

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Get the current theme folder

May 8, 2009 No Comments

If you ever needed to retrieve the path to your theme folder, you can easily do this by calling this function:

PHP
1
<?php echo $this->getSkinUrl(''); ?>

The code above will return something similar to: http://www.yoursite.com/skin/frontend/default/default/

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Page 6 of 9« First...«5678»...Last »

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