protected function savePriceValue($iPriceTypeID, $fPrice, $fOldPrice)
    {
        $obPriceModel = $this->getPriceObject($iPriceTypeID);
        if (empty($obPriceModel)) {
            $obPriceModel = Price::create([
                'item_id'       => $this->id,
                'item_type'     => static::class,
                'price'         => $fPrice,
                'old_price'     => $fOldPrice,
                'price_type_id' => $iPriceTypeID,
            ]);

            if (empty($iPriceTypeID)) {
                $this->main_price = $obPriceModel;
            } else {
                $this->price_link()->add($obPriceModel);
            }
        } else {
            $obPriceModel->price = $fPrice !== null ? $fPrice : $obPriceModel->price;
            $obPriceModel->old_price = $fOldPrice !== null ? $fOldPrice : $obPriceModel->old_price;
            $obPriceModel->save();
        }
    }
protected function savePriceValue($iPriceTypeID, $fPrice, $fOldPrice)
    {
        $obPriceModel = $this->getPriceObject($iPriceTypeID);
        if (empty($obPriceModel)) {
            $obPriceModel = Price::create([
                'item_id'       => $this->id,
                'item_type'     => static::class,
                'price'         => $fPrice,
                'old_price'     => $fOldPrice,
                'price_type_id' => $iPriceTypeID,
            ]);

            if (empty($iPriceTypeID)) {
                $this->main_price = $obPriceModel;
            } else {
                $this->price_link()->add($obPriceModel);
            }
        } else {
            $obPriceModel->price = $fPrice !== null ? $fPrice : $obPriceModel->price;
            $obPriceModel->old_price = $fOldPrice !== null ? $fOldPrice : $obPriceModel->old_price;
            $obPriceModel->save();
        }
    }
protected function savePriceValue ( $ iPriceTypeID , $ fPrice , $ fOldPrice ) { $ obPriceModel = $ this -> getPriceObject ( $ iPriceTypeID ) ; if ( empty ( $ obPriceModel ) ) { $ obPriceModel = Price :: create ( [ 'item_id' => $ this -> id , 'item_type' => static :: class , 'price' => $ fPrice , 'old_price' => $ fOldPrice , 'price_type_id' => $ iPriceTypeID , ] ) ; if ( empty ( $ iPriceTypeID ) ) { $ this -> main_price = $ obPriceModel ; } else { $ this -> price_link ( ) -> add ( $ obPriceModel ) ; } } else { $ obPriceModel -> price = $ fPrice !== null ? $ fPrice : $ obPriceModel -> price ; $ obPriceModel -> old_price = $ fOldPrice !== null ? $ fOldPrice : $ obPriceModel -> old_price ; $ obPriceModel -> save ( ) ; } }
Create or update main price object
@param int|null $iPriceTypeID
@param float    $fPrice
@param float    $fOldPrice
Create or update main price object