コード例 #1
0
 protected function copyFromPost(&$object, $table)
 {
     parent::copyFromPost($object, $table);
     if (get_class($object) != 'Product') {
         return;
     }
     /* Additional fields */
     foreach (Language::getIDs(false) as $id_lang) {
         if (isset($_POST['meta_keywords_' . $id_lang])) {
             $_POST['meta_keywords_' . $id_lang] = $this->_cleanMetaKeywords(Tools::strtolower($_POST['meta_keywords_' . $id_lang]));
             // preg_replace('/ *,? +,* /', ',', strtolower($_POST['meta_keywords_'.$id_lang]));
             $object->meta_keywords[$id_lang] = $_POST['meta_keywords_' . $id_lang];
         }
     }
     $_POST['width'] = empty($_POST['width']) ? '0' : str_replace(',', '.', $_POST['width']);
     $_POST['height'] = empty($_POST['height']) ? '0' : str_replace(',', '.', $_POST['height']);
     $_POST['depth'] = empty($_POST['depth']) ? '0' : str_replace(',', '.', $_POST['depth']);
     $_POST['weight'] = empty($_POST['weight']) ? '0' : str_replace(',', '.', $_POST['weight']);
     if (Tools::getIsset('unit_price') != null) {
         $object->unit_price = str_replace(',', '.', Tools::getValue('unit_price'));
     }
     if (Tools::getIsset('ecotax') != null) {
         $object->ecotax = str_replace(',', '.', Tools::getValue('ecotax'));
     }
     if ($this->isTabSubmitted('Informations')) {
         $object->available_for_order = (int) Tools::getValue('available_for_order');
         $object->show_price = $object->available_for_order ? 1 : (int) Tools::getValue('show_price');
         $object->online_only = (int) Tools::getValue('online_only');
     }
     if ($this->isTabSubmitted('Prices')) {
         $object->on_sale = (int) Tools::getValue('on_sale');
     }
 }
コード例 #2
0
 protected function copyFromPost(&$object, $table)
 {
     parent::copyFromPost($object, $table);
     if (get_class($object) != 'Product') {
         return;
     }
     if (Tools::getIsset('minimal_quantity')) {
         $minimal_quantity = Tools::getValue('minimal_quantity');
         $minimal_quantity = empty($minimal_quantity) ? '0' : str_replace(',', '.', $minimal_quantity);
         $_POST['minimal_quantity'] = $minimal_quantity;
         $object->setMinQty($minimal_quantity);
     }
     if (Tools::getIsset('sp_from_quantity')) {
         $_POST['sp_from_quantity'] = str_replace(',', '.', Tools::getValue('sp_from_quantity'));
     }
 }