E commerce, Tips & Tricks - October 29, 2009 - No Comment
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
E commerce - October 12, 2009 - No Comment
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 !
E commerce - September 28, 2009 - No Comment
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
- You can use a linux script to automatically modify magento email template files in your language / email folder
- script 1
http://www.osetemplates.com/?p=138 - script 2 (slightly better because incorporates store specific vairables in the script)
http://www.pridedesign.ie/content/magento-email-template-script
- script 1
- You can also use the email template adapter extension to get the job done via magento’s administration interface
Web Applications - August 31, 2009 - No Comment
Magento / facebook : display new products on your wall
Using the RSS feature of Mangeto to update your wall automatically is an easy task that you can finish in ea few inutes tuime, when you know where to go.
- Magento’s default layout is shipped with a rss page that requires activation in the admin, in the system->configuration, check rss feed to activate the /rss page that displays available feeds (check out our example on Rue de Siam)
- Import your feed to your facebook page or profile to get new produtcs or product special published automatically on your wall :
- Connect to facebook, and click  ”My Notes” from the navigational menu. If you have already entered notes on your page, then they will load for you to preview or edit.
- If you have not written an article, write one that announces the rss publication (e.g. new articles coming soon), in order to enable the settings menu. Select the “Import Blog” or “Edit Import Settings” link in the Notes Setting section. If you are already importing from a blog, the URL will appear here. Remeber that in the Notes applications, you can only import from 1 source at a time.  To change the url of the feed, click  ”Stop Importing”
- Enter the URL for the RSS feed in the box. Check the box next to the statement that you actually own the content.
- Click the “Start Importing” button. Facebook will import the content of the RSS feed for you to preview. If everything looks good, then go ahead and hit the “Continue” button. Now your RSS feed is automatically imported into your “Notes” section.
- Administrators note : Facebook RSS in articles application will not put a heavy load on your server , as they are pulled every 2 hours, but be careful of heavy loads if you have a larger reader base as images will be loaded from full article display in facebook
Web Components - June 4, 2009 - 1 Comment
Magento : display product image on invoice + shipping PDF
Magento’s wiki has a few articles on the subject of Magento’s PDF generation, which is not very efficient in its default version : one of the main critics I’ve seen is the size of the generated PDF, which can fly to more than 1MB, where a simple font replacement can bring the weight to less than a few KBs ! The subject of the article below is to illustrate how to display images on each line of the generated invoice and shipping PDF.
The product line display occurs in specific PHP classes within the app/code/core/Mage/sales/Model/order/pdf folder
there is one folder for shipment, one for invoice, and one for credit. The product display occurs in the DEfault file where the Mage_Sales_Model_Order_Pdf_Items_Abstract is defined. What I did was simply instanciate a product object using the id from order / items, and get the image file using the following code in the draw function :
-
//<display image>
-
$id = Mage::getModel(‘catalog/product’)->getIdBySku($this->getSku($item));
-
$product= Mage::getModel(‘catalog/product’)->load($id);
-
$imageUrl = $product->getSmallImageUrl();
-
// $page->drawText($imageFile , 65, $pdf->y-$shift{1}, ‘UTF-8′);
-
$imageWidth = 100; $imageHeight = 50;
-
$image = Zend_Pdf_Image::imageWithPath($imageFile,$imageWidth,$imageHeight);
-
$y=$pdf->y – $imageHeight /3;
-
$page->drawImage($image, 35,$y, 35+ $imageWidth / 2, $y + $imageHeight/2);
-
//</display image>
Tips & Tricks, Web Components - May 27, 2009 - 6 Comments
Magento one page checkout : display shopping cart details in sidebar
There are a lot of discussions going on about Magento’s one page checkout procedure : it is supposed to enhance customer payment experience by probviding ajax based single page order progress. But there are alos some discussions in the forum on how to enhance this process which is quite unusual and might discourage some customers. In a previous post I reviewed the code that produces sidebar shopping cart in default pages with right margin. The solution below explains how to add a full shopping cart display for the customer’s that trying to complete an order.
Design showcase, E commerce - April 20, 2009 - No Comment
Magento showcase : Rue de Siam
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 :
- products special display on home page,
- display new product icon on product list
- how to display products from other categories on the product view page
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.
E commerce - April 2, 2009 - 1 Comment
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 »
E commerce - March 25, 2009 - 7 Comments
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 ???
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!)
Hosted applications, Tips & Tricks, Web Components - March 11, 2009 - 9 Comments
Magento custom attributes display on product page
The flexibility created by the attribute feature in Magento allows limitless possibilities : vairous product types can be created and each of them can go with specific attributes, meaning specific form fields for the admin, that are inserted in the product view (template/product/view.phtml) for public display. The functions availble for each user defined attributes are very simple to guess : they are dynamically created for each attribute create using , as explained in the Pratthost developer zone blog…
Read the rest of this entry »





