Jump to content

Recommended Posts

Hi all,

 

I need to get $product variable from a product Id on my tpl.

 

I've tried smarty:

{assign var=$product value=$banditQuotes[nr].quote_product_link}

I've tried php on the page:

<?php $product = new Product (int)$banditQuotes[nr].quote_product_link?>

I've tried a function in the php controller page, that takes the id, and returns $product.

{$product = quoteProduct($banditQuotes[nr].quote_product_link)}

But none of these functions are recognised when loading the web page.

 

 

Does anyone know how I can do this?

 

I assume I can use the getProduct function somehow ?  :wacko:

 

 

Thanks all!

 

Simon

Link to comment
Share on other sites

can not use it, could you use to ajax to get id_product when you clicked or your page load

 

Thanks for the reply!

 

I can't, that would load just one product. I have an array of records which have the product ids.

 

And I'm trying to load the product image for each product id. So I need to get the product for each record.

 

Record with product id

   - Product Image

Record with product id

   - Product Image

Record with product id

   - Product Image

 

 

According to smarty 3 you can call the php function directly?? But that doesn't work!

 

So I thought I had to register the function - as I was getting 'function not recognised'

$this->context->smarty->registerPlugin("function","quoteProduct", "quoteProduct");

But that gives another error!!

 

Uncaught --> Smarty: Plugin "quoteProduct" not callable

 

 

Any ideas??

 

Thanks!

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