I am working on magento 1.9, I have created a multiple selection attribute from back-end and deploy it on attribute sets, I want users to choose a time slots between 4 or 5 slots, like, there will be options 08:00 Am, 10:00 AM, 12:00PM, And so on, and user will choose appropriate time slot from all these.

The problem is i am working with virtual products as like services. so i don't want to go to the configurable or bundle way, i want a drop-down with these slots on my product page. i tried getting attribute value on select option but every time i do so i get only a drop-down not options and nor values

enter image description here enter image description here

Any Suggestions will be appreciated


  • you can use custom options for this Commented Mar 30, 2017 at 12:13
  • @GopalPatel can you please assist me how to do that?
    – Lalit838
    Commented Mar 30, 2017 at 12:29
  • refer docs.magento.com/m1/ce/user_guide/catalog/… Commented Mar 30, 2017 at 12:34
  • @GopalPatel thank You so much,As i understand, it seems like i have to put it on every product individually?
    – Lalit838
    Commented Mar 30, 2017 at 12:39
  • Yes , But if you have large number of product then you can set it programmatically Commented Mar 30, 2017 at 12:43

1 Answer 1


Create custom.php in root folder and place below code. Run custom.php through command line because it will take time to run.

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
ini_set('max_execution_time', 0);



function getOptions($product){

    $slotes=$product->getAttributeText('time_slot'); //your attribute code ex. time_slot
    $slotes=explode(" ",$slotes);
    foreach ($slotes as $key => $value) {
            'title' => $value,
            'price' =>$product->getPrice,
            'price_type' => 'fixed',
            'sort_order' => '1'
    return $options;

foreach ($products as $product) {
    //echo $product->getId(); //print product id
    $option = array(
        'title' => 'custom option title',
        'type' => 'drop_down', // could be drop_down ,checkbox , multiple
        'is_require' => 1,
        'sort_order' => 0,
        'values' => getOptions($product)
    $optionInstance = $product->getOptionInstance()->unsetOptions();
    //break; //try on one product

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.