[Skip to main content](#vessel-content)

#   Display vote form in custom component

##

- **[ddasios](/forum/user/36689-ddasios "View ddasios's Profile")**
- [![ddasios's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar36689.jpg)](/forum/user/36689-ddasios "View ddasios's Profile") Topic Author
- [ Offline](/forum/user/36689-ddasios)

Less More

- Posts: 17
- Thank you received: 1
-
-

9 years 11 months ago [\#256962](#256962) by [ddasios](/forum/user/36689-ddasios "View ddasios's Profile")  *[Display vote form in custom component](/forum/42-vote/887803-display-vote-form-in-custom-component#256962 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.4  Hello. I have a custom component that display a hikashop product. I want below it to display the whole vote ranking and comment form, with the product id as a parameter. Could guide me to do this? Thanks")* was created by *[ddasios](/forum/user/36689-ddasios "View ddasios's Profile")*

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.4

Hello.
I have a custom component that display a hikashop product.
I want below it to display the whole vote ranking and comment form, with the product id as a parameter.
Could guide me to do this?
Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQyLXZvdGUvODg3ODAzLWRpc3BsYXktdm90ZS1mb3JtLWluLWN1c3RvbS1jb21wb25lbnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14296
-
-

9 years 11 months ago [\#257003](#257003) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Display vote form in custom component](/forum/42-vote/887803-display-vote-form-in-custom-component#257003 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.4  Hello. I have a custom component that display a hikashop product. I want below it to display the whole vote ranking and comment form, with the product id as a parameter. Could guide me to do this? Thanks")*

Hi,

First, you need to initialize HikaShop if that's not already the case with such code: Code:

include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_hikashop'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php');

Then, you can base yourself on the code we use in the "show" file of the "product" view in order to display the vote system at the bottom of the product page: Code:

&lt;form action="&lt;?php echo hikashop_currentURL() ?&gt;" method="post" name="adminForm_hikashop_comment_form" id="hikashop_comment_form"&gt; &lt;div id="hikashop_vote_listing" data-votetype="product" class="hikashop_product_vote_listing"&gt; &lt;?php if($this-&gt;params-&gt;get('show_vote_product')) { //LAYOUT listing of the comments for this product $js = ''; if(isset($this-&gt;element-&gt;main)) { $product_id = $this-&gt;element-&gt;main-&gt;product_id; } else { $product_id = $this-&gt;element-&gt;product_id; } $this-&gt;params-&gt;set('product_id',$product_id); echo hikashop_getLayout('vote', 'listing', $this-&gt;params, $js); ?&gt; &lt;/div&gt; &lt;div id="hikashop_vote_form" data-votetype="product" class="hikashop_product_vote_form"&gt; &lt;?php //LAYOUT form to send a comment &amp; vote $js = ''; if(isset($this-&gt;element-&gt;main)) { $product_id = $this-&gt;element-&gt;main-&gt;product_id; } else { $product_id = $this-&gt;element-&gt;product_id; } $this-&gt;params-&gt;set('product_id',$product_id); echo hikashop_getLayout('vote', 'form', $this-&gt;params, $js); } ?&gt; &lt;/div&gt; &lt;input type="hidden" name="add" value="1"/&gt; &lt;input type="hidden" name="ctrl" value="product"/&gt; &lt;input type="hidden" name="task" value="show"/&gt; &lt;input type="hidden" name="return_url" value="&lt;?php echo urlencode(base64_encode(urldecode($this-&gt;redirect_url))); ?&gt;"/&gt; &lt;/form&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQyLXZvdGUvODg3ODAzLWRpc3BsYXktdm90ZS1mb3JtLWluLWN1c3RvbS1jb21wb25lbnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ddasios](/forum/user/36689-ddasios "View ddasios's Profile")**
- [![ddasios's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar36689.jpg)](/forum/user/36689-ddasios "View ddasios's Profile") Topic Author
- [ Offline](/forum/user/36689-ddasios)

Less More

- Posts: 17
- Thank you received: 1
-
-

9 years 11 months ago [\#257033](#257033) by [ddasios](/forum/user/36689-ddasios "View ddasios's Profile")  Replied by *[ddasios](/forum/user/36689-ddasios "View ddasios's Profile")* on topic *[Display vote form in custom component](/forum/42-vote/887803-display-vote-form-in-custom-component#257033 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.4  Hello. I have a custom component that display a hikashop product. I want below it to display the whole vote ranking and comment form, with the product id as a parameter. Could guide me to do this? Thanks")*

Thank you Nicolas for the information. I have managed to do this as you proposed with some changes on $this element

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQyLXZvdGUvODg3ODAzLWRpc3BsYXktdm90ZS1mb3JtLWluLWN1c3RvbS1jb21wb25lbnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.045 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
