private function updateProductProp($params) { if ($this->multidimensional_plugin) { $product = isset($params['product']) ? $params['product'] : PP::productAsObject($params); if (Validate::isLoadedObject($product)) { $properties = $product->productProperties(); if ($properties['pp_ext'] == 1 && $properties['pp_ext_policy'] == 2) { $id_product_attribute = 0; $has_attributes = $product->hasAttributes(); if ($has_attributes) { $id_product_attribute = (int) Tools::getValue('id_product_attribute'); if ($id_product_attribute <= 0) { $id_product_attribute = false; } } if ($id_product_attribute !== false) { $db = Db::getInstance(); $db->delete(_DB_PREFIX_ . 'pp_product_prop', 'id_product = ' . $product->id . ($has_attributes ? ' AND (id_product_attribute=0 OR id_product_attribute=' . $id_product_attribute . ')' : '')); $r = array('id_product' => $product->id, 'id_product_attribute' => $id_product_attribute); foreach ($properties['pp_ext_prop'] as $position => $ext_prop) { $ext_prop_quantity = (double) str_replace(',', '.', Tools::getValue('pp_ext_prop_quantity_' . $position)); $r['position'] = $position; $r['quantity'] = $ext_prop_quantity > 0 ? $ext_prop_quantity : ((double) $ext_prop['default_quantity'] > 0 ? (double) $ext_prop['default_quantity'] : 1); $db->autoExecute(_DB_PREFIX_ . 'pp_product_prop', $r, 'INSERT'); } } } } } }