本文整理汇总了PHP中SpecificPrice::setSpecificPriority方法的典型用法代码示例。如果您正苦于以下问题:PHP SpecificPrice::setSpecificPriority方法的具体用法?PHP SpecificPrice::setSpecificPriority怎么用?PHP SpecificPrice::setSpecificPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpecificPrice
的用法示例。
在下文中一共展示了SpecificPrice::setSpecificPriority方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
//.........这里部分代码省略.........
Tools::redirectAdmin($currentIndex . (Tools::getValue('id_category') ? '&id_category=' . Tools::getValue('id_category') : '') . '&id_product=' . $id_product . '&add' . $this->table . '&tabs=2&conf=3&token=' . ($token ? $token : $this->token));
}
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
}
} elseif (Tools::isSubmit('deleteSpecificPrice')) {
if ($this->tabAccess['delete'] === '1') {
if (!($obj = $this->loadObject())) {
return;
}
if (!($id_specific_price = Tools::getValue('id_specific_price')) or !Validate::isUnsignedId($id_specific_price)) {
$this->_errors[] = Tools::displayError('Invalid specific price ID');
} else {
$specificPrice = new SpecificPrice((int) $id_specific_price);
if (!$specificPrice->delete()) {
$this->_errors[] = Tools::displayError('An error occurred while deleting the specific price');
} else {
Tools::redirectAdmin($currentIndex . (Tools::getValue('id_category') ? '&id_category=' . Tools::getValue('id_category') : '') . '&id_product=' . $obj->id . '&add' . $this->table . '&tabs=2&conf=1&token=' . ($token ? $token : $this->token));
}
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} elseif (Tools::isSubmit('submitSpecificPricePriorities')) {
if (!($obj = $this->loadObject())) {
return;
}
if (!($priorities = Tools::getValue('specificPricePriority'))) {
$this->_errors[] = Tools::displayError('Please specify priorities');
} elseif (Tools::isSubmit('specificPricePriorityToAll')) {
if (!SpecificPrice::setPriorities($priorities)) {
$this->_errors[] = Tools::displayError('An error occurred while updating priorities.');
} else {
Tools::redirectAdmin($currentIndex . '&id_product=' . $obj->id . '&add' . $this->table . '&tabs=2&conf=4&token=' . ($token ? $token : $this->token));
}
} elseif (!SpecificPrice::setSpecificPriority((int) $obj->id, $priorities)) {
$this->_errors[] = Tools::displayError('An error occurred while setting priorities.');
} else {
Tools::redirectAdmin($currentIndex . (Tools::getValue('id_category') ? '&id_category=' . Tools::getValue('id_category') : '') . '&id_product=' . $obj->id . '&add' . $this->table . '&tabs=2&conf=4&token=' . ($token ? $token : $this->token));
}
} elseif (Tools::isSubmit('submitCustomizationConfiguration')) {
if ($this->tabAccess['edit'] === '1') {
if (Validate::isLoadedObject($product = new Product((int) Tools::getValue('id_product')))) {
if (!$product->createLabels((int) $_POST['uploadable_files'] - (int) $product->uploadable_files, (int) $_POST['text_fields'] - (int) $product->text_fields)) {
$this->_errors[] = Tools::displayError('An error occurred while creating customization fields.');
}
if (!sizeof($this->_errors) and !$product->updateLabels()) {
$this->_errors[] = Tools::displayError('An error occurred while updating customization.');
}
$product->uploadable_files = (int) $_POST['uploadable_files'];
$product->text_fields = (int) $_POST['text_fields'];
$product->customizable = ((int) $_POST['uploadable_files'] > 0 or (int) $_POST['text_fields'] > 0) ? 1 : 0;
if (!sizeof($this->_errors) and !$product->update()) {
$this->_errors[] = Tools::displayError('An error occurred while updating customization configuration.');
}
if (!sizeof($this->_errors)) {
Tools::redirectAdmin($currentIndex . '&id_product=' . $product->id . '&id_category=' . (!empty($_REQUEST['id_category']) ? $_REQUEST['id_category'] : '1') . '&add' . $this->table . '&tabs=5&token=' . ($token ? $token : $this->token));
}
} else {
$this->_errors[] = Tools::displayError('Product must be created before adding customization possibilities.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
} elseif (Tools::isSubmit('submitProductCustomization')) {
if ($this->tabAccess['edit'] === '1') {
if (Validate::isLoadedObject($product = new Product((int) Tools::getValue('id_product')))) {
foreach ($_POST as $field => $value) {
if (strncmp($field, 'label_', 6) == 0 and !Validate::isLabel($value)) {
$this->_errors[] = Tools::displayError('Label fields are invalid');
}
}
if (!sizeof($this->_errors) and !$product->updateLabels()) {
$this->_errors[] = Tools::displayError('An error occurred while updating customization.');
}
if (!sizeof($this->_errors)) {
Tools::redirectAdmin($currentIndex . '&id_product=' . $product->id . '&id_category=' . (!empty($_REQUEST['id_category']) ? $_REQUEST['id_category'] : '1') . '&add' . $this->table . '&tabs=5&token=' . ($token ? $token : $this->token));
}
} else {
$this->_errors[] = Tools::displayError('Product must be created before adding customization possibilities.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
} elseif (isset($_GET['position'])) {
if ($this->tabAccess['edit'] !== '1') {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} elseif (!Validate::isLoadedObject($object = $this->loadObject())) {
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
if (!$object->updatePosition((int) Tools::getValue('way'), (int) Tools::getValue('position'))) {
$this->_errors[] = Tools::displayError('Failed to update the position.');
} else {
Tools::redirectAdmin($currentIndex . '&' . $this->table . 'Orderby=position&' . $this->table . 'Orderway=asc&conf=5' . (($id_category = !empty($_REQUEST['id_category']) ? $_REQUEST['id_category'] : '1') ? '&id_category=' . $id_category : '') . '&token=' . Tools::getAdminTokenLite('AdminCatalog'));
}
} else {
parent::postProcess(true);
}
}
示例2: processSpecificPricePriorities
public function processSpecificPricePriorities()
{
${"GLOBALS"}["dboffshjf"] = "priorities";
if (!(${${"GLOBALS"}["omhtkzfc"]} = Tools::getValue("specificPricePriority"))) {
$this->errors[] = Tools::displayError("Please specify priorities");
} elseif (Tools::isSubmit("specificPricePriorityToAll")) {
${"GLOBALS"}["oidcpqykby"] = "priorities";
if (!SpecificPrice::setPriorities(${${"GLOBALS"}["oidcpqykby"]})) {
$this->errors[] = Tools::displayError("An error occurred while updating priorities.");
} else {
$this->confirmations[] = $this->getMessage("Price rule successfully updated");
}
} elseif (!SpecificPrice::setSpecificPriority((int) $this->object->id, ${${"GLOBALS"}["dboffshjf"]})) {
$this->errors[] = Tools::displayError("An error occurred while setting priorities.");
}
}