Beispiel #1
0
 public function update($autodate = true, $nullValues = false)
 {
     if ((double) $this->conversion_rate <= 0) {
         return false;
     }
     return parent::update($autodate, $nullValues);
 }
Beispiel #2
0
 public function update($nullValues = false)
 {
     self::$_nbProducts = 0;
     $return = parent::update();
     Module::hookExec('cart');
     return $return;
 }
Beispiel #3
0
 public function update($null_values = false)
 {
     if (parent::update($null_values)) {
         return $this->cleanPositions($this->id_cms_category);
     }
     return false;
 }
Beispiel #4
0
 public function update($null_values = false)
 {
     $return = parent::update($null_values);
     if ($return) {
         Hook::exec('actionAttributeSave', array('id_attribute' => $this->id));
     }
     return $return;
 }
Beispiel #5
0
 public function update($null_values = false)
 {
     Cache::clean('getContextualValue_' . $this->id . '_*');
     if (!$this->reduction_currency) {
         $this->reduction_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT');
     }
     return parent::update($null_values);
 }
Beispiel #6
0
 public function update($autodate = true, $nullValues = false, $categories = false)
 {
     if (parent::update($autodate, $nullValues)) {
         $ret = true;
     }
     $this->updateCategories($categories);
     return $ret;
 }
Beispiel #7
0
 public function update($null_Values = false)
 {
     $res = parent::update($null_Values);
     if ($res) {
         $res = $this->response->save();
     }
     return $res;
 }
Beispiel #8
0
 public function update($null_values = false)
 {
     if (parent::update($null_values)) {
         // Refresh cache of feature detachable because the row can be deactive
         Configuration::updateGlobalValue('PS_VIRTUAL_PROD_FEATURE_ACTIVE', ProductDownload::isCurrentlyUsed($this->def['table'], true));
         return true;
     }
     return false;
 }
 public function update($null_values = false)
 {
     if ($this->cover) {
         $this->cover = 1;
     } else {
         $this->cover = null;
     }
     return parent::update($null_values);
 }
