Loading price of a product to a different module

  • Posts: 7
  • Thank you received: 0
7 years 7 months ago #248859

Hi, iam developing just small module for our hikashop and Iam littlebit lost with a way how to load a price of viewed product into the module thats all i need.

The purpose of this module is just to open loan calculator with predefined price form our site.

Iam no PhP guru, and iam sorry for my english its not my native language.

Thank you for your response

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 7 months ago #248889

Hi,

So in which file exactly do you want to load the price ?

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

  • Posts: 7
  • Thank you received: 0
7 years 7 months ago #248911

The file is new mod. mod_essox.php

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 7 months ago #248918

Hi,

So in that case, you need to do something like that:

//load HikaShop if not already loaded
if(!defined('DS'))
	define('DS',DIRECTORY_SEPARATOR);
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php'))
			return true;
//get product id
$product_id = (int)hikashop_getCID('product_id');
if(empty($product_id ))
 return true;

// load product
$productClass = hikashop_get('class.product');
$product = $productClass->get($product_id);
if(empty($product ))
 return true;

//load prices
$currencyClass = hikashop_get('class.currency');
$config = hikashop_config();
$ids = array($product_id);
$currencyClass->getPrices($product,$ids,hikashop_getCurrency(),(int)$config->get('main_currency',1), hikashop_getZone(null),(int)$config->get('discount_before_tax',0));

// display the first price of the product
echo $product->prices[0]->price_value;

The following user(s) said Thank You: Strmy

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

  • Posts: 7
  • Thank you received: 0
7 years 7 months ago #248962

Thank you so much. thats all what i needed. Problem solved

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

Time to create page: 0.062 seconds
Powered by Kunena Forum