Jump to content

Blockcontactinfos on contact-form.tpl


Katia Smet

Recommended Posts

Hi

 

I would like to customize my contact-page. Therefore I would like to display 2 extra modules. 1 before the contactform: blockcontactinfos and 1 after the contactform: blockcmsinfo. 

 

I could include those tpl but he can't find the php-variables. How do I send the php variables to contact-form.tpl ? 

 

Error code:

 

Notice: Undefined index: blockcontactinfos_company in /Applications/MAMP/htdocs/BVN/cache/smarty/compile/d5/68/76/d56876ff0f015b0f0ee84c6aa8802bb325ac00b1.file.blockcontactinfos.tpl.phpon line 36

{include file="$tpl_dir./modules/blockcontactinfos/blockcontactinfos.tpl"}

//contact form code

{include file="$tpl_dir./modules/blockcmsinfo/blockcmsinfo.tpl"}
Edited by Katia Smet (see edit history)
Link to comment
Share on other sites

Assuming you're using PrestaShop v1.6, you should be able to create override/controllers/front/ContactController.php with something like the following:

<?php

class ContactController extends ContactControllerCore
{
    public function initContent()
    {
        parent::initContent();

        $this->context->smarty->assign('blockcontactinfos_company', Configuration::get('BLOCKCONTACTINFOS_COMPANY'));
    }
}

This will create a new variable {$blockcontactinfos_company} you can use in contact-form.tpl.

Link to comment
Share on other sites

This does not work because the variable is empty. I cannot override it, it's ignored. I can only put this in the original controller and this variable is empty.

I configured my modules like contact infos for my footer. Now i would like to access this information in a contact page. How can I acces this information? 

Link to comment
Share on other sites

Strange. I just tested the code on my PrestaShop v1.6.1.6 website and it displays "My Company" on the contact page. Did you go to Advanced Parameters > Performance and click "Clear cache" or delete cache/class_index.php from your server? That should force PrestaShop to find the override.

 

Also, go to Modules > Contact information block > Configure and make sure you have something entered in the "Company name" field, then click the "Save" button.

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...