Beispiel #10
0
 public function add($autodate = true, $null_values = false)
 {
     //        foreach ($this->name as $k => $value)
     //
     //            if (preg_match('/^[1-9]\./', $value))
     //
     //                $this->name[$k] = '0' . $value;
     $ret = parent::add($autodate, $null_values);
     return $ret;
 public function update($null_values = false)
 {
     if (parent::update($null_values)) {
         // Flush cache when we updating a new specific price
         $this->flushCache();
         return true;
     }
     return false;
 }
Beispiel #12
0
 public function update($auto_date = true, $null_values = false)
 {
     if (is_array($this->content)) {
         $this->content = json_encode($this->content);
     }
     $return = parent::update($auto_date, $null_values);
     $this->content = json_decode($this->content, true);
     return $return;
 }
Beispiel #13
0
 public function update($null_values = false)
 {
     if (parent::update($null_values)) {
         // Flush cache when we updating a new specific price
         self::$_specificPriceCache = array();
         Product::flushPriceCache();
         return true;
     }
     return false;
 }
Beispiel #14
0
 public function update($nullValues = false)
 {
     if (!$this->updateZoneProducts()) {
         return false;
     }
     if (!$this->updateCategories()) {
         return false;
     }
     return parent::update($nullValues);
 }
Beispiel #15
0
        public function update($null_values = false)
        {
            $context = Context::getContext();
            $id_shop = $context->shop->id;
            $res = parent::update($null_values);
            $res &= Db::getInstance()->execute('
				REPLACE INTO `' . _DB_PREFIX_ . 'pagebuilderprofile_shop` (`id_shop`, `id_pagebuilderprofile`,`default`)
				VALUES(' . (int) $id_shop . ', ' . (int) $this->id . ',' . ($this->isDefault() ? 1 : 0) . ')');
            return $res;
        }
Beispiel #16
0
 public function update($null_values = false)
 {
     if ($this->default_on) {
         $this->default_on = 1;
     } else {
         $this->default_on = null;
     }
     $return = parent::update($null_values);
     Product::updateDefaultAttribute($this->id_product);
     return $return;
 }
 public function update($nullValues = false)
 {
     if ($this->group_type == 'color') {
         $this->is_color_group = 1;
     } else {
         $this->is_color_group = 0;
     }
     $return = parent::update($nullValues);
     Hook::exec('actionAttributeGroupSave', array('id_attribute_group' => $this->id));
     return $return;
 }
Beispiel #18
0
 public function update($null_values = false)
 {
     if (!$this->updateZoneProducts()) {
         return false;
     }
     if (!$this->updateCategories()) {
         return false;
     }
     if (parent::update($null_values)) {
         // Refresh cache of feature detachable
         Configuration::updateGlobalValue('PS_SCENE_FEATURE_ACTIVE', Scene::isCurrentlyUsed($this->def['table'], true));
         return true;
     }
     return false;
 }
 public function update($nullValues = false)
 {
     if (!$this->deleted && $this->isUsed()) {
         $historized_tax = new Tax($this->id);
         $historized_tax->historize();
         // remove the id in order to create a new object
         $this->id = 0;
         $res = $this->add();
         // change tax id in the tax rule table
         $res &= TaxRule::swapTaxId($historized_tax->id, $this->id);
         return $res;
     } elseif (parent::update($nullValues)) {
         return $this->_onStatusChange();
     }
     return false;
 }
    public function update($nullValues = false)
    {
        $previousUpdate = new self((int) $this->id);
        if (!parent::update($nullValues)) {
            return false;
        }
        if ($previousUpdate->id_product_comment_criterion_type != $this->id_product_comment_criterion_type) {
            if ($previousUpdate->id_product_comment_criterion_type == 2) {
                return Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'product_comment_criterion_category
																WHERE id_product_comment_criterion=' . (int) $previousUpdate->id);
            } elseif ($previousUpdate->id_product_comment_criterion_type == 3) {
                return Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'product_comment_criterion_product
																WHERE id_product_comment_criterion=' . (int) $previousUpdate->id);
            }
        }
        return true;
    }
    /**
     * Save the object with the field deleted to true
     *
     *  @return bool
     */
    public function historize(TaxRulesGroup $tax_rules_group)
    {
        $this->deleted = true;
        return parent::update() && Db::getInstance()->execute('
		INSERT INTO ' . _DB_PREFIX_ . 'tax_rule 
		(id_tax_rules_group, id_country, id_state, zipcode_from, zipcode_to, id_tax, behavior, description)
		(
			SELECT ' . (int) $tax_rules_group->id . ', id_country, id_state, zipcode_from, zipcode_to, id_tax, behavior, description
			FROM ' . _DB_PREFIX_ . 'tax_rule 
			WHERE id_tax_rules_group=' . (int) $this->id . '
		)') && Db::getInstance()->execute('
		UPDATE ' . _DB_PREFIX_ . 'product
		SET id_tax_rules_group=' . (int) $tax_rules_group->id . '
		WHERE id_tax_rules_group=' . (int) $this->id) && Db::getInstance()->execute('
		UPDATE ' . _DB_PREFIX_ . 'product_shop
		SET id_tax_rules_group=' . (int) $tax_rules_group->id . '
		WHERE id_tax_rules_group=' . (int) $this->id) && Db::getInstance()->execute('
		UPDATE ' . _DB_PREFIX_ . 'carrier
		SET id_tax_rules_group=' . (int) $tax_rules_group->id . '
		WHERE id_tax_rules_group=' . (int) $this->id) && Db::getInstance()->execute('
		UPDATE ' . _DB_PREFIX_ . 'carrier_tax_rules_group_shop
		SET id_tax_rules_group=' . (int) $tax_rules_group->id . '
		WHERE id_tax_rules_group=' . (int) $this->id);
    }
Beispiel #22
0
 /**
  * @see ObjectModel::update()
  */
 public function update($null_values = false)
 {
     $this->calculatePrices();
     $res = parent::update($null_values);
     if ($res && !$this->is_template) {
         $this->addHistory();
     }
     return $res;
 }
Beispiel #23
0
 public function update($null_values = false)
 {
     if (empty($this->stats_date_from) || $this->stats_date_from == '0000-00-00') {
         $this->stats_date_from = date('Y-m-d');
     }
     if (empty($this->stats_date_to) || $this->stats_date_to == '0000-00-00') {
         $this->stats_date_to = date('Y-m-d');
     }
     $currentEmployee = new Employee((int) $this->id);
     if ($currentEmployee->optin != $this->optin) {
         $this->saveOptin();
     }
     $this->updateTextDirection();
     return parent::update($null_values);
 }
Beispiel #24
0
 public function update($null_values = false)
 {
     $return = parent::update($null_values);
     Product::updateDefaultAttribute($this->id_product);
     return $return;
 }
Beispiel #25
0
 /**
  * Upgrades total_quantity_available after having update
  * @see ObjectModel::update()
  */
 public function update($null_values = false)
 {
     if (!parent::update($null_values)) {
         return false;
     }
     $this->postSave();
 }
Beispiel #26
0
 public function update($nullValues = false)
 {
     if (!parent::update($nullValues)) {
         return false;
     }
     return Tools::generateHtaccess(dirname(__FILE__) . '/../.htaccess', (int) Configuration::get('PS_REWRITING_SETTINGS'), (int) Configuration::get('PS_HTACCESS_CACHE_CONTROL'), Configuration::get('PS_HTACCESS_SPECIFIC'));
 }
Beispiel #27
0
 public function update($null_values = false)
 {
     if (isset(self::$_nbProducts[$this->id])) {
         unset(self::$_nbProducts[$this->id]);
     }
     if (isset(self::$_totalWeight[$this->id])) {
         unset(self::$_totalWeight[$this->id]);
     }
     $this->_products = null;
     $return = parent::update();
     Hook::exec('actionCartSave');
     return $return;
 }
Beispiel #28
0
 public function update($nullValues = false)
 {
     $return = parent::update($nullValues);
     if ($return) {
         Hook::exec('actionFeatureValueSave', array('id_feature_value' => $this->id));
     }
     return $return;
 }
Beispiel #29
0
 /**
  * update category positions in parent
  *
  * @param mixed $null_values
  * @return bool
  */
 public function update($null_values = false)
 {
     if ($this->id_parent == $this->id) {
         throw new PrestaShopException('a category cannot be its own parent');
     }
     if ($this->is_root_category && $this->id_parent != (int) Configuration::get('PS_ROOT_CATEGORY')) {
         $this->is_root_category = 0;
     }
     // Update group selection
     $this->updateGroup($this->groupBox);
     if ($this->level_depth != $this->calcLevelDepth()) {
         $this->level_depth = $this->calcLevelDepth();
         $changed = true;
     }
     // If the parent category was changed, we don't want to have 2 categories with the same position
     if (!isset($changed)) {
         $changed = $this->getDuplicatePosition();
     }
     if ($changed) {
         if (Tools::isSubmit('checkBoxShopAsso_category')) {
             foreach (Tools::getValue('checkBoxShopAsso_category') as $id_asso_object => $row) {
                 foreach ($row as $id_shop => $value) {
                     $this->addPosition((int) Category::getLastPosition((int) $this->id_parent, (int) $id_shop), (int) $id_shop);
                 }
             }
         } else {
             foreach (Shop::getShops(true) as $shop) {
                 $this->addPosition((int) Category::getLastPosition((int) $this->id_parent, $shop['id_shop']), $shop['id_shop']);
             }
         }
     }
     $ret = parent::update($null_values);
     if ($changed && (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree)) {
         $this->cleanPositions((int) $this->id_parent);
         Category::regenerateEntireNtree();
         $this->recalculateLevelDepth($this->id);
     }
     Hook::exec('actionCategoryUpdate', array('category' => $this));
     return $ret;
 }
Beispiel #30
0
 /**
  * @see ObjectModel::update()
  */
 public function update($null_values = false)
 {
     $this->getProductInformations();
     return parent::update($null_values);
 }