本文整理汇总了PHP中Hook::productOutOfStock方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::productOutOfStock方法的具体用法?PHP Hook::productOutOfStock怎么用?PHP Hook::productOutOfStock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hook
的用法示例。
在下文中一共展示了Hook::productOutOfStock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Category
}
}
}
if (!$category) {
$category = new Category($product->id_category_default, intval($cookie->id_lang));
}
if (isset($category) and Validate::isLoadedObject($category)) {
$smarty->assign(array('category' => $category, 'subCategories' => $category->getSubCategories(intval($cookie->id_lang), true), 'id_category_current' => intval($category->id), 'id_category_parent' => intval($category->id_parent), 'return_category_name' => Tools::safeOutput(Category::hideCategoryPosition($category->name))));
}
$smarty->assign(array('return_link' => (isset($category->id) and $category->id) ? Tools::safeOutput($link->getCategoryLink($category)) : 'javascript: history.back();', 'path' => (isset($category->id) and $category->id) ? Tools::getFullPath(intval($category->id), $product->name) : Tools::getFullPath(intval($product->id_category_default), $product->name)));
$lang = Configuration::get('PS_LANG_DEFAULT');
if (Pack::isPack(intval($product->id), intval($lang)) and !Pack::isInStock(intval($product->id), intval($lang))) {
$product->quantity = 0;
}
/* /Quantity discount management */
$smarty->assign(array('quantity_discounts' => QuantityDiscount::getQuantityDiscounts(intval($product->id), $product->getPriceWithoutReduct()), 'product' => $product, 'homeSize' => Image::getSize('home'), 'jqZoomEnabled' => $jqZoomEnabled, 'product_manufacturer' => new Manufacturer(intval($product->id_manufacturer)), 'token' => Tools::getToken(false), 'productPriceWithoutEcoTax' => floatval($productPriceWithoutEcoTax), 'features' => $features, 'attachments' => $attachments, 'allow_oosp' => $product->isAvailableWhenOutOfStock(intval($product->out_of_stock)), 'last_qties' => intval($configs['PS_LAST_QTIES']), 'group_reduction' => (100 - Group::getReduction(intval($cookie->id_customer))) / 100, 'col_img_dir' => _PS_COL_IMG_DIR_, 'HOOK_EXTRA_LEFT' => Module::hookExec('extraLeft'), 'HOOK_EXTRA_RIGHT' => Module::hookExec('extraRight'), 'HOOK_PRODUCT_OOS' => Hook::productOutOfStock($product), 'HOOK_PRODUCT_FOOTER' => Hook::productFooter($product, $category), 'HOOK_PRODUCT_ACTIONS' => Module::hookExec('productActions'), 'HOOK_PRODUCT_TAB' => Module::hookExec('productTab'), 'HOOK_PRODUCT_TAB_CONTENT' => Module::hookExec('productTabContent')));
$images = $product->getImages(intval($cookie->id_lang));
$productImages = array();
foreach ($images as $k => $image) {
if ($image['cover']) {
$smarty->assign('mainImage', $images[0]);
$cover = $image;
$cover['id_image'] = intval($product->id) . '-' . $cover['id_image'];
$cover['id_image_only'] = intval($image['id_image']);
}
$productImages[intval($image['id_image'])] = $image;
}
if (!isset($cover)) {
$cover = array('id_image' => Language::getIsoById($cookie->id_lang) . '-default', 'legend' => 'No picture', 'title' => 'No picture');
}
$size = Image::getSize('large');
示例2: process
//.........这里部分代码省略.........
$this->product->quantity = 0;
}
$group_reduction = (100 - Group::getReduction((int) self::$cookie->id_customer)) / 100;
$id_customer = (isset(self::$cookie->id_customer) and self::$cookie->id_customer) ? (int) self::$cookie->id_customer : 0;
$id_group = $id_customer ? (int) Customer::getDefaultGroupId($id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_;
$id_country = (int) ($id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT'));
if ((int) Tools::getValue('pp') == 1) {
$time3 = time();
echo 'time3: ' . $time3;
}
// Tax
$tax = (double) Tax::getProductTaxRate((int) $this->product->id, $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
self::$smarty->assign('tax_rate', $tax);
$ecotax_rate = (double) Tax::getProductEcotaxRate($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$ecotaxTaxAmount = Tools::ps_round($this->product->ecotax, 2);
if (Product::$_taxCalculationMethod == PS_TAX_INC && (int) Configuration::get('PS_TAX')) {
$ecotaxTaxAmount = Tools::ps_round($ecotaxTaxAmount * (1 + $ecotax_rate / 100), 2);
}
$manufacturer = new Manufacturer((int) $this->product->id_manufacturer, 1);
$sizechart = new Sizechart((int) $this->product->id_sizechart, 1);
//see if the product is already in the wishlist
if ($id_customer) {
$sql = "select id from ps_wishlist where id_customer = " . $id_customer . " and id_product = " . $this->product->id;
$res = Db::getInstance()->ExecuteS($sql);
if ($res) {
self::$smarty->assign("in_wishlist", true);
} else {
self::$smarty->assign("in_wishlist", false);
}
} else {
self::$smarty->assign("in_wishlist", false);
}
self::$smarty->assign(array('quantity_discounts' => $this->formatQuantityDiscounts(SpecificPrice::getQuantityDiscounts((int) $this->product->id, (int) Shop::getCurrentShop(), (int) self::$cookie->id_currency, $id_country, $id_group), $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false), (double) $tax), 'product' => $this->product, 'ecotax_tax_inc' => $ecotaxTaxAmount, 'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2), 'ecotaxTax_rate' => $ecotax_rate, 'homeSize' => Image::getSize('home'), 'product_manufacturer' => $manufacturer, 'token' => Tools::getToken(false), 'productPriceWithoutEcoTax' => (double) $productPriceWithoutEcoTax, 'features' => $features, 'attachments' => $attachments, 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int) $this->product->out_of_stock), 'last_qties' => (int) $configs['PS_LAST_QTIES'], 'group_reduction' => $group_reduction, 'col_img_dir' => _PS_COL_IMG_DIR_, 'sizechart' => $sizechart->sizechart, 'sizechart_data' => $sizechart->sizechart_data));
self::$smarty->assign(array('HOOK_EXTRA_LEFT' => Module::hookExec('extraLeft'), 'HOOK_EXTRA_RIGHT' => Module::hookExec('extraRight'), 'HOOK_PRODUCT_OOS' => Hook::productOutOfStock($this->product), 'HOOK_PRODUCT_FOOTER' => Hook::productFooter($this->product, $category), 'HOOK_PRODUCT_ACTIONS' => Module::hookExec('productActions'), 'HOOK_PRODUCT_TAB' => Module::hookExec('productTab'), 'HOOK_PRODUCT_TAB_CONTENT' => Module::hookExec('productTabContent')));
if ((int) Tools::getValue('pp') == 1) {
$time4 = time();
echo 'time4: ' . $time4;
}
$images = $this->product->getImages((int) self::$cookie->id_lang);
$productImages = array();
foreach ($images as $k => $image) {
if ($image['cover']) {
self::$smarty->assign('mainImage', $images[0]);
$cover = $image;
$cover['id_image'] = Configuration::get('PS_LEGACY_IMAGES') ? $this->product->id . '-' . $image['id_image'] : $image['id_image'];
$cover['id_image_only'] = (int) $image['id_image'];
}
$productImages[(int) $image['id_image']] = $image;
}
if (!isset($cover)) {
$cover = array('id_image' => Language::getIsoById(self::$cookie->id_lang) . '-default', 'legend' => 'No picture', 'title' => 'No picture');
}
$size = Image::getSize('large');
self::$smarty->assign(array('cover' => $cover, 'imgWidth' => (int) $size['width'], 'mediumSize' => Image::getSize('medium'), 'largeSize' => Image::getSize('large'), 'accessories' => $this->product->getAccessories((int) self::$cookie->id_lang)));
if (sizeof($productImages)) {
self::$smarty->assign('images', $productImages);
}
if ((int) Tools::getValue('pp') == 1) {
$time5 = time();
echo 'time5: ' . $time5;
}
/* Attributes / Groups & colors */
$colors = array();
//see if the product has shades
if ($this->product->id_group && $this->product->id_group > 0) {
global $link;
示例3: process
public function process()
{
global $cart, $currency;
parent::process();
if (!Validate::isLoadedObject($this->product)) {
$this->errors[] = Tools::displayError('Product not found');
} else {
if (!$this->product->active and Tools::getValue('adtoken') != Tools::encrypt('PreviewProduct' . $this->product->id) || !file_exists(dirname(__FILE__) . '/../' . Tools::getValue('ad') . '/ajax.php')) {
header('HTTP/1.1 404 page not found');
$this->errors[] = Tools::displayError('Product is no longer available.');
} elseif (!$this->product->checkAccess((int) self::$cookie->id_customer)) {
$this->errors[] = Tools::displayError('You do not have access to this product.');
} else {
self::$smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int) $this->product->id));
if (!$this->product->active) {
self::$smarty->assign('adminActionDisplay', true);
}
/* Product pictures management */
require_once 'images.inc.php';
if ($this->product->customizable) {
self::$smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
if (Tools::isSubmit('submitCustomizedDatas')) {
$this->pictureUpload($this->product, $cart);
$this->textRecord($this->product, $cart);
$this->formTargetFormat();
} elseif (isset($_GET['deletePicture']) and !$cart->deletePictureToProduct((int) $this->product->id, (int) Tools::getValue('deletePicture'))) {
$this->errors[] = Tools::displayError('An error occurred while deleting the selected picture');
}
$files = self::$cookie->getFamily('pictures_' . (int) $this->product->id);
$textFields = self::$cookie->getFamily('textFields_' . (int) $this->product->id);
foreach ($textFields as $key => $textField) {
$textFields[$key] = str_replace('<br />', "\n", $textField);
}
self::$smarty->assign(array('pictures' => $files, 'textFields' => $textFields));
}
/* Features / Values */
$features = $this->product->getFrontFeatures((int) self::$cookie->id_lang);
$attachments = $this->product->cache_has_attachments ? $this->product->getAttachments((int) self::$cookie->id_lang) : array();
/* Category */
$category = false;
if (isset($_SERVER['HTTP_REFERER']) and preg_match('!^(.*)\\/([0-9]+)\\-(.*[^\\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) and !strstr($_SERVER['HTTP_REFERER'], '.html')) {
if (isset($regs[2]) and is_numeric($regs[2])) {
if (Product::idIsOnCategoryId((int) $this->product->id, array('0' => array('id_category' => (int) $regs[2])))) {
$category = new Category((int) $regs[2], (int) self::$cookie->id_lang);
}
} elseif (isset($regs[5]) and is_numeric($regs[5])) {
if (Product::idIsOnCategoryId((int) $this->product->id, array('0' => array('id_category' => (int) $regs[5])))) {
$category = new Category((int) $regs[5], (int) self::$cookie->id_lang);
}
}
}
if (!$category) {
$category = new Category($this->product->id_category_default, (int) self::$cookie->id_lang);
}
if (isset($category) and Validate::isLoadedObject($category)) {
self::$smarty->assign(array('path' => Tools::getPath((int) $category->id, $this->product->name, true), 'category' => $category, 'subCategories' => $category->getSubCategories((int) self::$cookie->id_lang, true), 'id_category_current' => (int) $category->id, 'id_category_parent' => (int) $category->id_parent, 'return_category_name' => Tools::safeOutput($category->name)));
} else {
self::$smarty->assign('path', Tools::getPath((int) $this->product->id_category_default, $this->product->name));
}
self::$smarty->assign('return_link', (isset($category->id) and $category->id) ? Tools::safeOutput(self::$link->getCategoryLink($category)) : 'javascript: history.back();');
if (Pack::isPack((int) $this->product->id) and !Pack::isInStock((int) $this->product->id)) {
$this->product->quantity = 0;
}
$group_reduction = (100 - Group::getReduction((int) self::$cookie->id_customer)) / 100;
$id_customer = (isset(self::$cookie->id_customer) and self::$cookie->id_customer) ? (int) self::$cookie->id_customer : 0;
$id_group = $id_customer ? (int) Customer::getDefaultGroupId($id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_;
$id_country = (int) ($id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT'));
// Tax
$tax = (double) Tax::getProductTaxRate((int) $this->product->id, $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
self::$smarty->assign('tax_rate', $tax);
$productPriceWithTax = Product::getPriceStatic($this->product->id, true, NULL, 6);
if (Product::$_taxCalculationMethod == PS_TAX_INC) {
$productPriceWithTax = Tools::ps_round($productPriceWithTax, 2);
}
$productPriceWithoutEcoTax = (double) ($productPriceWithTax - $this->product->ecotax);
$ecotax_rate = (double) Tax::getProductEcotaxRate($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$ecotaxTaxAmount = Tools::ps_round($this->product->ecotax, 2);
if (Product::$_taxCalculationMethod == PS_TAX_INC && (int) Configuration::get('PS_TAX')) {
$ecotaxTaxAmount = Tools::ps_round($ecotaxTaxAmount * (1 + $ecotax_rate / 100), 2);
}
self::$smarty->assign(array('quantity_discounts' => $this->formatQuantityDiscounts(SpecificPrice::getQuantityDiscounts((int) $this->product->id, (int) Shop::getCurrentShop(), (int) self::$cookie->id_currency, $id_country, $id_group), $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false), (double) $tax), 'product' => $this->product, 'ecotax_tax_inc' => $ecotaxTaxAmount, 'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2), 'ecotaxTax_rate' => $ecotax_rate, 'homeSize' => Image::getSize('home'), 'product_manufacturer' => new Manufacturer((int) $this->product->id_manufacturer, self::$cookie->id_lang), 'token' => Tools::getToken(false), 'productPriceWithoutEcoTax' => (double) $productPriceWithoutEcoTax, 'features' => $features, 'attachments' => $attachments, 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int) $this->product->out_of_stock), 'last_qties' => (int) Configuration::get('PS_LAST_QTIES'), 'group_reduction' => $group_reduction, 'col_img_dir' => _PS_COL_IMG_DIR_));
self::$smarty->assign(array('HOOK_EXTRA_LEFT' => Module::hookExec('extraLeft'), 'HOOK_EXTRA_RIGHT' => Module::hookExec('extraRight'), 'HOOK_PRODUCT_OOS' => Hook::productOutOfStock($this->product), 'HOOK_PRODUCT_FOOTER' => Hook::productFooter($this->product, $category), 'HOOK_PRODUCT_ACTIONS' => Module::hookExec('productActions'), 'HOOK_PRODUCT_TAB' => Module::hookExec('productTab'), 'HOOK_PRODUCT_TAB_CONTENT' => Module::hookExec('productTabContent')));
$images = $this->product->getImages((int) self::$cookie->id_lang);
$productImages = array();
foreach ($images as $k => $image) {
if ($image['cover']) {
self::$smarty->assign('mainImage', $images[0]);
$cover = $image;
$cover['id_image'] = Configuration::get('PS_LEGACY_IMAGES') ? $this->product->id . '-' . $image['id_image'] : $image['id_image'];
$cover['id_image_only'] = (int) $image['id_image'];
}
$productImages[(int) $image['id_image']] = $image;
}
if (!isset($cover)) {
$cover = array('id_image' => Language::getIsoById(self::$cookie->id_lang) . '-default', 'legend' => 'No picture', 'title' => 'No picture');
}
$size = Image::getSize('large');
self::$smarty->assign(array('cover' => $cover, 'imgWidth' => (int) $size['width'], 'mediumSize' => Image::getSize('medium'), 'largeSize' => Image::getSize('large'), 'accessories' => $this->product->getAccessories((int) self::$cookie->id_lang)));
if (count($productImages)) {
self::$smarty->assign('images', $productImages);
//.........这里部分代码省略.........