Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

 
Reply
   X-Cart forums > News and Announcements
 
Thread Tools
  #41  
Old 06-17-2015, 04:36 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

Thank you
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #42  
Old 06-17-2015, 05:16 AM
 
aim aim is offline
Advanced Staff Users
 

X-Cart team
  
Join Date: Dec 2008
Posts: 928
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

Quote:
Originally Posted by cflsystems
Am I missing something here or is this a bug in XC or Smarty 3

Smarty 3 eval fails if the text to evaluate has double quotes in it.

It took me some good time to find out why SmackDigital Dynamic Tabs module results in blank page, and XC static pages as well.

They all trying to eval text which looks like this for example

------------------------------------------
This is just a simple text using "quotes".
------------------------------------------

This will result in PHP Fatal error: Uncaught --> Smarty Compiler: Syntax error in template....

Replacing " with ' works but this should not happening in the first place. Using str_replace on the variable is my workaround for now but again this is ugly way of fixing the problem as it may show elsewhere as well.

QT - anything on this?


static_page_eval_quotes.diff has been uploaded.

smarty3 calls pre/post/output filters for the {eval} tag.

The recommended solution for custom pre/post/output filters is using a condition like this

Code:
function x_mc_remove_currency_options($tpl_source, $smarty) { if ('admin/main/configuration.tpl' == $smarty->template_resource) { .......... $tpl_source = some_func($tpl_source); .......... } return $tpl_source; }
Attached Files
File Type: diff static_page_eval_quotes.diff (540 Bytes, 8 views)
__________________
Sincerely yours,
Ildar Amankulov
Head of Maintenance group
Reply With Quote
  #43  
Old 06-17-2015, 06:38 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

I don't understand what this has to do with the xAuth module. This module may or may not be included and may or may not be setup even if activated.

And I did install this patch just to prove it doesn't work.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #44  
Old 06-17-2015, 10:21 PM
 
aim aim is offline
Advanced Staff Users
 

X-Cart team
  
Join Date: Dec 2008
Posts: 928
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

Quote:
Originally Posted by cflsystems
I don't understand what this has to do with the xAuth module. This module may or may not be included and may or may not be setup even if activated.

And I did install this patch just to prove it doesn't work.

The original pre-filter was

Code:
function x_tpl_prefilter($source, &$smarty) { return '{if $x_core_started}{xevent name="before" tpl="' . $smarty->template_resource . '"}{/if}' . $source . '{if $x_core_started}{xevent name="after" tpl="' . $smarty->template_resource . '"}{/if}'; }


The template for {eval} is
Code:
This is just a simple text using "quotes"


The resulted compiled template for {eval} was (which was wrong)
Code:
<?php if ($_smarty_tpl->tpl_vars['x_core_started']->value) { echo x_tpl_fire_event(array('name'=>"before",'tpl'=>"eval:This is just a simple text using "quotes""),$_smarty_tpl); }?> This is just a simple text using "quotes" <?php if ($_smarty_tpl->tpl_vars['x_core_started']->value) { echo x_tpl_fire_event(array('name'=>"after",'tpl'=>"eval:This is just a simple text using "quotes""),$_smarty_tpl); }?><?php }} ?>


This is unexpected behavior for the x_tpl_prefilter pre-filter

The expected compiled code is something like

Code:
<?php if ($_smarty_tpl->tpl_vars['x_core_started']->value) { echo x_tpl_fire_event(array('name'=>"after",'tpl'=>"modules/Special_Offers/customer/new_offers_message.tpl"),$_smarty_tpl); }?><?php }} ?>
__________________
Sincerely yours,
Ildar Amankulov
Head of Maintenance group
Reply With Quote
  #45  
Old 06-17-2015, 10:24 PM
 
aim aim is offline
Advanced Staff Users
 

X-Cart team
  
Join Date: Dec 2008
Posts: 928
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

The wrong php code is
Code:
echo x_tpl_fire_event(array('name'=>"before",'tpl'=>"eval:This is just a simple text using "quotes""),$_smarty_tpl);
__________________
Sincerely yours,
Ildar Amankulov
Head of Maintenance group
Reply With Quote
  #46  
Old 06-18-2015, 05:11 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

I am not sure I follow. The patch you provided static_page_eval_quotes.diff modifies xAuth module. This module is not in use, it is not setup and its code does nto run.
So how this solves the problem site wide or for static pages?

I installed the patch. Going to a static page results in same blank page with same error - because the patch you provided is not for static pages and it doesn't fix anything there.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #47  
Old 06-18-2015, 05:19 AM
 
aim aim is offline
Advanced Staff Users
 

X-Cart team
  
Join Date: Dec 2008
Posts: 928
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

Which modules do you use?
What is in your error logs?
__________________
Sincerely yours,
Ildar Amankulov
Head of Maintenance group
Reply With Quote
  #48  
Old 06-18-2015, 05:35 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

Forget modules. Stock XC. I can't show you this on the XC demo as it will not allow me to create/modify static page.
Create static page. Use double quotes in the text. Make sure " Parse Smarty tags in the content of embedded pages " option is active. Go to store fornt and try to access the static page. It results in the error I mentioned. This has nothing to do with any module. It is strictly the smarty {eval} and the value passed to it not being escaped.

If you use single quotes all works ok. If the " Parse Smarty tags in the content of embedded pages " option is not active all works ok. If the double quotes are replaced by their html coding all works ok.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #49  
Old 06-25-2015, 10:59 PM
 
aim aim is offline
Advanced Staff Users
 

X-Cart team
  
Join Date: Dec 2008
Posts: 928
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

Quote:
Originally Posted by cflsystems
Am I missing something here or is this a bug in XC or Smarty 3

Smarty 3 eval fails if the text to evaluate has double quotes in it.

It took me some good time to find out why SmackDigital Dynamic Tabs module results in blank page, and XC static pages as well.

They all trying to eval text which looks like this for example

------------------------------------------
This is just a simple text using "quotes".
------------------------------------------

This will result in PHP Fatal error: Uncaught --> Smarty Compiler: Syntax error in template....

Replacing " with ' works but this should not happening in the first place. Using str_replace on the variable is my workaround for now but again this is ugly way of fixing the problem as it may show elsewhere as well.

QT - anything on this?


https://forum.x-cart.com/showpost.php?p=388007&postcount=115
__________________
Sincerely yours,
Ildar Amankulov
Head of Maintenance group
Reply With Quote
  #50  
Old 07-26-2015, 09:54 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: X-Cart 4.7 beta:new skin, in-context checkout, custom order statuses, Smarty v3

Finding another issue with static pages and in general with the whole site - language variables.
Current store I am working on has about 8000 of them. On any given page only about 100 are being assigned to smarty and can be used in templates. None of the ones used in static pages from the old store work with the new one - they are just not in the $lng array.

Where is all this being assigned? Does it use some sort of cache? And how come only 100, give or take, are included in $lng array no matter which page is loaded?
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > News and Announcements



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:57 AM.

   

 
X-Cart forums © 2001-2020