I am trying to override a resource model class Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\TierPrice to select new columns that I have created in the catalog_product_entity_tier_price table. However, the new columns are not selected and the model is not getting overridden.

namespace [vendor][module]\Model\ResourceModel\Product\Attribute\Backend;

class TierPrice extends \Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\TierPrice

     * Add qty column
     * @param array $columns
     * @return array
    protected function _loadPriceDataColumns($columns)
        $columns = parent::_loadPriceDataColumns($columns);
        //$columns['price_qty'] = 'qty';
        //new columns
        return $columns;



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLcation="urn:magento:framework:ObjectManager/etc/config.xsd">
   <preference for="Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\TierPrice" type="[vendor]\[module]\Model\ResourceModel\Product\Attribute\Backend\TierPrice" /> 


    echo $p->getName();
    foreach($tier as $t)

returns error Notice: Undefined index: created_by

How to override this class to add additional columns of the tier price table.

Note I have implemented interface for the new columns. So if I directly edit the core resource model, it works.

  • Can you show me the full tree for your module? Also, did you mean to put [vendor]\[module] in your di.xml? Aug 16, 2017 at 19:36
  • @nick.graziano [vendor] is replaced with actual namespace in my environment
    – blakcaps
    Aug 18, 2017 at 8:20

2 Answers 2


It appears to me that the only problem with your code is capitalization.

The class you are writing preference for is actually: ...\Backend\Tierprice not ...\Backend\TierPrice (note the 'P')

I have just tested a preference with correct capitalization and works fine for me.

  • 1
    Ahhh... the sweet smell of case sensitivity. So many hours lost on this one... Aug 21, 2017 at 20:18

di.xml can live in many different scopes. You need to make sure that it matches the scope of the class that you are overriding. If it does not work, as a first step I would recommend placing it in the root of etc directory in your module. This will make it available in all scopes (or as Magento calls them 'areas'). You need to make sure it is not in frontend or adminhtml to make sure it applies everywhere.

Here you can find more info on what types of scopes exists. http://devdocs.magento.com/guides/v2.0/architecture/archi_perspectives/components/modules/mod_and_areas.html

  • di.xml exists directly under etc/
    – blakcaps
    Aug 18, 2017 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.