Friday, July 16, 2010

Installing a Drupal Module

Drupal is a very powerful CMS platform and has many modules to enhance it's functionality. Installing (contributed) modules is very simple as the process has been kept very rudimentary. Here are the steps needed to install a module:
  1. Find & download compatible module
  2. Unzip it locally
  3. Upload files to your server
  4. Read & follow special instructions (if any)
  5. Enable the new module
  6. Setup permissions (if required)
  7. Adjust Settings (if required)

Now lets delve into each of the above steps in a bit of detail:

1. Find & Download compatible Module
Search for the module on the drupal site http://drupal.org/project/modules/. This page has a big list of available modules and you can search for required modules as well. Once you find the module that is compatible with the version of the installed Drupal core, download the compressed "tar.gz" file locally.

2. Unzip it locally
Once the file is available locally, extract the contents to a temporary folder. On Ubuntu, I just double-click on the file to do this. On WinX platforms, this cannot be done directly - you will need to download & install the free & open source tool 7-Zip to do this. Now you should have a folder by the name of the module in your chosen temporary folder.

3. Upload files to your server
Now upload this extracted folder to sites/all/modules folder in your Drupal install. This is the folder that holds all the contributed modules.

4. Read & follow special instructions (if any)
Check the module folder for "README.txt" or "INSTALL.txt" or similarly named files to see if this module requires any special steps for installation. If so, follow those steps to a "T".

5. Enable the new module
Log in to the Drupal admin and go to Administer > Site building > Modules or the Drupal path admin/build/modules. Look for the new module and enable it.

For most cases, you should be good by now. If not, then follow the below steps.

6. Setup permissions (if required)
Some modules need extra permissions to be setup for them to work properly. Grant the permissions as appropriate & required for the module to function properly.

7. Adjust Settings (if required)
Tweak the settings provided by the module (if any) to make it function as per your requirements. Mostly the provided defaults work good, but there could be cases where you need to change the settings to suit your needs.

Monday, July 12, 2010

Google launches Android App Inventor Beta

