Jump to content

Asociar .tlp Con Una Pagina De Cms


Recommended Posts

Hola a todos:

 

Creo que soy el unico que necesita esto, pero estoy desarrollando un modulo para dentro de las pestañas de Homepage

es decir las de Mas vendido, populas etc..., crear otra pestaña con la información de una pagina del CMS, 

 

Lo que no consigo es que me llegue a mostrar la pagina que ha configurado,

os digo tres archivos:

 

 

pshometabs.php

<?php
if (!defined('_PS_VERSION_'))
    exit;
 
class pshometabs extends Module
{
    private $_html = '';
	private $_postErrors = array();
	
    public function __construct()
    {
        $this->name = 'pshometabs';
        $this->tab = 'front_office_features';
        $this->version = '1.0';
        $this->author = 'Nemo';
        $this->need_instance = 0;
 
        parent::__construct();
 
        $this->displayName = $this->l('PS new homepage tabs');
        $this->description = $this->l('Adds a new block to the homepage tabs.');
        $this->confirmUninstall = $this->l('Are you sure you want to delete this module?');
    }
     
	 	function install(){
		$this->_clearCache('tab.tpl');
		Configuration::updateValue('HNP_NBR', 8);

		if (!parent::install()
			|| !$this->registerHook('displayHome')
			|| !$this->registerHook('header')
			|| !$this->registerHook('displayHomeTab')
			|| !$this->registerHook('displayHomeTabContent')
			OR Configuration::updateValue('pshometabs', '0') == false
			
		)
			return false;
		return true;
	}	
	public function uninstall(){
		$this->_clearCache('tab.tpl');
		return parent::uninstall();
	}
	public function getContent(){
	   	$output="";
		if (Tools::isSubmit('module_settings')){            		
			Configuration::updateValue('pshometabs', $_POST['pshometabs']);                                   
        }	   
        $output.="";
        return $output.$this->displayForm();
	}
    
    public function getCMS($lang){
    	return CMS::listCms($lang);
    }
    
	public function displayForm(){
	    $options="<option>".$this->l('-- SELECT --')."</option>";
	    $idlang = (int)Configuration::get('PS_LANG_DEFAULT');
        foreach (self::getCMS($idlang) AS $k=>$v){
            if (Configuration::get('pshometabs')==$v['id_cms']){
                $selected='selected="yes"';
            } else {
                $selected='';
            }
            $options.="<option value=\"".$v['id_cms']."\" $selected>".$v['meta_title']."</option>";
        }
		$form='';
		return $form.'		
		<div style="diplay:block; clear:both; margin-bottom:20px;">
		</div>
		<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
            <fieldset style="position:relative; margin-bottom:10px;">
            <legend>'.$this->l('Select CMS page').'</legend>
            <div style="display:block; margin:auto; overflow:hidden; width:100%; vertical-align:top;">
                <label>'.$this->l('CMS Page').':</label>
                    <div class="margin-form" style="text-align:left;" >
                    <select name="pshometabs">'.$options.'
                    </select>
                </div>
                                          
                <div style="margin-top:20px; clear:both; overflow:hidden; display:block; text-align:center">
	               <input type="submit" name="module_settings" class="button" value="'.$this->l('save').'">
	            </div>
            </div>
            </fieldset>
		</form>';
	}   	
	 
	 
	 
	 
	
public function hookdisplayHomeTab($params)
{
	if (isset($this->context->controller->php_self) && $this->context->controller->php_self == 'index')
		$this->context->controller->addCSS($this->_path.'blocknewproducts.css', 'all');
    return $this->display(__FILE__, 'tab.tpl');
}
 
public function hookdisplayHomeTabContent($params)
{
$cms = new CMS(1, intval($cookie->id_lang));
if (Validate::isLoadedObject($cms))
$smarty->assign('content', $cms->content);
    return $this->display(__FILE__, 'tab_content.tpl');
}

} ?>  

tab.tpl

<li><a data-toggle="tab" href="#pshometabs" class="pshometabs">{l s='New Tab' mod='pshometabs'}</a></li>

tab_content.tpl

<div id="pshometabs">{$cms->content}</div>

Pufff la verdad que ya no se por donde tirar...

 

¿Algo de luz?

 

 

Gracias de antemano!!, Por supuesto cuando funcione el Modulo es POR Y PARA EL PUEBLO!!!

Link to comment
Share on other sites

  • nadie locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...