Jump to content

id image in file tpl


feof84

Recommended Posts

hi,

a member of this forum has helped me to write a tpl file, but now I have a problem.

 

In the tpl file I get the image id but the value is always empty.

 

 

<?php

global $smarty;

include('../../config/config.inc.php');

include('../../header.php');

 

 

$product_list = Product::getProducts($cookie->id_lang, 0,0, 'id_product', 'ASC', 60, true);

$smarty->assign('products', $product_list );

$smarty->display(dirname(__FILE__).'/mymodule_page.tpl');

 

 

in file tpl:

<img src="{$link->getImageLink($product->link_rewrite, $product->id_image, 'home')}"

 

$product->id_image is empty.

 

help me, please!

Link to comment
Share on other sites

hi,

a member of this forum has helped me to write a tpl file, but now I have a problem.

 

In the tpl file I get the image id but the value is always empty.

 

 

<?php

global $smarty;

include('../../config/config.inc.php');

include('../../header.php');

 

 

$product_list = Product::getProducts($cookie->id_lang, 0,0, 'id_product', 'ASC', 60, true);

$smarty->assign('products', $product_list );

$smarty->display(dirname(__FILE__).'/mymodule_page.tpl');

 

 

in file tpl:

<img src="{$link->getImageLink($product->link_rewrite, $product->id_image, 'home')}"

 

$product->id_image is empty.

 

help me, please!

 

 

Hi.

 

The function returns an array. The code you are using in the TPL file applies for objects. Also, the SQL query in the function does not retrieve image information.

 

Regards.

 

Robin.

 

The CartExpert Team

Link to comment
Share on other sites

in file php:

 

$product_list = Product::getProducts($cookie->id_lang, 0,0, 'id_product', 'ASC', 60, true);

$smarty->assign('products', $product_list );

in file tpl:

<h5><a href="{$product.link}" title="{$product.name|truncate:32:'...'|escape:'htmlall':'UTF-8'}">

 

the link of the product:

http://127.0.0.1/mytshirt/modules/mymodule/mymodule_page.php

 

if instead use

<a href="{$link->getProductLink($produtct.id_product)}"

the link is corret.

 

 

 

I still can not see the image of the product

  • Like 1
Link to comment
Share on other sites

in file php:

 

$product_list = Product::getProducts($cookie->id_lang, 0,0, 'id_product', 'ASC', 60, true);

$smarty->assign('products', $product_list );

in file tpl:

<h5><a href="{$product.link}" title="{$product.name|truncate:32:'...'|escape:'htmlall':'UTF-8'}">

 

the link of the product:

http://127.0.0.1/myt...module_page.php

 

if instead use

<a href="{$link->getProductLink($produtct.id_product)}"

the link is corret.

 

 

 

I still can not see the image of the product

 

Hi.

 

You mean the product and image links are not correct?

 

Regards.

 

Robin.

 

The CartExpert Team

Link to comment
Share on other sites

Hi Feof84

As Cartexpert wrote, in tpl you can refer to an

Object :

{$produtct.id_product}

 

Or an Array :

{$produtct.['id_product']}

 

 

also

http://127.0.0.1/myt...module_page.php

Refer to a local ip on your computer, which is unreachable through web. ;)

 

You are near the solution, go on.

Regards

Link to comment
Share on other sites

yes exactly.

 

you tell me I'm wrong because I use arrays instead of objects.

how should I do?

 

Hi.

 

This is incorrect: <a href="{$link->getProductLink($produtct.id_product)}"

You misspelled '$produtct'.

 

The HTML / Smarty code for the image is: {$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}

 

Regards.

 

Robin.

 

The CartExpert Team

Link to comment
Share on other sites

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