Fixed quantity: under the hood


Our Fixed quantity extension does not create new product types, just adds one or several more options to existing non-complex products. Complex product types have their own rules for price calculation and should not be used with this extension.

Pricing rules

When creating a product that will have fixed quantities, Magento still requires you to set normal price even though it will not be used in front-end.

  • When at least one fixed quantity is assigned, it overrides any price calculations made in cart and during checkout.
  • When more then one fixed quantity is created, the lowest price is used as the product price.
  • When adding a product to cart directly from category view page, the lowest price and quantity is added to cart.

Again, even if you set prices in Fixed quantities tab you need to set some price value in Price tab, even if it will be ignored. It is does not matter what base price you set – Magento will use fixed quantity prices.

Quantity rules

The extension disables Qty field in the store front-end and users are not able to input custom quantity amounts on their own.

Customers can only order one of the listed fixed quantity options per product page visit. If the customer returns to the same product after adding one option to cart (before order is completed) and adds it once more, the product is added to cart as a new item.

A product with fixed quantity is displayed with its unit label in cart and all through the rest of the ordering process – (ex. 100 Posters, Three hundred posters).

Products with Fixed quantities have the Qty box on shopping cart page disabled, preventing customers from being able to input custom values during the checkout process.

Redefined classes

Fixed quantity extension redefines 2 classes:

  • Mage_Catalog_Model_Product_Type_Price – > ZetaPrints_Fixedprices_Model_Fixedprices – this is where product price information is given.
  • Mage_Sales_Model_Quote_Item – > ZetaPrints_Fixedprices_Model_Quote_Item – this class is responsible for product order presentation (in cart, checkout, order details). We need this to present separate options as different items in the cart. Otherwise, adding the same product to cart results in adding larger quantities of it.


We have 3 events that we observe and use:

  • catalog_product_collection_load_after – this event fires when product collection is prepared (ex. in category view). Here we update product min_price, max_price, minimal_price attributes, to match lowest fixed price, this gives us correct price block in listings.

In adminhtml:

  • adminhtml_catalog_product_edit_prepare_form – remove duplicate input entries. Our new attributes are added to General tab by default. But, since we have a separate tab for them, we have to remove them from General tab.
  • core_block_abstract_prepare_layout_after – add fixed prices. After admin product edit layout is prepared, we hook and add our tab.
See also: