Link function for product item

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

-- HikaShop version -- : 2.6.0

Hello,
I am a developer and I am creating a module to use a gallery images of products.
The images are ok for the module but I can't find the function to associate the correct link
I see several $this->getlink( on files but I can't find where is this function and I can't call it as it is inside the module.
Can anyone help me out how to create the correct link for products?
What files I need to include, the query I need and the function to use.
Thanks and regards

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
9 years 10 months ago #216637

Hi,

So, suppose that your product data is an object in the variable $product.
You can use such code:

include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).'/components/com_hikashop/helpers/helper.php'); //load the main helper of HikaShop
$Itemid = XXX; //where XXX is the id of a product/category listing menu item
$productClass = hikashop_get('class.product');
$productClass->addAlias($product);
echo hikashop_contentLink('product&task=show&cid='.$product->product_id.'&name='.$product->alias.$Itemid, $product);

The following user(s) said Thank You: solrac

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

Time to create page: 0.058 seconds
Powered by Kunena Forum