title: Price based on product custom options (width and height)
body: <p>I have some products that can be custumized by the costumer. Naturally, the price must based on the costumization.</p>
  
  <p>For instance, I sell rugs. The dimensions of the rugs can be, sometimes, chosen by the costumer. In order to accomplish that, I created 3 custom options in all the customized products: square_meter_price, width and height.</p>
  
  <p>After clicking on 'add to cart', the customer can choose width and height. After that, on the checkout/cart url, the costumer reads on the 'Product Name' column the correct product name, width and height. The only think that is needed here is to get the correct price out of it.</p>
  
  <p>I am trying to do that by overriding Mage_Catalog_Model_Product_Type_Price::getPrice() method. The problem is I can't get the width/height values input by the costumer so I can do the math.</p>
  
  <p>Note: 
  I already tried iterating through $product->getOptions(). I was able to get the custom options width/height but I wasn't able to get the values input by the customer.</p>
  
  <p>I also tried $product->getCollection()->getAttribute('width') and $product->getAttribute('width'), but I got null.</p>
  
  <p>Thank you in advance.</p>
  
  <pre><code>class My_Catalog_Model_Product_Type_Price extends Mage_Catalog_Model_Product_Type_Price
  {
      public function getPrice(Mage_Catalog_Model_Product $product)
      {
  
          // get the width provided by the user
          $width = $this-&gt;howToGet('width');
  
          // get the height provided by the user
          $height =  $this-&gt;howToGet('height');
  
          if ($width &amp;&amp; $height) {
              return $width * $height * $product-&gt;getAttribute('square_meters_price');
          }
  
          return parent::getPrice($product);
      }
  
  }
  </code></pre>