Archive

Archive for the ‘blog posting’ Category

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 , ,

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 , ,

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 , ,

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 , ,

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 , ,

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 ,

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 , ,

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 ,

Magento Notes — Magento for B-2-B Web site

March 27th, 2009

<button class=”button” onclick=”setLocation(’<?php echo $this->getAddToCartUrl($_product) ?>’)”><span><?php echo $this->__(’Add to Cart’) ?></span></button>

I have recently been approached to work on a couple catalog-driven web sites for wholesalers and manufacturers, and what I have been presenting to them is simply a customized Magento installation in which 1) the pricing gets stripped out and/or
2) the pricing and the “add to cart” button gets stripped

Some of them also require that site operators approve customers before they can attempt to login; there’s a plugin for this here.

Below is a how-to on how to hide the “add-to-cart” button to non-logged in users.  Users would need to login in order to have a functional shopping cart:

Step 1 - To hide price: open the template file that shows prices: /app/design/frontend/default/[theme]/template/catalog/product/price.phtml and go to line line 30 (below: <?php $_id = $_product->getId() ?>) and add:

<?php if(Mage::getSingleton(’customer/session’)->isLoggedIn()): ?>

and at the very end, add:

<?php endif; /* if ($this->isCustomerLoggedIn()): */ ?>

Step 2 - go to /app/design/frontend/default/default/template/catalog/product/view/addtocart.phtml and add:

<?php if(Mage::getSingleton(’customer/session’)->isLoggedIn()): ?>

after: <?php $_product = $this->getProduct() ?>

and then add:

<?php endif; ?>

before <fieldset class=”add-to-cart-box”>

Step 3 - Remove add to cart buttons from /app/design/frontend/default/default/template/catalog/product/list.phtml

add the same if and endif statement around the following line of code:

<button class=”button” onclick=”setLocation(’<?php echo $this->getAddToCartUrl($_product) ?>’)”><span><?php echo $this->__(’Add to Cart’) ?></span></button>

so that it looks like:

<?php if(Mage::getSingleton(’customer/session’)->isLoggedIn()): ?>
<button class=”button” onclick=”setLocation(’<?php echo $this->getAddToCartUrl($_product) ?>’)”><span><?php echo $this->__(’Add to Cart’) ?></span></button>
<?php endif; ?>

read through the code and you will see 2 instances of the above (one for grid and one for list view)

Step 4 - Do the same as step 3 to file: /app/design/frontend/default/[theme]/template/catalog/product/compare/list.phtml

As I finished this, I found a more detailed wiki post on Magento: http://www.magentocommerce.com/wiki/price_on_application, it’s actually quite a bit more extensive and details on how to add attributes for variations to showing price.

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

Uploading mysql database via SSH

March 20th, 2009

I have always uploaded my Magento database via PHPMyAdmin (I know I know, it’s for novices)…but an incident yesterday with SimpleHelix (my current Magento hosting provider) forced me to learn how to import database and use SSH.  The whole incident started two days ago when I tried troubleshooting a new Magento installation, as the installation went through fine, but I kept getting error messages when I tried to view the front-end and when I tried logging into the backend; neither worked.  Tried googling on the web site for the error message (can’t remember what it was), but found no relevant errors…somewhat surprised, so I figure maybe it’s not a Magento issue. Read more…

blog posting, evaluation, technical notes , , , ,