Display HTML code (block) of product options in Magento

Share
Posted on January 7th, 2012 | Posted by admin

This simple helper will help you to display html code of your product options. It works with simple, virtual and configurable products. I believe you can use the same approach for other product types as well.

Getting HTML code for options of configurable products its little different from simple and virtual (well they are more or less same).

Update: for all types in configurable product.

With simple products we have a very “clean approach”.

First we are setting a block for product options, then we add item renderers (template and type) to product options block. And the last step is to take the product, create iteration over options and display it with our product options block.

We are seeing here some nice loose coupling. Nice separation of code.

How To Create An Admin Account From Magento Code

Share
Posted on May 23rd, 2011 | Posted by admin

Wondering how to restore your broken Magento admin access? If you have lost your magento admin credentials and you are stuck you should not loose heart. If accidentally you have deleted the admin access you can gain your access again with the help of slight magento code. In this article  i will tell you how you can create another temporary admin account and grant all necessary access to your new account.

Create User

Use a ftp program to edit: /app/code/core/Mage/Adminhtml/controllers/indexController.php

find the function loginAction and replace it by the following code (create a backup which you should restore later) :

Add Adwords tracking code to order confirmation page in Magento

Share
Posted on February 23rd, 2011 | Posted by admin

Add Adwords tracking code to order confirmation page in Magento

Adding an Adwords tracking code to order confirmation page in Magento is relatively easy task. One that can be handled under an hour or so if you choose to implement it the proper way. Here is how.

Modify the “app/design/frontend/default/my_custom_theme/layout/checkout.xml” file. Look for section

1.<checkout_onepage_success>
2.<reference name="root">
3.<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
4.</reference>
5.<reference name="content">
6.<block name="checkout.success" template="checkout/success.phtml" type="checkout/onepage_success" />
7.</reference>

Run Magento Code Outside of Magento

Share
Posted on February 23rd, 2011 | Posted by admin

Hi All -
Finally time for a new post! (Something I’m surprised I haven’t covered yet).
This post will inform you on how to run Magento code outside of Magento. All you need is to have access to Magento’s ‘app/Mage.php‘ file.

This will be handy code for a few things:

  • Integration with 3rd party items – shared sessions, or just shared themes
  • Ajax calls – although not the preferred solutions for Ajax calls, it is a quick and easy one

Magento Vertical Category Menu

Share
Posted on February 21st, 2011 | Posted by admin

Magento Vertical Menu using Peter Hamilton’s code

In one of our premium Magento themes we implemented a vertical category menu with the code adapted from this thread. It’s quite easy to implement and to make it even easier for others, we decided to write a step by step tutorial.

  • Add a new block type in “catalog.xml” file
  • Create a new phtml file and name it “leftnav.phtml”, place it inside catalog/navigation
  • Edit CSS

Add a new block type in “catalog.xml” file

Here we presume you want to have the vertical category menu shows up on every page, to do so, we will place the code in the <default> layout like so, and we want it to always stay on the top, so we added “before=”-”: