Jump to content

[solved] I Need Help On New Page In Front Office By My Module


fagottino

Recommended Posts

Hello everyone!

 

I'm creating a module on version 1.5.3 attached to the right column, the form is displayed and everything is ok.

 

But now I'm stuck on creating a page in the front office that displays all the products of my form.

 

Can you tell me how to create a new page? I saw that all pages "internal" (contacts, new products, etc.) use this type of link "index.php?controller=" .. How can I do to open a page of the "index.php?controller=my-page"?

 

Thanks to all who respond!

Link to comment
Share on other sites

this one should help you:

 

http://doc.prestasho...plateinthetheme

 

 

Hello vekia, thanks for the reply. I followed the guide and I did it, the page of my form is displayed.

 

Now my problem is this, "$ this->smarty->assign(array('my_key' => $my_key_array));"

 

$my_key_array fill it with some data of some products in my prestashop first to do smarty->assign.

 

But if in the file .php I add this "smarty->assign" on the front end page does not display anything: (

 

How can I pass this array to the tpl?

 

Paste a few lines to let you better understand:

 

This is the code of my-page.php

 

global $smarty;
include ('../../config/config.inc.php');
require_once ('../../init.php');
include( '../../header.php' );
$my_key_array = array("first" => "first", "second" => "second");
$smarty->assign (array ('my_key' => $my_key_array));
$smarty->display (dirname(__FILE__) . '/my-page.tpl');
include( '../../footer.php' );

 

This is the code of my-page.tpl

 

{capture name=path}{l s='My Page'}{/capture}
{include file="$tpl_dir./breadcrumb.tpl"}
<h1>{l s='Page of some product'}</h1>
{if $my_key}
 <div class="content_sortPagiBar">
   {include file="$tpl_dir./pagination.tpl"}
   <div class="sortPagiBar clearfix">
		{include file="$tpl_dir./product-sort.tpl"}
		{include file="$tpl_dir./product-compare.tpl"}
		{include file="$tpl_dir./nbr-product-page.tpl"}
   </div>
 </div>
 {include file="$tpl_dir./product-list.tpl" products=$my_key}
 <div class="content_sortPagiBar">
   <div class="sortPagiBar clearfix">
		 {include file="$tpl_dir./product-sort.tpl"}
		 {include file="$tpl_dir./product-compare.tpl"}
		 {include file="$tpl_dir./nbr-product-page.tpl"}
   </div>
 {include file="$tpl_dir./pagination.tpl"}
 </div>
{else}
 <p class="warning">{l s='No products at this moment.'}</p>
{/if}

 

 

Please, could you tell me what am I doing wrong?

 

Thank you very much, see you soon.

Edited by fagottino (see edit history)
Link to comment
Share on other sites

try to insert into tpl file this code:

 

{$my_key|print_r}

 

what have you got? nothing?

 

 

Hello vekia, thanks for the reply!

 

Ok it works, thanks to print_r I realized that the error in re-creating the object passed to the tpl files!

 

Thanks again, good day, see you soon!

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