Adding magento attribute with custom input renderer

Posted on May 17th, 2013 | Posted by admin

This is example which will explain you, how to add new attribute with custom input render. You will be able to modify existing functionality, add javascript, some other option or change default input renderer by your wishes.

You probably will ask yourself, what is magento input renderer and I will explain. This is Magento php class which is in charge for “rendering” html form elements. In magento there are different classes for rendering, you can find them in next folder:/lib/Varien/Data/Form/Element. In this folder you will notice next classes for rendering: price, date, image and so on.
Let’s go with our example.
First of all, you should create magento setup file which will add new product attribute with custom frontend input render, example is below:

Adding a ‘New Product’ icon in Magento for new products

Posted on April 19th, 2013 | Posted by admin

This is actually quick and easy but if you are new to Magento custom attributes you might struggle to work out how to set things up and then access the value of your attribute on the front end.

What I am talking about here is setting up a flag for the product, if it’s set to ‘Yes’ (ie the product is a new product) then a little icon or banner appears in the corner of the image.
You need to set up a new Attribute in Catalogue -> Attributes -> Manage Attributes . Set is as a boolean, give it an id of new_product. Make it available on the front end product view (one of the advanced options). Now add the attribute to your custom attribute set if your using one, or the default set if you are not. Go in and set it to ‘Yes’ for your product and save it.

So we’ve got a product in the Magento catalogue which has a boolean flag set to yes for the attribute ‘new_product’. How do we then access that an display it on the front end? Easy.

Auto-generated Product SKU when Adding New Product

Posted on March 8th, 2013 | Posted by admin

SKU isn’t needed in all stores and it’s sometimes annoying to have to enter it for every new product. Is there any way for Magento to automatically generate new SKU for new products?

There is.

Open /app/design/adminhtml/default/default/template/catalog/product/edit.phtmland add the following snippet to the bottom of the file:

    $dbread = Mage::getSingleton('core/resource')->getConnection('core_read');
    $sql = $dbread->query("SELECT * FROM catalog_product_entity ORDER BY created_at DESC LIMIT 1");
    $res = $sql->fetch();
<script type="text/javascript">
if(document.getElementById('sku').value == ""){
    document.getElementById('sku').value = <?php echo (int)$res["sku"] + 1; ?>;

What this code does:

Adding Categories to Your Magento Store

Posted on October 20th, 2012 | Posted by admin

If your Magento store has a large number of products to choose from, Product Categories are essential to help users navigate your store. This tutorial outlines the steps to add categories to your site.

To add a product category:

  1. Log in to the admin panel
  2. Select Catalog->Manage Catetories from the top menu
  3. In the left sidebar, first select “Default Category” then click “Add Subcategory.” (For your new category to show up in the frontend it must be a child to the “Default Category”)
  4. Configure the category. At the minimum, you must give your category a Name and select “yes” in the “Is Active” dropdown.
  5. Click the “Save Category” button to activate the category

Now go to the home page for your site and you will see your category added to the menu. Now you are ready to organize your products!

Adding New Payment Module In Magento

Posted on December 8th, 2011 | Posted by admin

 Adding New Payment Module In Magento
There are certain cases where you find the need to add new Payment Method (Payment Gateway) in a Magento store. Especially if the Magento store owner wishes to use a specific payment gateway not available in default Magento installation. Adding a new Magento Payment Module is not difficult but requires a little bit of programming at your end. In this article i am going to elaborate on how to add a new payment module (Payment Gateway) to your existing Magento Installation which will accept credit cards, authorize credit card when the order is placed and saves order ID in payment record.

Page 1 of 3123»