本文整理匯總了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'];