Misa Amane Posted July 5, 2016 Share Posted July 5, 2016 (edited) Hi, I included contact-form.tpl inside the file cms.tpl. I added a condition to display it in the right page. Until this point everything is okey. But the problem is about these lines : <select id="id_contact" class="form-control" name="id_contact"> <option value="0">{l s='-- Choose --'}</option> {foreach from=$contacts item=contact} <option value="{$contact.id_contact|intval}"{if isset($smarty.request.id_contact) && $smarty.request.id_contact == $contact.id_contact} selected="selected"{/if}>{$contact.name|escape:'html':'UTF-8'}</option> {/foreach} </select> $contact seems to be empty so nothing appear. Is there anyway to loop on contacts i added in the back office : Customer > Contacts ? btw this form work on the page contact but not on this one. I use presta 1.6 Edited July 5, 2016 by guillaume hammouti (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted July 6, 2016 Share Posted July 6, 2016 Assuming you're using PrestaShop v1.6, create override/controllers/front/CmsController.php with the following code: <?php class CmsController extends CmsControllerCore { function initContent() { parent::initContent(); $this->context->smarty->assign('contacts', Contact::getContacts($this->context->language->id)); } } Remember to go to Advanced Parameters > Performance and then click the "Clear cache" button after creating this file (or manually delete cache/class_index.php). Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now