本文整理汇总了PHP中AttributeGroup::getHigherPosition方法的典型用法代码示例。如果您正苦于以下问题:PHP AttributeGroup::getHigherPosition方法的具体用法?PHP AttributeGroup::getHigherPosition怎么用?PHP AttributeGroup::getHigherPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeGroup
的用法示例。
在下文中一共展示了AttributeGroup::getHigherPosition方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add($autodate = true, $nullValues = false)
{
if ($this->position <= 0) {
$this->position = AttributeGroup::getHigherPosition() + 1;
}
$return = parent::add($autodate, true);
Hook::exec('actionAttributeGroupSave', array('id_attribute_group' => $this->id));
return $return;
}
示例2: attributeImportOne
//.........这里部分代码省略.........
}
}
}
}
$id_attribute_group = 0;
// groups
$groups_attributes = array();
if (isset($info['group'])) {
foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group) {
if (empty($group)) {
continue;
}
$tab_group = explode(':', $group);
$group = trim($tab_group[0]);
if (!isset($tab_group[1])) {
$type = 'select';
} else {
$type = trim($tab_group[1]);
}
// sets group
$groups_attributes[$key]['group'] = $group;
// if position is filled
if (isset($tab_group[2])) {
$position = trim($tab_group[2]);
} else {
$position = false;
}
if (!isset($groups[$group])) {
$obj = new AttributeGroup();
$obj->is_color_group = false;
$obj->group_type = pSQL($type);
$obj->name[$default_language] = $group;
$obj->public_name[$default_language] = $group;
$obj->position = !$position ? AttributeGroup::getHigherPosition() + 1 : $position;
if (($field_error = $obj->validateFields(UNFRIENDLY_ERROR, true)) === true && ($lang_field_error = $obj->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) {
// here, cannot avoid attributeGroup insertion to avoid an error during validation step.
//if (!$validateOnly) {
$obj->add();
$obj->associateTo($id_shop_list);
$groups[$group] = $obj->id;
//}
} else {
$this->errors[] = ($field_error !== true ? $field_error : '') . (isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '');
}
// fills groups attributes
$id_attribute_group = $obj->id;
$groups_attributes[$key]['id'] = $id_attribute_group;
} else {
// already exists
$id_attribute_group = $groups[$group];
$groups_attributes[$key]['id'] = $id_attribute_group;
}
}
}
// inits attribute
$id_product_attribute = 0;
$id_product_attribute_update = false;
$attributes_to_add = array();
// for each attribute
if (isset($info['attribute'])) {
foreach (explode($this->multiple_value_separator, $info['attribute']) as $key => $attribute) {
if (empty($attribute)) {
continue;
}
$tab_attribute = explode(':', $attribute);
$attribute = trim($tab_attribute[0]);
示例3: array
<?php
$group = 'Format eBook';
$default_language = Configuration::get('PS_LANG_DEFAULT');
$id_shop_list = array(1);
$position = AttributeGroup::getHigherPosition() + 1;
$attributeGroup = new AttributeGroup();
$attributeGroup->is_color_group = false;
$attributeGroup->group_type = pSQL('select');
$attributeGroup->name[$default_language] = $group;
$attributeGroup->public_name[$default_language] = $group;
$attributeGroup->position = $position;
$attributeGroup->add();
$attributeGroup->associateTo($id_shop_list);
// create one attribute for each file type
foreach ($this->file_types as $type) {
$position_attribute = Attribute::getHigherPosition($attributeGroup->id) + 1;
$obj = new Attribute();
$obj->id_attribute_group = $attributeGroup->id;
$obj->name[$default_language] = $type;
$obj->position = $position_attribute;
$obj->add();
$obj->associateTo($id_shop_list);
Configuration::updateValue('prestaebooks_attribute_id_' . $type, $obj->id);
}
示例4: attributeImport
//.........这里部分代码省略.........
}
}
}
if (!$id_image) {
$this->warnings[] = sprintf(Tools::displayError('No image was found for combination with id_product = %s and image position = %s.'), $product->id, (int) $info['image_position']);
}
}
$id_attribute_group = 0;
// groups
$groups_attributes = array();
if (isset($info['group'])) {
foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group) {
$tab_group = explode(':', $group);
$group = trim($tab_group[0]);
if (!isset($tab_group[1])) {
$type = 'select';
} else {
$type = trim($tab_group[1]);
}
// sets group
$groups_attributes[$key]['group'] = $group;
// if position is filled
if (isset($tab_group[2])) {
$position = trim($tab_group[2]);
} else {
$position = false;
}
if (!isset($groups[$group])) {
$obj = new AttributeGroup();
$obj->is_color_group = false;
$obj->group_type = pSQL($type);
$obj->name[$default_language] = $group;
$obj->public_name[$default_language] = $group;
$obj->position = !$position ? AttributeGroup::getHigherPosition() + 1 : $position;
if (($field_error = $obj->validateFields(UNFRIENDLY_ERROR, true)) === true && ($lang_field_error = $obj->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) {
$obj->add();
$obj->associateTo($id_shop_list);
$groups[$group] = $obj->id;
} else {
$this->errors[] = ($field_error !== true ? $field_error : '') . (isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '');
}
// fils groups attributes
$id_attribute_group = $obj->id;
$groups_attributes[$key]['id'] = $id_attribute_group;
} else {
$id_attribute_group = $groups[$group];
$groups_attributes[$key]['id'] = $id_attribute_group;
}
}
}
// inits attribute
$id_product_attribute = 0;
$id_product_attribute_update = false;
$attributes_to_add = array();
// for each attribute
if (isset($info['attribute'])) {
foreach (explode($this->multiple_value_separator, $info['attribute']) as $key => $attribute) {
$tab_attribute = explode(':', $attribute);
$attribute = trim($tab_attribute[0]);
// if position is filled
if (isset($tab_attribute[1])) {
$position = trim($tab_attribute[1]);
} else {
$position = false;
}
if (isset($groups_attributes[$key])) {
示例5: attributeImport
//.........这里部分代码省略.........
}
if (empty($id_image)) {
$this->warnings[] = sprintf(Tools::displayError('No image was found for combination with id_product = %s and image position = %s.'), $product->id, (int) $position);
}
}
}
}
$id_attribute_group = 0;
$groups_attributes = array();
if (isset($info['group'])) {
foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group) {
if (empty($group)) {
continue;
}
$tab_group = explode(':', $group);
$group = trim($tab_group[0]);
if (!isset($tab_group[1])) {
$type = 'select';
} else {
$type = trim($tab_group[1]);
}
$groups_attributes[$key]['group'] = $group;
if (isset($tab_group[2])) {
$position = trim($tab_group[2]);
} else {
$position = false;
}
if (!isset($groups[$group])) {
$obj = new AttributeGroup();
$obj->is_color_group = false;
$obj->group_type = pSQL($type);
$obj->name[$default_language] = $group;
$obj->public_name[$default_language] = $group;
$obj->position = !$position ? AttributeGroup::getHigherPosition() + 1 : $position;
if (($field_error = $obj->validateFields(UNFRIENDLY_ERROR, true)) === true && ($lang_field_error = $obj->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) {
$obj->add();
$obj->associateTo($id_shop_list);
$groups[$group] = $obj->id;
} else {
$this->errors[] = ($field_error !== true ? $field_error : '') . (isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '');
}
$id_attribute_group = $obj->id;
$groups_attributes[$key]['id'] = $id_attribute_group;
} else {
$id_attribute_group = $groups[$group];
$groups_attributes[$key]['id'] = $id_attribute_group;
}
}
}
$id_product_attribute = 0;
$id_product_attribute_update = false;
$attributes_to_add = array();
if (isset($info['attribute'])) {
foreach (explode($this->multiple_value_separator, $info['attribute']) as $key => $attribute) {
if (empty($attribute)) {
continue;
}
$tab_attribute = explode(':', $attribute);
$attribute = trim($tab_attribute[0]);
if (isset($tab_attribute[1])) {
$position = trim($tab_attribute[1]);
} else {
$position = false;
}
if (isset($groups_attributes[$key])) {
$group = $groups_attributes[$key]['group'];