// revert previous commit

This commit is contained in:
tDidierjean
2011-07-08 16:12:27 +00:00
parent af4c7605de
commit 9b288cecf5
38 changed files with 284 additions and 332 deletions
+25 -26
View File
@@ -33,9 +33,9 @@ class ProductControllerCore extends FrontController
{
parent::setMedia();
$this->addCSS(_THEME_CSS_DIR_.'product.css');
$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
$this->addJS(array(
Tools::addCSS(_THEME_CSS_DIR_.'product.css');
Tools::addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
Tools::addJS(array(
_PS_JS_DIR_.'jquery/jquery.fancybox-1.3.4.js',
_PS_JS_DIR_.'jquery/jquery.idTabs.modified.js',
_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js',
@@ -45,14 +45,13 @@ class ProductControllerCore extends FrontController
if (Configuration::get('PS_DISPLAY_JQZOOM') == 1)
{
$this->addCSS(_PS_CSS_DIR_.'jqzoom.css', 'screen');
$this->addJS(_PS_JS_DIR_.'jquery/jquery.jqzoom.js');
Tools::addCSS(_PS_CSS_DIR_.'jqzoom.css', 'screen');
Tools::addJS(_PS_JS_DIR_.'jquery/jquery.jqzoom.js');
}
}
public function preProcess()
{
$context = Context::getContext();
if ($id_product = (int)Tools::getValue('id_product'))
$this->product = new Product($id_product, true, self::$cookie->id_lang, (int)$this->id_current_shop);
@@ -67,7 +66,7 @@ class ProductControllerCore extends FrontController
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
if (Validate::isLoadedObject($this->product))
{
$canonicalURL = $context->link->getProductLink($this->product);
$canonicalURL = self::$link->getProductLink($this->product);
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/i', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
{
header('HTTP/1.0 301 Moved');
@@ -87,7 +86,7 @@ class ProductControllerCore extends FrontController
$default_rewrite = array();
foreach ($rewrite_infos AS $infos)
$default_rewrite[$infos['id_lang']] = $context->link->getProductLink((int)$id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int)$infos['id_lang']);
$default_rewrite[$infos['id_lang']] = self::$link->getProductLink((int)$id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int)$infos['id_lang']);
self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
}
@@ -95,8 +94,8 @@ class ProductControllerCore extends FrontController
public function process()
{
global $cart, $currency;;
parent::process();
$context = Context::getContext();
if (!$id_product = (int)(Tools::getValue('id_product')) OR !Validate::isUnsignedId($id_product))
$this->errors[] = Tools::displayError('Product not found');
@@ -109,7 +108,7 @@ class ProductControllerCore extends FrontController
header('HTTP/1.1 404 page not found');
$this->errors[] = Tools::displayError('Pproduct is no longer available.');
}
elseif (!$this->product->checkAccess(isset($context->customer) ? $context->customer->id : 0))
elseif (!$this->product->checkAccess((int)(self::$cookie->id_customer)))
$this->errors[] = Tools::displayError('You do not have access to this product.');
else
{
@@ -119,7 +118,7 @@ class ProductControllerCore extends FrontController
self::$smarty->assign('adminActionDisplay', true);
/* rewrited url set */
$rewrited_url = $context->link->getProductLink($this->product->id, $this->product->link_rewrite);
$rewrited_url = self::$link->getProductLink($this->product->id, $this->product->link_rewrite);
/* Product pictures management */
require_once('images.inc.php');
@@ -127,11 +126,11 @@ class ProductControllerCore extends FrontController
if (Tools::isSubmit('submitCustomizedDatas'))
{
$this->pictureUpload($this->product, $context->cart);
$this->textRecord($this->product, $context->cart);
$this->pictureUpload($this->product, $cart);
$this->textRecord($this->product, $cart);
$this->formTargetFormat();
}
elseif (isset($_GET['deletePicture']) AND !$context->cart->deletePictureToProduct((int)($this->product->id), (int)(Tools::getValue('deletePicture'))))
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));
@@ -184,22 +183,22 @@ class ProductControllerCore extends FrontController
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($context->link->getCategoryLink($category)) : 'javascript: history.back();');
self::$smarty->assign('return_link', (isset($category->id) AND $category->id) ? Tools::safeOutput(self::$link->getCategoryLink($category)) : 'javascript: history.back();');
$lang = Configuration::get('PS_LANG_DEFAULT');
if (Pack::isPack((int)($this->product->id), (int)($lang)) AND !Pack::isInStock((int)($this->product->id), (int)($lang)))
$this->product->quantity = 0;
$id_customer = (isset($context->customer) ? (int)($context->customer->id) : 0);
$group_reduction = (100 - Group::getReduction($id_customer)) / 100;
$id_group = (isset($context->customer) ? $context->customer->id_default_group : _PS_DEFAULT_CUSTOMER_GROUP_);
$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 = (float)(Tax::getProductTaxRate((int)($this->product->id), $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
$tax = (float)(Tax::getProductTaxRate((int)($this->product->id), $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
self::$smarty->assign('tax_rate', $tax);
$ecotax_rate = (float) Tax::getProductEcotaxRate($context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$ecotax_rate = (float) 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);
@@ -245,7 +244,7 @@ class ProductControllerCore extends FrontController
$productImages[(int)($image['id_image'])] = $image;
}
if (!isset($cover))
$cover = array('id_image' => $context->language->iso_code.'-default', 'legend' => 'No picture', 'title' => 'No picture');
$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,
@@ -337,7 +336,7 @@ class ProductControllerCore extends FrontController
}
self::$smarty->assign(array(
'no_tax' => Tax::excludeTaxeOption() OR !Tax::getProductTaxRate((int)$this->product->id, $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}),
'no_tax' => Tax::excludeTaxeOption() OR !Tax::getProductTaxRate((int)$this->product->id, $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}),
'customizationFields' => $this->product->getCustomizationFields((int)(self::$cookie->id_lang))
));
@@ -357,10 +356,10 @@ class ProductControllerCore extends FrontController
'display_qties' => (int)(Configuration::get('PS_DISPLAY_QTIES')),
'display_ht' => !Tax::excludeTaxeOption(),
'ecotax' => (!sizeof($this->errors) AND $this->product->ecotax > 0 ? Tools::convertPrice((float)($this->product->ecotax)) : 0),
'currencySign' => $context->currency->sign,
'currencyRate' => $context->currency->conversion_rate,
'currencyFormat' => $context->currency->format,
'currencyBlank' => $context->currency->blank,
'currencySign' => $currency->sign,
'currencyRate' => $currency->conversion_rate,
'currencyFormat' => $currency->format,
'currencyBlank' => $currency->blank,
'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM')
));
}