Ever wanted to create an app for your (or for that matter, someone else's) Android phone? But were lost in the sea of code & APIs that is required to be mastered?

Worry no more - for Google Labs has launched (but of course) a Beta version of the App Inventor for Android.

This looks like a glorified equivalent of the Visual Basic interface that was used to make many a (good & bad) programs. However the good part here is that you can make an entire program without even a single line of coding! To quote from the App Inventor site:

To use App Inventor, you do not need to be a developer. App Inventor requires NO programming knowledge. This is because instead of writing code, you visually design the way the app looks and use blocks to specify the app's behavior.

The App Inventor team has created blocks for just about everything you can do with an Android phone, as well as blocks for doing "programming-like" stuff-- blocks to store information, blocks for repeating actions, and blocks to perform actions under certain conditions. There are even blocks to talk to services like Twitter.

Here's to Google to open up it's platform for the young and the old alike for whoever may have the appetite and energy to create their own Android apps. Only time will tell whether this approach will yield better apps or not!

Fee jQuery eBook - 7/12 Only

Sitepoint is offering free download of the eBook jQuery: Novice to Ninja by Earle Castledine and Craig Sharkie here.

Amazon reviews are pretty good and the paper edition is priced at $35.60.

Tuesday, June 29, 2010

Magento - Change Price Labels

Magento by default labels the prices as "Regular Price" and "Special Price". I could not find any simple or straightforward method of changing these labels in the back-end admin.

It turns out that this is driven from the template's Price PHP file app/code/design/frontend/MYTHEME/template/catalog/product/price.phtml which reads the label values from the locale files and displays it.

So the simple solution is to change the label values in app/locale/en_US/Mage_catalog.cvs:
"Special Price:","Special Price:" 
to
"Special Price:","Our Special Price:" 

and

"Regular Price:","Regular Price:" 
to
"Regular Price:","Suggested Retail Price:" 

However, the recommended upgrade-proof method would be to create a new locale specific translation file containing only the above desired changes and save it as: app/design/frontend/MYTHEME/locale/en_US/translate.csv.

And don't forget to clear the cache after doing any of the above changes or they may not be visible on the front-end!

Similarly you can change any labels that you desire. Note that this is case-sensitive and needs to be done very carefully.

Magento - Ampersand in Category name not showing properly

Quite a few Categories added to a test install of Magento shopping cart had the ampersand character in the name. The Category page was displaying the ampersand in the name as & a m p ; which is the special HTML entity for the ampersand character.

I fiddled around with the settings in the back-end admin but there was no solution like the one I had stumbled upon for a similar problem in Product names here.

After a lot of fiddling, it turned out that this was happening because the category view PHP file for the theme I was using had compatibility issues with the instaleld cart version. The solution was to modify the app/design/frontend/MYTHEME/template/catalog/category/view.phtml as follows:

Search for occurrences the line:
<h2><?php echo $_helper->categoryAttribute($_category, $this->htmlEscape($_category->getName()), 'name') ?></h2> 

Replace with this line:
<h2><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h2> 


Explanation:
We are changing the theme view code to not translate any characters in the name that may have a HTML Special Entity representation. So these will remain as they are and you will not see the names going haywire!

Note that this may need to be done in a different file depending on which of the files are causing this problem. The errant file could be an incompatible older version of a plug-in as well.

Magento - Ampersand in Product name not showing properly

Some of the products added to a test Magento cart had ampersand & character in the name. When viewing the product page for such products, the ampersand in the name was being shown as & a m p ; which is the special HTML entity for the ampersand character.

I was at a loss and almost on the verge of advising that Product name should not contain and special characters. However, while fiddling with the settings, I stumbled upon the setting in the attribute that allows HTML code in the name.

In the back-end admin, go to Catalog >> Attributes >> Manage Attributes menu and then click on the name attribute. Set the Allow HTML-tags on Front-end to Yes and you are all set to show ampersand and other special characters properly in the product name!

In fact, this same approach can be used for any field that is displaying such a similar behavior.

Magento - Invalid argument supplied for foreach in toolbar.phtml

After adding a new theme and uploading a big number of records to a fresh Magento install, I see the following error in the log files:

Invalid argument supplied for foreach() in /home/content/07/6268407/html/app/design/frontend/MYTHEME/template/catalog/product/list/toolbar.phtml on line 63

After much digging around, I realized that this error is due to change in Magento on how the pagination works now in 1.4 as compared to earlier versions. The theme I used was clearly not compatible with Magento1.4 and hence this issue. To resolve this problem, here are the steps I took:

1. Create Template file for Pagination
Create a new file for handling pagination according to the new way. Create a new file called pager.phtml in the /template/catalog/product/list/ folder inside your theme folder. Now write the below code into this new file:
<?php if($this->getCollection()->getSize()): ?>
        <?php if($this->getLastPageNum()>1): ?>
        <td class="pages">
            <strong><?php echo $this->__('Page:') ?></strong>
            <ol>
            <?php if (!$this->isFirstPage()): ?>
                <li><a href="<?php echo $this->getPreviousPageUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="<?php echo $this->__('Previous Page'); ?>" /></a></li>
            <?php endif ?>
            <?php foreach ($this->getPages() as $_page): ?>
                <?php if ($this->isPageCurrent($_page)): ?>
                    <li><span class="on"><?php echo $_page ?></span></li>
                <?php else: ?>
                    <li><a href="<?php echo $this->getPageUrl($_page) ?>"><?php echo $_page ?></a></li>
                <?php endif ?>
            <?php endforeach;; ?>
            <?php if (!$this->isLastPage()): ?>
                <li><a href="<?php echo $this->getNextPageUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="<?php echo $this->__('Next Page'); ?>" /></a></li>
            <?php endif ?>
            </ol>
        </td>
        <?php endif; ?>
<?php endif ?>

2. Call this Pagination code in Layout
Edit the catalog layout xml file to include this new pagination code. Open the file catalog.xml in the /layout/ folder inside your theme folder. Now search for this line of code:
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">

Below this line, add the following new line to call the pager file that you created in step 1 above:
<block type="page/html_pager" name="product_list_toolbar_pager" template="catalog/product/list/pager.phtml" />

3. Call this Pagination code in Toolbar
Edit the toolbar html file to include this new pagination code. Open the file toolbar.phtml in the /template/catalog/product/list/ folder inside your theme folder. Now search for the below block of code approximately around lines 42 - 63:
<?php if($this->getLastPageNum()>1 && is_array($this->getPages())): ?>
...
...
...
<?php endif; ?>

Now replace this block of code with the following single line of code:
<?php echo $this->getPagerHtml(); ?>


If you follow these 3 steps to the 'T' it should definitely resolve your problem!

To find out details of errors, please go through this post on Debugging Magento.

Monday, June 21, 2010

Logitech QuickCam Deluxe Webcam on Ubuntu 9.04

I suddenly realized that I had not used my Logitech QuickCam for Notebooks Deluxe Webcam on Ubuntu 9.04 till now! So I plugged it in and fired up Skype to do a Video Chat. To my pleasant surprise, it just worked right out of the box without requiring any tweaking, extra configuration or driver installation. The only thing that I had to do was to choose the Logitech devices as my Mic-In and Video-In devices.


Check out the specs & reviews of Logitech QuickCam for Notebooks Deluxe on Amazon:

Sony DSLR A230L Kit Refurb for 288 on SonyStyle

SonyStyle has a Refurbished Sony DSLR A230L for $288 with Free Shipping. The kit consists of Body having 10.2 Megapixel resolution & in-body image stabilization and 18-55 Standard Zoom Lens.

PROs:
  1. SteadyShot™ Image Stabilization in body
  2. HDMI Output
  3. Eye-Start™ Autofocus System
  4. Anti-Dust Technology helps keep the CCD imager clean
  5. Small & light body
  6. Accepts Memory Stick PRO Duo™, Memory Stick PRO-HG Duo™ and SD/SDHC media
  7. Very good for beginners
  8. Can shoot in RAW mode


CONs:
  1. Grip has been a major crib across the forums
  2. Included Lens is just about average
  3. Limited functionality for "PRO" users
  4. Average battery life
  5. Pop-up flash is front facing which may be disadvantageous
  6. Custom hot-shoe for external flash
  7. Average low-light performance

Verdict:

A good deal for the price especially for beginners, more so as it contains the lens as well.



For convenience, here's the direct link to DSLR-A230L on SonyStyle.



Check out the reviews and tech specs on Amazon:

Friday, June 18, 2010

Dell Outlet Laptops on Sale

Dell Outlet has a lot of good laptops & desktops with i3, i5 and i7 processors on sale right now.

Go to Dell Outlet and click on Home & Home Office link at the bottom right.
In the left menu, Check Availability & Prices section, select the product that you are interested in (laptop/desktop).
Select the Processor i3/i5/i7 with desired speed, uncheck Certified Refurbished (if not interested in Refurbished items) in the top center and click Filter Results. To sort by price low to high, click the Price column header.

Add desired item to your cart and then to make this deal sweeter, use coupon code
?C73C85JCXMXMG
for an extra 15% off - this coupon expires today. You will also get free 3-5 day ground shipping automatically for Dell Laptops from outlet store.

Check out the specs & reviews on Amazon:

LinkWithin

Related Posts Plugin for WordPress, Blogger...