Archive

Archive for February, 2009

How to reset Wordpress admin password

February 28th, 2009

If you have a Wordpress blog that you haven’t attended to in a long time and you have forgotten the password to get into the admin interface…here’s the trick to reset the password:

Use phpMyAdmin and run the following script:

UPDATE `wp_users` SET `user_pass` = MD5( ‘new_password_here‘ ) WHERE `wp_users`.`user_login` = “admin_username“;

Places in bold you will want to modify with your login name (most likely it’s admin) and select a new password. Once you run the script you should be able to login no problem.

This fix was found here: http://kb.siteground.com/article/How_to_reset_my_WordPress_admin_password.html

blog posting, technical notes, wordpress ,

Magento Notes - Fix for product category becoming blank

February 25th, 2009

After upgrading from version 1.1.6 to 1.2.1, there has been many issus with files not being updated properly.  The new problem deals with when you are editing a product (Catalog -> Manage Products) and you go to the “Categories” link at the left pane, you may see a screen with title “Product Categories” and nothing else.  Refer to pix.

Another system to this problem is that when you are in the Category Manager and you attempt to expand a parent category, you will just get the spinning wheel..and it would run forever.

the fix for both issues is to replace the “head.phtml” inside: magento/app/design/adminhtml/default/default/template/page

The fix was found here, but under a different topic: http://www.magentocommerce.com/boards/viewthread/27032/P75/#t101188

magento, technical notes , ,

Magento Notes - File access error in admin page (Catalog and Inventory links)

February 25th, 2009

Just upgraded a Magento installation from 1.6.1 to 1.2.1 and ran into some minor issues with file not found error like the following:

Warning: include(Mage/Adminhtml/Model/System/Config/Backend/Catalog/Inventory/Managestock.php) [function.include]: failed to open stream: No such file or directory in /home/noblesg/public_html/shop/app/code/core/Mage/Core/functions.php on line 73
Trace:

After some research on Magento forum…found a solution. It appears to be a common issue with version 1.2.1, the fix for this is fairly simple, just copy the files from:

http://svn.magentocommerce.com/source/branches/1.2-trunk/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Inventory/

if you look carefully the url path will correspond to your file structure in Magento, just copy the files that you are missing by traversing the folder and right-click the file and choose “Save As” and save the file(s) back into your magento folder and you should be ready to go.

For me, I had to recreate the “Catalog” folder and all files within underneath /config/backend/ and also the “Search” folder and all files within underneath Adminhtml/Model/System/Config/Source/Catalog/ to fix the “Catalog” and “Inventory” links in the admin page.

blog posting, magento, technical notes ,

Magento Notes - adding contact form into other CMS created pages

February 24th, 2009

I am just in the process of creating a new form for tickon.com, in which I would allow users to submit their products for evaluation and resell on the web site.  Again, with Magento, this is not something easy, or intuitive to do.  I came across a great read on http://inchoo.net/, giving a tutorial on how to embed the contact form in a CMS-created page.  Basically what you have to do is create a CMS page by going to: CMS -> Manage Pages -> Add New Page and simply embed the following script inside the “Content” text box, and you are ready to rock.

<!– CONTACT FORM –>
{{block type=’core/template’ name=’contactForm’ template=’contacts/form.phtml’}}
<!– END OF CONTACT FORM –>

blog posting, magento, technical notes , ,

Wordpress Technical Notes - embedding Google adsense in post

February 24th, 2009

Just as an experiment to see how effective google adsense can be, I am embedding Google adsense into my single posts in the blog.  I came across this tutorial which help made the implementation a breeze.

http://tamba2.org.uk/wordpress/adsense/

Now, let’s see those click-throughs come in!!

blog posting, technical notes, wordpress ,

Magento Notes - Adding a new page template

February 24th, 2009

In case anybody want to create a new page template to be selectable in the CMS, below are the simple steps to follow:

1. Create a a new phtml file in: app/design/frontend/default/your theme/template/page folder. Easiest way to do this is to copy one of the existing files (1column.phtml, 2columns-left.phtml, 3columns.phtml) that you will want to build on, and rename the new file to your liking.

2. Modify the config.xml in: app/code/core/Mage/Cms/etc, near line 182, you simply copy one of the existing xml block like the following:

<one_column>
<label>1 column</label>
<template>page/1column.phtml</template>
</one_column>

