本文整理匯總了PHP中ImageType類的典型用法代碼示例。如果您正苦於以下問題:PHP ImageType類的具體用法?PHP ImageType怎麽用?PHP ImageType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ImageType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->productSort();
// Override default configuration values: cause the new products page must display latest products first.
if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) {
$this->orderBy = 'date_add';
$this->orderWay = 'DESC';
}
$nbProducts = (int) Product::getNewProducts($this->context->language->id, null, null, true);
$this->pagination($nbProducts);
$products = Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displayLeftColumn'), 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
if ($this->ajax) {
$product_list = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'product-list.tpl');
$pagination = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'pagination.tpl');
$nbLeftProducts = $nbProducts - ($this->n * ($this->p - 1) + count($products));
$nbLeftProductsPercentage = ($nbProducts - $nbLeftProducts) / $nbProducts * 100;
echo Tools::jsonEncode(array('productList' => utf8_encode($product_list), 'pagination' => $pagination, 'nbRenderedProducts' => $nbProducts, 'nbLeftProducts' => $nbLeftProducts, 'nbLeftProductsPercentage' => $nbLeftProductsPercentage));
die;
} else {
$this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
}
}
示例2: __construct
public function __construct()
{
$this->name = 'flexiblebrands';
$this->imageHomeSize = Image::getSize(ImageType::getFormatedName('home'));
$this->orderValue = array('sales' => $this->l('Sales'), 'price' => $this->l('Price'), 'discount' => $this->l('Discount'), 'add' => $this->l('Add Date'), 'rand' => $this->l('Random'));
$this->orderType = array('asc' => $this->l('Ascending'), 'desc' => $this->l('Descending'));
$this->display = array('all' => $this->l('All'), 'condition-new' => $this->l('New'), 'condition-used' => $this->l('Used'), 'condition-refurbished' => $this->l('Refurbished'));
$this->groupType = array('auto' => $this->l('Auto'), 'manual' => $this->l('Manual'));
$this->moduleLayout = array('default' => $this->l('Layout [default]'));
$this->tempPath = dirname(__FILE__) . '/images/temps/';
$this->bannerPath = dirname(__FILE__) . '/images/banners/';
$this->iconPath = dirname(__FILE__) . '/images/icons/';
if (Configuration::get('PS_SSL_ENABLED')) {
$this->livePath = _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'modules/flexiblebrands/images/';
} else {
$this->livePath = _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/flexiblebrands/images/';
}
$this->secure_key = Tools::encrypt('ovic-' . $this->name);
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'OvicSoft [SonNC]';
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Ovic Flexible Brands Module');
$this->description = $this->l('Ovic Flexible Brands Module');
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
//$this->cache = new FlexibleBrandFastCache();
}
示例3: __construct
public function __construct()
{
$this->name = 'groupcategory';
//$this->cache = new GroupCategoryFastCache();
$this->arrType = array('saller' => $this->l('Best Sellers'), 'view' => $this->l('Most View'), 'special' => $this->l('Specials'), 'arrival' => $this->l('New Arrivals'));
$this->secure_key = Tools::encrypt('ovic-soft[group-category]' . $this->name);
$this->imageHomeSize = Image::getSize(ImageType::getFormatedName('home'));
$this->arrLayout = array('default' => $this->l('Layout [default]'));
$this->pathTemp = dirname(__FILE__) . '/images/temps/';
$this->pathBanner = dirname(__FILE__) . '/images/banners/';
$this->pathIcon = dirname(__FILE__) . '/images/icons/';
if (Configuration::get('PS_SSL_ENABLED')) {
$this->livePath = _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'modules/groupcategory/images/';
} else {
$this->livePath = _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/groupcategory/images/';
}
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'OvicSoft';
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Supershop - Group Category Module');
$this->description = $this->l('Group Category Module');
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
}
示例4: initContent
public function initContent()
{
parent::initContent();
$this->productSort();
// Override default configuration values: cause the new products page must display latest products first.
if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) {
$this->orderBy = 'date_add';
$this->orderWay = 'DESC';
}
$nb_products = (int) Product::getNewProducts($this->context->language->id, isset($this->p) ? (int) $this->p - 1 : null, isset($this->n) ? (int) $this->n : null, true);
$this->pagination($nb_products);
$products = Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
/************************* /Images Array ******************************/
if (method_exists('Product', 'getProductsImgs')) {
$image_array = array();
for ($i = 0; $i < $nb_products; $i++) {
if (isset($products[$i]['id_product'])) {
$image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
}
}
$this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
}
/************************* /Images Array ******************************/
$this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
$this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
}
示例5: initContent
public function initContent()
{
if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
parent::initContent();
$this->productSort();
$nb_products = (int) ProductSale::getNbSales();
$this->pagination($nb_products);
if (!Tools::getValue('orderby')) {
$this->orderBy = 'sales';
}
$products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
/************************* /Images Array ******************************/
if (method_exists('Product', 'getProductsImgs')) {
$image_array = array();
for ($i = 0; $i < $nb_products; $i++) {
if (isset($products[$i]['id_product'])) {
$image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
}
}
$this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
}
/************************* /Images Array ******************************/
$this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
$this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
} else {
Tools::redirect('index.php?controller=404');
}
}
示例6: setProduct
public function setProduct($product, $combination)
{
// create the product
$context = Context::getContext();
$this->give_it_product = new GiveItSdkProduct();
$this->give_it_product->setCurrency($context->currency->iso_code);
$usetax = Product::getTaxCalculationMethod((int) $context->customer->id) != PS_TAX_EXC;
if ($combination['id_product_attribute'] == 0) {
$combination['attributes'] = '';
$image = Product::getCover($product->id);
} else {
$comb = new Combination($combination['id_product_attribute']);
if ($image = $comb->getWsImages()) {
$image = $image[0];
$image['id_image'] = $image['id'];
}
}
$image['id_product'] = $product->id;
$image['id_image'] = Product::defineProductImage($image, Context::getContext()->language->id);
$img_profile = version_compare(_PS_VERSION_, '1.5', '<') ? 'home' : ImageType::getFormatedName('medium');
$image = $image ? $context->link->getImageLink($product->link_rewrite, $image['id_image'], $img_profile) : '';
// first, set the product details.
$this->give_it_product->setProductDetails(array('code' => $product->id . '_' . $combination['id_product_attribute'], 'price' => (int) (Product::getPriceStatic((int) $product->id, $usetax, $combination['id_product_attribute']) * 100), 'name' => $product->name . ($combination['attributes'] ? ' : ' . $combination['attributes'] : ''), 'image' => $image));
$delivery = $this->setDelivery();
// add the delivery option to the product
$this->give_it_product->addBuyerOption($delivery);
//We should validate this product
$this->product_valid = $this->give_it_product->validate();
}
示例7: generateImageLink
protected static function generateImageLink($product, $ps_product, $id_lang, $iso_code)
{
$link = new Link();
$cover = Image::getCover($ps_product->id);
$product->{"image_link_small_{$iso_code}"} = $link->getImageLink($ps_product->link_rewrite[$id_lang], $cover["id_image"], ImageType::getFormatedName("small"));
$product->{"image_link_large_{$iso_code}"} = $link->getImageLink($ps_product->link_rewrite[$id_lang], $cover["id_image"], ImageType::getFormatedName("large"));
return $product;
}
示例8: renderForm
public function renderForm($args, $data)
{
$helper = $this->getFormHelper();
$imagesTypes = ImageType::getImagesTypes('manufacturers');
$this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Widget Form.')), 'input' => array(array('type' => 'text', 'label' => $this->l('Limit'), 'name' => 'limit', 'default' => 10), array('type' => 'select', 'label' => $this->l('Image:'), 'desc' => $this->l('Select type image for manufacture.'), 'name' => 'image', 'default' => 'small' . '_default', 'options' => array('query' => $imagesTypes, 'id' => 'name', 'name' => 'name'))), 'buttons' => array(array('title' => $this->l('Save And Stay'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveandstayleotempcp'), array('title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveleotempcp')));
$default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
$helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($data), 'languages' => Context::getContext()->controller->getLanguages(), 'id_language' => $default_lang);
return $helper->generateForm($this->fields_form);
}
示例9: renderForm
public function renderForm($args, $data)
{
$helper = $this->getFormHelper();
$imagesTypes = ImageType::getImagesTypes('manufacturers');
$this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Widget Form.')), 'input' => array(array('type' => 'text', 'label' => $this->l('Items Per Page'), 'name' => 'itemspage', 'default' => 3, 'desc' => $this->l('The maximum number of products in each page Carousel (default: 3).')), array('type' => 'text', 'label' => $this->l('Colums In Tab'), 'name' => 'columns', 'default' => 3, 'desc' => 'The maximum column products in each page Carousel (default: 3).'), array('type' => 'text', 'label' => $this->l('Items In Tab'), 'name' => 'itemstab', 'default' => 6, 'desc' => $this->l('The maximum number of products in each Carousel (default: 6).')), array('type' => 'select', 'label' => $this->l('Image:'), 'desc' => $this->l('Select type image for manufacture.'), 'name' => 'image', 'default' => 'small_' . 'default', 'options' => array('query' => $imagesTypes, 'id' => 'name', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Interval'), 'name' => 'interval', 'default' => 8000, 'desc' => $this->l('Enter Time(miniseconds) to play carousel. Value 0 to stop.'))), 'buttons' => array(array('title' => $this->l('Save And Stay'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveandstayleotempcp'), array('title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveleotempcp')));
$default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
$helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($data), 'languages' => Context::getContext()->controller->getLanguages(), 'id_language' => $default_lang);
return $helper->generateForm($this->fields_form);
}
示例10: makeFormConfigs
public function makeFormConfigs()
{
if ($this->_fields_form) {
return;
}
$imagesTypes = ImageType::getImagesTypes('manufacturers');
$fields_form = array('form' => array('legend' => array('title' => $this->l('Settings'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => 'text', 'label' => $this->l('Colums In Tab.'), 'name' => $this->renderName('col'), 'desc' => $this->l('The maximum column items in tab.'), 'default' => 3), array('type' => 'text', 'label' => $this->l('Manufacturers Per Page:'), 'name' => $this->renderName('page'), 'desc' => $this->l('The maximum number of manufacturers displayed in this block.'), 'required' => true, 'default' => 6), array('type' => 'switch', 'label' => $this->l('Show title:'), 'name' => $this->renderName('active_title'), 'is_bool' => true, 'desc' => 'Display or none display Module title.', 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('No'))), 'default' => 0), array('type' => 'switch', 'label' => $this->l('Auto play:'), 'name' => $this->renderName('active_play'), 'is_bool' => true, 'desc' => 'For carousel.', 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('No'))), 'default' => 0), array('type' => 'select', 'label' => $this->l('Shipping method:'), 'desc' => $this->l('Type image'), 'name' => $this->renderName('type_img'), 'required' => true, 'options' => array('query' => $imagesTypes, 'id' => 'name', 'name' => 'name'), 'default' => 'pf_manufacturer'), array('type' => 'text', 'label' => $this->l('Interval .'), 'name' => $this->renderName('intv'), 'desc' => $this->l('Enter Time(miniseconds) to play carousel. Value 1 to stop.'), 'default' => 8000)), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-default')));
$this->_fields_form[] = $fields_form;
}
示例11: initContent
public function initContent()
{
parent::initContent();
$this->productSort();
$nbProducts = (int) ProductSale::getNbSales();
$this->pagination($nbProducts);
$this->context->smarty->assign(array('products' => ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
$this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
}
示例12: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
$original_query = Tools::getValue('q');
$query = Tools::replaceAccentedChars(urldecode($original_query));
if ($this->ajax_search) {
$searchResults = Search::find((int) Tools::getValue('id_lang'), $query, 1, 10, 'position', 'desc', true);
if (is_array($searchResults)) {
foreach ($searchResults as &$product) {
$product['product_link'] = $this->context->link->getProductLink($product['id_product'], $product['prewrite'], $product['crewrite']);
}
Hook::exec('actionSearch', array('expr' => $query, 'total' => count($searchResults)));
}
$this->ajaxDie(Tools::jsonEncode($searchResults));
}
//Only controller content initialization when the user use the normal search
parent::initContent();
$product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int) $this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
if ($this->instant_search && !is_array($query)) {
$this->productSort();
$this->n = abs((int) Tools::getValue('n', $product_per_page));
$this->p = abs((int) Tools::getValue('p', 1));
$search = Search::find($this->context->language->id, $query, 1, 10, 'position', 'desc');
Hook::exec('actionSearch', array('expr' => $query, 'total' => $search['total']));
$nbProducts = $search['total'];
$this->pagination($nbProducts);
$this->addColorsToProductList($search['result']);
$this->context->smarty->assign(array('products' => $search['result'], 'search_products' => $search['result'], 'nbProducts' => $search['total'], 'search_query' => $original_query, 'instant_search' => $this->instant_search, 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
} elseif (($query = Tools::getValue('search_query', Tools::getValue('ref'))) && !is_array($query)) {
$this->productSort();
$this->n = abs((int) Tools::getValue('n', $product_per_page));
$this->p = abs((int) Tools::getValue('p', 1));
$original_query = $query;
$query = Tools::replaceAccentedChars(urldecode($query));
$search = Search::find($this->context->language->id, $query, $this->p, $this->n, $this->orderBy, $this->orderWay);
if (is_array($search['result'])) {
foreach ($search['result'] as &$product) {
$product['link'] .= (strpos($product['link'], '?') === false ? '?' : '&') . 'search_query=' . urlencode($query) . '&results=' . (int) $search['total'];
}
}
Hook::exec('actionSearch', array('expr' => $query, 'total' => $search['total']));
$nbProducts = $search['total'];
$this->pagination($nbProducts);
$this->addColorsToProductList($search['result']);
$this->context->smarty->assign(array('products' => $search['result'], 'search_products' => $search['result'], 'nbProducts' => $search['total'], 'search_query' => $original_query, 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
} elseif (($tag = urldecode(Tools::getValue('tag'))) && !is_array($tag)) {
$nbProducts = (int) Search::searchTag($this->context->language->id, $tag, true);
$this->pagination($nbProducts);
$result = Search::searchTag($this->context->language->id, $tag, false, $this->p, $this->n, $this->orderBy, $this->orderWay);
Hook::exec('actionSearch', array('expr' => $tag, 'total' => count($result)));
$this->addColorsToProductList($result);
$this->context->smarty->assign(array('search_tag' => $tag, 'products' => $result, 'search_products' => $result, 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
} else {
$this->context->smarty->assign(array('products' => array(), 'search_products' => array(), 'pages_nb' => 1, 'nbProducts' => 0));
}
$this->context->smarty->assign(array('add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
$this->setTemplate(_PS_THEME_DIR_ . 'search.tpl');
}
示例13: renderForm
public function renderForm($args, $data)
{
$helper = $this->getFormHelper();
$imagesTypes = ImageType::getImagesTypes('manufacturers');
$this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Widget Form.')), 'input' => array(array('type' => 'html', 'html_content' => 'Please access <a href="http://apollotheme.com/" target="_blank" title="apollo site">Apollotheme.com</a> to buy professional version to use this '), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/how-to-buy-pro-version/" target="_blank" title="How to buy">How to buy Professional Version</a>'), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/different-between-free-pro-version/" target="_blank" title="Why should use">Why should use Professional Version</a>')), 'buttons' => array(array('title' => $this->l('Save And Stay'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveandstayleotempcp'), array('title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveleotempcp')));
$default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
$helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($data), 'languages' => Context::getContext()->controller->getLanguages(), 'id_language' => $default_lang);
return $helper->generateForm($this->fields_form);
}
示例14: _assignSummaryInformations
protected function _assignSummaryInformations()
{
$summary = $this->context->cart->getSummaryDetails();
$customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id);
// override customization tax rate with real tax (tax rules)
if ($customizedDatas) {
foreach ($summary['products'] as &$productUpdate) {
$productId = (int) isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id'];
$productAttributeId = (int) isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id'];
if (isset($customizedDatas[$productId][$productAttributeId])) {
$productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
}
}
Product::addCustomizationPrice($summary['products'], $customizedDatas);
}
$cart_product_context = Context::getContext()->cloneContext();
foreach ($summary['products'] as $key => &$product) {
$product['quantity'] = $product['cart_quantity'];
// for compatibility with 1.2 themes
if ($cart_product_context->shop->id != $product['id_shop']) {
$cart_product_context->shop = new Shop((int) $product['id_shop']);
}
$product['price_without_specific_price'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute'], _PS_PRICE_COMPUTE_PRECISION_, null, false, false, 1, false, null, null, null, $null, true, true, $cart_product_context);
/**
* ABU edit: variable is_discount set à 1 à tord, calcul foireux de presta
* @bugfix: https://github.com/PrestaShop/PrestaShop/commit/379e28b341730ea95c0b2d6567817305ea841b23
* @perso: soustraction de l'ecotax au price_without_specific_price @else
*/
if (Product::getTaxCalculationMethod()) {
// $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
$product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
} else {
// $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
$product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'] - $product['ecotax'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
}
}
// Get available cart rules and unset the cart rules already in the cart
$available_cart_rules = CartRule::getCustomerCartRules($this->context->language->id, isset($this->context->customer->id) ? $this->context->customer->id : 0, true, true, true, $this->context->cart);
$cart_cart_rules = $this->context->cart->getCartRules();
foreach ($available_cart_rules as $key => $available_cart_rule) {
if (!$available_cart_rule['highlight'] || strpos($available_cart_rule['code'], CartRule::BO_ORDER_CODE_PREFIX) === 0) {
unset($available_cart_rules[$key]);
continue;
}
foreach ($cart_cart_rules as $cart_cart_rule) {
if ($available_cart_rule['id_cart_rule'] == $cart_cart_rule['id_cart_rule']) {
unset($available_cart_rules[$key]);
continue 2;
}
}
}
$show_option_allow_separate_package = !$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE');
$this->context->smarty->assign($summary);
$this->context->smarty->assign(array('token_cart' => Tools::getToken(false), 'isLogged' => $this->isLogged, 'isVirtualCart' => $this->context->cart->isVirtualCart(), 'productNumber' => $this->context->cart->nbProducts(), 'voucherAllowed' => CartRule::isFeatureActive(), 'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'lastProductAdded' => $this->context->cart->getLastProduct(), 'displayVouchers' => $available_cart_rules, 'show_option_allow_separate_package' => $show_option_allow_separate_package, 'smallSize' => Image::getSize(ImageType::getFormatedName('small'))));
$this->context->smarty->assign(array('HOOK_SHOPPING_CART' => Hook::exec('displayShoppingCartFooter', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('displayShoppingCart', $summary)));
}
示例15: afterImageUpload
public function afterImageUpload()
{
/* Generate image with differents size */
if ($id_manufacturer = intval(Tools::getValue('id_manufacturer')) and isset($_FILES) and count($_FILES) and file_exists(_PS_MANU_IMG_DIR_ . $id_manufacturer . '.jpg')) {
$imagesTypes = ImageType::getImagesTypes('manufacturers');
foreach ($imagesTypes as $k => $imageType) {
imageResize(_PS_MANU_IMG_DIR_ . $id_manufacturer . '.jpg', _PS_MANU_IMG_DIR_ . $id_manufacturer . '-' . stripslashes($imageType['name']) . '.jpg', intval($imageType['width']), intval($imageType['height']));
}
}
}