Jump to content

How to add price to Viewed products block


Recommended Posts

  • 2 years later...

Hello,

 

modules/blockviewed/blockviewed.php->hookRightColumn(){

...

$productsViewedObj = array();

foreach ($productsViewed AS $productViewed)

{

$obj = (object)'Product';

if (!isset($productsImagesArray[$productViewed]) || (!$obj->active = $productsImagesArray[$productViewed]['active']))

continue;

else

{

$obj->id = (int)($productsImagesArray[$productViewed]['id_product']);

$product_obj = new Product($obj->id);

$obj->cover = (int)($productsImagesArray[$productViewed]['id_product']).'-'.(int)($productsImagesArray[$productViewed]['id_image']);

$obj->legend = $productsImagesArray[$productViewed]['legend'];

$obj->name = $productsImagesArray[$productViewed]['name'];

$obj->description_short = $productsImagesArray[$productViewed]['description_short'];

$obj->link_rewrite = $productsImagesArray[$productViewed]['link_rewrite'];

$obj->category_rewrite = $productsImagesArray[$productViewed]['category_rewrite'];

$obj->product_obj_price = $product_obj->price;

 

if (!isset($obj->cover) || !$productsImagesArray[$productViewed]['id_image'])

{

$obj->cover = $defaultCover;

$obj->legend = '';

}

$productsViewedObj[] = $obj;

}

}

...

}

Now in blockviewed.tpl you should refer to the field product_obj_price, object productsViewedObj. If you need to take into account taxes, sales (price reduction), then you need to modify the code above following the example of function Product :: getPriceStatic ()

 

Best regards

Link to comment
Share on other sites

  • 4 months later...

Hello valerie_BelVG,

 

Thanks you for your answer. But it's possible to give me a example how do you make to display the reduce price? Because i try it for a day and i don't found the solution.

 

Thank's a lot and Best regards.

Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...