Re-run module’s setup routines in Magento

October 25, 2010 10:03

When you’re implementing custom module, normally you will have to re-run setup routines. Some people will create newer version of the setup file, but it will make you confuse after 100 modification. To do it, simply remove references to your modules in “core_resource” table and then, in backend, go to ‘System’ -> ‘Configuration’ -> ‘Advanced’ in Advanced Section, click ‘Save Config’. Magento will run all your setup scripts again.

Happy Magento’ing ~

Share
Comments Off

Remove the visitors counter

October 25, 2010 10:03

I’ve decided to remove the visitors counter in this website. The counter is not accurate (last number is 61982) because it includes all the search bots. The number is meaningless. So I switch to use Google Analytics and hope it will give me the real report, although I understand the number should be within 2 or 3 digits … per month … or per season …

Share
Comments Off

“Could not determine temp directory, please specify a cache_dir manually” after Magento is installed

October 22, 2010 10:06

After Magento is installed, you may have the error “Could not determine temp directory, please specify a cache_dir manually” when clicking on some pages in both backend and frontend. Usually it will be happened in shared web hosting, but also in individual server if the permission of tmp folder set wrong.

Many bloggers suggested to modify the core file “/lib/Zend/Cache/Backend/File.php” to fix this problem. However, it may be a trap when you upgrade your Magento. I recommend to use Magento’s override feature.

Firstly, copy “/lib/Zend/Cache/Backend/File.php” to “/app/code/local/Zend/Cache/Backend/File.php”, then in line 91:

    'cache_dir' => null,

change to

    'cache_dir' => "var/tmp/",

Of course, you can change the cache folder wherever you want, and that directory you should create yourself and change the permission to 777 if necessary.

Now, your Magento should be run smoothly.

Share
Comments Off

How to convert links in ajax page with JoomSEF?

October 21, 2010 09:38
Tags: , , ,

Recently one of my company websites decided to use JoomSEF for SEO (Joomla 1.5.20 and JoomSEF 3.7.4). Because some custom components are developed in this website, so some extension of JoomSEF for these custom components are needed. Everything goes smooth … except the ajax page …

The following codes are placed in view.html.php

<?php
    function display($tpl = null) {
        ...
        ...

        parent::display($tpl);

        if ('ajaxpage' == JRequest::getVar('layout')) {
            global $mainframe;
            $mainframe->close();
        }
    }
?>

Because the application is closed, no plugin or other action can be taken. All the links in this ajax page haven’t converted by JoomSEF.

I don’t know how to call plugin by system function individually, so my solution is to call JoomSEF directly.

In my ajax page (ajaxpage.php inside tmpl), first create JoomSEF router object:

<?php
    // create JRouterJoomsef object if JoomSEF is installed
    if (class_exists('JRouterJoomsef')) {
        $jRouterJoomsef = new JRouterJoomsef();
    } else {
        // no JoomSef installed
        $jRouterJoomsef = null;
    }
?>

Then before you paste the link to HTML A tag,

<?php
    $link = 'index.php?option=com_customcomponent&view=xxxx&id='.$object->id.'&Itemid=101';
    if (null != $jRouterJoomsef) {
        // JoomSEF installed and published
        $link = $jRouterJoomsef->build($link)->getPath();
    }
?>

If you installed and published the JoomSEF, the JRouterJoomsef object should be created. Then you can use its function build() to return JURI object, then use JURI’s getPath() function to paste the sef’ed path.

Hope this help, thanks.

Updated on 22 October 2010:

JoomSEF Support Team replied that it can be done simply by JRoute::_() function:

$link = JRoute::_('index.php?option=com_customcomponent&view=xxxx&id='.$object->id.'&Itemid=101');

No matter you turn on or off either the SEF or JoomSEF, JRoute will take care for you. So just one sentence and it’s done.

Thanks JoomSEF Support Team.

Share

Redirect 301 from old site to new site using .htaccess

October 20, 2010 16:47

I have the old website which placed in sub-domain. Because this blog is launched, so all the links point to old website should be re-direct to the new website. However, the links are different with WordPress, so I would re-direct all links to new website’s homepage.

Simply, job is done by adding one line in .htaccess which is placed in old website’s root directory:

