本文整理汇总了PHP中SpecificPrice::update方法的典型用法代码示例。如果您正苦于以下问题:PHP SpecificPrice::update方法的具体用法?PHP SpecificPrice::update怎么用?PHP SpecificPrice::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpecificPrice
的用法示例。
在下文中一共展示了SpecificPrice::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SpecificPrice
if (round($mrp) > round($newPrice)) {
$specificPrice->reduction_type = "amount";
$specificPrice->reduction = $mrp - $newPrice;
$specificPrice->update();
} else {
SpecificPrice::deleteByProductId($id_product);
}
} else {
if (round($mrp) > round($newPrice)) {
$specificPrice = new SpecificPrice();
$specificPrice->id_product = $id_product;
$specificPrice->reduction_type = "amount";
$specificPrice->reduction = $mrp - $newPrice;
$specificPrice->from_quantity = 1;
$specificPrice->from = date('Y-m-d H:i:s');
$specificPrice->update();
}
}
SolrSearch::updateProduct($id_product);
$count++;
}
fclose($f);
echo 'Total ' . $count . ' products updated. Thanks for your attention.';
} else {
// error
}
} else {
echo "There was an error uploading the file, please try again!";
}
}
if (Tools::getValue('getAddresses')) {
示例2: postProcess
//.........这里部分代码省略.........
}
if (Tools::strlen($attachment->file_name) > 128) {
$this->_errors[] = Tools::displayError('File name too long');
}
if (!sizeof($this->_errors)) {
$attachment->add();
Tools::redirectAdmin($currentIndex . '&id_product=' . (int) Tools::getValue($this->identifier) . '&id_category=' . (int) Tools::getValue('id_category') . '&addproduct&conf=4&tabs=6&token=' . ($token ? $token : $this->token));
} else {
$this->_errors[] = Tools::displayError('Invalid file');
}
}
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
}
} elseif (Tools::isSubmit('submitAttachments')) {
if ($this->tabAccess['edit'] === '1') {
if ($id = (int) Tools::getValue($this->identifier)) {
if (Attachment::attachToProduct($id, $_POST['attachments'])) {
Tools::redirectAdmin($currentIndex . '&id_product=' . (int) $id . (isset($_POST['id_category']) ? '&id_category=' . (int) $_POST['id_category'] : '') . '&conf=4&add' . $this->table . '&tabs=6&token=' . ($token ? $token : $this->token));
}
}
}
} elseif (isset($_GET['duplicate' . $this->table])) {
if ($this->tabAccess['add'] === '1') {
if (Validate::isLoadedObject($product = new Product((int) Tools::getValue('id_product')))) {
$id_product_old = $product->id;
unset($product->id);
unset($product->id_product);
$product->indexed = 0;
$product->active = 0;
if ($product->add() and Category::duplicateProductCategories($id_product_old, $product->id) and ($combinationImages = Product::duplicateAttributes($id_product_old, $product->id)) !== false and GroupReduction::duplicateReduction($id_product_old, $product->id) and Product::duplicateAccessories($id_product_old, $product->id) and Product::duplicateFeatures($id_product_old, $product->id) and Product::duplicateSpecificPrices($id_product_old, $product->id) and Pack::duplicate($id_product_old, $product->id) and Product::duplicateCustomizationFields($id_product_old, $product->id) and Product::duplicateTags($id_product_old, $product->id) and Product::duplicateDownload($id_product_old, $product->id)) {
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
}
if (!Tools::getValue('noimage') and !Image::duplicateProductImages($id_product_old, $product->id, $combinationImages)) {
$this->_errors[] = Tools::displayError('An error occurred while copying images.');
} else {
Hook::addProduct($product);
Search::indexation(false, $product->id);
Tools::redirectAdmin($currentIndex . '&id_category=' . (!empty($_REQUEST['id_category']) ? $_REQUEST['id_category'] : '1') . '&conf=19&token=' . ($token ? $token : $this->token));
}
} else {
$this->_errors[] = Tools::displayError('An error occurred while creating object.');
}
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
}
} elseif (isset($_GET['status']) and Tools::getValue($this->identifier)) {
if ($this->tabAccess['edit'] === '1') {
if (Validate::isLoadedObject($object = $this->loadObject())) {
if ($object->toggleStatus()) {
Tools::redirectAdmin($currentIndex . '&conf=5' . (($id_category = !empty($_REQUEST['id_category']) ? $_REQUEST['id_category'] : '1' and Tools::getValue('id_product')) ? '&id_category=' . $id_category : '') . '&token=' . $token);
} else {
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
}
} else {
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
} elseif (isset($_GET['delete' . $this->table])) {
if ($this->tabAccess['delete'] === '1') {
if (Validate::isLoadedObject($object = $this->loadObject()) and isset($this->fieldImageSettings)) {