Archive for the ‘E commerce’ Category

Magento : how to learn from free templates

The power of Magento is great but it requires long days of learning and suffering to get through relative simple features, such as the now common front page slide banner. I had a quick look at magento free templates on google and was conquered by Magento ’s classic theme, the kind of  stuff that’s really given free of charge when I would have paid for it. It actually comes with an interesting development of Magento’s block systems, and demonstrates how to add a custom block between navigation and content : the prototype glider that scrolls images is defined a cms static block, which is then called in the home page CMS  custom xml definition, with a reference to the slider block that’s positionned in phtml files and declared in the xml layouts as a core/text_list type . Impressive stuff : that’s pure  magento design and illustrates how versatile the system is.

Links : 25 free templates for Magento

Magento log cleaner

Magento, in earlier versions, does not seem to handle log cleaning very well. A lot of configuration options are vailable under the configuration  / Advanced / System menu, that seem to have an impact on the cron.php process. But trying to remove logs this way is a complicated task that involves full log counting (select count on mage_log_visitor) and the result is not always there, don’t know why. A full truncate on log tables seems more appropriate, as described on the knowledge base, to use with caution obviously : Magento Maintenance Script was posted a few days ago but I tried it and it’s pretty efficient. Let us know how it performed on your install, on mine it works well. Go ahead after you’ve performed the appropriate backups !

Magento email configuration pain and how to solve it

It’s nice to setup a magento shop, but one particular task is painful and time consuming : the modification  of automatic email templates . By defautl, email tempaltes in Magento are well designed as a sample given out to the developer, but when you expect to have your shop running in a few hours  time, it is really a pain to go through all emails jsut to change phone numbers, shop name, and opening times especially when this information could be centralized in the database.  The subject is not new and here a few hacks to let you work faster when setting up a shop

One Page javascript shopping cart

This one struck me because I can remember working out a javascript shopping cart back in 1996… Long time ago in terms of web time, and 13 years later the idea has popped again from some strange mind figuring out that simplicity does it all. If you’ve had enough of configuring complex ecommerce solutions like Magento or Prestashop, then simplecart(js) is for you. “No databases, no programming, no headaches. A simplejavascript shopping cart in under 20kb that you can setup in minutes. It’s lightweight, fast, simple to use, and completely customizable. All you need to know is basic HTML. Works with Paypal and google checkout apparently.

simplecart

http://simplecartjs.com/

Magento release 1.4

It’s only alpha but I’ve tested it because I’m still running 1.2 and I’m waiting for serious reason to upgrade : I can tell you I’ve seriously avoided the basic Magento advice whic is ‘never hack the core’, and I have a dozen fixes implemented in the app/code/core section of my production install, which means a few hours upgrade. Reading Release notes was not very interesting so I decided I’d for a test drive. Well not much to say except the new tax system which is suited to european complexity, including or excluding shipping costs, reductions and other attributes are available in the system/ admin menu. The most noticeabl imporvement was not indeed produced by Magento but by google : remember at some time Chrome did not work well with the admin. This is now fixed, and thanks to a better cookie management chrome now handles magento admin pefectly, which means faster work. For enterprise users (9000 $ /year), a new video has been posted about private sales that offer special deals to users for a limited time using special member restricted access with invitations. Magento actually works well with emails, including reports on accepted invitations and generated sales. Enjoy.

Tomatocart rebuilds oscommerce

tomatocart

There are many discussions on whether oscommerce is dead or not. From an industry where every six months new products come online with ever more exciting new features, the longevity of Oscommerce, the first opensource e commerce application, is a good example of a bad designed  application theat does the job well. Os commerce evolution has stopped in 2005, when the first preview of the MS3 version – not yet released as of today – went public. What struck me with tomatocart is the backend interface, based on ext js desktop layout with charts by piwik / openchart flash . More info on http://www.tomatocart.com/

Magento showcase : Rue de Siam

screenshot1

I’ve finally released my first Magento website, and it proves to be a  real SEO winner (100% increase in visits after 2 weeks). RuedeSiam is a furniture importer based in Brittany. Now you know why I bothered comparing commercial and opensource Flash based zoomers : Rue de Siam’s website site features an implementation of image  a flash based zoom within a prototype lightbox gallery  (check out this one) . Interesting too is the specific template for the “At your home” showcase category that uses products with  specific layout. Magento is really great for customising layouts, I suppose that’s partly a big feature of Zend Framework expressed at its best. One technique I used a lot is the css based text over image transparency effect that I detailed a while ago for Wordpress on this blog. Works fine with Magento images categories except that the background image really has to be adjusted perfectly so I used phpthumbs instead of Magento’s resizing helpers that seemed to complicated to understand at first.   I’ve also covered  various development challenges that I shared on this blog during the development :

And a few tips :

One advice : once you’re running a Magento production web site, be careful with upgrades. The Sales extension did not work with 1.3.0 on my development server and I’m sticking to 1.2.x for the moment.

Product specials on home page

This tutorial explains briefly how to display one product on sale on the right column of thehome page, but that could be any page in fact.The code below is inspired from the front page featured product tutorial. Read the rest of this entry »

Magento product : display new product icon on product list

