Jump to content

Module independent page not displaying content


Theo13

Recommended Posts

Hello,

 

I'm having trouble to display content on an independent page for my module. When I test simple things, like text, there isn't any problem. But I want to create a Fancy Product Designer module, and to integrate it in this page.

 

I thought it was because of this kind of code :

<img src="images/basket/left_plain.png" title="1-Base" data-parameters='{"x": 300, "y": 300, "topped": true, "price": 20}' />

And of the custom tags (data-paremeters) but when I test locally by downloading the page and editing it it seems to work, so I don't know if it is a JavaScript problem...? Because I only get a blank page.

 

If someone could help me, it would be very appreciated, I'm struggling with it. I'm attaching a basic version without all the files that are not from the paid module.

customproduct.zip

 

Thank you very much !

Link to comment
Share on other sites

are you sure the urls are correct?

 

if you have

<img src="images/basket/left_plain.png" />

 

it will look for the images folder starting from the current folder

 

for example if you are on

"www.myshop.com/page/mypage"

it will look for images in

"www.myshop.com/page/images/basket/left_plain.png"

the same applies for scripts, css etc.. , in your module all your urls are like that..

 

you should use {$content_dir} before the url

Link to comment
Share on other sites

Okay, so the error is

 

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/var/www/prestashop/modules/customproduct/views/templates/front/details.tpl" on line 143 "<img src="modules/customproduct/images/basket/left_plain.png" title="1-Base" data-parameters='{"x": 300, "y": 300, "topped": true, "price": 20}' />" - Unexpected ": ", expected one of: "}" , " " , ATTR' in /var/www/prestashop/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:667 Stack trace: #0 /var/www/prestashop/tools/smarty/sysplugins/smarty_internal_templateparser.php(3144): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 /var/www/prestashop/tools/smarty/sysplugins/smarty_internal_templateparser.php(3209): Smarty_Internal_Templateparser->yy_syntax_error(2, ': ') #2 /var/www/prestashop/tools/smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparse in/var/www/prestashop/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 667

 

So the problem is the data-paremeters on this line.

<img src="modules/customproduct/images/basket/left_plain.png" title="1-Base" data-parameters='{"x": 300, "y": 300, "topped": true, "price": 20}' />

But it is essential to make the module work. Do you know if there a way to make this work?

Thanks!

Link to comment
Share on other sites

it's probably the curly brackets confusing smarty, are you storing a json object in the data-parameters?

 

you can try swapping the curly brackets with {rdelim} and {ldelim}

 

{rdelim}"x": 300, "y": 300, "topped": true, "price": 20{ldelim}

Link to comment
Share on other sites

  • 2 weeks later...

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