adding desc more for product

This commit is contained in:
Marion Muszynski 2016-04-27 16:11:19 +02:00
parent 20beed5ed7
commit 2a160422d9
4 changed files with 125 additions and 14 deletions

View File

@ -3275,6 +3275,17 @@ class AdminProducts extends AdminTab
</div>
</td></tr>
<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
<tr>
<td class="col-left">'.$this->l('More description:').'<br /><br /><i>('.$this->l('appears in the product lists and on the top of the product page').')</i></td>
<td style="padding-bottom:5px;" class="translatable">';
foreach ($this->_languages as $language)
echo ' <div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').';float: left;">
<textarea class="rte" cols="100" rows="10" id="description_more_'.$language['id_lang'].'" name="description_more_'.$language['id_lang'].'">'.htmlentities(stripslashes($this->getFieldValue($obj, 'description_more', $language['id_lang'])), ENT_COMPAT, 'UTF-8').'</textarea>
</div>';
echo ' </td>
</tr>
<tr>
<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
<tr>
<td class="col-left">'.$this->l('Short description:').'<br /><br /><i>('.$this->l('appears in the product lists and on the top of the product page').')</i></td>
<td style="padding-bottom:5px;" class="translatable">';

View File

@ -1,6 +1,58 @@
<?php
class Product extends ProductCore
{
/** @var string More description */
public $description_more;
/**
* @Override
*/
protected $fieldsValidateLang = array(
'meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName',
'meta_title' => 'isGenericName', 'link_rewrite' => 'isLinkRewrite', 'name' => 'isCatalogName',
'description' => 'isString', 'description_short' => 'isString', 'available_now' => 'isGenericName', 'available_later' => 'IsGenericName',
'description_more' => 'isString');
/**
* @Override
* Check then return multilingual fields for database interaction
*
* @return array Multilingual fields
*/
public function getTranslationsFieldsChild()
{
self::validateFieldsLang();
$fieldsArray = array('meta_description', 'meta_keywords', 'meta_title', 'link_rewrite', 'name', 'available_now', 'available_later');
$fields = array();
$languages = Language::getLanguages(false);
$defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
foreach ($languages as $language)
{
$fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
$fields[$language['id_lang']][$this->identifier] = (int)($this->id);
$fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']])) ? pSQL($this->description[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['description_short'] = (isset($this->description_short[$language['id_lang']])) ? pSQL($this->description_short[$language['id_lang']], true) : '';
$fields[$language['id_lang']]['description_more'] = (isset($this->description_more[$language['id_lang']])) ? pSQL($this->description_more[$language['id_lang']], true) : '';
foreach ($fieldsArray as $field)
{
if (!Validate::isTableOrIdentifier($field))
die(Tools::displayError());
/* Check fields validity */
if (isset($this->{$field}[$language['id_lang']]) AND !empty($this->{$field}[$language['id_lang']]))
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]);
elseif (in_array($field, $this->fieldsRequiredLang))
{
if ($this->{$field} != '')
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]);
}
else
$fields[$language['id_lang']][$field] = '';
}
}
return $fields;
}
/**
* @Override

View File

@ -5755,6 +5755,11 @@ div#giftvoucher_ask_infos_block .gv_customization > .gv_param input {
background-position: -5px;
padding-left: 55px;
}
#sale_end #countdown {
clear: both;
color: #fb66a9;
float: left;
}
#product #short_description_block {
padding: 0px 20px 0px 20px;
width: 100%;
@ -5812,12 +5817,40 @@ div.form-right{
padding-top: 10px;
text-align: right;
}
#product #short_description_block #short_description_content {
#product #short_description_block #more_description_content{
margin-top: 20px;
}
#product #short_description_block #more_description_content p {
font-size: 12px;
line-height: 1.5em;
margin-bottom: 10px;
color: #444d52;
width: 100%;
margin-left: 5px;
text-align: justify;
}
#product #more_info_block {
clear: both;
padding: 10px 15px 20px 20px;
}
#product #more_info_block .idTabs li{
position: relative;
margin-left: 1px;
line-height: 12px;
}
#product #more_info_block .idTabs li a {
background: #fb66a9;
color: #fff;
}
#product #more_info_block .idTabs li a.selected {
font-weight: bold;
background: #F3F3F3;
color: #fb66a9;
}
#product .sheets {
padding: 20px 0px;
background: #F3F3F3;
}
@keyframes slideInDown {
0% {

View File

@ -214,7 +214,7 @@ var fieldRequired = '{l s='Please fill in all required fields, then save the cus
</div>
</div>
{if $product->description_short OR $packItems|@count > 0}
{if $product->description_more OR $packItems|@count > 0}
<div id="short_description_block">
{*{if $product->description}
@ -389,9 +389,10 @@ var fieldRequired = '{l s='Please fill in all required fields, then save the cus
<div class="clear"></div>
</form>
<div class="clear"></div>
{/if}
{if $product->description_short}
<div id="short_description_content" class="rte align_justify">{$product->description_short}</div>
{if $product->description_more}
<div id="more_description_content" class="rte align_justify">{$product->description_more}</div>
{/if}
</div>
{/if}
@ -416,20 +417,37 @@ var fieldRequired = '{l s='Please fill in all required fields, then save the cus
<!-- description and features -->
{if $product->description || $features || $accessories || $HOOK_PRODUCT_TAB || $attachments}
{if $product->description_short || $product->description || $features || $accessories || $HOOK_PRODUCT_TAB || $attachments}
<div id="more_info_block" class="clear">
<ul id="more_info_tabs" class="idTabs idTabsShort">
{if $features}<li><a id="more_info_tab_data_sheet" href="#idTab2">{l s='Data sheet'}</a></li>{/if}
{if $product->description_short}<li><a id="more_info_tab_data_sheet" href="#idTab1">{l s='Description'}</a></li>{/if}
{if $product->description}<li><a id="more_info_tab_data_sheet" href="#idTab2">{l s='Good to know'}</a></li>{/if}
{*if $product->buy_guide}<li><a id="more_info_tab_data_sheet" href="#idTab3">{l s='Buy guide'}</a></li>{/if*}
{*if $product->videos}<li><a id="more_info_tab_data_sheet" href="#idTab4">{l s='Videos'}</a></li>{/if*}
<li><a id="more_info_tab_data_sheet" href="#idTab5">{l s='Shipping'}</a></li>
{*{if $features}<li><a id="more_info_tab_data_sheet" href="#idTab2">{l s='Data sheet'}</a></li>{/if}
{if $attachments}<li><a id="more_info_tab_attachments" href="#idTab9">{l s='Download'}</a></li>{/if}
{if isset($accessories) AND $accessories}<li><a href="#idTab4">{l s='Accessories'}</a></li>{/if}
{if isset($accessories) AND $accessories}<li><a href="#idTab4">{l s='Accessories'}</a></li>{/if}*}
{$HOOK_PRODUCT_TAB}
</ul>
<div id="more_info_sheets" class="sheets align_justify">
{if $product->description}
{if $product->description_short}
<!-- full description -->
<div id="idTab1" class="rte">
<div class="product_info">
{$product->description_short}
</div>
{/if}
{if $product->description}
<!-- full description -->
<div id="idTab2" class="rte">
{$product->description}
</div>
{/if}
<div id="idTab3" class="rte">
</div>
<div id="idTab4" class="rte">
</div>
<div id="idTab5" class="rte product_info">
<div class="info info_1">
{if $sale->delivery_delay == 2
|| $sale->delivery_delay == 3
@ -455,9 +473,6 @@ var fieldRequired = '{l s='Please fill in all required fields, then save the cus
{l s='Paypal & CB'}
</div>
</div>
{$product->description}</div>
{/if}
{if $features}
<!-- product's features -->
<ul id="idTab2" class="bullet">