Article ID: 117005, created on Aug 29, 2013, last review on Sep 12, 2014

  • Applies to:
  • Business Automation 5.5
  • Business Automation 5.4

Symptoms

Online Store Customization pre-check fails during upgrade to PBA 5.5.

Cause

The problem occurs because new smarty does not allow using the {php} tag any longer.

Resolution

Existing templates, customized using php code, require editing - php code fragments must be transformed into custom plug-ins and then called from the template. To get the list customized templates you can use the following command:

cd /usr/local/bm/templatestore/cache/<Store_ID>/templates
grep "{php}" *

The path for Windows (default location) is: C:\Program Files\Parallels\PBA\templatestore

Note: the templates must be edited in UI (Products > Online Store > Layout Template and click on the respective template name).

Detailed instructions how to modify customized templates are provided below:

  1. Create the function.<name_of_the_function>.inc file in the /usr/local/bm/templatestore/libs/3rdparties/plugins/ directory. The <name_of_the_function> will be further used in smarty templates.

    Windows path (by default) is C:\Program Files\Parallels\PBA\templatestore\libs\3rdparties\plugins\

  2. Set 'apache' as the owner of this file, granting it READ and EXECUTE rights. For Windows, give the same permissions for users IIS_IUSRS and IUSR.

  3. Declare the function in the created file and move your code from {php}{/php}:

    function smarty_function_<name_of_the_function>($params, $template)
    {
    ... your_code_from_{php}{/php}_must_be_here...
    }
    

    $params is an array that contains all attributes passed from the template to template function.

  4. The smarty template must call the created function as follows:

    {<name_of_the_function>  param1=value1 param2=value2 ... paramN=valueN}
    

  5. After PBA upgrade to 5.5.x rename function.<name_of_the_function>.inc to function.<name_of_the_function>.php (for plugin to work with new Smarty).
Example:

A smarty template which included the following php code:

{php}
$cookie_name = $this->get_template_vars("cookie_name");
if ($_COOKIE[$cookie_name) {
$this->assign('enabled_resources', unserialize($_COOKIE['enabled_resources']));
}
{/php}

must be rewritten as a custom plug-in /usr/local/bm/templatestore/libs/3rdparties/plugins/function.cookies.php:

<?php
  function smarty_function_cookies($params, $template) {
    if ($_COOKIE[$params["cookie_name"]]) {
      $template->assign($params['assign'], unserialize($_COOKIE[$params["cookie_name"]]));
    } 
  }
?>

and should be called from the smarty template:

{cookies assign="enabled_resources" cookie_name=$cookie_name}

For more information on custom plug-ins refer to http://www.smarty.net/docs/en/plugins.tpl

Note: if you followed all the steps of current instruction, and your online store doesn't work , the problem can lie in syntax errors. Check the error log for details.

On Linux: /var/log/httpd/error_log

On Windows: Value of parameter error_log (default: C:\Windows\temp\php-errors.log) in php.ini

801221f8cd76fba7300d1e6817c8e08b caea8340e2d186a540518d08602aa065 198398b282069eaf2d94a6af87dcb3ff 92711db0799e8aefe8e51f12dace0496 210d017ddc3a076d22f0f865b1cf0730 e12cea1d47a3125d335d68e6d4e15e07

Email subscription for changes to this article
Save as PDF