// .htaccess in www.oldsite.com root folder
RedirectMatch 301 "^/(.*)$" "http://www.newsite.com"

That is, is it easy?

Share
Comments Off

Reborn ~

October 20, 2010 11:40

After two … ar … four years and more slient, I recently decided to back to blog life. One motivation is because my old web hosting will be closed, so I have to move my blog to other web hosting company. Because the old blog system is written on 2003, and I don’t have time (and mood !!) to rebuild a new one, so … just use WordPress.

In current company, I mainly develop custom components in Joomla and custom modules in Magento, and a bit for WordPress too. I would like to share my experience on those development and … keep notes here for my future use … :P

Ok, hope I can keep updating this blog and won’t last again …

Share
Comments Off

One and half year empty again and bugs found

January 21, 2008 14:27
Tags: ,

Well, one and half year passed since last news … I’m still alive. Nine months before I moved to a new web hosting. The server was faster than before and I’ve got unlimited storage, subdomain and FTP account. However, they moved to new server since Nov 2007 and the PHP also upgraded to 5.2.1. After they moved to new server, I only tested my website once and visited the first page only. I guessed that it should be okay. Unfortunately, when I wanted to review my resume one week before, I’ve found that I couldn’t reach it, the session variable for counter also didn’t work anymore. First I think it should be some wrong setting in php.ini (eg. register_global), but it is in correct setting. Then I checked the code and found that … it’s my problem. The code was developed under PHP 4.0.x … and still using HTTP_xxx_VARS!! I’m really surprised that and changed them already. So next time if your website have problems with moving to new server, please check both the server setting and your codes.

Share
Comments Off

Vista Beta 2 Build 5384 installed

August 14, 2006 10:49
Tags:

Okay, I’ve installed Vista Beta 2 Build 5384 on Monday in a machine with P4 2.4GB, 480MB RAM, S3 display card (build-in) … the performance is fair, a little bit slow (of course), but also can finish login process in 2 minutes with Office 2007 Beta 2 and MSN Live Messager installed.

First, <servername>/connectcomputer is failed in the last step. I’m sure that the DNS is correct and tested in XP a few hours before I install Vista. So I just join the domain in Control Panel -> System, click “Change Setting” in “Computer Name, domain and workgroup setting” section. The computer account should be added in SBS 2003 before take action. Everything works smoothly and I can connect to domain after reboot.

After joined the domain and reboot, there is a welcome screen with your previous login username, you have to click “Switch user” and type your domainname\username and password to login. Everytime you login, your domainname\username is shown in Welcome Screen and you just need to type the password to login the system. Actually I don’t like it because of security, however, I cannot find the place where I can change this setting.

Then I open Outlook 2007, all the setting is typed automatically (username, email, Exchange Server Setting). I don’t know it will be done by joining domain, or I run /connectcomputer before. Anyway, it works well.

IE 7 Beta 2 (7.0.5384.4) is included in Vista, but it contains a little bug: sometimes I cannot connect to the website and I need to close all the IE and open again. The Tab feature is very good, although I found it in Firefox a long time ago …

Although I have Trend Micro in SBS 2003, but I don’t want to use one license for Vista, so I download the free anti-virus from CA which contain 1 year free for Vista Beta tester. You have to register and get the download link from email. The file is only 5.xMB and double click to install. While the installation, it will also download the latest patch and virus signature from Internet.

Well … this is my first review of Vista … I will try to update when I got more information. Comment is welcome.

Share
Comments Off

Half price off for every product in php architect

July 10, 2006 02:17

Because Italy won the Would Cup, I could get a half price discount in php|architect. I bought four books from it which all about PHP: php|architect’s Guide to PHP Security, php|architect’s Guide to PHP Design Patterns, php|architect Nanobook: Beginning PDF Programming with PHP and PDFlib, and The Zend PHP Certification Practice Book. I am waiting for this kind of discount a long time ago and thanks for Italy, I’ve got it.

Share
Comments Off

One year empty …

July 3, 2006 23:16

Ok, it’s already no news added within one year. It’s because of my laziness. Recently I got the motivity by unknown issue that want to keep this website update. Mmm … I will try to pick it up again and update periodically.

Share
Comments Off