本文整理匯總了PHP中ImageType::getFormatedName方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageType::getFormatedName方法的具體用法?PHP ImageType::getFormatedName怎麽用?PHP ImageType::getFormatedName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImageType
的用法示例。
在下文中一共展示了ImageType::getFormatedName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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');
}
}
示例2: __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_);
}
示例3: 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');
}
}
示例4: 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();
}
示例5: __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();
}
示例6: 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');
}
示例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: 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');
}
示例9: 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');
}
示例10: _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)));
}
示例11: hookDisplayHomeLine5
public function hookDisplayHomeLine5($params)
{
if (!$this->isCached('blockbestsellershome.tpl', $this->getCacheId('blockbestsellershome'))) {
$this->smarty->assign(array('best_sellers' => BlockBestSellers::$cache_best_sellers, 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
}
if (BlockBestSellers::$cache_best_sellers === false) {
return false;
}
return $this->display(__FILE__, 'blockbestsellershome.tpl', $this->getCacheId('blockbestsellershome'));
}
示例12: hookRightColumn
public function hookRightColumn($params)
{
if (Configuration::get('PS_CATALOG_MODE')) {
return;
}
if (!($special = Product::getRandomSpecial((int) $params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) {
return;
}
$this->smarty->assign(array('special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium'))));
return $this->display(__FILE__, 'blockspecials.tpl');
}
示例13: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->productSort();
$nbProducts = Product::getPricesDrop($this->context->language->id, null, null, true);
$this->pagination($nbProducts);
$products = Product::getPricesDrop($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
$this->context->smarty->assign(array('products' => $products, '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_ . 'prices-drop.tpl');
}
示例14: 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, isset($this->p) ? (int) $this->p - 1 : null, isset($this->n) ? (int) $this->n : null, true);
$this->pagination($nbProducts);
$this->context->smarty->assign(array('products' => Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay), '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')));
$this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
}
示例15: formatProduct
protected function formatProduct($id_product, $id_lang)
{
$link = new Link();
$product = new Product($id_product, true, $id_lang);
$category = new Category($product->id_category_default, $id_lang);
$product->objectID = $product->id;
$product->category = $category->name;
$product->url = $link->getProductLink($product->id);
/* Cover */
$cover = Image::getCover($product->id);
$product->image_link_small = $link->getImageLink($product->link_rewrite, $cover['id_image'], ImageType::getFormatedName('small'));
$product->image_link_large = $link->getImageLink($product->link_rewrite, $cover['id_image'], ImageType::getFormatedName('large'));
return $product;
}