Getting the Prices of a Product

  • Posts: 10
  • Thank you received: 0
9 years 10 months ago #185697

-- HikaShop version -- : latest
-- Joomla version -- : latest
-- PHP version -- : latest
-- Browser(s) name and version -- : modern html 5 browser

Hello Everybody,

I am about to create a View for a certain product collection… Well, I could manage to retrive the list of products from the database, so I have each nessesary »product_id«.

Is there a function I can use to get the prices of each Product, or do I have to code that myself?

Have a look at the attachment, I am interessted in the Prices Array, how can I get that?

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
9 years 10 months ago #185713

Hi,

Once you have the product data in a $product variable you can use that code:

<?php
$productClass = hikashop_get('class.product');
$ids = array($product->product_id);
$config = hikashop_config();
$main_currency = $config->get('main_currency');
$discount_before_tax = $config->get('discount_before_tax');
$productClass->getPrices($product, $ids,hikashop_getCurrency(), $main_currency, hikashop_getZone(), $discount_before_tax);
var_dump($product->prices);
?>

Please Log in or Create an account to join the conversation.

Time to create page: 0.065 seconds
Powered by Kunena Forum