Create configurable product in Magento programmatically

Following post includes the code that can be used to create a configurable product in Magento.

Brief introduction about configurable product

When adding new products to your Magento store you have the option to select the type of the product. The most basic option is simple product.
That’s just a single item with no specific attributes/options that can be changed by the buyer.
With the configurable product type you can offer an item with some options that can be configured by the customers themselves.
For example, you can sell the same model of shoes that are offered in different colors, sizes, etc. Instead of creating several simple
products for each size of the same shoe model that will be displayed individually on the frontend,
for instance, you can create a configurable product which will allow the customer to select the size before ordering the product.

To understand the code, one must have a basic understanding of how configurable product works in a Magento store.

Continue reading

Create Simple Product in Magento Store Programmatically


We are creating a simple product programmatically in Magento Store. There is nothing much to describe in this post.
I am using the basic required information to create the product. May be your store needs more attributes to create the product, but to keep the post simple I am using just 2 custom created attributes.




Following script contains a function that gives the option id of option label for any attribute code.
For example, Magento needs the 321(assume option id for label “Black”) to save the value of attribute color.

Continue reading

Prevent Direct Url Access in PHP

Add the below piece of code to header file of your application and prevent direct URL access . Any user who tries to navigate via changing the URL or post data will be redirected to previous webpage.

< ?php
{     echo '<script>history.back();'   }

How To Purchase Amazon EC2 Reserved Instance

Quickly understand reserved instance before purchasing from here.

If you’ve purchased a on demand EC 2 instance and later realized that it would run for a course of time(for ex. 1 year,2 year), you can convert it into reserved instance to save few bucks. Remember reserved instance is just a pricing feature, and no actual conversion is done to your instance.

Here we go - 

  • The following details of the on-demand instance (which you are reserving) will be required – Platform,Instance Type,Availability Zone.
  • Click on the Purchase Reserved Instance Button in your AWS console.
  • Click on search after selecting the appropriate details.
  • Offering Type -
    Light Utilization RI’s – Lowest upfront price,ideal  for periodic workloads that only run for couple of hours a day.
    Medium Utilization RI’s – Higher upfront price than Light Utilization RIs, but a much lower hourly usage fee,best suited for workloads that run most of the time, but have some variability in usage.
    Heavy Utilization RI’s – Highest upfront price,lowest hourly rate,,suitable for instance that run 24 hours.

  • search_result
  • Here you go,you can see your purchased instance in the reserved instance tab on left side of the AWS console.

Congratulations ! You just saved some bucks.