Jump to content

Retrieve data from SQL db


Recommended Posts

Hello,

 

I added a column Price2 in ps_product

 

what are the step to retrieve data from the sql db, put it in a variable to be use on the front site ?

 

I searched fo any instenciation section from SQL but I didn't find it

 

I really want to perform this use

 

Please if anyone can help,

 

thank you

Link to comment
Share on other sites

there is steps to implement your function

1. In /classes/Product.php add follwing line

 

public $price2;

 

2. In same file add follwing line in side function getFields()

 

$fields['price2'] = (float)($this->price2);

 

3. Load product by ID

 

$product = new Product($id_product)

 

4. use it in PHP file

$product->price2

 

5. use in theme files .tpl file

{$product->price2}

Link to comment
Share on other sites

×
×
  • Create New...