Как сделать таблицу с текстом под изображением в Товаре?

Автор IgorSch, 06 октября 2017, 23:30:37

« назад - далее »

IgorSch

Добрый день!
Подскажите пожалуйста, как сделать таблицу с текстом под изображением в Товаре ?  Если делать это в "Описании" через визуальный редактор, таблица не вмещается и вылазит за границы блока.
prestashop 1.7

Миколас

Ширину задай у колонок. Можно еще классы css присвоить. Посмотри какие классы в твоей теме отвечают за сетку и определи этими классами ширину.

IgorSch

#2
могли бы на скриншот посмотреть, правильно ли мы поняли друг друга, о каком блоке идет речь))

ширина у колонок в таблице нормальная, просто не хватает места в модуле, где описание. , по-идее можно приобрести модуль extra tab который в товар добавляет таблицу, просто я думаю как еще можно решить это ?

то есть с помощью присваивания классов можно как-то ? )) если да, то я буду тогда дальше изучать этот вопрос

mistral

Ни классы, ни модуль extra tab не помогут. Вам нужен модуль блок html или contentbox, но и их придется переделать добавить новый хук, также нужно изменить стили для блока описания уменьшть ширину и вставить новый хук в шаблон product.tpl.

Миколас

Ниже табов можно показать таблицу. В экстратаб создай текстовое поле и выволи в хук productfooter.

IgorSch

да, это 100 % мое решение))  у меня presta 1.7, бесплатный модуль content box не ставится, но у меня установился какой-то "Блок HTML" с просторов интернета, но у него хуки только с главной, а мне нужен я так понимаю хук ProductTab, как связать модуль с этим хуком, ну или чтобы он там в модуле отображался?
либо другой выход это купить модуль html box professional там уже добавлены хуки ProductTab и Product Tab Content


Цитата: mistral от 07 октября 2017, 12:05:36
Ни классы, ни модуль extra tab не помогут. Вам нужен модуль блок html или contentbox, но и их придется переделать добавить новый хук, также нужно изменить стили для блока описания уменьшть ширину и вставить новый хук в шаблон product.tpl.

Adik

В файле php модуля можно изменить хук установки на hookDisplayFooterProduct.

IgorSch

#7
на удивление, по-моему, у меня получилось привязать модуль прописав в php файле модуля, там где строчка параграф install след. строчки
OR $this->registerHook('displayFooterProduct') == false
OR Configuration::updateValue('displayFooterProduct', '0') == false


, но как в самом модуле , слева, теперь выбрать FooterProduct? скриншот во вложении.

Цитата: Adik от 07 октября 2017, 15:19:41
В файле php модуля можно изменить хук установки на hookDisplayFooterProduct.

mistral

