- Posts: 7
- Thank you received: 0
Loading price of a product to a different module
10 years 4 weeks ago #248859
by Strmy
Loading price of a product to a different module was created by Strmy
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
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.
10 years 3 weeks ago #248889
by nicolas
Replied by nicolas on topic Loading price of a product to a different module
Hi,
So in which file exactly do you want to load the price ?
So in which file exactly do you want to load the price ?
Please Log in or Create an account to join the conversation.
10 years 3 weeks ago #248911
by Strmy
Replied by Strmy on topic Loading price of a product to a different module
The file is new mod. mod_essox.php
Please Log in or Create an account to join the conversation.
10 years 3 weeks ago #248918
by nicolas
Replied by nicolas on topic Loading price of a product to a different module
Hi,
So in that case, you need to do something like that:
So in that case, you need to do something like that:
Code:
//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.
10 years 3 weeks ago #248962
by Strmy
Replied by Strmy on topic Loading price of a product to a different module
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.188 seconds