Jump to content

Problems with Multiple Categories Blocks module - smarty error in template


manu1987

Recommended Posts

Hello,

 

I have an error with the Multiple Categories Blocks module in connection with the smarty template engine. I don't know how to fix it. I explain it as brief as possible:

 

- Multiple Categories Blocks version: 1.4.1.2

 

- Error description in error_log:

PHP Warning:  Illegal string offset 'id' in .../cache/smarty/compile/1d/ab/6d/....file.multicatblock.tpl.php on line 90

 

- Smarty settings in prestashop: "Never recompile template files", Cache = Yes

 

Line 90 of the compiled template tpl-file:

<?php if ($_smarty_tpl->tpl_vars['ooocat']->value['id']==$_smarty_tpl->tpl_vars['parents']->value['id_category']) {?>
<?php $_smarty_tpl->tpl_vars['is_in_subcategories'] = new Smarty_variable(1, null, 0);?>
<?php }?>

 

- it looks like $ooocat is not an array which has an element with index 'id'. It is a string

 

- This error appeared since I installed the module (I compared the dates)

 

- Every time I click on a category this error is written in the error_log about 15 times. The module works fine but I would like this error to be removed because it creates a huge error log file after time and maybe it slows down the server.

 

 

Does anybody has a solution to it? I am not a programmer but I would be able to implement some code on certain lines in certain files.

Link to comment
Share on other sites

I contacted that support e-mail address but I did not get a reply. I could not figure out where exactly I have to include the 'var_dump($ooocat)' in the code. The problem is I cannot see very clearly where the $ooocat variable is assigning its data, e.g. $ooocat = ... as explained.

 

This is the relevant code from multicatblock.php (I copied only the parts where similar words to 'ooocat' appeared). Note that I cannot find the variable 'ooocat' in this code. I could only find the variable in the second code further below.

class multicatblock extends ObjectModel {

        public $id_block;
        public $oocats;
    public $oocats_method;
    public $oocategories;

        public static $definition = array(
                  'table'         => 'cb',
                  'primary'         => 'id_block',
                  'multilang' => true,
                 'fields' => array(
                           'id_block' => array('type' => ObjectModel :: TYPE_INT),
            'oocats' => array('type' => ObjectModel :: TYPE_BOOL),
            'oocats_method' => array('type' => ObjectModel :: TYPE_BOOL),
            'oocategories' => array('type'=> ObjectModel :: TYPE_STRING),
                  ),
        );

    public function __construct($id_block = null, $id_lang = null, $id_shop = null){
                parent::__construct($id_block, $id_lang, $id_shop);
        }


}

The following is from multicatblock.tpl (I copied the part where the variable 'ooocat' appears). The exactly same code is also found in another file. There are no other files where the variable 'ooocat' appears.

{if $mcb_block.oocats==1 && $mcb_block.oocats_method==2}
    {if isset($smarty.get.id_category)}
        {foreach from=$mcb_block.oocategories_array item=oocat}
            {foreach from=$mcb_block.blockCategTree item=ooocat}
                {if $mcb_block.parent_current!=1}
                  {if $smarty.get.id_category==$mcb_block.blockCategTree.id}
                      {assign var='is_in_subcategories' value=1}
                  {/if}
                {else}
                  {if $smarty.get.id_category==$ooocat && in_array($smarty.get.id_category, $mcb_block.oocategories_array)}
                      {assign var='is_in_subcategories' value=1}
                  {/if}
                {/if}

                {foreach from=multicatblocks::getParentsCategories($smarty.get.id_category) item=parents}
                    {if count($ooocat)>1}
                    {foreach from=$ooocat item=oooocat}
                         {if $oooocat['id']==$parents.id_category || in_array($parents.id_category, $mcb_block.oocategories_array)}
                             {assign var='is_in_subcategories' value=1}
                         {/if}
                    {/foreach}
                    {/if}
                    {if $ooocat['id']==$parents.id_category}
                        {assign var='is_in_subcategories' value=1}
                    {/if}
                {/foreach}
            {/foreach}
        {/foreach}

I would appreciate some help with this :)

Link to comment
Share on other sites

Hi,

 

I need help with categories setup. I get this error and blank page;

 

Strict Standards: Declaration of Dispatcher::loadRoutes() should be compatible with DispatcherCore::loadRoutes($id_shop = NULL) in /var/zpanel/hostdata/chicnluxury/public_html/chic-n-luxury_com/override/classes/Dispatcher.php on line 0

Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /var/zpanel/hostdata/chicnluxury/public_html/chic-n-luxury_com/override/controllers/admin/AdminCategoriesController.php on line 4

 

Could you help me?

 

Thanks in advance

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...