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


PHP Shineisp_Commons_Utilities::format方法代码示例

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


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

示例1: addNew

 /**
  * Add a new product attribute
  * 
  * @param integer $id [empty to create a new record]
  * @param string $code
  * @param string $label
  * @param string $type
  * @param integer $language_id
  * @param integer $position
  * @param boolean $active
  * @param string $prefix
  * @param string $suffix
  * @param string $description
  * @param boolean $is_visible_on_front
  * @param boolean $is_system_var
  * @param string $system_var
  * @param string $defaultvalue
  * @param boolean $is_required
  * @param boolean $is_comparable
  * @param boolean $on_product_listing
  */
 public static function addNew($id = NULL, $code, $label, $type, $language_id = 1, $position = 0, $active = 1, $prefix = NULL, $suffix = NULL, $description = NULL, $is_visible_on_front = 1, $is_system_var = 0, $system_var = NULL, $defaultvalue = NULL, $is_required = 0, $is_comparable = 0, $on_product_listing = 0)
 {
     $productsattributes = new ProductsAttributes();
     // Set the new values
     if (is_numeric($id)) {
         $productsattributes = Doctrine::getTable('ProductsAttributes')->find($id);
     }
     // format the attribute code
     $code = Shineisp_Commons_Utilities::format($code);
     // Check if the code has been already used before
     $thecode = self::getAttributebyCode($code);
     // If the record is in Update mode
     if (is_numeric($id)) {
         if (!empty($thecode) && count($thecode) > 1) {
             return false;
         }
     } else {
         // If the record is new
         if (!empty($thecode) && count($thecode) > 0) {
             return false;
         }
     }
     $productsattributes['code'] = $code;
     $productsattributes['position'] = $position;
     $productsattributes['is_visible_on_front'] = $is_visible_on_front;
     $productsattributes['active'] = $active;
     $productsattributes['system'] = $is_system_var;
     $productsattributes['system_var'] = $system_var;
     $productsattributes['defaultvalue'] = $defaultvalue;
     $productsattributes['type'] = $type;
     $productsattributes['is_required'] = $is_required;
     $productsattributes['is_comparable'] = $is_comparable;
     $productsattributes['on_product_listing'] = $on_product_listing;
     $productsattributes->save();
     $productsattributesdata = Doctrine::getTable('ProductsAttributesData')->createQuery('pad')->where('pad.attribute_id = ?', $productsattributes['attribute_id'])->andWhere('pad.language_id = ?', $language_id)->fetchOne();
     if (empty($productsattributesdata)) {
         $productsattributesdata = new ProductsAttributesData();
     }
     $productsattributesdata['attribute_id'] = $productsattributes['attribute_id'];
     $productsattributesdata['language_id'] = $language_id;
     $productsattributesdata['label'] = $label;
     $productsattributesdata['prefix'] = $prefix;
     $productsattributesdata['suffix'] = $suffix;
     $productsattributesdata['description'] = $description;
     $productsattributesdata->save();
     return $productsattributes['attribute_id'];
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:68,代码来源:ProductsAttributes.php


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