/**
  * Add a qty-based product pricing
  *
  * @param string $passkey
  * @param int $intProductId
  * @param int $intPricingLevel
  * @param float $fltQty
  * @param double $fltPrice
  * @return string
  */
 public function add_product_qty_pricing($passkey, $intProductId, $intPricingLevel, $fltQty, $fltPrice)
 {
     if (!$this->check_passkey($passkey)) {
         return self::FAIL_AUTH;
     }
     Yii::app()->db->createCommand('SET FOREIGN_KEY_CHECKS=0;')->execute();
     $qtyP = new ProductQtyPricing();
     $qtyP->product_id = $intProductId;
     $qtyP->pricing_level = $intPricingLevel + 1;
     $qtyP->qty = $fltQty;
     $qtyP->price = $fltPrice;
     $qtyP->save();
     if (!$qtyP->save()) {
         Yii::log("SOAP ERROR : Error saving qty pricing {$intProductId} " . print_r($qtyP->getErrors()), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         return self::UNKNOWN_ERROR . " Error saving qty pricing {$intProductId} " . print_r($qtyP->getErrors(), true);
     }
     Yii::app()->db->createCommand('SET FOREIGN_KEY_CHECKS=1;')->execute();
     return self::OK;
 }
 /**
  * Add a qty-based product pricing
  *
  * @param string $passkey
  * @param int $intProductId
  * @param int $intPricingLevel
  * @param float $fltQty
  * @param double $fltPrice
  * @return string
  * @throws SoapFault
  *
  * @soap
  */
 public function add_product_qty_pricing($passkey, $intProductId, $intPricingLevel, $fltQty, $fltPrice)
 {
     self::check_passkey($passkey);
     Yii::app()->db->createCommand('SET FOREIGN_KEY_CHECKS=0;')->execute();
     $qtyP = new ProductQtyPricing();
     $qtyP->product_id = $intProductId;
     $qtyP->pricing_level = $intPricingLevel + 1;
     $qtyP->qty = $fltQty;
     $qtyP->price = $fltPrice;
     $qtyP->save();
     if (!$qtyP->save()) {
         $strMsg = "Error saving qty pricing {$intProductId}";
         Yii::log("SOAP ERROR : {$strMsg} " . print_r($qtyP->getErrors()), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         throw new SoapFault($strMsg, WsSoapException::ERROR_UNKNOWN);
     }
     Yii::app()->db->createCommand('SET FOREIGN_KEY_CHECKS=1;')->execute();
     return self::OK;
 }