Heroic Multimedia Group
Sonic wings final boss

Sonic wings final boss

Magento hacks - Show last login on magento manage customers grid.php

So Magento is pretty tough to modify. It’s quite obvious once you start digging in the code that:

1) It was never created for a programmer to modify on the fly for your needs

2) It was built in such a way that modifying simple code or trying to add basic extra functionality would put you in a headspin enough to want to buy extensions instead of making your own.

Let’s not get on the topic of Free / Opensource here, but more that it is quite obvious the code is a mess.

It is structured in folders upon folders, with each part of a page sometimes miles apart. There is object oriented code extending things you can’t see anywhere in the documentation, and JSON references to things that appear to be invisible.

The best part is, after each minor update it looks like they change table names, locations of data or functions of Magento just for the hell of it - And this makes finding free online help impossible. Even if someone has done what you are trying to do now, the version might be slightly different and this will have a big effect on how it can be achieved now.

Absolutely insane! If you are looking for an Ecommerce solution that wont try to charge you or restrict you, DO NOT get Magento. Don’t get sucked into the pretty graphics if you don’t know much about coding. It’s a a false vision of what it should be.

With that out of the way, here is a code I created today to show the ‘last logged in’ status on the “manage customers” section of the Admin. This is for Magento 1.5 and 1.5 only. If someone has a better way please let me know, because there is almost no information on what tables to join or what Magento specific commands to do.

Shove this above grid.php in the apps/code/core/magento/adminhtml/customers/ folder (Yes, all Magento pages are structured like that, causing thousands of folders to dig through to modify a single page.)

$host = "localhost"; $database_username = "username"; $database_password = "password";
$select_database = "databasename";
$prefix = "magento_"; //if required.
$con = mysql_connect($host, $database_username, $database_password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db ($select_database, $con); $sql = 'Select * from '.$prefix.'customer_entity left join (select customer_id, max(login_at) as latest_login from '.$prefix.'log_customer group by customer_id) as logdate on entity_id = customer_id'; //$sql = 'SELECT * FROM `megento_log_customer` JOIN `megento_log_customer` ON `megento_customer_entity.entity_id` = `megento_log_customer.customer_id;`'; $result = mysql_query($sql); while ($row = mysql_fetch_assoc ($result)) { extract ($row); $sql_append = 'UPDATE `'.$select_database.'`.`'.$prefix.'customer_entity` SET `last_login` = \''.$latest_login.'\' WHERE `'.$prefix.'customer_entity`.`entity_id` = '.$customer_id.' LIMIT 1;'; $result2 = mysql_query($sql_append); } mysql_close($con);

You will need to add a new column to customer_entity called last_login . Give it the same attributes as the last_updated column in the same table.

Every time you load the page, the query finds the last login for each user and updates that column - Then you can call it the same way as the other columns:

->addAttributeToSelect(‘last_login’)

Baby emus!

Baby emus!

New website for AUPBA

A new website I’ve made just went live a few days ago, located at http://www.aupba.org.au/ .

The AUPBA aims to improve the standard of the facilities and services found at all Australian & New Zealand paintball centres, to further promote the game to broader audiences and to develop standards that ensure the paintball experience is a safe and memorable one.

Check it out and comment.

Plesk 10 Vs. CPanel 11

There really isn’t much on the subject online - Not many people get a good chance to work a lot with both at the same time. I, unfortunately, have. I thought I’d give a brief rundown so far on some of the features each have.

Database user privileges.

In Cpanel, after you create a user you are given the option to modify the rights that user has to the database. Plesk currently does not support this option.

Password-Protect Subdomains.

Technically Plesk can do it, but it’s a bit of a workaround. I’ll post it here as it was a bit difficult to find.

Create a directory in your main domain hosting, and password protect it with Plesk. Then, put a .htaccess file in each of your subdomains root directories that has this code:

AuthType Basic

AuthName " "

AuthUserFile /var/www/vhosts/dtestf.com.au/pd/d..httpdocs@_subaccess

require valid-user

Where “_subaccess” is the folder name you created. This can be a slow process for ~100 subdomains but if you don’t have SSH access or dedicated hosting this may be the only decent way for you.

Cpanel has directories above your main hosting, so adding password-protected directories to them is nothing different.

What do you think?

Someone give me some good reasons for Wordpress

I’ve made a lot of professional websites for people using the “Content Management System Made Simple” engine. I like the fact that you can create users with any sort of access you want, just add pages, just add news articles, Whatever you need to restrict, it’s really easy.

Once your template is sorted, it is also really easy for someone to make new pages or edit pictures. It’s quite simple and easy to learn for people who don’t want to know a whole lot about technology but still want to manage their own website to some extent.

I’ve been using Wordpress for the past 10 professional websites and I can say that there isn’t much difference in the production of these websites. One advantage is the blogging system is better (Wordpress was and still is primarily a blogging engine). But the user groups and policies by default are lacking.

‘Plugins’ for Wordpress are to be used carefully - You’d have to be kidding yourself if you think using plugins will give you a good website. Plugins usually fight with each other, break W3C standards or stop working after a large Wordpress update. Web developers should really rely on their own coding in Templates then adding a plugin to fix a problem fast.

My question to anyone who can answer it: Why use Wordpress over a CMS system designed specifically for websites?

Make less database requests in Wordpress.

If you are creating your own Wordpress theme, making less database requests can speed up your site. Currently Wordpress calls functions for certain things like stylesheets and template urls by default, but if we hook onto one of the commands and just call the database once we can greatly decrease the amount of Database traffic.

Here is the code I am currently using on a template:

// Theme's folder name (With trailing slash) $themefolder = "nzpba/"; // Only one database function request $wordpressurl = get_bloginfo('wpurl') . "/"; // Path to wordpress theme folders should not change anytime soon $templateurl = $wordpressurl . "wp-content/themes/" . $themefolder; // Local files array $link = array("url" => $wordpressurl, "stylesheet" => $templateurl . "style.php", "images" => $templateurl . "images/", "templateurl" => $templateurl, "galleryimage" => $templateurl . "images/galleryimage"); //Shorten page code function dis($in) { global $link; echo $link[$in]; return true; }

Maybe this will be of use to some people. Enjoy!

Crazy Hosting Deal :D

WebsitesFor the rest of this month, get a Bronze Hosting Package for AUS $5! Use this code on the order page after selecting Bronze Web Hosting:

CRAZYDEAL1

To redeem it now. Offer expires 01/07/11 so act quick!

Giving your website more kick!

Hi-Yah!I’d like to give a quick write up on how your website can get more kick; have your clients really want to visit the site, stay there and purchase something.

The design can’t just look pretty. It needs to function exactly the way you intend it to, with no glitches or 404 pages.

A good way to help your site along, is to make sure it is accessible. When you start to fill out a form and press tab to go to the next field, does it go to the right one, or the one your clients are expecting? It sounds simple, but make sure the order of your form is correct and as less confusing as impossible - You don’t want your clients giving up once they decide to contact you!

Make sure all the basics are there. It’s surprising how many sites forget the favicon, the icon that appears in your bookmarks. that little 16x16 block will catch the attention of someone who bookmarked your site, and hopefully get them back to look a second time!

And of course, make sure your site is selling something clearly and with focus! Having a crisp image of your product with a clear description works wonders.

Evan Harrison

www.heroicmultimedia.com

New Blog Site

Set up a blog for Harry, located at http://hazzorik.com/ !