Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap

This commit is contained in:
Jerome Nadaud
2013-10-08 18:42:19 +02:00
23 changed files with 756 additions and 660 deletions
@@ -149,7 +149,7 @@ class AdminDashboardControllerCore extends AdminController
'translations' => $translations,
'action' => '#',
'warning' => $this->getWarningDomainName(),
'new_version_url' => Tools::getCurrentUrlProtocolPrefix().'api.dev.prestashop.com/version/check_version.php?v='._PS_VERSION_.'&l='.$this->context->language->iso_code,
'new_version_url' => Tools::getCurrentUrlProtocolPrefix().'api.prestashop.com/version/check_version.php?v='._PS_VERSION_.'&lang='.$this->context->language->iso_code,
'dashboard_use_push' => Configuration::get('PS_DASHBOARD_USE_PUSH'),
'datepickerFrom' => Tools::getValue('datepickerFrom', $this->context->employee->stats_date_from),
'datepickerTo' => Tools::getValue('datepickerTo', $this->context->employee->stats_date_to)
@@ -2423,7 +2423,7 @@ class AdminProductsControllerCore extends AdminController
<span style="float: left">
'.$this->l('Your product will be saved as a draft.').'
</span>
<span style="float:right"><a href="#" class="button" style="display: block" onclick="submitAddProductAndPreview()" >'.$this->l('Save and preview.').'</a></span>
<span style="float:right"><a href="#" class="button" style="display: block" onclick="submitAddProductAndPreview()" >'.$this->l('Save and preview').'</a></span>
<input type="hidden" name="fakeSubmitAddProductAndPreview" id="fakeSubmitAddProductAndPreview" />
<br class="clear" />
</p>
@@ -2506,7 +2506,7 @@ class AdminProductsControllerCore extends AdminController
$this->toolbar_btn['delete'] = array(
'short' => 'Delete',
'href' => $this->context->link->getAdminLink('AdminProducts').'&amp;id_product='.(int)$product->id.'&amp;deleteproduct',
'desc' => $this->l('Delete this product.'),
'desc' => $this->l('Delete this product'),
'confirm' => 1,
'js' => 'if (confirm(\''.$this->l('Delete product?').'\')){return true;}else{event.preventDefault();}'
);
@@ -2614,7 +2614,7 @@ class AdminProductsControllerCore extends AdminController
{
$this->product_exists_in_shop = false;
if ($this->tab_display == 'Informations')
$this->displayWarning($this->l('Warning: The product does not exist in this shop.'));
$this->displayWarning($this->l('Warning: The product does not exist in this shop'));
$default_product = new Product();
$definition = ObjectModel::getDefinition($product);
@@ -2771,7 +2771,7 @@ class AdminProductsControllerCore extends AdminController
);
if ($id_currency <= 0 || ( !($result = Currency::getCurrency($id_currency)) || empty($result) ))
$this->errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
$this->errors[] = Tools::displayError('The selected currency is not valid');
// Save product-supplier data
$product_supplier_id = (int)ProductSupplier::getIdByProductAndSupplier($product->id, $attribute['id_product_attribute'], $supplier->id_supplier);
@@ -3177,7 +3177,7 @@ class AdminProductsControllerCore extends AdminController
if (!file_exists($exists_file)
&& !empty($product->productDownload->display_filename)
&& empty($product->cache_default_attribute))
$msg = sprintf(Tools::displayError('This file "%s" is missing.'), $product->productDownload->display_filename);
$msg = sprintf(Tools::displayError('This file "%s" is missing'), $product->productDownload->display_filename);
else
$msg = '';
@@ -4383,7 +4383,7 @@ class AdminProductsControllerCore extends AdminController
<span>
'.$this->l('Your product will be saved as a draft.').'
</span>
<span style="float:right"><a href="#" class="button" style="display: block" onclick="submitAddProductAndPreview()" >'.$this->l('Save and preview.').'</a></span>
<span style="float:right"><a href="#" class="button" style="display: block" onclick="submitAddProductAndPreview()" >'.$this->l('Save and preview').'</a></span>
<input type="hidden" name="fakeSubmitAddProductAndPreview" id="fakeSubmitAddProductAndPreview" />
</p>
</div>';
+2 -31
View File
@@ -199,45 +199,16 @@ class CategoryControllerCore extends FrontController
// Pagination must be call after "getProducts"
$this->pagination($this->nbProducts);
$products_need_cache = array();
foreach ($this->cat_products as &$product)
{
if ($product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity']))
$product['minimal_quantity'] = $product['product_attribute_minimal_quantity'];
if (!$this->isCached(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product'])))
$products_need_cache[] = (int)$product['id_product'];
}
unset($product);
$colors = false;
if (count($products_need_cache))
$colors = Product::getAttributesColorList($products_need_cache);
Tools::enableCache();
foreach ($this->cat_products as &$product)
{
$tpl = $this->context->smarty->createTemplate(_PS_THEME_DIR_.'product-list-colors.tpl');
if (isset($colors[$product['id_product']]))
$tpl->assign(array(
'id_product' => $product['id_product'],
'colors_list' => $colors[$product['id_product']]
));
if (!in_array($product['id_product'], $products_need_cache) || isset($colors[$product['id_product']]))
$product['color_list'] = $tpl->fetch(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product']));
else
$product['color_list'] = '';
}
Tools::restoreCacheSettings();
$this->addColorsToProductList($this->cat_products);
$this->context->smarty->assign('nb_products', $this->nbProducts);
}
protected function getColorsListCacheId($id_product)
{
return 'productlist_colors|'.(int)$id_product.'|'.$this->context->shop->id;
}
/**
* Get instance of current category
*/
+5 -1
View File
@@ -97,9 +97,13 @@ class ManufacturerControllerCore extends FrontController
$this->manufacturer->description = Tools::nl2br(trim($this->manufacturer->description));
$nbProducts = $this->manufacturer->getProducts($this->manufacturer->id, null, null, null, $this->orderBy, $this->orderWay, true);
$this->pagination((int)$nbProducts);
$products = $this->manufacturer->getProducts($this->manufacturer->id, $this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
$this->context->smarty->assign(array(
'nb_products' => $nbProducts,
'products' => $this->manufacturer->getProducts($this->manufacturer->id, $this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay),
'products' => $products,
'path' => ($this->manufacturer->active ? Tools::safeOutput($this->manufacturer->name) : ''),
'manufacturer' => $this->manufacturer,
'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')
+11 -2
View File
@@ -75,6 +75,9 @@ class SearchControllerCore extends FrontController
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'], // DEPRECATED (since to 1.4), not use this: conflict with block_cart module
'search_products' => $search['result'],
@@ -83,7 +86,7 @@ class SearchControllerCore extends FrontController
'instant_search' => $this->instant_search,
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
}
else if (($query = Tools::getValue('search_query', Tools::getValue('ref'))) && !is_array($query))
elseif (($query = Tools::getValue('search_query', Tools::getValue('ref'))) && !is_array($query))
{
$this->productSort();
$this->n = abs((int)(Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'))));
@@ -93,6 +96,9 @@ class SearchControllerCore extends FrontController
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'], // DEPRECATED (since to 1.4), not use this: conflict with block_cart module
'search_products' => $search['result'],
@@ -100,12 +106,15 @@ class SearchControllerCore extends FrontController
'search_query' => $query,
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
}
else if (($tag = urldecode(Tools::getValue('tag'))) && !is_array($tag))
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($search['result']);
$this->context->smarty->assign(array(
'search_tag' => $tag,
'products' => $result, // DEPRECATED (since to 1.4), not use this: conflict with block_cart module
+5 -1
View File
@@ -99,9 +99,13 @@ class SupplierControllerCore extends FrontController
$this->supplier->description = Tools::nl2br(trim($this->supplier->description));
$nbProducts = $this->supplier->getProducts($this->supplier->id, null, null, null, $this->orderBy, $this->orderWay, true);
$this->pagination((int)$nbProducts);
$products = $this->supplier->getProducts($this->supplier->id, $this->context->cookie->id_lang, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
$this->context->smarty->assign(array(
'nb_products' => $nbProducts,
'products' => $this->supplier->getProducts($this->supplier->id, $this->context->cookie->id_lang, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay),
'products' => $products,
'path' => ($this->supplier->active ? Tools::safeOutput($this->supplier->name) : ''),
'supplier' => $this->supplier,
'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')