and rename the label to your liking (this name will be how you reference the template in the CMS, and then modify the phtml file name.  For my example below is my revised xml block:

<one_column_splash>
<label>1 column w splash</label>
<template>page/1column_splash.phtml</template>
</one_column_splash>

3. Make sure you refresh your cache, and go back into CMS and in the design section of the page, you will see the new template name in the drop down menu.

Text in green are what I have modified.  Hope people find this helpful.

The know-how for this post is obtained from Magento forum at: http://www.magentocommerce.com/boards/viewthread/1406/, and has been personally verified that it works very well. Thanks Chinesedream for the wonderful fix.

blog posting, e-commerce, magento, technical notes ,

Now servicing non-profit organizations

February 24th, 2009

Aside from making a profit, Casual Commerce also believes in contributing back to the community. We are always on the look out to work with non-profit organizations in helping them establish a web site and get their mission statement out to the general public. If you are a non-profit organization and you are looking for technical assistance, please contact us.

blog posting, news, services ,

1st Contribution - Wordpress Oriental Theme with 3-Columns

February 19th, 2009

Having used so much open source stuff to build my project…it’s finally time for me to give back to the community.  I have recently deployed my Chinese blog blog.52my.info using the original Oriental theme built by http://pure-essence.net/, but thought the layout was inadequate for displaying ads, so I have expanded the original design and made it into 3-columns in which the right side bar is now dedicated for ads.

Anyone interested in the 3-column oriental theme can download here.  I am not sure yet what the proper etiquette is for mod’ing someone else’s work and redistributing it, but if someone uses this and notices that i am not properly giving credit, please let me know.  I want to know so that I can make more contributions the right way in the future.

Trying something new here as well.  If you like the template, you can also donate and encourage me to create more free templates for the community.


blog posting, news, templates, wordpress , , , ,

Give your products more exposure on Google Base

February 17th, 2009

Just spent 2 days to get my products on Tickon.com listed in Googlebase.  By having the products listed in googlebase, you can get additional exposure on Google’s database, as well as more opportunities for Google crawlers to find your products and link to your site. 

Since Tickon.com is still running on an older version of Magento (still need to find time to upgrade, but I am afraid of the upgrade process due to bad past experiences), the tutorial here from Magento didn’t really help. But if you are on 1.1.7, you should check out the video! They have added extra menu options in the admin page to facilitate this.

So without the automated features to export from magento and into googlebase, the process becomes a manual process of exporting out a .txt file and uploading it into googlebase.  To export, you can use this workaround that I found on the Magento forum; thanks Turbo1.  Simply download the gbase.php file (or view the script below), modify the path to where you want to save the file (for me, i saved it to /var/export), and simply drop the file into the Magento root folder and then access the file like this: http://www.tickon.com/gbase.php, and this would create the required .txt file into the /var/export folder.

Now that you have the file, you can simply create a datafeed in googlebase and upload the txt file.  without this gbase.php file, using the default Export Magento module would be difficult, but not impossible!

Have fun.  My next task…feeding the products into Feedburner.

<?php
define(’SAVE_FEED_LOCATION’,'var/export/google_base_feed.txt’);//you can set a new folder and file if you want, don’t forget to chmod the folder to 777

// make sure we don’t time out
set_time_limit(0);

require_once ‘app/Mage.php’;
Mage::app(’default’);

try{
$handle = fopen(SAVE_FEED_LOCATION, ‘w’);

$heading = array(’id’,'title’,'description’,'link’,'image_link’,'price’,'brand’,'product_type’);
$feed_line=implode(”\t”, $heading).”\r\n”;
fwrite($handle, $feed_line);

//———————- GET THE PRODUCTS
$products = Mage::getModel(’catalog/product’)->getCollection();
$products->addAttributeToFilter(’status’, 1);//enabled
$products->addAttributeToFilter(’visibility’, 4);//catalog, search
$products->addAttributeToSelect(’*');
$prodIds=$products->getAllIds();

//echo ‘Product filter: ‘.memory_get_usage(false).’<br>’;
//flush();

$product = Mage::getModel(’catalog/product’);

foreach($prodIds as $productId) {
//echo ‘. ‘;
//flush();
//echo ‘Loop start: ‘.memory_get_usage(false).’<br>’;
//flush();

//$product = Mage::getModel(’catalog/product’);
$product->load($productId);

$product_data = array();
$product_data['sku']=$product->getSku();
$product_data['title']=$product->getName();
$product_data['description']=$product->getDescription();
$product_data['link']=$product->getProductUrl();
$product_data['image_link']=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).’catalog/product’.$product->getImage();
$product_data['price']=$product->getPrice();
$product_data['brand']=$product->getResource()->getAttribute(’manufacturer’)->getFrontend()->getValue($product);
$product_data['product_type']=”;

//echo ‘Product load: ‘.memory_get_usage(false).’<br>’;
//flush();

//get the product categories
foreach($product->getCategoryIds() as $_categoryId){
$category = Mage::getModel(’catalog/category’)->load($_categoryId);
$product_data['product_type'].=$category->getName().’, ‘;
}
$product_data['product_type']=rtrim($product_data['product_type'],’, ‘);

//echo ‘Category load: ‘.(memory_get_usage(false)).’<br>’;

//sanitize data
foreach($product_data as $k=>$val){
$bad=array(’”‘,”\r\n”,”\n”,”\r”,”\t”);
$good=array(”",” “,” “,” “,”");
$product_data[$k] = ‘”‘.str_replace($bad,$good,$val).’”‘;
}

$feed_line = implode(”\t”, $product_data).”\r\n”;
fwrite($handle, $feed_line);
fflush($handle);

//echo ‘Loop end: ‘.memory_get_usage(false).’<br>’;
//flush();
}

//———————- WRITE THE FEED
fclose($handle);

}
catch(Exception $e){
die($e->getMessage());
}

blog posting, e-commerce, magento, technical notes , , ,

Favicon - the little bookmark icon that shows up next to URL

February 16th, 2009

Just wanted to put a note to a pretty good Photoshop extension that I found as I was looking for tools to create .ico files (favicons) for my web sites. Here’s a link to download the extension from Toby Thain: http://www.telegraphics.com.au/sw/#icoformat, all it is is a simple file that you copy into the “File Formats” folder inside your Photoshop Plugins folder.

Now when you create a new icon, which is a 16px x 16px icon you can save as .ico file format in Photoshop. As to where to put this file, simply name this file favicon and drop it into the root of your web site folder.

For Wordpress, you will want to drop this into your wp-content/themes/themeName folder.

For Magento, you will want to drop you favicon file in the root Magento folder as well as: skin/frontend/default/themeName if you want to add the favicon to the admin page you will drop it here: skin/adminhtml/default/ThemeName

e-commerce, magento, technical notes, wordpress , , ,