Magento Site Development Please Help

Discussion in 'eCommerce' started by rahul247rocks, Jan 15, 2012.

  1. #1
    hey Guys,

    I Decided to make a website exactly like blinds.com using Magento. My developer told me that he can do everything except the height vs width price grids I have for all my products. He is telling me that the only way to do it is upload each height vs width as separate products. I believe there is a better way to do it. I want it kind of like this product page in Blinds.com. So can anyone please tell me how it should be done so that it shows a unique price for different height vs width from the drop down box. My client gave me all the excel sheets of the height vs width for different products and the prices are unique and there is no perfect increase or fixed increase.

    Please Help

    Regards,
    Rahul
     
    rahul247rocks, Jan 15, 2012 IP
  2. mridu

    mridu Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you are using the default Magento functionality you have to do the way your developer is saying. However there is always a way to extend the Core Magento Functionality. You can create a custom module for this in which you can create the functionality to upload the excel sheet from the backend admin. Now you have the price for every product. This may be also possible that you have different prices for different products. In that case you have to to relate the products with the prices.

    Now we have the prices ready for every different products. On the front end you need to create another block in which there would be the options. These options would be coming from the database which you have populated from the admin section. Now as and when the users selects the height or width its price would be reset using magento event observer "catalog_product_get_final_price". For more details on this observer you may refer to the following link from Magento official site -

    http:// www. magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method

    (remove space after and before www to make it a link)

    And you are done. If you don't want to create this functionality then you can create custom option for every product programatically but if you have to change then you need to go to every product and modify the same. Below is the script about how you can do the same:

    function _setCustomOption ($value, $title, $type, $noOption = false, $price='', $sort_order=0, $is_required = 1)
    {
    $custom_options = array();
    if ($type && $value != "" && $value) {
    $values = explode(',', $value);
    if (count($values)) {
    /**If the custom option has options*/
    if (! $noOption) {
    $custom_options[] = array(
    'is_delete' => 0 , 'title' => $title , 'previous_group' => '' , 'previous_type' => '' , 'type' => $type , 'is_require' => $is_required , 'sort_order' => $sort_order , 'values' =>
    array()
    );
    foreach ($values as $v) {
    $titleopt = ucfirst(trim($v));
    switch ($type) {
    case 'drop_down':
    case 'radio':
    case 'checkbox':
    case 'multiple':
    default:
    $title = ucfirst(trim($v));
    $custom_options[count($custom_options) - 1]['values'][] = array(
    'is_delete' => 0 , 'title' => $titleopt , 'option_type_id' => - 1 , 'price_type' => '' , 'price' => $price , 'sku'
    => '' , 'sort_order' => '', 'price_type' => 'fixed'
    );
    break;
    }
    }
    return $custom_options;
    }
    /**If the custom option doesn't have options | Case: area and field*/
    else {
    $custom_options[] = array(
    "is_delete" => 0 , "title" => $title , "previous_group" => "text" , "price_type" => 'fixed' , "price" => $price , "type" => $type , "is_required" => $is_required, 'price_type' => 'fixed'
    );
    return $custom_options;
    }
    }
    }
    return false;
    }


    //insert Custom option
    $arrayOption = array()

    $arrayOption[] = $this->_setCustomOption(implode(',',
    range(37,48)), "Select Size", "drop_down", false, 0, 1, 1);
    /*
    * Add more options if required
    */
    /**
    * Load the product you want to assign custom option to
    */
    $product = Mage::getModel('catalog/product')->load($id);
    foreach ($arrayOption as $options) {
    foreach ($options as $option) {
    $opt = Mage::getModel('catalog/product_option');
    $opt->setProduct($product);
    $opt->addOption($option);
    $opt->saveOptions();
    }
    }

    You may modify the above script as per yuor requirement. Feel free to contact in case you need any more help in this.
     
    mridu, Jan 16, 2012 IP
  3. 5Twenty

    5Twenty Peon

    Messages:
    79
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Just to clarify the problem: you sell blinds, these blinds come in different types/brands, each type/brand has different sizes. You would like a user to choose a type/brand and then select a size from that product detail page. Correct?

    If this is the case, that's actually really easy. You wont need to do any programming as this is a built in function of Magento. You will however have to create multiple products, BUT your customer will never see them. What you are looking for is a configurable product, which is essentially the parent with simple products attached.

    The way this works is magento sees the configurable product as the actual product, and uses each simple product as for attributes: size, color, gender, etc. This is most commonly used with clothing lines, but works for everything.

    OK so here is the process: (I'm winging this off the top of my head, it be close but I might mis-label a step. :) )

    1) Create a new product attribute: Size & enter your size options.

    2) Create a new "attribute set", label it blinds, and assigns the attributes you need. INCLUDING your new one SIZE.

    3) Create a NEW - CONFIGURABLE PRODUCT - and select the attribute set blinds.

    4) Fill this configurable product out like you would any standard product including pricing, images, etc.

    5) Save and continue editings

    6) Scroll down the left had product menu and select: Associate Products

    7) Now begin to add a simple product for each of the sizes that you allow for that blind.

    The great part about this is it allows you to manage your inventory on a size basis. So each size / blind will have its own sku too. The other nice part is that you can adjust the pricing based on the sizes they choose.
     
    5Twenty, Jan 16, 2012 IP
  4. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    406
    Best Answers:
    21
    Trophy Points:
    295