Problem with Magento not able to download/install extensions

June 24th, 2009

Not sure if it’s just me.  But for every Magento development done, whenever I upload my code to the production server, the code would run fine, but when it comes to installing extensions using Magento Connect, it would never properly install the extensions (even though it claims that it has successfully installed the ext.).

The problem appears to be an issue with the “Downloader” folder not being writeable in the production environment; this makes perfect sense from security perspective, but there just needs to be better documentation on how to best setup the site so that Magento Connect works as advertised.

I googled and came across the following post: https://www.gigapros.com/support/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=164, the long and short of is is simply to make Magento fully writeable (777) when you run the Magento Connect, and then reset the permissions after the extension has been installed….it’s a somewhat satisfactory workaround i guess.

Here’s how to do this thru your SSH client. Log in to your SSH account and then execute the following commands:

1. cd <your_magento_folder_path>
2. find . -type d -exec chmod 777 {} \;
3. chmod 666 downloader/config.ini

You should now be able to access the Magento Connect Manager. When you have finished the installation/upgrade, you should reset the permissions by executing the following SSH commands:

1. find . -type d -exec chmod 755 {} \;
2. find . -type f -exec chmod 644 {} \;
3. chmod o+w var media app/etc/use_cache.ser

blog posting , , ,

Bookmark and Share

Strategically inserting Google ads into Wordpress blog

May 21st, 2009

Have been working hard to promote blog.52my.info, but have realized that there isn’t an easy way to add google ads more naturally in between posts.  Some research landed me on Problogger.net (an excellent blog that teaches/motivates people how to make money blogging — I am a believer in Darren).

To more naturally add google ads, what you simply need to do is modify your “Main Index Template” usually the index.php file.  In there you should find a while loop that looks something like:

if (have_posts()) :
while (have_posts()) :
the_post();
the_content();
endwhile;
endif;

just change it to something like this:

// Set Counter to 1, First Post
$counter = 1;
if (have_posts()) :
   while (have_posts()) :
      $counter = $counter + 1;
      the_post();
      the_content();
      if(2 == $counter)
      {
         echo 'Adsense code';
      }
   endwhile;
endif;

the things to look for and add are in bold.  The “2″ indicates that google ads will be inserted in every 2 posts. This information was obtained here

blog posting, technical notes, wordpress , ,

Bookmark and Share

Magento Notes — Default sorting is not logical

May 19th, 2009

Now that I have my e-commerce site, tickon.com, running for a while (3-months), I am back at it adding more products to link to my affiliate partners (this is a new experiment on this web site).

As I started to add new products, I noticed that newest items are added to the last page of the category that it was assigned to…not a very smart implementatio in my opinon. Did some googling and found a fix here:

http://www.magentocommerce.com/boards/viewthread/1176/

Essentially what needs to be done is to fix the file: app/code/core/Mage/Catalog/Block/Product/List/toolbar.php

near line 47, I changed the original code to the following:

$this->_availableOrder = array(
‘entity_id’ => $this->__(’Newest’),
‘name’      => $this->__(’Name’),
‘price’     => $this->__(’Price’)
);

The first item listed will be the default sort filter, the default was “best value”…which didn’t make a lot of sense to me.

Second item to fix up is in the same file, but you go to line 108 (approx.) and modify the highlighted part as below:

