Magento Module: Unit Price Options

A price extension that offers unit-based price options and unique custom option enhancements.

Details

This module was developed to introduce custom price calculation logic to Magento for industry-specific needs. The merchant needed the ability to sell custom sizes of products in different units of measure. Additionally, the merchant needed a way to better manage custom option pricing in a way that reduced management overhead.

Screenshots

Setting the product price unit

Configuring a custom option for dimensional unit pricing

Module configuration options

Example of dimensional pricing on the frontend

Using relational pricing on custom options to derive price from SKU

Example of relational pricing at work on the frontend

Enabling quantities of a custom option to be purchased

Example of custom option quantity on the frontend

Technical Features

Code Sample

protected function _getChargableOptionPrice(
    $price,
    $isPercent,
    $basePrice,
    Mage_Catalog_Model_Product_Option_Value $value = null
) {
    if ( $value && (int) $value->getAllowQty() === 1 ) {
        $optionValue    = $this->getConfigurationItemOption()->getValue();
        $quantity       = $this->_extractQuantity($optionValue);

        if ($quantity < 1) {
            $quantity = 1;
        }

        return $quantity * $price;
    }

    return parent::_getChargableOptionPrice($price, $isPercent, $basePrice);
}

Static Analysis