Skip to main content

Price information from another component

More
12 years 10 months ago #132071 by esotechie
Hi

I am accessing the product information from another component to display in a scroller with certain effects not available on the standard one.

I have successfully got the product name and image loading, but wanted to know where to get the best code to use for fetching the price, which takes into account the currency and discounts.

Thanks in advance

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

More
12 years 10 months ago #132144 by Jerome
Hi,

If you want to load an HikaShop product, the best is to use the HikaShop product class.
Code:
$productClass = hikashop_get('class.product'); $product = $productClass->get($product_id);
It will load the values from the different tables (product, product_price, etc).

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

More
12 years 10 months ago #132164 by esotechie
Thank you for the quick response Jerome. I'll give that a go :)

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

More
12 years 10 months ago #132871 by esotechie
The line $productClass = hikashop_get('class.product'); crashes the page.

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

More
12 years 10 months ago #132961 by nicolas
Of course you need to initialize HikaShop before calling HikaShop functions.
You can initialize HikaShop with that line of code:
Code:
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_hikashop'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php')) return true;

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

Time to create page: 0.169 seconds
Powered by Kunena Forum