LAMP How To – Open Source At Work

Only Passion Matters

git: finding file changed since certain date and upload a server

good old bash.

git log -p --since={2011-11-01} | grep "diff --git" | awk '{print $3}' | sed 's/^a\///g' | sort -rn | uniq | while read s; do scp $s root@yourip:/server_path/$s; done;
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

Tips in Magento

Debugging Tips:

1. In your .htaccess, add

SetEnv MAGE_IS_DEVELOPER_MODE

2. Under system -> configuration -> advanced -> developer,

change current configuration scope dropdown on top left to main website, then debug -> turn template hints and block name hints to on.

3. We can log errors easily.

Mage::log($var);

4. To display popup errors,

Mage::throwException(“Your debug message here”);

5. To see a list of all events (useful when create events/observers in config.xml)

cd /app/code/core/Mage
grep -r -i Mage::dispatchEvent *
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

Magento: Removing SSL After Installation

use magento_db;
UPDATE core_config_data SET value = 0 WHERE path=’web/secure/use_in_frontend’;
UPDATE core_config_data SET value = 0 WHERE path=’web/secure/use_in_adminhtml’;

might need to clear the cache and do hard refresh after that.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

Magento: Adding Downloadable Product To A Bundle

After googling for ages, I could not find an answer to bundling downloadable product, as in the downloadable product will not appear under the bundle items search section. After some tough digging, I noticed magento community version 1.6 only accepts virtual and simple product in a bundle.

the config is at app/code/core/Mage/Bundle/etc/config.xml, about line 103.

To get downloadable items to appear under bundle items search, update the xml to

<allowed_selection_types>
<simple/>
<virtual/>
<downloadable/>
</allowed_selection_types>

Wondering why they only allow simple and virtual products? Perhaps downloadable products are buggy or not well testing if bundled?

One more thing, also make sure the downloadable product has “Links can be purchased separately” set to “No” as well.

A lot of people would be bundling downloadable product in magento… I hope varien would consider fixing this in the next update.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

Turning on Mac keyboard Backlit

If you find your mac keyboard not having any backlit, try apple -> system preferences -> keyboard -> illuminate keyboard in low light conditions.

Then try covering your fingers over the camera, the keyboard should be lit up.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz