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:

Wednesday, June 16, 2010

Make your Blog Post Title SEO Friendly

By default, the Blog Post Title that Blogger creates has the Blog Name followed by the Post title. This is not so SEO Friendly and it determines how you your blog title is displayed in search results. Making it more relevant increases the chances of people clicking through your link and besides, doing this is really very simple!

Change Blog Post Title
  1. Go to Design > Edit HTML in your Dashboard
  2. Search for:
    <title><data:blog.pageTitle/></title>
  3. Replace it with:
    <b:if cond='data:blog.pageType == "index"'> 
      <title><data:blog.title/></title>
    <b:else/> 
      <title><data:blog.pageName/> | <data:blog.title/></title> 
    </b:if>
    
  4. Save the Template

Note: The changes on your Blog will be immediate, but the results to show up on the search engines may take up time depending on how they spider and change their databases.

Jamba Juice for a Dollar - 16 June 2010

Today Jamba Juice is offering three of its new super-fruit smoothie flavors for only a dollar! These include Pomegranate, Yumberry or Acai 16 oz smoothies - they are just awesome!
Yumberry fruit is a Chinese / Japanese Bayberry which looks like litchi except that the outer skin is also edible.
Acai fruit or Acai berry has been long touted as a very good anti-oxidant but not clinically proven as yet.

So go ahead and have a healthy fruit smoothie today for a buck, courtesy of Jamba Juice!

Summer is here (almost)!

Good to see that warmth is returning to the air and its summer time again!
And along with the arrival of summer, it is good see new, fresh and very good templates/themes being made available from blogger!
My previous blog template was good but was breaking and it was time to change it - what a timing from blogger in releasing the new templates!
So to reflect the joy in the air, I have changed the template on my blog to be more cheerful!
If you have a blogger/blogspot blog, do check out the new templates!

With the new template, the Tag Cloud widget stopped working so I had to re-install it. If you face a similar problem, then check out the creator phydeaux3 blog page on this here. Only thing that I did not like about this widget is that it shows the current post also in the list of related posts. I feel filtering it should not be such a big task - I hope the creator can take note of this and implement it at the earliest.

The code was not showing up properly after installing new template - this indicated that the Syntax Highlighter was not working. To re-install it, I referred to the detailed post here.

Apparently, adding the new template broke the Related Posts widget as well, so I had to re-install that as well. Check out the instructions at the the creators' site here.

Note: Please backup your current template locally before doing any such changes. Also you may need to re-install 3rd party widgets as they may not be cleanly supported by these new templates!

Monday, June 14, 2010

Fix Magento Error Message “Exception printing is disabled by default for security reasons”

Sometimes when Magento exceptions out, it gives the message:
“Exception printing is disabled by default for security reasons”
To remove this message, follow the steps below:

Step 1:
Copy the file errors/local.xml.sample and name it as errors/local.xml

Step 2:
Modify the configuration to suit your needs - the xml is very well commented and self-explanatory. For leaving the error log files on the server for future reference as well as email it to the store admin, the config should be setup as below:

<config>
    <skin>default</skin>
    <report>
        <!--
            "action" can be set to "print" to show exception on screen and "email"
            to send exception on specified email
        -->
        <action>email</action>
        <!--
            in "subject" you can set subject of email
        -->
        <subject>Store Debug Information</subject>
        <!--
            "email_address" admin email address
        -->
        <email_address>storeadmin@mystore.com</email_address>
        <!--
            "trash" is handle about trace info
            value "leave" is for store on disk
            value "delete" is for cleaning
        -->
        <trash>leave</trash>
    </report>
</config>

For more Magento debugging tips, check out my article Debugging Magento.

Debugging Magento

Magento some times errors out with the below message which gives no clue as to what might have gone wrong:

There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: XXXXXXXXXX

If you have access to the files on the server, then go to the folder /var/report/ and look for the file named with the above number and open it up - you will see a "stack trace" of the error!

In case you do not have access to these files, fear not! You can enable the printing of the logs on the front-end. Open the file index.php and uncomment line 71 to display the errors:

ini_set('display_errors', 1);

But remember - do not keep this on for a long time as the error messages will be visible to the world.

Monday, June 7, 2010

Rip Audio CDs in Ubuntu

I had an old music audio CD that I wanted to convert/rip to MP3 and then upload to my RockBox-ed Sansa e260. This is quite a simple task if you have the right set of tools with you. Here's how I did it on Ubuntu 9.04.

Here are the steps to get this done:
  1. Install SoundJuicer
  2. Install MP3 Encoder
  3. Setup Sound Juicer to convert to MP3
  4. Convert the Audio CD

Install SoundConverter
You need to install soundjuicer application from the Synaptic package manager. This program does the work of converting between formats and supports WAV, FLAC and OGG Vorbis natively. So for converting to MP3 and other formats, it requires the appropriate encoders.

Install MP3 Encoder
You need to install GStreamer MP3 Encoder (gstreamer-0.10-plugins-ugly) from Multi-Verse link apt:gstreamer0.10-plugins-ugly-multiverse?section=multiverse as mentioned on the SoundConverter website since it is not directly supported by Ubuntu and so may not available from the Synaptic package manager.

Setup SoundJuicer to convert to MP3
Now that our installation is complete, fire-up the Sound Juicer application Applications > Sound & Video > Audio CD Extractor and go to Edit > Preferences menu. Change the Format > Output Format to ".MP3"; Bitrate Mode to "Variable (VBR) - Best Quality; and Quality to High.

Convert the required files
This completes our setup and now we are ready to convert files. Just load the audio CD you want to convert and press the Extract button!

Note: Sometimes if the tracks in the Audio CD do not have any tag info, then Sound Juicer simply crashes. In that case, copy the files from the CD onto a local folder and then follow the steps to convert WAV to MP3 in my post here

Convert WAV files to MP3 in Ubuntu

I had old music files in WAV format that I wanted to convert to MP3 and then upload to my RockBox-ed Sansa e260. This is quite a simple task if you have the right set of tools with you. Here's how I did it on Ubuntu 9.04.

Here are the steps to get this done:
  1. Install SoundConverter
  2. Install MP3 Encoder
  3. Setup Sound Converter to convert to MP3
  4. Convert the required files

Install SoundConverter
You need to install soundconverter application from the Synaptic package manager. This program does the work of converting between formats and supports WAV, FLAC and OGG Vorbis natively. So for converting to MP3 and other formats, it requires the appropriate encoders.

Install MP3 Encoder
You need to install GStreamer MP3 Encoder (gstreamer-0.10-plugins-ugly) from Multi-Verse link apt:gstreamer0.10-plugins-ugly-multiverse?section=multiverse as mentioned on the SoundConverter website since it is not directly supported by Ubuntu and so may not available from the Synaptic package manager.

Setup SoundConverter to convert to MP3
Now that our installation is complete, fire-up the Sound Converter application and go to Edit > Preferences menu. Change the Type of result? > Format to ".MP3"; Bitrate Mode to "Variable (VBR) - Best Quality; and Quality to High.

Convert the required files
This completes our setup and now we are ready to convert files. Just add the files you want to convert and press the Convert button!

Note: that you will need to copy files from the Audio CD onto your HDD before starting the conversion otherwise SoundConverter complains and does not do anything.

Note: If you sinply want to rip an Audio CD, then follow the steps to rip an Audio CD to MP3 in my post here

Full featured hosting for $1.99 per month

For those on the lookout for a good Web Hosting Deal, WebHostingPad.com is now offering full featured unlimited hosting for $1.99/month when prepaid for 4 or 5 years!

For those looking for affordable Linux + Java/JSP Web Hosting, DailyRazor is providing a full featured unlimited hosting including Shared Tomcat for $4.60/month when prepaid for 3 years!
If looking for a regular hosting, DailyRazor is offering a full featured unlimited web hosting for only $2.95/month when prepaid for 3 years.
Use coupon code 15PD for another 15% discount at DailyRazor!

Checking for NaNs

In Sybase 12.5.4, checking for NaN is very simple - just convert the number to a string and check for the string!
select * from mydata where STR(numcol) like '%NaN%'

From Oracle 10g onwards, this is very simple as a special NaN value is made available for checking against:
select * from mydata where numcol is NaN

Tuesday, June 1, 2010

Bagel and Coffee for a Buck plus more food deals

Its always good to see cheap food deals, especially in NYC! So this week Mustang Cafe on 22 W 38th Street between 5th and 6th Avenues has the following deals:
Breakfast
Toasted Bagel with Butter and small Coffee or Tea for $1.
Lunch
Tossed or Chopped Salad with 1 Main ingredient and Unlimited Toppings with Free Small Soup. Small Salad for $6.99 and Large Salad for $7.99.

Enjoy it while it lasts!

Update: As of the week of June 21, these deals are still valid!

LinkWithin

Related Posts Plugin for WordPress, Blogger...