// Changes to product page layout
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11146 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -33,15 +33,75 @@
|
||||
<div id="no_default_category" style="color: red;font-weight: bold;display: none;">
|
||||
{l s='Please check a category in order to select the default category.'}
|
||||
</div>
|
||||
{*<script type="text/javascript">
|
||||
var post_selected_cat;
|
||||
post_selected_cat = '{$selected_cat_ids}';
|
||||
</script>*}
|
||||
<select id="id_category_default" name="id_category_default">
|
||||
{foreach from=$selected_cat item=cat}
|
||||
<option value="{$cat.id_category}" {if $product->id_category_default == $cat.id_category}selected="selected"{/if} >{$cat.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<select id="id_category_default" name="id_category_default">
|
||||
{foreach from=$selected_cat item=cat}
|
||||
<option value="{$cat.id_category}" {if $product->id_category_default == $cat.id_category}selected="selected"{/if} >{$cat.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<div id="category_block">{$category_tree}</div>
|
||||
{if $feature_shop_active}
|
||||
{* @todo use asso_shop from Helper *}
|
||||
<tr id="shop_association">
|
||||
<td class="col-left"><label>{l s='Shop association:' }</label></td>
|
||||
<td style="padding-bottom:5px;">{$displayAssoShop}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Accessories:'}<br /><br /><i>{l s='(Do not forget to Save the product afterward)'}</i></label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<div id="divAccessories">
|
||||
{* @todo : donot use 3 foreach, but assign var *}
|
||||
{foreach from=$accessories item=accessory}
|
||||
{$accessory.name|htmlentitiesUTF8}{if !empty($accessory.reference)}{$accessory.reference}{/if} <span onclick="delAccessory({$accessory.id_product});" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span><br />
|
||||
{/foreach}
|
||||
</div>
|
||||
<input type="hidden" name="inputAccessories" id="inputAccessories" value="{foreach from=$accessories item=accessory}{$accessory.id_product}-{/foreach}" />
|
||||
<input type="hidden" name="nameAccessories" id="nameAccessories" value="{foreach from=$accessories item=accessory}{$accessory.name|htmlentitiesUTF8}¤{/foreach}" />
|
||||
|
||||
<div id="ajax_choose_product" style="padding:6px; padding-top:2px; width:600px;">
|
||||
<p class="clear">{l s='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" />
|
||||
<img onclick="$(this).prev().search();" style="cursor: pointer;" src="../img/admin/add.gif" alt="{l s='Add an accessory'}" title="{l s='Add an accessory'}" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
<script type="text/javascript">
|
||||
var formProduct;
|
||||
var accessories = new Array();
|
||||
urlToCall = null;
|
||||
/* function autocomplete */
|
||||
$(document).ready(function() {
|
||||
$('#product_autocomplete_input')
|
||||
.autocomplete('ajax_products_list.php', {
|
||||
minChars: 1,
|
||||
autoFill: true,
|
||||
max:20,
|
||||
matchContains: true,
|
||||
mustMatch:true,
|
||||
scroll:false,
|
||||
cacheLength:0,
|
||||
formatItem: function(item) {
|
||||
return item[1]+' - '+item[0];
|
||||
}
|
||||
}).result(addAccessory);
|
||||
$('#product_autocomplete_input').setOptions({
|
||||
extraParams: {
|
||||
excludeIds : getAccessorieIds()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function getAccessorieIds()
|
||||
{
|
||||
var ids = {$product->id}+',';
|
||||
ids += $('#inputAccessories').val().replace(/\\-/g,',').replace(/\\,$/,'');
|
||||
ids = ids.replace(/\,$/,'');
|
||||
|
||||
return ids;
|
||||
}
|
||||
</script>
|
||||
@@ -110,13 +110,6 @@
|
||||
<label for="active_off" class="t">{l s='Disabled'} </label>
|
||||
</td>
|
||||
</tr>
|
||||
{if $feature_shop_active}
|
||||
{* @todo use asso_shop from Helper *}
|
||||
<tr id="shop_association">
|
||||
<td class="col-left"><label>{l s='Shop association:' }</label></td>
|
||||
<td style="padding-bottom:5px;">{$displayAssoShop}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr id="product_options" {if !$product->active}style="display:none"{/if} >
|
||||
<td class="col-left"><label>{l s='Options:' }</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
@@ -317,63 +310,7 @@ var textFieldLabel = 0;
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="separation"></div>
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
{if !$ps_stock_management}
|
||||
<tr>
|
||||
<td colspan="2">{l s='The stock management is disabled'}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if !$has_attribute}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Minimum quantity:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="3" maxlength="6" name="minimal_quantity" id="minimal_quantity" type="text" value="{$product->minimal_quantity|default:1}" />
|
||||
<p class="preference_description">{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Additional shipping cost:'}</label></td>
|
||||
<td style="padding-bottom:5px;">{$currency->prefix}<input type="text" name="additional_shipping_cost"
|
||||
value="{$product->additional_shipping_cost}" />{$currency->suffix}
|
||||
{if $country_display_tax_label}{l s='tax excl.'}{/if}
|
||||
<p>{l s='Carrier tax will be applied.'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when in-stock:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_now
|
||||
input_name='available_now'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when allowed to be back-ordered:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_later
|
||||
input_name='available_later'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
{if $countAttributes}
|
||||
|
||||
{* .(($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $language['id_lang']))) : '0000-00-00').'" *}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Available date:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input id="available_date" name="available_date" value="{$product->available_date}" class="datepicker"
|
||||
style="text-align: center;" type="text" />
|
||||
<p>{l s='The available date when this product is out of stock'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
<div class="separation"></div>
|
||||
@@ -568,61 +505,6 @@ var textFieldLabel = 0;
|
||||
<p class="preference_description">{l s='Tags separated by commas (e.g., dvd, dvd player, hifi)'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Accessories:'}<br /><br /><i>{l s='(Do not forget to Save the product afterward)'}</i></label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<div id="divAccessories">
|
||||
{* @todo : donot use 3 foreach, but assign var *}
|
||||
{foreach from=$accessories item=accessory}
|
||||
{$accessory.name|htmlentitiesUTF8}{if !empty($accessory.reference)}{$accessory.reference}{/if} <span onclick="delAccessory({$accessory.id_product});" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span><br />
|
||||
{/foreach}
|
||||
</div>
|
||||
<input type="hidden" name="inputAccessories" id="inputAccessories" value="{foreach from=$accessories item=accessory}{$accessory.id_product}-{/foreach}" />
|
||||
<input type="hidden" name="nameAccessories" id="nameAccessories" value="{foreach from=$accessories item=accessory}{$accessory.name|htmlentitiesUTF8}¤{/foreach}" />
|
||||
<script type="text/javascript">
|
||||
var formProduct;
|
||||
var accessories = new Array();
|
||||
</script>
|
||||
|
||||
<div id="ajax_choose_product" style="padding:6px; padding-top:2px; width:600px;">
|
||||
<p class="clear">{l s='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" />
|
||||
<img onclick="$(this).prev().search();" style="cursor: pointer;" src="../img/admin/add.gif" alt="{l s='Add an accessory'}" title="{l s='Add an accessory'}" />
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
urlToCall = null;
|
||||
/* function autocomplete */
|
||||
$(document).ready(function() {
|
||||
$('#product_autocomplete_input')
|
||||
.autocomplete('ajax_products_list.php', {
|
||||
minChars: 1,
|
||||
autoFill: true,
|
||||
max:20,
|
||||
matchContains: true,
|
||||
mustMatch:true,
|
||||
scroll:false,
|
||||
cacheLength:0,
|
||||
formatItem: function(item) {
|
||||
return item[1]+' - '+item[0];
|
||||
}
|
||||
}).result(addAccessory);
|
||||
$('#product_autocomplete_input').setOptions({
|
||||
extraParams: {
|
||||
excludeIds : getAccessorieIds()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function getAccessorieIds()
|
||||
{
|
||||
var ids = {$product->id}+',';
|
||||
ids += $('#inputAccessories').val().replace(/\\-/g,',').replace(/\\,$/,'');
|
||||
ids = ids.replace(/\,$/,'');
|
||||
|
||||
return ids;
|
||||
}
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -127,6 +127,54 @@
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="separation"></div>
|
||||
<h4>{l s='Availability display'}</h4>
|
||||
<table cellpadding="5">
|
||||
{if !$ps_stock_management}
|
||||
<tr>
|
||||
<td colspan="2">{l s='The stock management is disabled'}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if !$has_attribute}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Minimum quantity:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input size="3" maxlength="6" name="minimal_quantity" id="minimal_quantity" type="text" value="{$product->minimal_quantity|default:1}" />
|
||||
<p class="preference_description">{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when in-stock:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_now
|
||||
input_name='available_now'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Displayed text when allowed to be back-ordered:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
{include file="products/input_text_lang.tpl"
|
||||
languages=$languages
|
||||
input_value=$product->available_later
|
||||
input_name='available_later'}
|
||||
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</td>
|
||||
</tr>
|
||||
{if $countAttributes}
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Available date:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<input id="available_date" name="available_date" value="{$product->available_date}" class="datepicker"
|
||||
style="text-align: center;" type="text" />
|
||||
<p>{l s='The available date when this product is out of stock'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
var showAjaxError = function(msg)
|
||||
|
||||
@@ -54,6 +54,14 @@
|
||||
<input size="6" maxlength="6" name="weight" type="text" value="{$product->weight}" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.');" /> {$ps_weight_unit}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Additional shipping cost:'}</label></td>
|
||||
<td style="padding-bottom:5px;">{$currency->prefix}<input type="text" name="additional_shipping_cost"
|
||||
value="{$product->additional_shipping_cost}" />{$currency->suffix}
|
||||
{if $country_display_tax_label}{l s='tax excl.'}{/if}
|
||||
<p>{l s='Carrier tax will be applied.'}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left">
|
||||
<label>Carriers:</label>
|
||||
|
||||
@@ -39,8 +39,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
protected $available_tabs = array(
|
||||
'Informations',
|
||||
'Prices',
|
||||
'Images',
|
||||
'Associations',
|
||||
'Images',
|
||||
'Shipping',
|
||||
'Combinations',
|
||||
'Features',
|
||||
@@ -56,9 +56,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
protected $tabs_toolbar_save_buttons = array(
|
||||
'Informations' => true,
|
||||
'Images' => false,
|
||||
'Prices' => false,
|
||||
'Associations' => true,
|
||||
'Images' => false,
|
||||
'Shipping' => true,
|
||||
'Combinations' => false,
|
||||
'Features' => true,
|
||||
@@ -2364,6 +2364,30 @@ class AdminProductsControllerCore extends AdminController
|
||||
'search' => $this->l('Search a category')
|
||||
);
|
||||
|
||||
// Multishop block
|
||||
$data->assign('feature_shop_active', Shop::isFeatureActive());
|
||||
$helper = new Helper();
|
||||
if ($this->object && $this->object->id)
|
||||
$helper->id = $this->object->id;
|
||||
else
|
||||
$helper->id = null;
|
||||
$helper->table = $this->table;
|
||||
$helper->identifier = $this->identifier;
|
||||
|
||||
$data->assign('displayAssoShop', $helper->renderAssoShop());
|
||||
|
||||
// Accessories block
|
||||
$accessories = Product::getAccessoriesLight($this->context->language->id, $product->id);
|
||||
|
||||
if ($postAccessories = Tools::getValue('inputAccessories'))
|
||||
{
|
||||
$postAccessoriesTab = explode('-', Tools::getValue('inputAccessories'));
|
||||
foreach ($postAccessoriesTab as $accessory_id)
|
||||
if (!$this->haveThisAccessory($accessory_id, $accessories) && $accessory = Product::getAccessoryById($accessory_id))
|
||||
$accessories[] = $accessory;
|
||||
}
|
||||
$data->assign('accessories', $accessories);
|
||||
|
||||
$data->assign(array('default_category' => $default_category,
|
||||
'selected_cat_ids' => implode(',', array_keys($selected_cat)),
|
||||
'selected_cat' => $selected_cat,
|
||||
@@ -2727,10 +2751,22 @@ class AdminProductsControllerCore extends AdminController
|
||||
$data->assign('currency', $currency);
|
||||
$this->object = $product;
|
||||
$this->display = 'edit';
|
||||
$has_attribute = $product->hasAttributes();
|
||||
|
||||
$cover = Product::getCover($product->id);
|
||||
$this->_applyTaxToEcotax($product);
|
||||
|
||||
// Accessories block
|
||||
$accessories = Product::getAccessoriesLight($this->context->language->id, $product->id);
|
||||
|
||||
if ($postAccessories = Tools::getValue('inputAccessories'))
|
||||
{
|
||||
$postAccessoriesTab = explode('-', Tools::getValue('inputAccessories'));
|
||||
foreach ($postAccessoriesTab as $accessory_id)
|
||||
if (!$this->haveThisAccessory($accessory_id, $accessories) && $accessory = Product::getAccessoryById($accessory_id))
|
||||
$accessories[] = $accessory;
|
||||
}
|
||||
$data->assign('accessories', $accessories);
|
||||
|
||||
/*
|
||||
* Form for adding a virtual product like software, mp3, etc...
|
||||
*/
|
||||
@@ -2739,19 +2775,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$product_download = new ProductDownload($id_product_download);
|
||||
$product->{'productDownload'} = $product_download;
|
||||
|
||||
|
||||
$cache_default_attribute = (int) $this->getFieldValue($product, 'cache_default_attribute');
|
||||
$data->assign('feature_shop_active', Shop::isFeatureActive());
|
||||
|
||||
$helper = new Helper();
|
||||
if ($this->object && $this->object->id)
|
||||
$helper->id = $this->object->id;
|
||||
else
|
||||
$helper->id = null;
|
||||
$helper->table = $this->table;
|
||||
$helper->identifier = $this->identifier;
|
||||
|
||||
$data->assign('displayAssoShop', $helper->renderAssoShop());
|
||||
|
||||
$product_props = array();
|
||||
// global informations
|
||||
@@ -2850,12 +2874,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
$data->assign('error_product_download', $error);
|
||||
}
|
||||
|
||||
$data->assign('ps_stock_management', Configuration::get('PS_STOCK_MANAGEMENT'));
|
||||
$data->assign('has_attribute', $has_attribute);
|
||||
// Check if product has combination, to display the available date only for the product or for each combination
|
||||
if (Combination::isFeatureActive())
|
||||
$data->assign('countAttributes', (int)Db::getInstance()->getValue('SELECT COUNT(id_product) FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.(int)$product->id));
|
||||
|
||||
$images = Image::getImages($this->context->language->id, $product->id);
|
||||
|
||||
foreach($images as $k => $image)
|
||||
@@ -2864,16 +2882,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
$data->assign('images', $images);
|
||||
$data->assign('imagesTypes', ImageType::getImagesTypes('products'));
|
||||
|
||||
$accessories = Product::getAccessoriesLight($this->context->language->id, $product->id);
|
||||
|
||||
if ($postAccessories = Tools::getValue('inputAccessories'))
|
||||
{
|
||||
$postAccessoriesTab = explode('-', Tools::getValue('inputAccessories'));
|
||||
foreach ($postAccessoriesTab as $accessory_id)
|
||||
if (!$this->haveThisAccessory($accessory_id, $accessories) && $accessory = Product::getAccessoryById($accessory_id))
|
||||
$accessories[] = $accessory;
|
||||
}
|
||||
$data->assign('accessories', $accessories);
|
||||
$product->tags = Tag::getProductTags($product->id);
|
||||
|
||||
// TinyMCE
|
||||
@@ -2898,7 +2906,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
'product' => $obj,
|
||||
'ps_dimension_unit' => Configuration::get('PS_DIMENSION_UNIT'),
|
||||
'ps_weight_unit' => Configuration::get('PS_WEIGHT_UNIT'),
|
||||
'carrier_list' => $this->getCarrierList()
|
||||
'carrier_list' => $this->getCarrierList(),
|
||||
'currency' => $this->context->currency,
|
||||
'country_display_tax_label' => $this->context->country->display_tax_label
|
||||
));
|
||||
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
||||
}
|
||||
@@ -3195,7 +3205,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
return $helper->generateList($comb_array, $this->fieldsDisplay);
|
||||
}
|
||||
|
||||
public function initFormQuantities($obj)
|
||||
public function initFormQuantities($obj, $languages)
|
||||
{
|
||||
$data = $this->context->smarty->createData();
|
||||
|
||||
@@ -3247,6 +3257,12 @@ class AdminProductsControllerCore extends AdminController
|
||||
$show_quantities = false;
|
||||
}
|
||||
|
||||
$data->assign('ps_stock_management', Configuration::get('PS_STOCK_MANAGEMENT'));
|
||||
$data->assign('has_attribute', $obj->hasAttributes());
|
||||
// Check if product has combination, to display the available date only for the product or for each combination
|
||||
if (Combination::isFeatureActive())
|
||||
$data->assign('countAttributes', (int)Db::getInstance()->getValue('SELECT COUNT(id_product) FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.(int)$obj->id));
|
||||
|
||||
$data->assign(array(
|
||||
'attributes' => $attributes,
|
||||
'available_quantity' => $available_quantity,
|
||||
@@ -3255,7 +3271,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
'product' => $obj,
|
||||
'show_quantities' => $show_quantities,
|
||||
'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'),
|
||||
'token' => $this->token
|
||||
'token' => $this->token,
|
||||
'languages' => $languages
|
||||
));
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user