Magento Module: Third Party Inventory

An extension that aggregates distributor inventory for display on the B2B catalog.


This module was developed to serve links to distributor websites that hold additional inventory for a given product. When the merchant reflects low or no inventory for a SKU, the wholesale customer can check for additional inventory options. This was built as a value-add experience to help serve customers with larger ordering needs.


Wholesale PDP form with distributor inventory button

Distributor inventory expanded

Module configuration options

Technical Features

Code Sample

protected function _initSkuModel(array $data) {
    $collection = Mage::getResourceModel('thirdpartyinventory/distributor_location_sku_collection');

    if (!empty($data['distributor_location_sku_id'])) {
        if (!is_numeric($data['distributor_location_sku_id'])) {

        return Mage::getModel('thirdpartyinventory/distributor_location_sku')->load($data['distributor_location_sku_id']);
    } else if (!empty($data['distributor_location_sku'])) {
        $collection->addFieldToFilter('sku', $data['distributor_location_sku']);

    if (!empty($data['distributor_location_id'])) {
        $collection->addFieldToFilter('location_id', $data['distributor_location_id']);

    if (count($collection) > 1) {
        $this->_fault('multiple_matches', "Multiple matches for SKU {$data['distributor_location_sku']}");

    return $collection->getFirstItem();

Static Analysis