public function getCurrentDirection()
{
if ($dir = (string) $this->getRequest()->getParam($this->getDirectionVarName())) {
$dir = strtolower($dir);
if (in_array($dir, array(’asc’, ‘desc’))) {
return $dir;
}
}
return ‘desc‘;

default is asc, but you need to change it to descending so that it sorts from newest id first.

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

Bookmark and Share

Relaunch of OCCACC.ORG

May 5th, 2009

I would also like to take this time to announce the relaunch of Orange County Chinese-American Chamber of Commerce (OCCACC.ORG) web site.  It is a web site dedicated to  developing Chinese-American commerce by providing assistance in business management business operation, trade materials, and business experience.

Please send any questions and feedback related to the web site to me. Thanks.

blog posting, news, wordpress , ,

Bookmark and Share

Upgrading Wordpress from 2.6.x to 2.7.x

May 5th, 2009

I have recently being doing a lot of moving. Moving web sites that is, from Godaddy to Simplehelix, as i am trying to clear my godaddy vps to be dedicated for 52my.info web site. The hits on 52my.info has been growing steadily. But we are hoping for a POP soon!!

Anyways, as I start moving my sites from one host to another, i figured, why not take the time to also upgrade my older blog sites to the newer WP versions, so I did a quick search and I came across a great post by Siddharth, but I will do a quick summary of what worked for me:

1. Backup the following files and folders :
* Folder: wp-content (backup the whole directory)
* Config File: wp-config.php (file)
* Database: Database (using phpmyadmin, backup the whole database, safe.)
2. Downloaded the latest Wordpress here.
3. Delete all the old Wordpress files .
4. Extract and upload (or upload and extract) the new Wordpress files.
5. Copy the wp-config.php to the Wordpress root directory.
6. Run wp-admin/update.php (http://yourwordpresssite/wp-admin/update.php). It will ask for a database upgrade, continue. If all goes well it will redirect to a blank page.
7. Delete the new wp-content directory and upload your old wp-content directory in place of it.
8. Visit your site! All your posts and plugins will be active and it will look the same! (All incompatible plugins will be disabled automatially, but most of the plugins that work with 2.6.* also work with 2.7
9. Admin URL is the same: http://yourwordpresssite/wp-admin/

Thanks Siddharth!! for for this wonderful guideline!!

blog posting, wordpress , ,

Bookmark and Share

Relaunch of 52my.info — Chinese classified web site

April 17th, 2009

I would like to announce the relaunch of our fast-growing 52my.info web site.  It is a “chinese-craigslist” for the Chinese community in Southern California.  With a rapid growing user base we will be expanding into other cities soon!

The web site has been completely rewritten with ASP.NET 3.5 & C#, and a lot of ajaxy features have been thrown in to make the user-interface more friendly then what it was before.  So far the feedback has been mostly positive, but we are always gathering new feedback and trying to improve on the site.

If you can read Chinese, please visit the site and provide me with some feedback! Constructive criticisms are welcomed too!!

blog posting, news , ,

Bookmark and Share

Magento Notes — Setting Product Options to ALWAYS Show in Product Info Column

April 13th, 2009

I can’t believe how difficult it is to modify the admin interface so that when you are adding an item, that in the Design menu options, it would default to “Product Info Column” rather than “Block After Info Column”. After hours of searching, I came up with a hack, it’s not the best fix, but it works for my scenario in which I would never set the options to use the “Block After Info Column”. Personally, I think that “block after info column” design is poor usability, so it baffles me what that is even the default.

Anyways, the way I got around to fixing this is to simply remove that option as a possible selection option in the dropdown, so that is left is “Product Info Column”. So if this is something that suits your need, all you would have to do is the following:

Modify config.xml inside: app/code/core/Mage/Catalog/etc, and go to line (approx): 257 and look for the xml block:

<option2 translate=”label”>
<value>container2</value>
<label>Block after Info Column</label>
</option2>

Hope this helps!!

blog posting ,

Bookmark and Share

Magento Notes — How to reference custom product attributes

April 6th, 2009

One thing that I find very useful as I start to seriously customize the product details page for my B2B client is the ability to create custom attributes.  But it took me forever to figure out how to call them from the view.phtml which is the file you are most likely gonna be modifying as well as list.phtml, both located in: app\design\frontend\default\blue\template\catalog\product

If you have created a custom attribute of type dropdown list or other multi-select list, you will reference the attribute using:

<?php echo $_product->getAttributeText(’attribute_code‘) ?>

where the attribute_code is what you have setup in the admin interface when creating this custom attribute. For textboxes and text area data types, you will call these a little differently using:

<?php echo $_product->getAttributeName() ?>

where getAttributeName is a variable of “get” + “attribute_code” where if you have underscores (_) or dashes (-), they are removed, and each word’s first character is capitalized.  So for example, if you have an attribue code called: shirt_size, your call would be:

<?php echo $_product->getShirtSize() ?>

Note that it is case-sensitive.

The link here has additional information on this topic.

magento, technical notes ,

Bookmark and Share

Magento Notes — Adding a mini login to the side bar

April 5th, 2009

Client requested to have a user login (user name and password textboxes) on the side bar for the customers to more easily login to their account and place an order.  This is a b-2-b web site, so users are only able to order after they have successfully logged in. I found a great post on Sibble.com, which details the steps to add the mini login, walking through the suggested procedure it worked for my ver 1.2.1 install using the BLUE theme.

Below is my walkthrough steps:

1) Modify the boxes.css inside: /skin/frontend/default/blue/css/, near line494 add the following line:

.mini-login-form h4 { background-image:url(../images/icon_page_white_text.gif); }

what this does is add a small logo at the top of the mini login form, so that it stays consistent with all the other boxes in the sidebar.

2) Modify the existing mini.login.phtml file to add extra formatting as the default only shows a plain textbox without any formatting. Go to app\design\frontend\default\blue\template\customer\form and open up mini.login.phtml, and change:

<form action=”<?php echo $this->getPostActionUrl() ?>” method=”post”>
<table width=”100%” class=”mini-login”>
<tr><td><?php echo $this->__(’Email’) ?>:</td><td><input name=”login[username]” /></td></tr>
<tr><td><?php echo $this->__(’Password’) ?>:</td><td><input name=”login[password]” /></td></tr>
<tr><td>&nbsp;</td><td><input type=”submit” value=”<?php echo $this->__(’Login’) ?>” /></td></tr>
</table>
</form>

to:

<div class=”box base-mini mini-login-form”>
<div class=”head”>
<h4><?php echo $this->__(’Login’) ?></h4>
</div>
<form action=”<?php echo $this->getPostActionUrl() ?>” method=”post” id=”login-form”>
<div class=”content”>
<ul class=”form-list”>
<li>
<label for=”email”><?php echo $this->__(’Email Address’) ?> <span class=”required”>*</span></label><br />
<input name=”login[username]” value=”<?php echo $this->htmlEscape($this->getUsername()) ?>” title=”<?php echo $this->__(’Email Address’) ?>” id=”email” type=”text” class=”input-text required-entry” style=”width:122px;” />
</li>
<li>
<label for=”pass”><?php echo $this->__(’Password’) ?> <span class=”required”>*</span></label><br />
<input name=”login[password]” type=”password” class=”input-text required-entry validate-password” id=”pass” style=”width:122px;” />
</li>
</ul>
<p class=”required”><?php echo $this->__(’* Required Fields’) ?></p>
</div>
<div class=”actions”>
<button class=”form-button-alt” type=”submit” name=”send” id=”send2″><span><?php echo $this->__(’Login’) ?></span></button>
</div>
</form>
<script type=”text/javascript”>
var dataForm = new VarienForm(’login-form’, true);
</script>
</div>

3) Add mini.login.phtml to the sidbar. Go into: app\design\frontend\default\blue\layout and open up customer.xml. Go to line 76, which should take you to the <customer_logged_out> block, then add:

<remove name=”reorder”></remove>
<reference name=”right”>
<block type=”customer/form_login” name=”mini_login” template=”customer/form/mini.login.phtml” />

underneath <remove name=”reorder”></remove>

From here you should see a mini login in your right sidebar when you are not logged in. This mini sidebar would disappear after you have successfully logged in.

One catch to this is that for some reason now all the page title shows: Customer Login, so this required editing the core file. Open up: app/code/core/Mage/Customer/Block/Form/Login.php and comment out the line that says:

$this->getLayout()->getBlock(’head’)->setTitle(Mage::helper(’customer’)->__(’Customer Login’));

Now it should be functional.

blog posting , ,

Bookmark and Share

Magento 1.3 Release

April 1st, 2009

Came across the news release on Magento’s blog with the release of Magento 1.3 Download here

One of the most coveted feature is now available: Customer Upload of Files.  I can see many uses for this feature, and I will definitely take advantage of this feature in my next project. But I won’t actually touch 1.3 for awhile, or atleast after I hear other people’s feedback on this update.

blog posting, e-commerce, magento, news ,

Bookmark and Share