[-] Installer : Fix country_to_timezone in last step

[+] BO : now AdminProducts and AdminCategories are separated from AdminCatalog
[+] FO : new method Category::getAllChildren() (the return value is an array, but can evolve to a collection
// Uses of Media:: in header.inc.php 

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9097 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2011-10-06 13:02:24 +00:00
parent 646eda2e4e
commit f9bcf3f84f
9 changed files with 286 additions and 278 deletions
+6 -4
View File
@@ -41,14 +41,16 @@ echo '
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'admin.css" />
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'jquery.cluetip.css" />
<link type="text/css" rel="stylesheet" href="themes/'.Context::getContext()->employee->bo_theme.'/admin.css" />
<title>PrestaShop&trade; - '.translate('Administration panel').'</title>
<script type="text/javascript">
<title>PrestaShop&trade; - '.translate('Administration panel').'</title>';
$hoverindent = Media::getJqueryPluginPath('hoverIntent');
$cluetip = Media::getJqueryPluginPath('cluetip');
echo '<script type="text/javascript">
var helpboxes = '.Configuration::get('PS_HELPBOX').';
var roundMode = '.Configuration::get('PS_PRICE_ROUND_MODE').';
</script>
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery.hoverIntent.minified.js"></script>
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery.cluetip.js"></script>
<script type="text/javascript" src="'.$hoverindent['js'].'"></script>
<script type="text/javascript" src="'.$cluetip['js'].'"></script>
<script type="text/javascript" src="'._PS_JS_DIR_.'admin.js"></script>
<script type="text/javascript" src="'._PS_JS_DIR_.'toggle.js"></script>
<script type="text/javascript" src="'._PS_JS_DIR_.'tools.js"></script>
+8 -21
View File
@@ -99,9 +99,7 @@ class AdminCatalog extends AdminTab
public function postProcess()
{
if (!Tools::getValue('id_product'))
$this->adminCategories->postProcess();
elseif (isset($_GET['attributegenerator']))
if (isset($_GET['attributegenerator']))
{
if (!isset($this->attributeGenerator))
{
@@ -136,20 +134,8 @@ class AdminCatalog extends AdminTab
public function display()
{
if (((Tools::isSubmit('submitAddcategory') OR Tools::isSubmit('submitAddcategoryAndStay')) AND sizeof($this->adminCategories->_errors)) OR isset($_GET['updatecategory']) OR isset($_GET['addcategory']))
{
$this->adminCategories->displayForm($this->token);
echo '<br /><br /><a href="'.self::$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
}
elseif (((Tools::isSubmit('submitAddproduct') OR Tools::isSubmit('submitAddproductAndPreview') OR Tools::isSubmit('submitAddproductAndStay') OR Tools::isSubmit('submitSpecificPricePriorities') OR Tools::isSubmit('submitPriceAddition') OR Tools::isSubmit('submitPricesModification')) AND sizeof($this->adminProducts->_errors)) OR Tools::isSubmit('updateproduct') OR Tools::isSubmit('addproduct'))
{
$this->adminProducts->displayForm($this->token);
if (Tools::getValue('id_category') > 1)
echo '<br /><br /><a href="index.php?tab='.Tools::getValue('tab').'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to home').'</a><br />';
else
echo '<br /><br /><a href="index.php?tab='.Tools::getValue('tab').'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to catalog').'</a><br />';
}
elseif (isset($_GET['attributegenerator']))
// @todo : this has to be dealt in AdminAttributeGenerator !!
if (isset($_GET['attributegenerator']))
{
if (!isset($this->attributeGenerator))
{
@@ -175,11 +161,12 @@ class AdminCatalog extends AdminTab
$catBarIndex = preg_replace('/&'.$tab.'Orderby=([a-z _]*)&'.$tab.'Orderway=([a-z]*)/i', '', self::$currentIndex);
echo '<div class="cat_bar"><span style="color: #3C8534;">'.$this->l('Current category').' :</span>&nbsp;&nbsp;&nbsp;'.getPath($catBarIndex, $id_category, '', '', 'catalog', $home).'</div>';
echo '<h2>'.$this->l('Categories').'</h2>';
$this->adminCategories->display($this->token);
//echo '<h2>'.$this->l('Categories').'</h2>';
echo '<h1><a class="button" href="'.$this->context->link->getAdminLink('AdminCategories').'">'.$this->l('Categories').'</a></h1>';
//$this->adminCategories->display($this->token);
echo '<div style="margin:10px">&nbsp;</div>';
echo '<h2>'.$this->l('Products in this category').'</h2>';
$this->adminProducts->display($this->token);
echo '<h1><a class="button" href="'.$this->context->link->getAdminLink('AdminProducts').'">'.$this->l('Products').'</a></h1>';
//$this->adminProducts->display($this->token);
}
}
}
+29 -14
View File
@@ -28,13 +28,14 @@
class AdminCategories extends AdminTab
{
/** @var object Category() instance for navigation*/
private $_category;
private $_category = null;
public function __construct()
{
$this->table = 'category';
$this->className = 'Category';
$this->lang = true;
$this->add = true;
$this->edit = true;
$this->view = true;
$this->delete = true;
@@ -47,8 +48,13 @@ class AdminCategories extends AdminTab
'description' => array('title' => $this->l('Description'), 'width' => 500, 'maxlength' => 90, 'callback' => 'getDescriptionClean', 'orderby' => false),
'position' => array('title' => $this->l('Position'), 'width' => 40,'filter_key' => 'position', 'align' => 'center', 'position' => 'position'),
'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
if ($id_category = Tools::getvalue('id_category'))
$this->_category = new Category($id_category);
else
$this->_category = new Category(1);
$this->_category = AdminCatalog::getCurrentCategory();
$this->_filter = 'AND `id_parent` = '.(int)($this->_category->id);
$this->_select = 'position ';
@@ -71,15 +77,24 @@ class AdminCategories extends AdminTab
public function display($token = NULL)
{
$this->getList((int)($this->context->language->id), !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, $this->context->shop->getID(true));
echo '<h3>'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subcategory')))).' '.$this->l('in category').' "'.stripslashes($this->_category->getName()).'"</h3>';
if ($this->tabAccess['add'] === '1')
echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCatalog&add'.$this->table.'&id_parent='.$this->_category->id.'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new subcategory').'</a>';
echo '<div style="margin:10px;">';
$this->displayList($token);
echo '</div>';
if (((Tools::isSubmit('submitAddcategory') OR Tools::isSubmit('submitAddcategoryAndStay')) AND sizeof($this->_errors)) OR isset($_GET['updatecategory']) OR isset($_GET['addcategory']))
{
$this->displayForm($this->token);
echo '<br /><br /><a href="'.self::$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
}
else
{
$this->getList((int)($this->context->language->id), !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, $this->context->shop->getID(true));
echo '<h3>'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subcategory')))).' '.$this->l('in category').' "'.stripslashes($this->_category->getName()).'"</h3>';
if ($this->tabAccess['add'] === '1')
echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?controller=AdminCategories&add'.$this->table.'&id_parent='.$this->_category->id.'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new subcategory').'</a>';
echo '<a href="'.$this->context->link->getAdminLink('AdminProducts').'&amp;addproduct&amp;id_parent='.$this->_category->id.'">
<img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new product').'</a>';
echo '<div style="margin:10px;">';
$this->displayList($token);
echo '</div>';
}
}
public function postProcess($token = NULL)
@@ -136,7 +151,7 @@ class AdminCategories extends AdminTab
if (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
$this->_errors[] = Tools::displayError('Failed to update the position.');
else
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCatalog'));
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCategories'));
}
/* Delete multiple objects */
elseif (Tools::getValue('submitDel'.$this->table))
@@ -151,7 +166,7 @@ class AdminCategories extends AdminTab
if ($result)
{
$category->cleanPositions((int)(Tools::getValue('id_category')));
Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCatalog').'&id_category='.(int)(Tools::getValue('id_category')));
Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCategories').'&id_category='.(int)(Tools::getValue('id_category')));
}
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
@@ -234,7 +249,7 @@ class AdminCategories extends AdminTab
</div>
<label>'.$this->l('Image:').' </label>
<div class="margin-form">';
echo $this->displayImage($obj->id, _PS_IMG_DIR_.'c/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).$this->context->employee->id), true);
echo $this->displayImage($obj->id, _PS_IMG_DIR_.'c/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminCategories'.(int)(Tab::getIdFromClassName('AdminCategories')).$this->context->employee->id), true);
echo ' <br /><input type="file" name="image" />
<p>'.$this->l('Upload category logo from your computer').'</p>
</div>
+198 -224
View File
@@ -56,7 +56,11 @@ class AdminProducts extends AdminTab
'a!active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'filter_key' => 'a!active', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
/* Join categories table */
$this->_category = AdminCatalog::getCurrentCategory();
if ($id_category = Tools::getvalue('id_category'))
$this->_category = new Category($id_category);
else
$this->_category = new Category(1);
$this->_join = Product::sqlStock('a').'
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` AND i.`cover` = 1)
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`)
@@ -179,6 +183,7 @@ class AdminProducts extends AdminTab
else
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
}
else
/* Delete a product in the download folder */
if (Tools::getValue('deleteVirtualProduct'))
@@ -188,7 +193,7 @@ class AdminProducts extends AdminTab
else
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
else
/* Delete a product in the download folder */
if (Tools::getValue('deleteVirtualProductAttribute'))
{
@@ -1462,20 +1467,57 @@ class AdminProducts extends AdminTab
public function display($token = null)
{
if ($id_category = (int)Tools::getValue('id_category'))
AdminTab::$currentIndex .= '&id_category='.$id_category;
$this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : null, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : null, 0, null, $this->context->shop->getID(true));
if (((Tools::isSubmit('submitAddproduct') OR Tools::isSubmit('submitAddproductAndPreview') OR Tools::isSubmit('submitAddproductAndStay') OR Tools::isSubmit('submitSpecificPricePriorities') OR Tools::isSubmit('submitPriceAddition') OR Tools::isSubmit('submitPricesModification')) AND sizeof($this->_errors)) OR Tools::isSubmit('updateproduct') OR Tools::isSubmit('addproduct'))
{
$this->displayForm($this->token);
if (Tools::getValue('id_category') > 1)
echo '<br /><br /><a href="index.php?tab='.Tools::getValue('tab').'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to home').'</a><br />';
else
echo '<br /><br /><a href="index.php?tab='.Tools::getValue('tab').'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to catalog').'</a><br />';
}
else
{
if ($id_category = (int)Tools::getValue('id_category'))
AdminTab::$currentIndex .= '&id_category='.$id_category;
$this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : null, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : null, 0, null, $this->context->shop->getID(true));
$id_category = Tools::getValue('id_category', 1);
if (!$id_category)
$id_category = 1;
echo '<h3>'.(!$this->_listTotal ? ($this->l('No products found')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('products') : $this->l('product')))).' '.
$this->l('in category').' "'.stripslashes($this->_category->getName()).'"</h3>';
if ($this->tabAccess['add'] === '1')
echo '<a href="'.self::$currentIndex.'&id_category='.$id_category.'&add'.$this->table.'&token='.($token != null ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new product').'</a>';
echo '<div style="margin:10px;">';
$this->displayList($token);
echo '</div>';
$id_category = Tools::getValue('id_category', 1);
if (!$id_category)
$id_category = 1;
echo '<h3>'.(!$this->_listTotal ? ($this->l('No products found')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('products') : $this->l('product')))).'</h3>';
////////////////////////
// @todo lot of ergonomy works around here
echo '<p>'.$this->l('Go to category');
$select_child = ' <select id="go_to_categ"><option value="0">Jump to ...</option>';
// @todo : move blockcategories select queries in class Category
$root_categ = Category::getRootCategory();
$children = $root_categ->getAllChildren();
$all_cats = array();
foreach ($children as $categ)
{
// $all_cats[$categ['id_parent']]
$categ = new Category($categ['id_category'],$this->context->language->id);
$select_child .= '<option value="'.$categ->id.'" '.($this->_category->id_category == $categ->id ? 'selected="selected" class="selected level-depth-'.$categ->level_depth.'"':'class="level-depth-'.$categ->level_depth.'"') .'>' . str_repeat('&nbsp;-&nbsp;',$categ->level_depth). $categ->name .' ('.$categ->id.')</option>';
}
$select_child .= '</select>';
echo $select_child;
echo '</p>
<script type="text/javascript">
$("#go_to_categ").change(function(e){
console.log("pouet");
document.location.href = "'.$this->context->link->getAdminLink('AdminProducts').'&id_category="+$(this).val();
});
</script>';
////////////////////////
$this->l('in category').' "'.stripslashes($this->_category->getName()).'"</h3>';
if ($this->tabAccess['add'] === '1')
echo '<a href="'.self::$currentIndex.'&id_category='.$id_category.'&add'.$this->table.'&token='.($token != null ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new product').'</a>';
echo '<div style="margin:10px;">';
$this->displayList($token);
echo '</div>';
}
}
/**
@@ -1612,9 +1654,11 @@ class AdminProducts extends AdminTab
$(\'#mvt_sign\').html(\'<img src="../img/admin/arrow_up.png" /> '.$this->l('Increase your stock').'\');
$(\'#mvt_sign\').show();
}
</script>
<script src="'._PS_JS_DIR_.'tabpane.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="../css/tabpane.css" />
</script>';
$tabpane = Media::getJqueryPluginPath('tabpane');
$tabpane['css'] = key($tabpane['css']);
echo '<script src="'.$tabpane['js'].'" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="'.$tabpane['css'].'" />
<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post" enctype="multipart/form-data" name="product" id="product">
'.$this->_displayDraftWarning($obj->active).'
@@ -2169,125 +2213,7 @@ class AdminProducts extends AdminTab
$productDownload = new ProductDownload($id_product_download);
$hidden = $display_filename = $check = '';
?>
<script type="text/javascript">
// <![CDATA[
ThickboxI18nImage = '<?php echo $this->l('Image') ?>';
ThickboxI18nOf = '<?php echo $this->l('of') ?>';
ThickboxI18nClose = '<?php echo $this->l('Close') ?>';
ThickboxI18nOrEscKey = '<?php echo $this->l('(or "Esc")') ?>';
ThickboxI18nNext = '<?php echo $this->l('Next >') ?>';
ThickboxI18nPrev = '<?php echo $this->l('< Previous') ?>';
tb_pathToImage = '../img/loadingAnimation.gif';
//]]>
</script>
<script type="text/javascript" src="<?php echo _PS_JS_DIR_ ?>jquery/thickbox-modified.js"></script>
<script type="text/javascript" src="<?php echo _PS_JS_DIR_ ?>jquery/ajaxfileupload.js"></script>
<script type="text/javascript" src="<?php echo _PS_JS_DIR_ ?>date.js"></script>
<style type="text/css">
<!--
@import url(<?php echo _PS_CSS_DIR_?>thickbox.css);
-->
</style>
<script type="text/javascript">
//<![CDATA[
function toggleVirtualProduct(elt)
{
$("#is_virtual_file_product").hide();
$("#virtual_good_attributes").hide();
if (elt.checked)
{
$('#virtual_good').show('slow');
$('#virtual_good_more').show('slow');
getE('out_of_stock_1').checked = 'checked';
getE('out_of_stock_2').disabled = 'disabled';
getE('out_of_stock_3').disabled = 'disabled';
getE('label_out_of_stock_2').setAttribute('for', '');
getE('label_out_of_stock_3').setAttribute('for', '');
}
else
{
$('#virtual_good').hide('slow');
$('#virtual_good_more').hide('slow');
getE('out_of_stock_2').disabled = false;
getE('out_of_stock_3').disabled = false;
getE('label_out_of_stock_2').setAttribute('for', 'out_of_stock_2');
getE('label_out_of_stock_3').setAttribute('for', 'out_of_stock_3');
}
}
function uploadFile()
{
$.ajaxFileUpload (
{
url:'./uploadProductFile.php',
secureuri:false,
fileElementId:'virtual_product_file',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename")
if(result == "error")
$("#upload-confirmation").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product').show();
$('#virtual_product_name').attr('value', fileName);
$('#upload-confirmation').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'"><?php echo $this->l('The file') ?>&nbsp;"' + fileName + '"&nbsp;<?php echo $this->l('has successfully been uploaded') ?></a>' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
}
}
}
);
}
function uploadFile2()
{
var link = '';
$.ajaxFileUpload (
{
url:'./uploadProductFileAttribute.php',
secureuri:false,
fileElementId:'virtual_product_file_attribute',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename");
if(result == "error")
$("#upload-confirmation2").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file_attribute').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product_attribute').show();
$('#virtual_product_name_attribute').attr('value', fileName);
$('#upload-confirmation2').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'"><?php echo $this->l('The file') ?>&nbsp;"' + fileName + '"&nbsp;<?php echo $this->l('has successfully been uploaded') ?></a>' +
'<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="' + msg + '" />');
link = $("#delete_downloadable_product_attribute").attr('href');
$("#delete_downloadable_product_attribute").attr('href', link+"&file="+msg);
}
}
}
);
}
//]]>
</script>
<?php
$this->displayInitInformationAndAttachment();
if(!$productDownload->id OR !$productDownload->active)
$hidden = 'style="display:none;"';
@@ -2526,91 +2452,8 @@ class AdminProducts extends AdminTab
$productDownload = new ProductDownload();
if ($id_product_download = $productDownload->getIdFromIdProduct($this->getFieldValue($obj, 'id')))
$productDownload = new ProductDownload($id_product_download);
$this->displayInitInformationAndAttachment();
?>
<script type="text/javascript">
// <![CDATA[
ThickboxI18nImage = '<?php echo $this->l('Image') ?>';
ThickboxI18nOf = '<?php echo $this->l('of') ?>';
ThickboxI18nClose = '<?php echo $this->l('Close') ?>';
ThickboxI18nOrEscKey = '<?php echo $this->l('(or "Esc")') ?>';
ThickboxI18nNext = '<?php echo $this->l('Next >') ?>';
ThickboxI18nPrev = '<?php echo $this->l('< Previous') ?>';
tb_pathToImage = '../img/loadingAnimation.gif';
//]]>
</script>
<script type="text/javascript" src="<?php echo _PS_JS_DIR_ ?>jquery/thickbox-modified.js"></script>
<script type="text/javascript" src="<?php echo _PS_JS_DIR_ ?>jquery/ajaxfileupload.js"></script>
<script type="text/javascript" src="<?php echo _PS_JS_DIR_ ?>date.js"></script>
<style type="text/css">
<!--
@import url(<?php echo _PS_CSS_DIR_?>thickbox.css);
-->
</style>
<script type="text/javascript">
//<![CDATA[
function toggleVirtualProduct(elt)
{
if (elt.checked)
{
$('#virtual_good').show('slow');
$('#virtual_good_more').show('slow');
getE('out_of_stock_1').checked = 'checked';
getE('out_of_stock_2').disabled = 'disabled';
getE('out_of_stock_3').disabled = 'disabled';
getE('label_out_of_stock_2').setAttribute('for', '');
getE('label_out_of_stock_3').setAttribute('for', '');
}
else
{
$('#virtual_good').hide('slow');
$('#virtual_good_more').hide('slow');
getE('out_of_stock_2').disabled = false;
getE('out_of_stock_3').disabled = false;
getE('label_out_of_stock_2').setAttribute('for', 'out_of_stock_2');
getE('label_out_of_stock_3').setAttribute('for', 'out_of_stock_3');
}
}
function uploadFile()
{
$.ajaxFileUpload (
{
url:'./uploadProductFile.php',
secureuri:false,
fileElementId:'virtual_product_file',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename");
if (result == "error")
{
$("#upload-confirmation").html('<p>error: ' + msg + '</p>');
}
else
{
$('#virtual_product_file').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product').show();
$('#virtual_product_name').attr('value', fileName);
$('#upload-confirmation').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'"><?php echo $this->l('The file') ?>&nbsp;"' + fileName + '"&nbsp;<?php echo $this->l('has successfully been uploaded') ?></a>' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
}
}
}
);
}
//]]>
</script>
<?php
echo '
<script type="text/javascript" src="'._PS_JS_DIR_.'price.js"></script>
<script type="text/javascript">
@@ -3350,10 +3193,12 @@ class AdminProducts extends AdminTab
<script type="text/javascript">
var formProduct;
var accessories = new Array();
</script>
</script>';
<link rel="stylesheet" type="text/css" href="'.__PS_BASE_URI__.'css/jquery.autocomplete.css" />
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery.autocomplete.js"></script>
$autocomplete = Media::getJqueryPluginPath('autocomplete');
echo '<link rel="stylesheet" type="text/css" href="'.key($autocomplete['css']).'" />
<script type="text/javascript" src="'.$autocomplete['js'].'"></script>
<div id="ajax_choose_product" style="padding:6px; padding-top:2px; width:600px;">
<p class="clear">'.$this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:').'</p>
<input type="text" value="" id="product_autocomplete_input" />
@@ -4498,4 +4343,133 @@ class AdminProducts extends AdminTab
$this->displayErrors();
}
public function displayInitInformationAndAttachment()
{
?>
<script type="text/javascript">
// <![CDATA[
ThickboxI18nImage = '<?php echo $this->l('Image') ?>';
ThickboxI18nOf = '<?php echo $this->l('of') ?>';
ThickboxI18nClose = '<?php echo $this->l('Close') ?>';
ThickboxI18nOrEscKey = '<?php echo $this->l('(or "Esc")') ?>';
ThickboxI18nNext = '<?php echo $this->l('Next >') ?>';
ThickboxI18nPrev = '<?php echo $this->l('< Previous') ?>';
tb_pathToImage = '../img/loadingAnimation.gif';
//]]>
</script>
<?php
$tmp_jss = array();
$tmp_jss[] = Media::getJqueryPluginPath('thickbox');
$tmp_jss[] = Media::getJqueryPluginPath('ajaxfileupload');
$tmp_jss[] = Media::getJqueryPluginPath('date');
foreach($tmp_jss as $tmp_js)
{
echo '<script type="text/javascript" src="'. $tmp_js['js'].'"></script>';
if (empty ($tmp_js['css']))
continue;
$tmp_js['css'] = key($tmp_js['css']);
echo '<style type="text/css">';
echo '@import url('.$tmp_js['css'].')';
echo '</style>';
}
?>
<script type="text/javascript">
//<![CDATA[
function toggleVirtualProduct(elt)
{
$("#is_virtual_file_product").hide();
$("#virtual_good_attributes").hide();
if (elt.checked)
{
$('#virtual_good').show('slow');
$('#virtual_good_more').show('slow');
getE('out_of_stock_1').checked = 'checked';
getE('out_of_stock_2').disabled = 'disabled';
getE('out_of_stock_3').disabled = 'disabled';
getE('label_out_of_stock_2').setAttribute('for', '');
getE('label_out_of_stock_3').setAttribute('for', '');
}
else
{
$('#virtual_good').hide('slow');
$('#virtual_good_more').hide('slow');
getE('out_of_stock_2').disabled = false;
getE('out_of_stock_3').disabled = false;
getE('label_out_of_stock_2').setAttribute('for', 'out_of_stock_2');
getE('label_out_of_stock_3').setAttribute('for', 'out_of_stock_3');
}
}
function uploadFile()
{
$.ajaxFileUpload (
{
url:'./uploadProductFile.php',
secureuri:false,
fileElementId:'virtual_product_file',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename")
if(result == "error")
$("#upload-confirmation").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product').show();
$('#virtual_product_name').attr('value', fileName);
$('#upload-confirmation').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'"><?php echo $this->l('The file') ?>&nbsp;"' + fileName + '"&nbsp;<?php echo $this->l('has successfully been uploaded') ?></a>' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
}
}
}
);
}
function uploadFile2()
{
var link = '';
$.ajaxFileUpload (
{
url:'./uploadProductFileAttribute.php',
secureuri:false,
fileElementId:'virtual_product_file_attribute',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename");
if(result == "error")
$("#upload-confirmation2").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file_attribute').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product_attribute').show();
$('#virtual_product_name_attribute').attr('value', fileName);
$('#upload-confirmation2').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'"><?php echo $this->l('The file') ?>&nbsp;"' + fileName + '"&nbsp;<?php echo $this->l('has successfully been uploaded') ?></a>' +
'<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="' + msg + '" />');
link = $("#delete_downloadable_product_attribute").attr('href');
$("#delete_downloadable_product_attribute").attr('href', link+"&file="+msg);
}
}
}
);
}
//]]>
</script>
<?php
}
}
+4 -4
View File
@@ -187,8 +187,8 @@ abstract class AdminTabCore
public $ignore_sleep = false;
public static $tabParenting = array(
'AdminProducts' => 'AdminCatalog',
'AdminCategories' => 'AdminCatalog',
// 'AdminProducts' => 'AdminCatalog',
// 'AdminCategories' => 'AdminCatalog',
'AdminCMS' => 'AdminCMSContent',
'AdminCMSCategories' => 'AdminCMSContent',
'AdminOrdersStates' => 'AdminStatuses',
@@ -222,8 +222,8 @@ abstract class AdminTabCore
if (!$this->identifier) $this->identifier = 'id_'.$this->table;
if (!$this->_defaultOrderBy) $this->_defaultOrderBy = $this->identifier;
$className = get_class($this);
if ($className == 'AdminCategories' OR $className == 'AdminProducts')
$className = 'AdminCatalog';
// if ($className == 'AdminCategories' OR $className == 'AdminProducts')
// $className = 'AdminCatalog';
$this->token = Tools::getAdminToken($className.(int)$this->id.(int)$this->context->employee->id);
if (!Shop::isMultiShopActivated())
+13
View File
@@ -652,6 +652,19 @@ class CategoryCore extends ObjectModel
ORDER BY `position` ASC');
}
/** return an array of all children of the current category
*
* @return array rows of table category
* @todo return hydrateCollection
*/
public function getAllChildren()
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'category`
WHERE '. $this->nleft . ' < nleft AND nright < '. $this->nright);
}
/**
* This method allow to return children categories with the number of sub children selected for a product
*
+1 -1
View File
@@ -752,7 +752,7 @@ if ($lm->getIncludeTradFilename())
$('#benefitsBlock').show();
$.ajax({
type: "GET",
url: "./php?controller=country_to_timezone.php?country="+$("select#infosCountry option:selected").attr('rel'),
url: "./php/country_to_timezone.php?country="+$("select#infosCountry option:selected").attr('rel'),
success: function(timezone){
$("select#infosTimezone").val(timezone);
}
+22 -9
View File
@@ -835,8 +835,8 @@ INSERT INTO `PREFIX_profile_lang` (`id_profile`, `id_lang`, `name`) VALUES (1, 1
INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUES (1, 'AdminCatalog', 0, 1),(2, 'AdminCustomers', 0, 2),(3, 'AdminOrders', 0, 3),
(4, 'AdminPayment', 0, 4),(5, 'AdminShipping', 0, 5),(6, 'AdminStats', 0, 6),(7, 'AdminModules', 0, 7),(29, 'AdminEmployees', 0, 8),(8, 'AdminPreferences', 0, 9),
(9, 'AdminTools', 0, 10),(82, 'AdminStores', 9, 11),(60, 'AdminTracking', 1, 1),(10, 'AdminManufacturers', 1, 2),(34, 'AdminSuppliers', 1, 3),(11, 'AdminAttributesGroups', 1, 4),
(36, 'AdminFeatures', 1, 5),(58, 'AdminScenes', 1, 6),(66, 'AdminTags', 1, 7),(68, 'AdminAttachments', 1, 7),(12, 'AdminAddresses', 2, 1),(63, 'AdminGroups', 2, 2),
(9, 'AdminTools', 0, 10),(82, 'AdminStores', 9, 11),(60, 'AdminTracking', 1, 3),(10, 'AdminManufacturers', 1, 4),(34, 'AdminSuppliers', 1, 5),(11, 'AdminAttributesGroups', 1, 6),
(36, 'AdminFeatures', 1, 7),(58, 'AdminScenes', 1, 8),(66, 'AdminTags', 1, 9),(68, 'AdminAttachments', 1, 10),(12, 'AdminAddresses', 2, 1),(63, 'AdminGroups', 2, 2),
(65, 'AdminCarts', 2, 3),(42, 'AdminInvoices', 3, 1),(55, 'AdminDeliverySlip', 3, 2),(47, 'AdminReturn', 3, 3),(49, 'AdminSlip', 3, 4),(59, 'AdminMessages', 3, 5),
(13, 'AdminStatuses', 3, 6),(54, 'AdminOrderMessage', 3, 7),(14, 'AdminDiscounts', 4, 4),(15, 'AdminCurrencies', 4, 1),(16, 'AdminTaxes', 4, 2),
(17, 'AdminCarriers', 5, 1),(46, 'AdminStates', 5, 2),(18, 'AdminCountries', 5, 3),(19, 'AdminZones', 5, 5),(20, 'AdminRangePrice', 5, 6),
@@ -846,10 +846,12 @@ INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUE
(48, 'AdminPDF', 3, 8),(44, 'AdminLocalization', 8, 9),(67, 'AdminSearchConf', 8, 10),(32, 'AdminLanguages', 9, 1),(33, 'AdminTranslations', 9, 2),
(35, 'AdminTabs', 29, 3),(37, 'AdminQuickAccesses', 9, 4),(40, 'AdminAliases', 8, 5),(41, 'AdminImport', 9, 6),(52, 'AdminSubDomains', 9, 7),
(53, 'AdminBackup', 9, 8),(57, 'AdminCMSContent', 9, 9),(64, 'AdminGenerator', 9, 10),(43, 'AdminSearch', -1, 0),(69, 'AdminInformation', 9, 5),
(70, 'AdminPerformance', 8, 11),(71, 'AdminCustomerThreads', 29, 4),(72, 'AdminWebservice', 9, 12),(73, 'AdminStockMvt', 1, 9),
(70, 'AdminPerformance', 8, 11),(71, 'AdminCustomerThreads', 29, 4),(72, 'AdminWebservice', 9, 12),(73, 'AdminStockMvt', 1, 11),
(80, 'AdminAddonsCatalog', 7, 1),(81, 'AdminAddonsMyAccount', 7, 2),(83, 'AdminThemes', 7, 3),(84, 'AdminGeolocation', 8, 12),
(85, 'AdminTaxRulesGroup', 4, 3),(86, 'AdminLogs', 9, 13), (87,'AdminHome',-1,0),
(88,'AdminShop', 0, 11), (89,'AdminGroupShop', 88, 1),(90, 'AdminShopUrl', 88, 2),(91, 'AdminGenders', 2, 4),(92, 'AdminRequestSql', 9, 14);
(88,'AdminShop', 0, 11), (89,'AdminGroupShop', 88, 1),(90, 'AdminShopUrl', 88, 2),(91, 'AdminGenders', 2, 4),(92, 'AdminRequestSql', 9, 14),
(93, 'AdminProducts', 1, 1),
(94, 'AdminCategories', 1, 2);
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM PREFIX_tab);
@@ -866,7 +868,9 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(1, 61, 'Search Engines'),(1, 62, 'Referrers'),(1, 63, 'Groups'),(1, 64, 'Generators'),(1, 65, 'Shopping Carts'),(1, 66, 'Tags'),(1, 67, 'Search'),
(1, 68, 'Attachments'),(1, 69, 'Configuration Information'),(1, 70, 'Performance'),(1, 71, 'Customer Service'),(1, 72, 'Webservice'),(1, 73, 'Stock Movements'),
(1, 80, 'Modules & Themes Catalog'),(1, 81, 'My Account'),(1, 82, 'Stores'),(1, 83, 'Themes'),(1, 84, 'Geolocation'),(1, 85, 'Tax Rules'),(1, 86, 'Log'),
(1, 87, 'Home'), (1, 88, 'Shops'), (1, 89, 'Group Shops'), (1, 90, 'Shop Urls'),(1, 91, 'Genders'),(1, 92, 'SQL Manager');
(1, 87, 'Home'), (1, 88, 'Shops'), (1, 89, 'Group Shops'), (1, 90, 'Shop Urls'),(1, 91, 'Genders'),(1, 92, 'SQL Manager'),
(1, 93, 'Products'),
(1, 94, 'Categories');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 1, 'Catalogue'),(2, 2, 'Clients'),(2, 3, 'Commandes'),(2, 4, 'Paiement'),(2, 5, 'Transport'),
@@ -881,7 +885,9 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 62, 'Sites affluents'),(2, 63, 'Groupes'),(2, 64, 'Générateurs'),(2, 65, 'Paniers'),(2, 66, 'Tags'),(2, 67, 'Recherche'),
(2, 68, 'Documents joints'),(2, 69, 'Informations'),(2, 70, 'Performances'),(2, 71, 'SAV'),(2, 72, 'Service web'),(2, 73, 'Mouvements de Stock'),
(2, 80, 'Catalogue de modules et thèmes'),(2, 81, 'Mon compte'),(2, 82, 'Magasins'),(2, 83, 'Thèmes'),(2, 84, 'Géolocalisation'),(2, 85, 'Règles de taxes'),(2, 86, 'Log'),
(2, 87,'Accueil'), (2, 88, 'Boutiques'), (2, 89, 'Groupes de boutique'), (2, 90, 'URLs de boutique'),(2, 91, 'Genres'),(2, 92, 'SQL Manager');
(2, 87,'Accueil'), (2, 88, 'Boutiques'), (2, 89, 'Groupes de boutique'), (2, 90, 'URLs de boutique'),(2, 91, 'Genres'),(2, 92, 'SQL Manager'),
(2, 93, 'Produits'),
(2, 94, 'Catégories');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 1, 'Catálogo'),(3, 2, 'Clientes'),(3, 3, 'Pedidos'),(3, 4, 'Pago'),(3, 5, 'Transporte'),
@@ -895,7 +901,9 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 55, 'Albaranes de entrega'),(3, 56, 'SEO & URLs'),(3, 57, 'CMS'),(3, 58, 'Mapeo de la imagen'),(3, 59, 'Mensajes del cliente'),(3, 60, 'Rastreo'),
(3, 61, 'Motores de búsqueda'),(3, 62, 'Referido'),(3, 63, 'Grupos'),(3, 64, 'Generadores'),(3, 65, 'Carritos'),(3, 66, 'Etiquetas'),(3, 67, 'Búsqueda'),(3, 68, 'Adjuntos'),
(3, 69, 'Informaciones'),(3, 70, 'Rendimiento'),(3, 72, 'Web service'),(3, 71, 'Servicio al cliente'),(3, 73, 'Movimiento de Stock'), (3, 82, 'Tiendas'),(3, 83, 'Temas'),(3, 84, 'Geolocalización'),(3, 85, 'Reglas de Impuestos'),(3, 86, 'Log'),
(3, 87,'Home'), (3, 88, 'Shops'), (3, 89, 'Group Shops'), (3, 90, 'Shop Urls'),(3, 91, 'Genders'),(3, 92, 'SQL Manager');
(3, 87,'Home'), (3, 88, 'Shops'), (3, 89, 'Group Shops'), (3, 90, 'Shop Urls'),(3, 91, 'Genders'),(3, 92, 'SQL Manager'),
(3, 93, 'Products'),
(3, 94, 'Categories');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'),
@@ -910,7 +918,9 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 61, 'Suchmaschinen'),(4, 62, 'Referrer'),(4, 63, 'Gruppen'),(4, 64, 'Generatoren'),(4, 65, 'Warenkörbe'),(4, 66, 'Tags'),(4, 67, 'Suche'),
(4, 68, 'Anhänge'),(4, 69, 'Konfigurationsinformationen'),(4, 70, 'Leistung'),(4, 71, 'Kundenservice'),(4, 72, 'Webservice'),(4, 73, 'Lagerbewegungen'),
(4, 80, 'Module und Themenkatalog'),(4, 81, 'Mein Konto'),(4, 82, 'Shops'),(4, 83, 'Themen'),(4, 84, 'Geotargeting'),(4, 85, 'Steuerregeln'),(4, 86, 'Log'),
(4, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls'),(4, 91, 'Genders'),(4, 92, 'SQL Manager');
(4, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls'),(4, 91, 'Genders'),(4, 92, 'SQL Manager'),
(4, 93, 'Products'),
(4, 94, 'Categories');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 1, 'Catalogo'),(5, 2, 'Clienti'),(5, 3, 'Ordini'),(5, 4, 'Pagamento'),
@@ -925,7 +935,10 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 61, 'Motori di ricerca'),(5, 62, 'Referenti'),(5, 63, 'Gruppi'),(5, 64, 'Generatori'),(5, 65, 'Carrelli shopping'),(5, 66, 'Tag'),(5, 67, 'Cerca'),
(5, 68, 'Allegati'),(5, 69, 'Informazioni di configurazione'),(5, 70, 'Performance'),(5, 71, 'Servizio clienti'),(5, 72, 'Webservice'),(5, 73, 'Movimenti magazzino'),
(5, 80, 'Moduli & Temi catalogo'),(5, 81, 'Il mio Account'),(5, 82, 'Negozi'),(5, 83, 'Temi'),(5, 84, 'Geolocalizzazione'),(5, 85, 'Regimi fiscali'),(5, 86, 'Log'),
(5, 87,'Home'), (5, 88, 'Shops'), (5, 89, 'Group Shops'), (5, 90, 'Shop Urls'),(5, 91, 'Genders'),(5, 92, 'SQL Manager');
(5, 87,'Home'), (5, 88, 'Shops'), (5, 89, 'Group Shops'), (5, 90, 'Shop Urls'),(5, 91, 'Genders'),(5, 92, 'SQL Manager'),
(5, 93, 'Products'),
(5, 94, 'Categories');
INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`)
(SELECT `id_tab`, id_lang, (SELECT tl.`name`
+5 -1
View File
@@ -175,4 +175,8 @@ CREATE TABLE IF NOT EXISTS `PREFIX_request_sql` (
ALTER TABLE `PREFIX_carrier` ADD COLUMN `id_reference` int(10) NOT NULL AFTER `id_carrier`;
UPDATE `PREFIX_carrier` SET id_reference = id_carrier;
ALTER TABLE `PREFIX_product` ADD `is_virtual` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `cache_has_attachments`
ALTER TABLE `PREFIX_product` ADD `is_virtual` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `cache_has_attachments`
/* PHP:add_new_tab(AdminProducts, fr:Products|es:Products|en:Products|de:Products|it:Products, 1); */;
/* PHP:add_new_tab(AdminCategories, fr:Categories|es:Categories|en:Categories|de:Categories|it:Categories, 1); */;