当前位置: 首页>>代码示例>>PHP>>正文


PHP AdminController::copyFromPost方法代码示例

本文整理汇总了PHP中AdminController::copyFromPost方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminController::copyFromPost方法的具体用法?PHP AdminController::copyFromPost怎么用?PHP AdminController::copyFromPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AdminController的用法示例。


在下文中一共展示了AdminController::copyFromPost方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: copyFromPost

 /**
  * @param Language $object
  * @param string   $table
  */
 protected function copyFromPost(&$object, $table)
 {
     if ($object->id && $object->iso_code != $_POST['iso_code']) {
         if (Validate::isLanguageIsoCode($_POST['iso_code'])) {
             $object->moveToIso($_POST['iso_code']);
         }
     }
     parent::copyFromPost($object, $table);
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:13,代码来源:AdminLanguagesController.php

示例2: copyFromPost

 /**
  * @param AphOffer|ObjectModel $object
  * @param string              $table
  */
 protected function copyFromPost(&$object, $table)
 {
     parent::copyFromPost($object, $table);
     if (get_class($object) != 'AphOffer') {
         return;
     }
     if (!empty($_POST['leave_bprice'])) {
         $object->price = $object->price_wt = -1;
     } else {
         $object->reduction = 0.0;
         $object->reduction_type = 'amount';
     }
     /* 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];
         }
     }
 }
开发者ID:paolobattistella,项目名称:aphro,代码行数:25,代码来源:AdminAphOffersController.php

示例3: copyFromPost

 /**
  * @param Product|ObjectModel $object
  * @param string              $table
  */
 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')) {
         if ($this->checkMultishopBox('available_for_order', $this->context)) {
             $object->available_for_order = (int) Tools::getValue('available_for_order');
         }
         if ($this->checkMultishopBox('show_price', $this->context)) {
             $object->show_price = $object->available_for_order ? 1 : (int) Tools::getValue('show_price');
         }
         if ($this->checkMultishopBox('online_only', $this->context)) {
             $object->online_only = (int) Tools::getValue('online_only');
         }
     }
     if ($this->isTabSubmitted('Prices')) {
         $object->on_sale = (int) Tools::getValue('on_sale');
     }
 }
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:43,代码来源:AdminProductsController.php

示例4: copyFromPost

 protected function copyFromPost(&$object, $table)
 {
     parent::copyFromPost($object, $table);
     if (get_class($object) != 'Product') {
         return;
     }
     //если упакавка, то считаем сумму входящих в нее товаров
     $inputPackItems = null;
     if (isset($_POST['inputPackItems']) && !empty($_POST['inputPackItems'])) {
         $price = 0;
         $inputPackItems = explode('-', $_POST['inputPackItems']);
         foreach ($inputPackItems as $part) {
             $part = explode('x', $part);
             if (!is_array($part) || count($part) != 2) {
                 continue;
             }
             $pack_item = new Product($part[1]);
             if (!is_object($pack_item) || !isset($pack_item->price)) {
                 continue;
             }
             $price += $pack_item->price * $part[0];
         }
         $_POST['price'] = $price;
     }
     /* Additional fields */
     $languages = Language::getLanguages(false);
     foreach ($languages as $language) {
         if (isset($_POST['meta_keywords_' . $language['id_lang']])) {
             $_POST['meta_keywords_' . $language['id_lang']] = $this->_cleanMetaKeywords(Tools::strtolower($_POST['meta_keywords_' . $language['id_lang']]));
             // preg_replace('/ *,? +,* /', ',', strtolower($_POST['meta_keywords_'.$language['id_lang']]));
             $object->meta_keywords[$language['id_lang']] = $_POST['meta_keywords_' . $language['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'));
     }
     $object->available_for_order = (int) Tools::getValue('available_for_order');
     $object->show_price = $object->available_for_order ? 1 : (int) Tools::getValue('show_price');
     $object->on_sale = (int) Tools::getValue('on_sale');
     $object->online_only = (int) Tools::getValue('online_only');
     $object->in_transit = (int) Tools::getValue('in_transit');
     if (isset($_POST['inputPackItems']) && !empty($_POST['inputPackItems'])) {
         $object->price = $price;
     }
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:52,代码来源:AdminProductsController.php


注:本文中的AdminController::copyFromPost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。