[*] BO : #PSFV-94 - added AdminSuppliersController
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9806 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -1,226 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7300 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminSuppliers extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'supplier';
|
||||
$this->className = 'Supplier';
|
||||
$this->view = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->_select = 'COUNT(p.`id_product`) AS products';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product` p ON (a.`id_supplier` = p.`id_supplier`)';
|
||||
|
||||
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 'su');
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_supplier' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 120),
|
||||
'logo' => array('title' => $this->l('Logo'), 'align' => 'center', 'image' => 'su', 'orderby' => false, 'search' => false),
|
||||
'products' => array('title' => $this->l('Number of products'), 'align' => 'right', 'filter_type' => 'int', 'tmpTableFilter' => true),
|
||||
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function viewsupplier()
|
||||
{
|
||||
if (!($supplier = $this->loadObject()))
|
||||
return;
|
||||
echo '<h2>'.$supplier->name.'</h2>';
|
||||
|
||||
$products = $supplier->getProductsLite($this->context->language->id);
|
||||
echo '<h3>'.$this->l('Total products:').' '.sizeof($products).'</h3>';
|
||||
foreach ($products AS $product)
|
||||
{
|
||||
$product = new Product($product['id_product'], false, $this->context->language->id);
|
||||
echo '<hr />';
|
||||
if (!$product->hasAttributes())
|
||||
{
|
||||
echo '
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table width3">
|
||||
<tr>
|
||||
<th><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'" target="_blank">'.$product->name.'</a></th>
|
||||
'.(!empty($product->reference) ? '<th width="150">'.$this->l('Ref:').' '.$product->reference.'</th>' : '').'
|
||||
'.(!empty($product->ean13) ? '<th width="120">'.$this->l('EAN13:').' '.$product->ean13.'</th>' : '').'
|
||||
'.(!empty($product->upc) ? '<th width="120">'.$this->l('UPC:').' '.$product->upc.'</th>' : '').'
|
||||
'.(Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="50">'.$this->l('Qty:').' '.$product->quantity.'</th>' : '').'
|
||||
</tr>
|
||||
</table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '
|
||||
<h3><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'" target="_blank">'.$product->name.'</a></h3>
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
|
||||
<tr>
|
||||
<th>'.$this->l('Attribute name').'</th>
|
||||
<th width="80">'.$this->l('Reference').'</th>
|
||||
<th width="80">'.$this->l('EAN13').'</th>
|
||||
<th width="80">'.$this->l('UPC').'</th>
|
||||
'.(Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="40">'.$this->l('Quantity').'</th>' : '').'
|
||||
</tr>';
|
||||
/* Build attributes combinaisons */
|
||||
$combinaisons = $product->getAttributeCombinaisons($this->context->language->id);
|
||||
foreach ($combinaisons AS $k => $combinaison)
|
||||
{
|
||||
$combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
|
||||
$combArray[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
|
||||
$combArray[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc'];
|
||||
$combArray[$combinaison['id_product_attribute']]['quantity'] = $combinaison['quantity'];
|
||||
$combArray[$combinaison['id_product_attribute']]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
|
||||
}
|
||||
$irow = 0;
|
||||
foreach ($combArray AS $id_product_attribute => $product_attribute)
|
||||
{
|
||||
$list = '';
|
||||
foreach ($product_attribute['attributes'] AS $attribute)
|
||||
$list .= $attribute[0].' - '.$attribute[1].', ';
|
||||
$list = rtrim($list, ', ');
|
||||
echo '
|
||||
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').' >
|
||||
<td>'.stripslashes($list).'</td>
|
||||
<td>'.$product_attribute['reference'].'</td>
|
||||
'.(Configuration::get('PS_STOCK_MANAGEMENT') ? '<td>'.$product_attribute['ean13'].'</td><td>'.$product_attribute['upc'].'</td>' : '').'
|
||||
<td class="right">'.$product_attribute['quantity'].'</td>
|
||||
</tr>';
|
||||
}
|
||||
unset($combArray);
|
||||
echo '</table>';
|
||||
echo '</td></tr></table>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
parent::displayForm();
|
||||
|
||||
if (!($supplier = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$langtags = 'description¤smeta_title¤smeta_keywords¤smeta_description';
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
||||
'.($supplier->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$supplier->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/suppliers.gif" />'.$this->l('Suppliers').'</legend>
|
||||
<label>'.$this->l('Name:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="40" name="name" value="'.htmlentities(Tools::getValue('name', $supplier->name), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>
|
||||
<label>'.$this->l('Description:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="description_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($supplier, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
<p class="clear">'.$this->l('Will appear in supplier list').'</p>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'description');
|
||||
echo ' <div class="clear"></div>
|
||||
</div>
|
||||
<label>'.$this->l('Logo:').' </label>
|
||||
<div class="margin-form">';
|
||||
echo $this->displayImage($supplier->id, _PS_SUPP_IMG_DIR_.$supplier->id.'.jpg', 350, NULL, NULL, true);
|
||||
echo ' <br /><input type="file" name="logo" />
|
||||
<p>'.$this->l('Upload supplier logo from your computer').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Meta title:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="smeta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_title_'.$language['id_lang'].'" id="meta_title_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($supplier, 'meta_title', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'smeta_title');
|
||||
echo ' <div class="clear"></div>
|
||||
</div>
|
||||
<label>'.$this->l('Meta description:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '<div id="smeta_description_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_description_'.$language['id_lang'].'" id="meta_description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($supplier, 'meta_description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'smeta_description');
|
||||
echo ' <div class="clear"></div>
|
||||
</div>
|
||||
<label>'.$this->l('Meta keywords:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="smeta_keywords_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_keywords_'.$language['id_lang'].'" id="meta_keywords_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($supplier, 'meta_keywords', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'smeta_keywords');
|
||||
echo ' <div class="clear"></div>
|
||||
</div>
|
||||
<label>'.$this->l('Enable:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($this->getFieldValue($supplier, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$this->getFieldValue($supplier, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
</div>';
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoShop('group_shop');
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
public function afterImageUpload()
|
||||
{
|
||||
/* Generate image with differents size */
|
||||
if (($id_supplier = (int)(Tools::getValue('id_supplier'))) AND isset($_FILES) AND count($_FILES) AND file_exists(_PS_SUPP_IMG_DIR_.$id_supplier.'.jpg'))
|
||||
{
|
||||
$imagesTypes = ImageType::getImagesTypes('suppliers');
|
||||
foreach ($imagesTypes AS $k => $imageType)
|
||||
{
|
||||
$file = _PS_SUPP_IMG_DIR_.$id_supplier.'.jpg';
|
||||
imageResize($file, _PS_SUPP_IMG_DIR_.$id_supplier.'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height']));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,15 +27,6 @@
|
||||
{extends file="../helper/form/form.tpl"}
|
||||
|
||||
{block name="label"}
|
||||
{* {if $input.type == 'text_customer'}
|
||||
{if isset($customer)}
|
||||
<label>{$input.label}</label>
|
||||
{else}
|
||||
<label>{l s='Customer e-mail'}</label>
|
||||
{/if}
|
||||
{else if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
{/if} *}
|
||||
{/block}
|
||||
|
||||
{block name="start_field_block"}
|
||||
|
||||
@@ -71,20 +71,11 @@
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/form.js"></script>
|
||||
{/if}
|
||||
<div class="toolbarBox">
|
||||
<ul class="cc_button">
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
<li>
|
||||
<a class="toolbar_btn" href="{$btn.href}" title="{$btn.desc}">
|
||||
<span class="process-icon-{$btn.imgclass|default:$k} {$btn.class|default:'' }" ></span>{$btn.desc}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="pageTitle">{* todo : what to display as title for each items (table_lang.name ? *}
|
||||
<h3><span id="current_obj" style="font-weight: normal;">{$current_obj_name|default:' '}</span></h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if isset($toolbar) && $toolbar}
|
||||
{include file="toolbar.tpl"}
|
||||
{/if}
|
||||
|
||||
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
|
||||
<form class="defaultForm" action="{$current}&{$submit_action}=1&token={$token}" method="post" enctype="multipart/form-data">
|
||||
{if $form_id}
|
||||
|
||||
@@ -62,20 +62,11 @@
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/form.js"></script>
|
||||
{/if}
|
||||
<div class="toolbarBox">
|
||||
<ul class="cc_button">
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
<li>
|
||||
<a class="toolbar_btn" href="{$btn.href}" title="{$btn.desc}">
|
||||
<span class="process-icon-{$btn.imgclass|default:$k} {$btn.class|default:''}" ></span>{$btn.desc}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="pageTitle">{* todo : what to display as title for each items (table_lang.name ? *}
|
||||
<h3><span id="current_obj" style="font-weight: normal;">{$current_obj_name|default:' '}</span></h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if isset($toolbar) && $toolbar}
|
||||
{include file="toolbar.tpl"}
|
||||
{/if}
|
||||
|
||||
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
|
||||
<form class="defaultForm" action="{$current}&{$submit_action}=1&token={$token}" method="post" enctype="multipart/form-data">
|
||||
{if $form_id}
|
||||
|
||||
@@ -55,23 +55,12 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{if isset($toolbar) && $toolbar}
|
||||
{include file="toolbar.tpl"}
|
||||
{/if}
|
||||
|
||||
<div class="toolbarBox">
|
||||
<ul class="cc_button">
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
<li>
|
||||
<a class="toolbar_btn" href="{$btn.href}" title="{$btn.desc}">
|
||||
<span class="process-icon-{$btn.imgclass|default:$k} {$btn.class|default:''}" ></span>{$btn.desc}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="pageTitle">{* todo : what to display as title for each items (table_lang.name ? *}
|
||||
<h3><span id="current_obj" style="font-weight: normal;">{$current_obj_name|default:' '}</span></h3>
|
||||
</div>
|
||||
</div>
|
||||
<a name="{$table}"> </a>
|
||||
|
||||
{/if}{* End if simple_header *}
|
||||
<form method="post" action="{$action}" class="form">
|
||||
<input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if isset($list_manufacturers)}
|
||||
{include file="toolbar.tpl"}
|
||||
<h2>{l s='List of manufacturers:'}</h2>
|
||||
{$list_manufacturers}
|
||||
{/if}
|
||||
|
||||
{if isset($list_addresses)}
|
||||
{include file="toolbar.tpl"}
|
||||
<h2>{l s='Manufacturers addresses:'}</h2>
|
||||
{$list_addresses}
|
||||
{/if}
|
||||
|
||||
{$content}
|
||||
@@ -1,202 +0,0 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 9639 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if !$simple_header}
|
||||
<link href="../css/admin.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('table.{$table} .filter').keypress(function(event){
|
||||
formSubmit(event, 'submitFilterButton{$table}')
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{* Display column names and arrows for ordering (ASC, DESC) *}
|
||||
{if $is_order_position}
|
||||
<script type="text/javascript" src="../js/jquery/jquery.tablednd_0_5.js"></script>
|
||||
<script type="text/javascript">
|
||||
var token = '{$token}';
|
||||
var come_from = '{$table}';
|
||||
var alternate = {if $order_way == 'DESC'}'1'{else}'0'{/if};
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/admin-dnd.js"></script>
|
||||
{/if}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
if ($("table.{$table} .datepicker").length > 0)
|
||||
$("table.{$table} .datepicker").datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="toolbarBox">
|
||||
<ul class="cc_button">
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
<li>
|
||||
<a class="toolbar_btn" href="{$btn.href}" title="{$btn.desc}">
|
||||
<span class="process-icon-{$btn.imgclass|default:$k} {$btn.class|default:''}" ></span>{$btn.desc}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="pageTitle">{* todo : what to display as title for each items (table_lang.name ? *}
|
||||
<h3><span id="current_obj" style="font-weight: normal;">{$current_obj_name|default:' '}</span></h3>
|
||||
</div>
|
||||
</div>
|
||||
<a name="{$table}"> </a>
|
||||
<h2>{$title_list}</h2>
|
||||
|
||||
|
||||
<form method="post" action="{$action}" class="form">
|
||||
{/if}{* End if simple_header *}
|
||||
<input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
|
||||
<table class="table_grid">
|
||||
{if !$simple_header}
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;">
|
||||
<span style="float: left;">
|
||||
{if $page > 1}
|
||||
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$table}').value=1"/>
|
||||
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$table}').value={$page - 1}"/>
|
||||
{/if}
|
||||
{l s='Page '}<b>{$page}</b> / {$total_pages}
|
||||
{if $page < $total_pages}
|
||||
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$table}').value={$page + 1}"/>
|
||||
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$table}'').value={$total_pages}"/>
|
||||
{/if}
|
||||
| {l s='Display'}
|
||||
<select name="pagination">
|
||||
{* Choose number of results per page *}
|
||||
{foreach $pagination AS $value}
|
||||
<option value="{$value|intval}"{if $selected_pagination == $value} selected="selected" {elseif $selected_pagination == NULL && $value == $pagination[1]} selected="selected2"{/if}>{$value|intval}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
/ {$list_total} {l s='result(s)'}
|
||||
</span>
|
||||
<span style="float: right;">
|
||||
<input type="submit" name="submitReset{$table}" value="{l s='Reset'}" class="button" />
|
||||
<input type="submit" id="submitFilterButton{$table}" name="submitFilter" value="{l s='Filter'}" class="button" />
|
||||
</span>
|
||||
<span class="clear"></span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td{if $simple_header} style="border:none;"{/if}>
|
||||
<table
|
||||
{if $table_id} id={$table_id}{/if}
|
||||
class="table {if $table_dnd}tableDnd{/if} {$table}"
|
||||
cellpadding="0" cellspacing="0"
|
||||
style="width: 100%; margin-bottom:10px;"
|
||||
>
|
||||
<thead>
|
||||
<tr class="nodrag nodrop">
|
||||
<th style="width:10px;">
|
||||
{if $delete}
|
||||
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$table}Box[]', this.checked)" />
|
||||
{/if}
|
||||
</th>
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<th {if isset($params.widthColumn)} style="width: {if $params.widthColumn == 'auto'}auto{else}{$params.widthColumn}px{/if}"{/if}>{$params.title}
|
||||
{if (!isset($params.orderby) || $params.orderby) && !$simple_header}
|
||||
<br />
|
||||
<a href="{$currentIndex}&{$identifier}={$id_cat}&{$table}Orderby={$key|urlencode}&{$table}Orderway=desc&token={$token}">
|
||||
<img border="0" src="../img/admin/down{if isset($order_by) && ($key == $order_by) && ($order_way == 'DESC')}_d{/if}.gif" />
|
||||
</a>
|
||||
<a href="{$currentIndex}&{$identifier}={$id_cat}&{$table}Orderby={$key|urlencode}&{$table}Orderway=asc&token={$token}">
|
||||
<img border="0" src="../img/admin/up{if isset($order_by) && ($key == $order_by) && ($order_way == 'ASC')}_d{/if}.gif" />
|
||||
</a>
|
||||
{/if}
|
||||
</th>
|
||||
{/foreach}
|
||||
|
||||
{if $shop_link_type}
|
||||
<th style="width: 80px">
|
||||
{if $shop_link_type == 'shop'}
|
||||
{l s='shop'}
|
||||
{else}
|
||||
{l s='Group shop'}
|
||||
{/if}
|
||||
</th>
|
||||
{/if}
|
||||
{if $has_actions}
|
||||
<th style="width: 52px">{l s='Actions'}</th>
|
||||
{/if}
|
||||
</tr>
|
||||
{if !$simple_header}
|
||||
<tr class="nodrag nodrop" style="height: 35px;">
|
||||
<td class="center">
|
||||
{if $delete}
|
||||
--
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
{* Filters (input, select, date or bool) *}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<td {if isset($params.align)} class="{$params.align}" {/if}>
|
||||
{if isset($params.search) && !$params.search}
|
||||
--
|
||||
{else}
|
||||
{if $params.type == 'bool'}
|
||||
<select onchange="$('#submitFilterButton{$table}').focus();$('#submitFilterButton{$table}').click();" name="{$table}Filter_{$key}">
|
||||
<option value="">--</option>
|
||||
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
|
||||
</select>
|
||||
{elseif $params.type == 'date' || $params.type == 'datetime'}
|
||||
{l s='From'} <input type="text" class="filter datepicker" id="{$name_id}_0" name="{$name}[0]" value="{if isset($value.0)}$value.0{/if}"{if isset($params.width)} style="width:{$params.width}px"{/if}/><br />
|
||||
{l s='To'} <input type="text" class="filter datepicker" id="{$name_id}_1" name="{$name}[1]" value="{if isset($value.1)}$value.1{/if}"{if isset($params.width)} style="width:{$params.width}px"{/if}/>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.filter_key)}
|
||||
<select onchange="$('#submitFilterButton{$table}').focus();$('#submitFilterButton{$table}').click();" name="{$table}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
<option value="" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>--</option>
|
||||
{if isset($params.select) && is_array($params.select)}
|
||||
{foreach $params.select AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if $option_display.selected == 'selected'} selected="selected"{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/if}
|
||||
{else}
|
||||
<input type="text" class="filter" name="{$table}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'htmlall':'UTF-8'}" {if isset($params.width)} style="width:{$params.width}px"{/if} />
|
||||
{/if}
|
||||
{/if}
|
||||
</td>
|
||||
{/foreach}
|
||||
|
||||
{if $shop_link_type}
|
||||
<td>--</td>
|
||||
{/if}
|
||||
{if $has_actions}
|
||||
<td class="center">--</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
</thead>
|
||||
@@ -72,6 +72,7 @@
|
||||
{if !empty($product->reference)}<th width="150">{l s='Ref:'} {$product->reference}</th>{/if}
|
||||
{if !empty($product->ean13)}<th width="120">{l s='EAN13:'} {$product->ean13}</th>{/if}
|
||||
{if !empty($product->upc)}<th width="120">{l s='UPC:'} {$product->upc}</th>{/if}
|
||||
{if $stock_management}<th class="right" width="50">{l s='Qty:'} {$product->quantity}</th>{/if}
|
||||
</tr>
|
||||
</table>
|
||||
{else}
|
||||
@@ -86,6 +87,7 @@
|
||||
<th width="80">{l s='Reference'}</th>
|
||||
<th width="80">{l s='EAN13'}</th>
|
||||
<th width="80">{l s='UPC'}</th>
|
||||
{if $stock_management}<th class="right" width="40">{l s='Quantity'}</th>{/if}
|
||||
</tr>
|
||||
{foreach $product->combinaison AS $id_product_attribute => $product_attribute}
|
||||
<tr {if $id_product_attribute %2}class="alt_row"{/if} >
|
||||
@@ -93,6 +95,7 @@
|
||||
<td>{$product_attribute.reference}</td>
|
||||
<td>{$product_attribute.ean13}</td>
|
||||
<td>{$product_attribute.upc}</td>
|
||||
{if $stock_management}<td class="right">{$product_attribute.quantity}</td>{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<h2>{$supplier->name}</h2>
|
||||
|
||||
<h3>{l s='Total products:'} {count($products)}</h3>
|
||||
{foreach $products AS $product}
|
||||
<hr />
|
||||
{if !$product->hasAttributes()}
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:990px;">
|
||||
<tr>
|
||||
<th>{$product->name}</th>
|
||||
{if !empty($product->reference)}<th width="150">{l s='Ref:'} {$product->reference}</th>{/if}
|
||||
{if !empty($product->ean13)}<th width="120">{l s='EAN13:'} {$product->ean13}</th>{/if}
|
||||
{if !empty($product->upc)}<th width="120">{l s='UPC:'} {$product->upc}</th>{/if}
|
||||
{if $stock_management}<th class="right" width="50">{l s='Qty:'} {$product->quantity}</th>{/if}
|
||||
</tr>
|
||||
</table>
|
||||
{else}
|
||||
<h3><a href="?tab=AdminProducts&id_product={$product->id}&updateproduct&token={getAdminToken tab='AdminProducts'}">{$product->name}</a></h3>
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:990px;">
|
||||
<tr>
|
||||
<th>{l s='Attribute name'}</th>
|
||||
<th width="80">{l s='Reference'}</th>
|
||||
<th width="80">{l s='EAN13'}</th>
|
||||
<th width="80">{l s='UPC'}</th>
|
||||
{if $stock_management}<th class="right" width="40">{l s='Quantity'}</th>{/if}
|
||||
</tr>
|
||||
{foreach $product->combinaison AS $id_product_attribute => $product_attribute}
|
||||
<tr {if $id_product_attribute %2}class="alt_row"{/if} >
|
||||
<td>{$product_attribute.attributes}</td>
|
||||
<td>{$product_attribute.reference}</td>
|
||||
<td>{$product_attribute.ean13}</td>
|
||||
<td>{$product_attribute.upc}</td>
|
||||
{if $stock_management}<td class="right">{$product_attribute.quantity}</td>{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
||||
{/foreach}
|
||||
<br /><br />
|
||||
<a href="{$current}&token={$token}"><img src="../img/admin/arrow2.gif" /> {l s='Back to manufacturer list'}</a><br />
|
||||
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div class="toolbarBox">
|
||||
<ul class="cc_button">
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
<li>
|
||||
<a class="toolbar_btn" href="{$btn.href}" title="{$btn.desc}">
|
||||
<span class="process-icon-{$btn.imgclass|default:$k} {$btn.class|default:'' }" ></span>{$btn.desc}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="pageTitle">{* todo : what to display as title for each items (table_lang.name ? *}
|
||||
<h3><span id="current_obj" style="font-weight: normal;">{$current_obj_name|default:' '}</span></h3>
|
||||
</div>
|
||||
</div>
|
||||
@@ -962,8 +962,8 @@ class AdminControllerCore extends Controller
|
||||
|
||||
if (trim($tab['module']) != '')
|
||||
$img = _MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.png';
|
||||
|
||||
// retrocompatibility
|
||||
|
||||
// retrocompatibility
|
||||
if(!file_exists($img))
|
||||
$img = str_replace('png', 'gif', $img);
|
||||
|
||||
@@ -1091,7 +1091,13 @@ class AdminControllerCore extends Controller
|
||||
return;
|
||||
$this->content .= $this->initForm();
|
||||
}
|
||||
elseif ($this->display != 'view' && !$this->ajax)
|
||||
elseif ($this->display == 'view')
|
||||
{
|
||||
if (!($this->object = $this->loadObject(true)))
|
||||
return;
|
||||
$this->content .= $this->initView();
|
||||
}
|
||||
elseif (!$this->ajax)
|
||||
{
|
||||
$this->content .= $this->initList();
|
||||
$this->content .= $this->initOptions();
|
||||
@@ -1169,10 +1175,17 @@ class AdminControllerCore extends Controller
|
||||
return $helper->generateList($this->_list, $this->fieldsDisplay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to init display of the view page
|
||||
*/
|
||||
public function initView()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* this function set various display option for helper list
|
||||
*
|
||||
* @param Helper $helper
|
||||
*
|
||||
* @param Helper $helper
|
||||
* @return void
|
||||
*/
|
||||
public function setHelperListDisplay(Helper $helper)
|
||||
|
||||
@@ -31,6 +31,7 @@ class HelperFormCore extends Helper
|
||||
public $id;
|
||||
|
||||
public $first_call = true;
|
||||
public $toolbar = true;
|
||||
|
||||
/**
|
||||
* @var array of forms fields
|
||||
@@ -98,7 +99,8 @@ class HelperFormCore extends Helper
|
||||
'asso_shop' => (isset($this->fields_form['asso_shop']) && $this->fields_form['asso_shop']) ? $this->displayAssoShop() : null,
|
||||
'iso' => file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en',
|
||||
'path_css' => _THEME_CSS_DIR_,
|
||||
'ad' => dirname($_SERVER["PHP_SELF"])
|
||||
'ad' => dirname($_SERVER["PHP_SELF"]),
|
||||
'toolbar' => $this->toolbar
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->tpl);
|
||||
|
||||
@@ -62,6 +62,8 @@ class HelperListCore extends Helper
|
||||
|
||||
protected $is_dnd_identifier = false;
|
||||
|
||||
public $toolbar = true;
|
||||
|
||||
/* Customize list display
|
||||
*
|
||||
* align : determine value alignment
|
||||
@@ -538,6 +540,7 @@ class HelperListCore extends Helper
|
||||
'table_dnd' => isset($table_dnd) ? $table_dnd : null,
|
||||
'name' => isset($name) ? $name : null,
|
||||
'name_id' => isset($name_id) ? $name_id : null,
|
||||
'toolbar' => $this->toolbar
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->header_tpl);
|
||||
|
||||
@@ -85,11 +85,17 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setHelperListDisplay(Helper $helper)
|
||||
{
|
||||
$helper->toolbar = false;
|
||||
parent::setHelperListDisplay($helper);
|
||||
}
|
||||
|
||||
public function initList()
|
||||
{
|
||||
$this->addRowAction('view');
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
$this->addRowAction('view');
|
||||
|
||||
$this->_select = '
|
||||
COUNT(`id_product`) AS `products`, (
|
||||
@@ -104,7 +110,7 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
$this->context->smarty->assign('title_list', $this->l('List of manufacturers:'));
|
||||
|
||||
$this->initToolbar();
|
||||
$this->content .= parent::initList();
|
||||
$list_manufacturers = parent::initList();
|
||||
|
||||
// reset actions and query vars
|
||||
$this->actions = array();
|
||||
@@ -185,7 +191,12 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
$this->postProcess();
|
||||
|
||||
$this->initToolbar();
|
||||
$this->content .= parent::initList();
|
||||
$list_addresses = parent::initList();
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'list_manufacturers' => $list_manufacturers,
|
||||
'list_addresses' => $list_addresses
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -563,7 +574,8 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
$this->context->smarty->assign(array(
|
||||
'manufacturer' => $manufacturer,
|
||||
'addresses' => $addresses,
|
||||
'products' => $products
|
||||
'products' => $products,
|
||||
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7300 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminSuppliersControllerCore extends AdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'supplier';
|
||||
$this->className = 'Supplier';
|
||||
|
||||
$this->addRowAction('view');
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
|
||||
$this->_select = 'COUNT(p.`id_product`) AS products';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product` p ON (a.`id_supplier` = p.`id_supplier`)';
|
||||
$this->_group = 'GROUP BY a.`id_supplier`';
|
||||
|
||||
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 'su');
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_supplier' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 120),
|
||||
'logo' => array('title' => $this->l('Logo'), 'align' => 'center', 'image' => 'su', 'orderby' => false, 'search' => false),
|
||||
'products' => array('title' => $this->l('Number of products'), 'align' => 'right', 'filter_type' => 'int', 'tmpTableFilter' => true),
|
||||
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Suppliers'),
|
||||
'image' => '../img/admin/suppliers.gif'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Name:'),
|
||||
'name' => 'name',
|
||||
'size' => 40,
|
||||
'required' => true,
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Description:'),
|
||||
'name' => 'description',
|
||||
'size' => 33,
|
||||
'lang' => true,
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}',
|
||||
'p' => $this->l('Will appear in supplier list')
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Logo:'),
|
||||
'name' => 'logo',
|
||||
'display_image' => true,
|
||||
'p' => $this->l('Upload supplier logo from your computer')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Meta title:'),
|
||||
'name' => 'smeta_title',
|
||||
'lang' => true,
|
||||
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Meta description:'),
|
||||
'name' => 'meta_description',
|
||||
'lang' => true,
|
||||
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Meta keywords:'),
|
||||
'name' => 'meta_keywords',
|
||||
'lang' => true,
|
||||
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Enable:'),
|
||||
'name' => 'active',
|
||||
'required' => false,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'group_shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
'values' => Shop::getTree()
|
||||
);
|
||||
}
|
||||
|
||||
// Set logo image
|
||||
$image = cacheImage(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg', $this->table.'_'.(int)$this->object->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
$this->fields_value = array(
|
||||
'image' => $image ? $image : false,
|
||||
'size' => $image ? filesize(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg') / 1000 : false
|
||||
);
|
||||
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function initView()
|
||||
{
|
||||
$products = $this->object->getProductsLite($this->context->language->id);
|
||||
$total_product = count($products);
|
||||
for ($i = 0; $i < $total_product; $i++)
|
||||
{
|
||||
$products[$i] = new Product($products[$i]['id_product'], false, $this->context->language->id);
|
||||
// Build attributes combinaisons
|
||||
$combinaisons = $products[$i]->getAttributeCombinaisons($this->context->language->id);
|
||||
foreach ($combinaisons as $k => $combinaison)
|
||||
{
|
||||
$comb_array[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
|
||||
$comb_array[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
|
||||
$comb_array[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc'];
|
||||
$comb_array[$combinaison['id_product_attribute']]['quantity'] = $combinaison['quantity'];
|
||||
$comb_array[$combinaison['id_product_attribute']]['attributes'][] = array(
|
||||
$combinaison['group_name'],
|
||||
$combinaison['attribute_name'],
|
||||
$combinaison['id_attribute']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($comb_array))
|
||||
{
|
||||
foreach ($comb_array as $key => $product_attribute)
|
||||
{
|
||||
$list = '';
|
||||
foreach ($product_attribute['attributes'] as $attribute)
|
||||
$list .= $attribute[0].' - '.$attribute[1].', ';
|
||||
$comb_array[$key]['attributes'] = rtrim($list, ', ');
|
||||
}
|
||||
isset($comb_array) ? $products[$i]->combinaison = $comb_array : '';
|
||||
unset($comb_array);
|
||||
}
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'supplier' => $this->object,
|
||||
'products' => $products,
|
||||
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
|
||||
));
|
||||
}
|
||||
|
||||
public function afterImageUpload()
|
||||
{
|
||||
/* Generate image with differents size */
|
||||
if (($id_supplier = (int)(Tools::getValue('id_supplier'))) AND isset($_FILES) AND count($_FILES) AND file_exists(_PS_SUPP_IMG_DIR_.$id_supplier.'.jpg'))
|
||||
{
|
||||
$imagesTypes = ImageType::getImagesTypes('suppliers');
|
||||
foreach ($imagesTypes AS $k => $imageType)
|
||||
{
|
||||
$file = _PS_SUPP_IMG_DIR_.$id_supplier.'.jpg';
|
||||
imageResize($file, _PS_SUPP_IMG_DIR_.$id_supplier.'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height']));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user