If you’re working on Magento Ecommerce layouts and template design, you might have had a look at some nasty bugs, such the sort by price bug that’s occuring on Magento’s latest release (1.2..1). If you’ve spent a few minutes reading the fix for that bug on Magento’s forums, you know what product collection means. Product Collection in Magento means an easy way of listing products for specific blocks : the big drawback is that product collections store arrays of products, and products inside don’t always come fully loaded of details. That’s why the few hacks below are useful to get the very basic attribute of every product on a decent ecommerce store : is that product new or not, and should I tell my customer which products are new ???

magento-new-product490

How to load new attribute : in Magento the new attribute is defined by two database fields (or attributes) : new from and new to .

  • Using these parameters in list.phtml requires you to modify the attribute set returned by the Mage_Catalog_Block_Product_List class to be found in app\code\core\Mage\Catalog\Block\Product\List.php
  • in function _getProductCollection, paste the following line
    $this->_productCollection
    ->addAttributeToSelect(’news_from_date’)
    ->addAttributeToSelect(’news_to_date’);
  • obvisouly this comes just after the product collection definition around line 75 of the List.php
    $this->_productCollection = $layer->getProductCollection();
  • your list.phtml template now has access to the data and checking that a product is new is as simple as performing PHP based date comparisons. We provide here basic comparison that will only work for products where both news_from and news_to have been filled. Add the following PHP code somewhere in your productcollection loop and the work is done !
    $now = date(”Y-m-d”);
    $newsFrom= substr($_product->getData(’news_from_date’),0,10);
    $newsTo=  substr($_product->getData(’news_to_date’),0,10);
    if ($now>=$newsFrom && $now<=$newsTo)
    {?> <h3 class=”nouveauteProductList” >NEW PRODUCT!<h3><?};
    ?>

This hack will be used on RueDeSiam’s website (to be released next month,bookmark it now!)

Magento product page : how to display other products from same category

Magento comes with a lot of product relationship features :  implemented as selective lists maintained for each product by the shop owner, related / cross selling and up selling backend features allow some sort of manual product linking that displays product associations on the front end. For example related products are displayed by default in the product page right column, while upsell / crosssell products are displayed on the shopping cart page. These 3 types of product associations are well explained on inchoo’s blog, and  on magento ’s knowledge base you’ll find user instructions on how to setup   product relationship in the backend.

What we aim here is to setup an automatic  display of related products on a product view page, via the categories they belong to. We build two loops : one that gets categories the product belongs to, and another one inside that gets products of each category.

How to setup category related products in Product view :

  1. add the following code somewhere in default\template\catalog\product\view.phtml
  2. Configure the category query according to your catalog by uncommenting the following :
    • ->setPage(1, 1) : selects only one category
    • ->addFieldToFilter(’level’,”3″) : selects only 3rd level categories
    • ->addFieldToFilter(’parent_id’,”3″) : select only child categories of no 3
    • ->setOrder(”level”) : combined by setPage, returns the lowest level category
  3. please that the product loop uses the $_product variable, which can be dangerous because this name is widely used. We use it here for comodity reasons because I just took toe display code from Magento’s product list view
  1. if ($_product) {
  2.   // get collection of categories this product is associated with
  3.   $categories =$_product->getCategoryCollection()
  4.   //  ->setPage(1, 1)
  5.  //->addFieldToFilter(’level’,"3")                                     
  6.  //->addFieldToFilter(’parent_id’,"3")                                 
  7.  //->setOrder("level")
  8.    ->load();
  9.        
  10. // if the product is associated with any category
  11. if ($categories->count())
  12. foreach ($categories as $_category)
  13. {
  14.   $cur_category = Mage::getModel(‘catalog/category’)->load($_category->getId());
  15. ?><div style="clear:both">
  16. <h2>Dans la même collection :<?=$cur_category->getName()?></h2>
  17. </div>
  18. <?$products = Mage::getResourceModel(‘catalog/product_collection’)
  19. ->addCategoryFilter($_category)
  20. ->addAttributeToSelect(’small_image’);
  21.  
  22.  foreach ( $products as $productModel )
  23.    {
  24.         $_product = Mage::getModel(‘catalog/product’)->load($productModel->getId());
  25.           $width=135; $height=135;
  26.          $_imageUrl =  $this->helper(‘catalog/image’)->init($productModel, ’small_image’)->resize($width, $height);
  27. ?>
  28.   <div class="product-shop">
  29.    <h5><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
  30. <?php echo $this->htmlEscape($_product->getName())?></a></h5>
  31.  
  32.  <img src=<?=$_imageUrl ?> width="<?=$width?>" height="<?=$height?>"/>
  33. <?php echo $this->getPriceHtml($_product, true) ?>
  34.    <?php if($_product->isSaleable()): ?>
  35.  <button class="form-button" onclick="setLocation(’<?php echo $this->getAddToCartUrl($_product) ?>’)"><span><?php echo $this->__(‘Add to Cart’) ?></span></button>
  36.  <?php else: ?>
  37.   <div class="out-of-stock"><?php echo $this->__(‘Out of stock’) ?></div>
  38.      <?php endif; ?>
  39.      <div class="clear"></div>
  40.       <div class="description">
  41.        <?php echo nl2br($_product->getShortDescription()) ?>
  42.     <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><small><?php echo $this->__(‘Learn More’) ?></small></a>
  43.             </div>
  44.     </div>
  45. <?  }  
  46.   }
  47. }
  48. ?>