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


PHP osC_Product::getCustomizations方法代码示例

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


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

示例1: execute

 function execute()
 {
     global $osC_Session, $osC_Product, $toC_Customization_Fields, $osC_Language, $messageStack;
     if (!isset($osC_Product)) {
         $id = false;
         foreach ($_GET as $key => $value) {
             if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
                 $id = $key;
             }
             break;
         }
         if ($id !== false && osC_Product::checkEntry($id)) {
             $osC_Product = new osC_Product($id);
         }
     }
     if (isset($osC_Product)) {
         $errors = array();
         $data = array();
         $customizations = $osC_Product->getCustomizations();
         foreach ($customizations as $field) {
             $fields_id = $field['customization_fields_id'];
             if ($field['type'] == CUSTOMIZATION_FIELD_TYPE_INPUT_TEXT) {
                 $value = isset($_POST['customizations'][$fields_id]) ? $_POST['customizations'][$fields_id] : null;
                 if ($field['is_required'] && $value == null) {
                     $messageStack->add_session('products_customizations', sprintf($osC_Language->get('error_customization_field_must_be_specified'), $field['name']), 'error');
                 } else {
                     if ($value != null) {
                         $data[$fields_id] = array('customization_fields_id' => $field['customization_fields_id'], 'customization_fields_name' => $field['name'], 'customization_type' => CUSTOMIZATION_FIELD_TYPE_INPUT_TEXT, 'customization_value' => $value);
                     }
                 }
             } else {
                 $file = new upload('customizations_' . $fields_id, DIR_FS_CACHE . '/products_customizations/');
                 if ($field['is_required'] && !$file->exists() && !$toC_Customization_Fields->hasCustomizationField($osC_Product->getID(), $fields_id)) {
                     $messageStack->add_session('products', sprintf($osC_Language->get('error_customization_field_must_be_specified'), $field['name']), 'error');
                 } else {
                     if ($file->exists()) {
                         if ($file->parse() && $file->save()) {
                             $filename = $file->filename;
                             $cache_filename = md5($filename . time());
                             rename(DIR_FS_CACHE . '/products_customizations/' . $filename, DIR_FS_CACHE . '/products_customizations/' . $cache_filename);
                             $data[$fields_id] = array('customization_fields_id' => $field['customization_fields_id'], 'customization_fields_name' => $field['name'], 'customization_type' => CUSTOMIZATION_FIELD_TYPE_INPUT_FILE, 'customization_value' => $filename, 'cache_filename' => $cache_filename);
                         } else {
                             $messageStack->add_session('products_customizations', $file->getLastError(), 'error');
                         }
                     }
                 }
             }
         }
         //var_dump($data);exit;
         if ($messageStack->size('products_customizations') === 0) {
             $toC_Customization_Fields->set($osC_Product->getID(), $data);
         }
     }
     osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()));
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:55,代码来源:save_customization_fields.php


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