Archive

Archive for the ‘e-commerce’ Category

Magento Notes — Customizing the RSS Feed that Magento Outputs

November 11th, 2009

One of the marketing strategy employed by many e-commerce sits is to provide product feeds (RSS) to have them be displayed in an affiliate or partner blog or content-driven web sites.  I’ve recently came across this need to do just that and what I have found is that the default Magento RSS feed is clunky and display the entire product description as part of the feed items.  The way to customize the output is go to into the following file (NOTE: this workaround requires modify Magento core file, which may become a hassle and you update your Magento installation):

\app\code\core\Mage\Rss\Block\Catalog\

under the above folder, you will see different files (category.php, new.php, tag.php, etc.) each file controls the output of each type of RSS feed Magento has built in by default. So if you want to modify the RSS feed format for your products in a certain category you would modify the category.php file. For me, i was looking at syndicating my new products, so I modified new.php file.

When opening up the new.php file, scroll down to approximately line 99-104, under the public function addNewItemXmlCallback($args) is where the RSS feed content is formatted, so you can simply move around the html table and or select to replace the product description with the short description, etc.  For me, I simply removed the long description and kept the pricing, product image and the product title. Below is my revised output code snippet:

$description = ‘<table><tr>’.
‘<td><a href=”‘.$product->getProductUrl().’”><img src=”‘. $this->helper(’catalog/image’)->init($product, ‘thumbnail’)->resize(75, 75) .’” border=”0″ align=”left” height=”75″ width=”75″></a><br>Price:’.Mage::helper(’core’)->currency($product->getPrice()).
($product->getPrice() != $final_price  ? ‘ Special Price:’. Mage::helper(’core’)->currency($final_price) : ”).
‘</td>’.
‘</tr></table>’;

and the output looks like the following when it gets syndicated to a content driven site, you see the RSS feed of the products at the right side of the screen:

http://links.chosen29.com - this is a PLIGG-driven bookmarking web site similar to Digg.com

http://links.chosen29.com - this is a PLIGG-driven bookmarking web site similar to Digg.com

The RSS feed from Magento is fed through Google’s Feedburner and then syndicated thereafter, primarily for the purpose of better exposure and trackability.

Lastly, here’s a shameless plug, please visit my new web site at Chosen29.com

blog posting, e-commerce, magento ,

Tickon.com for Sale

July 28th, 2009

We are selling our e-commerce web site: www.tickon.com.

Why are we selling? Becuase we have more projects to work on, and we simply don’t have time to operate the business side of the e-commerce site, and that includes marketing the site, fulfilling orders, finding new products, and most importantly — providing excellent customer service.

How much are you selling for? Make your best offer and we will consider every bid.  We just want the site to be in good hands; someone willing to put in the effort to market the site.

What’s included? We will include the domain name, help you move to your desired web hosting company? or we will host it for you for a small monthly fee. You will also have the code (the site runs on Magento 1.2.1), and the existing database, and you will be hooked up with the product supplier for future order fulfilment (they are a great supplier to work with!!).

For more information email me at jerry at casualcommerce dot com

blog posting, e-commerce, magento , , ,

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

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

Magento Notes — Show thumbnail image without pop-up window

March 19th, 2009

Finding ways to improve on the usability of tickon.com, I have made a small improvement.  I thought it was quite annoying to always have to wait for a new window to open to view the alternate images, so did some googling and found the perfect fix on Magento forum (link to exact post).  This fix simply allows you to click on the thumbnail alternate images and have it be shown in the large image box above.  Without going through the discussion thread…here’s the quick fix:

Locate media.phtml in app/design/frontend/default/themename/template/catalog/product/view, and near line# 59, you should see:

<a href=”#” onclick=”popWin(’<?php echo $this->getGalleryUrl($_image) ?>’, ‘gallery’, ‘width=300,height=300,left=50,top=50,location=no,status=yes,scrollbars=yes,resizable=yes’); return false;”><img src=”<?php echo $this->helper(’catalog/image’)->init($this->getProduct(), ‘thumbnail’, $_image->getFile())->resize(120); ?>” alt=”<?php echo $this->htmlEscape($_image->getLabel()) ?>” title=”<?php echo $this->htmlEscape($_image->getLabel()) ?>” /></a>

change the part in red to the following:

<a href=”<?php echo $this->helper(’catalog/image’)->init($this->getProduct(), ‘image’, $_image->getFile()); ?>” title=”<?php echo $_product->getName();?>” onclick=”$(’image’).src = this.href; return false;”>

You should be able to modify it a bit more if you want the image to update on mouseover.

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

Magento Notes — Fix for adding contact form in CMS pages

March 16th, 2009

This is a follow-up post on a fix that I had suggested about adding a contact us form through the CMS admin tool here.  What I found out was that the form post back left out the action parameter…when you do a view source.  So essentially the form gets filled out but doesn’t get sent to the site owner.

I found this out on my own tickon.com web site’s submit a product page.  Below is the fix for this:

Go into: app/design/frontend/default/blue/template/contacts and modify the form.phtml.  On (or around) line# 32, replace:

<form action=”<?php echo $this->getFormAction(); ?>” id=”contactForm” method=”post”>

with

<form action=”<?php echo Mage::getUrl(); ?>contacts/index/post/” id=”contactForm” method=”post”>

and you should be ready to go.

e-commerce, magento, technical notes , ,

Magento notes — Add social bookmarking to your e-commerce site

March 9th, 2009

Now that tickon.com has been running for about a month, the real challenge is how to promote this web site.  This appears to be the most common question that I get nowaday.  Many potential clients have asked me the same question…and honestly, aside from the generic SEO techniques that every SEO firm uses, how else can you drive traffic to your site?

Here’s one strategy: I am exploring the possibility of having existing users on tickon.com do the promotion for me by making it easy for them to bookmark my site and add my web site information to any of the popular social bookmarking and networking sites out there.

here’s how I did it…sign up for a FREE AddThis account, and add the javascript that was provided into the following Magento page: app/design/frontend/default/your theme/template/catalog/product/view/addto.phtml

I simply added a new <ul></ul> below the existing links for “add to wishlist” and “add to compare”, below is the code:

<ul class=”add-to-box”>
<li><br>
<!– AddThis Button BEGIN –>
<script type=”text/javascript”>var addthis_pub=”youraddthisaccount”;</script>
<a href=”http://www.addthis.com/bookmark.php?v=20″ onmouseover=”return addthis_open(this, ”, ‘[URL]‘, ‘[TITLE]‘)” onmouseout=”addthis_close()” onclick=”return addthis_sendto()”><img src=”http://s7.addthis.com/static/btn/lg-share-en.gif” width=”125″ height=”16″ alt=”Bookmark and Share” style=”border:0″/></a><script type=”text/javascript” src=”http://s7.addthis.com/js/200/addthis_widget.js”></script>
<!– AddThis Button END –>
</li>
</ul>

the code is added right below the closing

on line 37

I will be posting the effectiveness of adding this social bookmarking widget once I gather enough stats from tickon.com.

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

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 ,

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