Нужно еще описать метод displayFooterProduct
function hookdisplayFooterProduct($params){ // шаблон и переменные шаблона

IgorSch

#9
в модуле "Блок HTML" слева появился displayFooterProduct , это получилось. но вся суть была в том, чтобы в товарах в админке появилось окно в котором я мог бы забить информацию для каждого товара и она появилась бы в хуке displayFooterProduct на странице  ( под изображениями в товаре), но этого не случается. посмотрите пожалуйста код, может в нем где-то ошибка?

<?php
class blockhtml extends Module {
function __construct(){
$this->name = 'blockhtml';
$this->tab = 'Other';
$this->version = '1.4';
       
$this->module_key = '';
       
$this->dir = '/modules/blockhtml/';
parent::__construct();
$this->displayName = $this->l('HTMLbox');
$this->description = $this->l('With this module you can put the HTML/JavaScript/CSS code anywhere you want');
       
}
   
function install(){
       if (
parent::install() == false
   OR
$this->registerHook('header') == false
   OR
$this->registerHook('top') == false
   OR
$this->registerHook('leftColumn') == false
   OR
$this->registerHook('rightColumn') == false
   OR
$this->registerHook('footer') == false
OR $this->registerHook('displayFooterProduct') == false
   OR
$this->registerHook('home') == false

       
OR Configuration::updateValue('blockhtml_header', '0') == false
       
OR Configuration::updateValue('blockhtml_top', '0') == false
       
OR Configuration::updateValue('blockhtml_leftcol', '0') == false
       
OR Configuration::updateValue('blockhtml_rightcol', '1') == false
       
OR Configuration::updateValue('blockhtml_footercol', '0') == false
       
OR Configuration::updateValue('blockhtml_homecol', '0') == false
OR Configuration::updateValue('displayFooterProduct', '0') == false
       
OR Configuration::updateValue('blockhtml_body', 'Block HTML') == false
       
){
           return
false;
       }
       return
true;
}
   
public function getContent(){
  $output="";
if (Tools::isSubmit('submit_settings')){
$body=str_replace(array("\rn", "\r", "\n"), array(' ',' ',' '),($_POST['blockhtml_body']));
Configuration::updateValue('blockhtml_body', $body, true);
           
$output .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>';

$hooks=$this->getsettingsofblockhtml();
foreach ($hooks['hook'] AS $hook=>$value){
if ($hook==$_POST['blockhtml_hook']){
$hookval=1;
} else {
$hookval=0;
}

Configuration::updateValue($hook,$hookval);
}                                    
       }
 
       
$output.="";
       return
$output.$this->displayForm();
}

public function displayForm(){
$array=$this->getsettingsofblockhtml();
$radio="";  
foreach ($array['hook'] as $key=>$value){
if ($key=="blockhtml_leftcol"){$place=$this->l("left column");}
if ($key=="blockhtml_rightcol"){$place=$this->l("right column");}
if ($key=="blockhtml_top"){$place=$this->l("top");}
if ($key=="blockhtml_header"){$place=$this->l("header");}
if ($key=="blockhtml_footercol"){$place=$this->l("footer");}
if ($key=="blockhtml_homecol"){$place=$this->l("home");}
if (
$key=="blockhtml_displayFooterProduct"){$place=$this->l("displayFooterProduct");}

$selected=0;
if ($value==1){
$selected="checked";
}
$radio.="
<tr>
<td style=\"border-left:1px solid #c0c0c0; width:150px; padding:10px; background:#f2f2f2; border-bottom:1px solid #FFF; border-top:1px solid #c0c0c0; margin-right:10px;\">
$place:</td>
<td style=\"padding:10px; background:#fff; border-right:1px solid #c0c0c0;  border-bottom:1px solid #FFF; border-top:1px solid #c0c0c0; margin-right:10px;\"><input type=\"radio\" name=\"blockhtml_hook\" value=\"
$key\" $selected style=\"cursor:pointer;\"/></td>
</tr>
"
;
}
return'
<form action="'
.$_SERVER['REQUEST_URI'].'" method="post">
<div style="display:block; margin:auto; overflow:hidden; width:100%; vertical-align:top;">
                   <div style="clear:both; display:block; vertical-align:top;">
<fieldset style="height:412px; display:inline-block; width:160px; margin-right:10px; vertical-align:top;">
 <legend><img src="'
.$this->_path.'logo.gif" alt="" title="" />'.$this->l('HTMLbox configuration').'</legend>  
 <h3 style="margin-bottom:0px; padding-bottom:0px; margin-bottom:20px;">'
.$this->l('Where to display HTMLbox ?').'</h3>
 <table style="border-bottom:1px solid #c0c0c0;  clear:both; vertical-align:top;" cellspacing="0" cellpadding="0">
'
.$radio.'
 </table>
</fieldset>            

                       <fieldset style="display:inline-block; width:600px;  vertical-align:top;">
 <legend><img src="'
.$this->_path.'logo.gif" alt="" title="" />'.$this->l('HTMLbox configuration').'</legend>
                         <h3 style="margin-bottom:0px; padding-bottom:0px;">'
.$this->l('Enter the HTML/js/css code here').'</h3>
                         <hr style="margin-top:5px;">
 <textarea type="text" style="margin-bottom:10px; width:99%; height:300px;" id="blockhtml_body" name="blockhtml_body">'
.$array['body'].'</textarea>                                                                                                                                        
                         <div align="center">
           <input type="submit" name="submit_settings" value="'
.$this->l('Save Settings').'" class="button" />
                         </div>
                       </fieldset>                    
                   </div>
</div>
</form>
       '
;
}  
 
   public function
getsettingsofblockhtml(){
       
$array['hook']['blockhtml_header']= Configuration::get('blockhtml_header');
$array['hook']['blockhtml_top']= Configuration::get('blockhtml_top');
$array['hook']['blockhtml_leftcol']= Configuration::get('blockhtml_leftcol');
$array['hook']['blockhtml_rightcol']= Configuration::get('blockhtml_rightcol');
$array['hook']['blockhtml_footercol']= Configuration::get('blockhtml_footercol');
$array['hook']['blockhtml_homecol']= Configuration::get('blockhtml_homecol');
$array['hook']['blockhtml_displayFooterProduct']= Configuration::get('blockhtml_displayFooterProduct');

$array['body'] = str_replace(array("\rn", "\r", "\n"), array(' ',' ',' '),Configuration::get('blockhtml_body'));
return $array;
   }
 
function hookrightColumn($params){
$array=$this->getsettingsofblockhtml();
if ($array['hook']['blockhtml_rightcol']=="1"){
       global $smarty;
       $smarty->assign(array('blockhtmlbody' => nl2br(stripslashes($array['body']))));
return $this->display(__FILE__, 'blockhtml.tpl');
}
}
   
function hookleftColumn($params){
$array=$this->getsettingsofblockhtml();
if ($array['hook']['blockhtml_leftcol']=="1"){
       global $smarty;
       $smarty->assign(array('blockhtmlbody' => nl2br(stripslashes($array['body']))));
return $this->display(__FILE__, 'blockhtml.tpl');
}
}

   
function hookdisplayFooterProduct($params){
$array=$this->getsettingsofblockhtml();
if ($array['hook']['blockhtml_displayFooterProduct']=="1"){
       global $smarty;
       $smarty->assign(array('blockhtmlbody' => nl2br(stripslashes($array['body']))));
return $this->display(__FILE__, 'blockhtml.tpl');
}

}
   
function hookhome($params){
$array=$this->getsettingsofblockhtml();
if ($array['hook']['blockhtml_homecol']=="1"){
       global $smarty;
       $smarty->assign(array('blockhtmlbody' => nl2br(stripslashes($array['body']))));
return $this->display(__FILE__, 'blockhtml.tpl');
}
}
   
function hookfooter($params){
$array=$this->getsettingsofblockhtml();
if ($array['hook']['blockhtml_footercol']=="1"){
       global $smarty;
       $smarty->assign(array('blockhtmlbody' => nl2br(stripslashes($array['body']))));
return $this->display(__FILE__, 'blockhtml.tpl');
}
}

function hookheader($params){
$array=$this->getsettingsofblockhtml();
if ($array['hook']['blockhtml_header']=="1"){
       global $smarty;
       $smarty->assign(array('blockhtmlbody' => nl2br(stripslashes($array['body']))));
return $this->display(__FILE__, 'blockhtml.tpl');
}
}

function hooktop($params){
$array=$this->getsettingsofblockhtml();
if ($array['hook']['blockhtml_top']=="1"){
       global $smarty;
       $smarty->assign(array('blockhtmlbody' => nl2br(stripslashes($array['body']))));
return $this->display(__FILE__, 'blockhtml.tpl');
}
}      
   
}
?>





Цитата: mistral от 07 октября 2017, 21:08:29
Нужно еще описать метод displayFooterProduct
function hookdisplayFooterProduct($params){ // шаблон и переменные шаблона

tigran

Для того чтобы у каждого товара добавилось новое окно нужен другой модуль. Блок HTML добавляет одно и тоже окно для всех товаров.

IgorSch

подскажите пожалуйста, какой модуль нужен для этого?

Цитата: tigran от 08 октября 2017, 12:04:16
Для того чтобы у каждого товара добавилось новое окно нужен другой модуль. Блок HTML добавляет одно и тоже окно для всех товаров.

tigran


IgorSch

всем большое спасибо за помощь! и всемогучему интернету.
решил задачу с помощью модуля HTML BOX pro  интересная штука. Но для работы с товарами у них есть еще один  модуль, Product Page Content blocks , там больше хуков привязано.  Я взял первое, потому что с ней можно не только на странице товара работать.

конечно если бы не вы, до меня бы не дошло ничего)) спасибо!