Jump to content

Fatal Error: Call To A Member Function Getprice() On A Non-Object In... (Prestashop 1.6.1.2)


Mistersvapo

Recommended Posts

Ciao a tutti, ho bisogno del vostro aiutoooooo...ieri ho aggiornato Prestashop alla versione stabile 1.6.1.2, (con il quale ho risolto il problema dei pulsanti "salva e rimani" e "salva" che caricavano all'infinito), oggi ho caricato i nuovi prodotti, ma quando i clienti che visitano il sito cliccano su uno di questi nuovi prodotti compare il seguente errore "Fatal error: Call to a member function getPrice() on a non-object in /home/nome_sito/public_html/cache/smarty/compile/e5/cf/16/e5cf163ebcfc8fe308518045508fa74f9fd4ad5a.file.product_tab_content.tpl.php on line 39" , ho provato a caricare i prodotti sia importandoli dal file excel (come ho sempre fatto) sia caricandoli manualmente, ma l'errore è presente in entrambi i casi. Non riesco a capire da cosa possa dipendere visto che il caricamento e l'aggiornamento di questi prodotti nel back office va sempre a buon fine, può essere un bug della versione 1.6.1.2 ?. Vi riporto di seguito il file php in questione:

 

<?php /* Smarty version Smarty-3.1.19, created on 2015-11-24 12:23:45
         compiled from "/home/nomesito/public_html/modules/prestamusicshop/views/templates/front/product_tab_content.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1185831637565448c1efbbe2-86394108%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' =>
  array (
    'e5cf163ebcfc8fe308518045508fa74f9fd4ad5a' =>
    array (
      0 => '/home/nomesito/public_html/modules/prestamusicshop/views/templates/front/product_tab_content.tpl',
      1 => 1431558467,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1185831637565448c1efbbe2-86394108',
  'function' =>
  array (
  ),
  'variables' =>
  array (
    'modules_dir' => 0,
    'priceDisplayPrecision' => 0,
    'priceDisplay' => 0,
    'product' => 0,
    'product_mp3' => 0,
    'items' => 0,
    'assoc_increment' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.19',
  'unifunc' => 'content_565448c206eac0_57287946',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_565448c206eac0_57287946')) {function content_565448c206eac0_57287946($_smarty_tpl) {?>
<script src='<?php echo $_smarty_tpl->tpl_vars['modules_dir']->value;?>
prestamusicshop/js/soundmanager2en.js' type='text/javascript'></script>
<?php if (!isset($_smarty_tpl->tpl_vars['priceDisplayPrecision']->value)) {?>
        <?php $_smarty_tpl->tpl_vars['priceDisplayPrecision'] = new Smarty_variable(2, null, 0);?>
<?php }?>
<?php if (!$_smarty_tpl->tpl_vars['priceDisplay']->value||$_smarty_tpl->tpl_vars['priceDisplay']->value==2) {?>
    <?php $_smarty_tpl->tpl_vars['productPrice'] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value->getPrice(true,@constant('NULL'),$_smarty_tpl->tpl_vars['priceDisplayPrecision']->value), null, 0);?>
    <?php $_smarty_tpl->tpl_vars['productPriceWithoutReduction'] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value->getPriceWithoutReduct(false,@constant('NULL')), null, 0);?>
<?php } elseif ($_smarty_tpl->tpl_vars['priceDisplay']->value==1) {?>
    <?php $_smarty_tpl->tpl_vars['productPrice'] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value->getPrice(false,@constant('NULL'),$_smarty_tpl->tpl_vars['priceDisplayPrecision']->value), null, 0);?>
    <?php $_smarty_tpl->tpl_vars['productPriceWithoutReduction'] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value->getPriceWithoutReduct(true,@constant('NULL')), null, 0);?>
<?php }?>
<script>
function checkIfIncluded(file) {
    var links = document.getElementsByTagName("link");
    for(var i = 0; i < links.length; i++) {
        if (links.href.substr(-file.length) == file)
            return true;
    }

    var scripts = document.getElementsByTagName("script");
    for(var i = 0; i < scripts.length; i++) {
        if (scripts.src.substr(-file.length) == file)
            return true;
    }

    return false;
}
function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}
$(document).ready(function(){
    if(checkIfIncluded("soundmanager2.js")){
        $("script[src=soundmanager2en.js]").remove()
        loadjscssfile("<?php echo $_smarty_tpl->tpl_vars['modules_dir']->value;?>
prestamusicshop/css/mp3-player-button-tab.css", "css") //dynamically load and add this .css file
        loadjscssfile("<?php echo $_smarty_tpl->tpl_vars['modules_dir']->value;?>
prestamusicshop/js/mp3-player-button.js", "js") //dynamically load and add this .js file
    }else{
        //loadjscssfile("<?php echo $_smarty_tpl->tpl_vars['modules_dir']->value;?>
prestamusicshop/js/soundmanager2.js", "js")
        loadjscssfile("<?php echo $_smarty_tpl->tpl_vars['modules_dir']->value;?>
prestamusicshop/css/mp3-player-button-tab.css", "css")
        loadjscssfile("<?php echo $_smarty_tpl->tpl_vars['modules_dir']->value;?>
prestamusicshop/js/mp3-player-button.js", "js")
    }
})
</script>
<h3 id="" class="idTabHrefShort page-product-heading"><?php echo smartyTranslate(array('s'=>'TRACKS'),$_smarty_tpl);?>
</h3>
<?php $_smarty_tpl->tpl_vars["assoc_increment"] = new Smarty_variable(1, null, 0);?>
<?php  $_smarty_tpl->tpl_vars['items'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['items']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['product_mp3']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['items']->key => $_smarty_tpl->tpl_vars['items']->value) {
$_smarty_tpl->tpl_vars['items']->_loop = true;
?>
    <p class="music_shop_item">
        <a href="<?php echo $_smarty_tpl->tpl_vars['modules_dir']->value;?>
prestamusicshop/mp3/<?php echo $_smarty_tpl->tpl_vars['items']->value['mp3_name'];?>
" title="<?php echo $_smarty_tpl->tpl_vars['items']->value['author'];?>
-<?php echo $_smarty_tpl->tpl_vars['items']->value['mp3_title'];?>
" class="sm2_button"><?php echo $_smarty_tpl->tpl_vars['items']->value['author'];?>
-<?php echo $_smarty_tpl->tpl_vars['items']->value['mp3_title'];?>
</a>
        <span class="music_title "><?php echo $_smarty_tpl->tpl_vars['assoc_increment']->value;?>
. <?php echo $_smarty_tpl->smarty->registered_plugins[smarty::PLUGIN_MODIFIER]['truncate'][0][0]->smarty_modifier_truncate($_smarty_tpl->tpl_vars['items']->value['author'],45);?>
-<?php echo $_smarty_tpl->smarty->registered_plugins[smarty::PLUGIN_MODIFIER]['truncate'][0][0]->smarty_modifier_truncate($_smarty_tpl->tpl_vars['items']->value['mp3_title'],45);?>
</span>
        <?php echo $_smarty_tpl->tpl_vars['items']->value['linked_digital_id'];?>

        <?php if ($_smarty_tpl->tpl_vars['items']->value['linked_digital_id']=='') {?>
        <?php } else { ?>
        
        <?php }?>
    </p>
<?php $_smarty_tpl->tpl_vars['assoc_increment'] = new Smarty_variable($_smarty_tpl->tpl_vars['assoc_increment']->value+1, null, 0);?>
<?php } ?><?php [spam-filter] ?>
 
 
Ringrazio anticipatamente chiunque potrà aiutarmi a risolvere il problema!

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