Category Archives: Code

Extending a Magento Controller

We’re ajaxing part of the Magento shopping cart so we need to modify/extend some of the cart controller functionality.  Sometimes when modifying controller’s you have to worry about updating the routes. For this, we don’t need to, we still want all the urls to be used the same way.

app/code/local/Ai/Checkout/etc/config.xml:

<config>
    <modules>
        <Ai_Checkout>
             <version>0.0.1</version>
        </Ai_Checkout>
    </modules>
...
    <frontend>
        <routers>
            <checkout>
                <use>standard</use>
                <args>
                    <module>Ai_Checkout</module>
                    <frontName>checkout</frontName>
                </args>
            </checkout>
        </routers>
    </frontend>
</config>

app/code/local/Ai/Checkout/controllers/CartController.php:

require_once Mage::getModuleDir('controllers', 'Mage_Checkout') . DS . 'CartController.php';

class Ai_Checkout_CartController extends Mage_Checkout_CartController
{
   public function updatePostAction()
    {
        Mage::log("NEW CONTROLLER", null, 'tim.log');
        try {

Moving Gmail Gadgets to the Right Side

I started using Remember the Milk recently but didn’t want the gmail gadget to be so far down on the left hand side of my screen.  There is no built in way to move gadgets to the right hand side with the exception of chat (labels used to do this but was removed in favor of drag in drop back in late 2009).

 

If you don’t have anything in the right hand column, enable Right-Side Chat from Gmail Labs.  We are going to add in some custom css to gmail so install either Stylist for Chrome or Stylish for Firefox.

Add the following style:

div.TZ:nth-child(8) {
    position:absolute !important;
    right:0px;
    top:165px;
    width:164px;
}

In chrome you can also restrict the domain to mail.google.com. For me, the Remember the Milk gadget was the 8th child. Play with this until it looks right for you. You may also have to play with the “top” element depending on how much room your chat gadget takes up

New Digg reverse paywall coming

Interesting: http://about.digg.com/blog/cha-ching

Welcome to the future of killing time on the internet, and getting paid for it: Digg is implementing a reverse pay wall! We believe this will greatly enhance the Digg experience. Early reaction from test users has been great. Can Duruk, developer at Digg, sums it up well:

“I thought Rebecca Black’s ‘Friday’ video was great now that I got paid to watch it!”

Now, I used to be on Digg for at least an hour a day. then v4 came… and it kind of sucks now….. Losing nested categories was a huge loss for me.

(9:39:48 AM) Tim: i would totally go back to digg to get paid http://about.digg.com/blog/cha-ching
(9:40:46 AM) Laura: Hmm
(9:41:00 AM) Laura: Digg is so horrible, that’s a little like being ok with becoming a prostitute
(9:41:03 AM) Laura: I mean, you get paid

http://about.digg.com/blog/cha-ching

Firefox 4 landing

It will be updating on your current installs tomorrow.

To download now: Windows, Mac, and Linux

Setting a project as the default redmine homepage

Only have a single project running on redmine? want it to be the homepage?
in config/routes.rb

in cofig/routes.rb

map.home '', :controller => 'projects', :action => 'show', :id => 'my_project_name'

Stress Relief: Blow things up


Online Physics Games

Running Mongodb as a service on windows

> c:\mongodb\mongod.exe –logpath “c:\mongodb\logs\mongo.log” –logappend –dbpath “c:\mongodb\dat
a” –directoryperdb –install
all output going to: c:\mongodb\logs\mongo.log
Creating service MongoDB.
Service creation successful.
Service can be started from the command line via ‘net start “MongoDB”‘.

> net start MongoDB
The Mongo DB service was started successfully.
>

> mongo
MongoDB shell version: 1.6.5
connecting to: test
>

A note on Magento and multiple nodes using Memcached

If you have multiple nodes using a shared memcached server, make sure you define a shared prefix for the keys to use.

In local.xml:

        <cache>
...
            <prefix>a1i</prefix>
            <id_prefix>a1i</id_prefix>
            <memcached>
...
Performance Optimization WordPress Plugins by W3 EDGE