Jump to content

Edit History

JSilva

JSilva

Hi,

i've solved but know i need change it, and that change is not function...

 

This is in Product.php

public static function teste($id_product){

//    $sql = 'SELECT count(*) AS count FROM `ps_product` WHERE  `id_product`='.(int)$id_product;
    $sql = 'SELECT id_product_1 AS prod FROM `ps_accessory` WHERE  `id_product_2`='.(int)$id_product;
    $result = Db::getInstance()->getRow($sql);
//    return  $result['count'];
    return $result['prod'];
}

 

and in catalog/product.tpl

{Product::teste(Tools::getvalue('id_product'))}

{$link->getProductLink({Product::teste(Tools::getvalue('id_product'))}, $smarty.get.id_product.link_rewrite)|escape:'htmlall':'UTF-8'}

 

thid function very well.

But when i want to do the some in catalog/_partials/miniatures/product.tpl

{Product::teste(Tools::getvalue('id_product'))}  

 

this return empty. Also echo test words in method, and those word appear on screen, and the variable $id_product is always empty. 

 

anyone know why?

 

Regards

JSilva

JSilva

Hi,

i've solved but know i need change it, and that change is not function...

 

This is in Product.php

public static function teste($id_product){

//    $sql = 'SELECT count(*) AS count FROM `ps_product` WHERE  `id_product`='.(int)$id_product;
    $sql = 'SELECT id_product_1 AS prod FROM `ps_accessory` WHERE  `id_product_2`='.(int)$id_product;
    $result = Db::getInstance()->getRow($sql);
//    return  $result['count'];
    return $result['prod'];
}

 

and in catalog/product.php

{Product::teste(Tools::getvalue('id_product'))}

{$link->getProductLink({Product::teste(Tools::getvalue('id_product'))}, $smarty.get.id_product.link_rewrite)|escape:'htmlall':'UTF-8'}

 

thid function very well.

But when i want to do the some in catalog/_partials/miniatures/product.tpl

{Product::teste(Tools::getvalue('id_product'))}  

 

this return empty. Also echo test words in method, and those word appear on screen, and the variable $id_product is always empty. 

 

anyone know why?

 

Regards

JSilva

JSilva

Hi,

i've solved but know i need change it, and that change is not function...

 

This is in Product.php

public static function teste($id_product){

//    $sql = 'SELECT count(*) AS count FROM `ps_product` WHERE  `id_product`='.(int)$id_product;
    $sql = 'SELECT id_product_1 AS prod FROM `ps_accessory` WHERE  `id_product_2`='.(int)$id_product;
    $result = Db::getInstance()->getRow($sql);
//    return  $result['count'];
    return $result['prod'];
}

 

and in catalog/product.php

{Product::teste(Tools::getvalue('id_product'))}

{$link->getProductLink({Product::favcount(Tools::getvalue('id_product'))}, $smarty.get.id_product.link_rewrite)|escape:'htmlall':'UTF-8'}

 

thid function very well.

But when i want to do the some in catalog/_partials/miniatures/product.tpl

{Product::teste(Tools::getvalue('id_product'))}  

 

this return empty. Also echo test words in method, and those word appear on screen, and the variable $id_product is always empty. 

 

anyone know why?

 

Regards

×
×
  • Create New...