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

#   restrict contact button to registered users

##

- **[christofu](/forum/user/31338-christofu "View christofu's Profile")**
- [![christofu's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/31338-christofu "View christofu's Profile") Topic Author
- [ Offline](/forum/user/31338-christofu)

Less More

- Posts: 108
- Thank you received: 6
-
-

12 years 3 months ago [\#166053](#166053) by [christofu](/forum/user/31338-christofu "View christofu's Profile")  *[restrict contact button to registered users](/forum/26-product-category-display/870099-restrict-contact-button-to-registered-users#166053 "-- HikaShop version -- : 2.3.2  Hi,  I was looking for an option to prevent someone from contacting the vendor without registering? (on the product page)  i.e. send them to the registration page when they attempt to contact vendor  or is there code I could add to do this?  thanks")* was created by *[christofu](/forum/user/31338-christofu "View christofu's Profile")*

-- HikaShop version -- : 2.3.2

Hi,

I was looking for an option to prevent someone from contacting the vendor without registering? (on the product page)

i.e. send them to the registration page when they attempt to contact vendor

or is there code I could add to do this?

thanks

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

12 years 3 months ago [\#166105](#166105) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[restrict contact button to registered users](/forum/26-product-category-display/870099-restrict-contact-button-to-registered-users#166105 "-- HikaShop version -- : 2.3.2  Hi,  I was looking for an option to prevent someone from contacting the vendor without registering? (on the product page)  i.e. send them to the registration page when they attempt to contact vendor  or is there code I could add to do this?  thanks")*

Hi,

You can edit the view "product / show_default" and replace: Code:

&lt;div id="hikashop_product_contact_main" class="hikashop_product_contact_main"&gt; &lt;?php $contact = $this-&gt;config-&gt;get('product_contact',0); if (hikashop_level(1) &amp;&amp; ($contact == 2 &#124;&#124; ($contact == 1 &amp;&amp; !empty ($this-&gt;element-&gt;product_contact)))) { $empty = ''; $params = new HikaParameter($empty); global $Itemid; $url_itemid=''; if(!empty($Itemid)){ $url_itemid='&amp;Itemid='.$Itemid; } echo $this-&gt;cart-&gt;displayButton(JText :: _('CONTACT_US_FOR_INFO'), 'contact_us', $params, hikashop_completeLink('product&amp;task=contact&amp;cid=' . $this-&gt;element-&gt;product_id.$url_itemid), 'window.location=\'' . hikashop_completeLink('product&amp;task=contact&amp;cid=' . $this-&gt;element-&gt;product_id.$url_itemid) . '\';return false;'); } ?&gt; &lt;/div&gt;

By: Code:

&lt;?php if(hikashop_loadUser() != null){ ?&gt; &lt;div id="hikashop_product_contact_main" class="hikashop_product_contact_main"&gt; &lt;?php $contact = $this-&gt;config-&gt;get('product_contact',0); if (hikashop_level(1) &amp;&amp; ($contact == 2 &#124;&#124; ($contact == 1 &amp;&amp; !empty ($this-&gt;element-&gt;product_contact)))) { $empty = ''; $params = new HikaParameter($empty); global $Itemid; $url_itemid=''; if(!empty($Itemid)){ $url_itemid='&amp;Itemid='.$Itemid; } echo $this-&gt;cart-&gt;displayButton(JText :: _('CONTACT_US_FOR_INFO'), 'contact_us', $params, hikashop_completeLink('product&amp;task=contact&amp;cid=' . $this-&gt;element-&gt;product_id.$url_itemid), 'window.location=\'' . hikashop_completeLink('product&amp;task=contact&amp;cid=' . $this-&gt;element-&gt;product_id.$url_itemid) . '\';return false;'); } ?&gt; &lt;/div&gt; &lt;?php } ?&gt;

This way the contact button will only be displayed for registered users.

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

- **[christofu](/forum/user/31338-christofu "View christofu's Profile")**
- [![christofu's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/31338-christofu "View christofu's Profile") Topic Author
- [ Offline](/forum/user/31338-christofu)

Less More

- Posts: 108
- Thank you received: 6
-
-

12 years 3 months ago [\#166148](#166148) by [christofu](/forum/user/31338-christofu "View christofu's Profile")  Replied by *[christofu](/forum/user/31338-christofu "View christofu's Profile")* on topic *[restrict contact button to registered users](/forum/26-product-category-display/870099-restrict-contact-button-to-registered-users#166148 "-- HikaShop version -- : 2.3.2  Hi,  I was looking for an option to prevent someone from contacting the vendor without registering? (on the product page)  i.e. send them to the registration page when they attempt to contact vendor  or is there code I could add to do this?  thanks")*

thanks Xavier - perfect:)

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

- **[Galle43](/forum/user/36383-galle43 "View Galle43's Profile")**
- [![Galle43's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/36383-galle43 "View Galle43's Profile")
- [ Offline](/forum/user/36383-galle43)

Less More

- Posts: 16
- Thank you received: 2
-
-

10 years 5 months ago [\#241789](#241789) by [Galle43](/forum/user/36383-galle43 "View Galle43's Profile")  Replied by *[Galle43](/forum/user/36383-galle43 "View Galle43's Profile")* on topic *[restrict contact button to registered users](/forum/26-product-category-display/870099-restrict-contact-button-to-registered-users#241789 "-- HikaShop version -- : 2.3.2  Hi,  I was looking for an option to prevent someone from contacting the vendor without registering? (on the product page)  i.e. send them to the registration page when they attempt to contact vendor  or is there code I could add to do this?  thanks")*

Sorry It didnt worked for me ![:unsure:](/media/kunena/emoticons/18.png ":unsure:") "Ask a question button" still pop-up at no registered users.

My final code after editing product show/default was:
Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 2.6.0 * @author hikashop.com * @copyright (C) 2010-2015 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;div id="hikashop_product_top_part" class="hikashop_product_top_part"&gt; &lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;topBegin)) { echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;topBegin); } ?&gt; &lt;h1&gt; &lt;span id="hikashop_product_name_main" class="hikashop_product_name_main"&gt; &lt;?php if (hikashop_getCID('product_id')!=$this-&gt;element-&gt;product_id &amp;&amp; isset ($this-&gt;element-&gt;main-&gt;product_name)) echo $this-&gt;element-&gt;main-&gt;product_name; else echo $this-&gt;element-&gt;product_name; ?&gt; &lt;/span&gt; &lt;?php if ($this-&gt;config-&gt;get('show_code')) { ?&gt; &lt;span id="hikashop_product_code_main" class="hikashop_product_code_main"&gt; &lt;?php echo $this-&gt;element-&gt;product_code; ?&gt; &lt;/span&gt; &lt;?php } ?&gt; &lt;/h1&gt; &lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;topEnd)) { echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;topEnd); } ?&gt; &lt;?php $this-&gt;setLayout('show_block_social'); echo $this-&gt;loadTemplate(); ?&gt; &lt;/div&gt; &lt;?php if(HIKASHOP_RESPONSIVE){ ?&gt; &lt;div class="&lt;?php echo HK_GRID_ROW; ?&gt;"&gt; &lt;?php } ?&gt; &lt;div id="hikashop_product_left_part" class="hikashop_product_left_part &lt;?php echo HK_GRID_COL_6; ?&gt;"&gt; &lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;leftBegin)) { echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;leftBegin); } $this-&gt;row = &amp; $this-&gt;element; $this-&gt;setLayout('show_block_img'); echo $this-&gt;loadTemplate(); if(!empty($this-&gt;element-&gt;extraData-&gt;leftEnd)) { echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;leftEnd); } ?&gt; &lt;/div&gt; &lt;div id="hikashop_product_right_part" class="hikashop_product_right_part &lt;?php echo HK_GRID_COL_6; ?&gt;"&gt; &lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;rightBegin)) echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;rightBegin); ?&gt; &lt;div id="hikashop_product_vote_mini" class="hikashop_product_vote_mini"&gt; &lt;?php $config =&amp; hikashop_config(); if($this-&gt;params-&gt;get('show_vote_product') == '-1'){ $this-&gt;params-&gt;set('show_vote_product',$config-&gt;get('show_vote_product')); } if($this-&gt;params-&gt;get('show_vote_product')){ $js = ''; $this-&gt;params-&gt;set('vote_type','product'); 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('vote_ref_id',$product_id); echo hikashop_getLayout('vote', 'mini', $this-&gt;params, $js); } ?&gt; &lt;/div&gt; &lt;span id="hikashop_product_price_main" class="hikashop_product_price_main"&gt; &lt;?php if ($this-&gt;params-&gt;get('show_price')) { $this-&gt;row = &amp; $this-&gt;element; $this-&gt;setLayout('listing_price'); echo $this-&gt;loadTemplate(); } ?&gt; &lt;/span&gt; &lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;rightMiddle)) echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;rightMiddle); ?&gt; &lt;?php $this-&gt;setLayout('show_block_dimensions'); echo $this-&gt;loadTemplate(); ?&gt;&lt;br /&gt; &lt;?php if($this-&gt;params-&gt;get('characteristic_display') != 'list') { $this-&gt;setLayout('show_block_characteristic'); echo $this-&gt;loadTemplate(); ?&gt; &lt;br /&gt; &lt;?php } $form = ',0'; if (!$this-&gt;config-&gt;get('ajax_add_to_cart', 1)) { $form = ',\'hikashop_product_form\''; } if (hikashop_level(1) &amp;&amp; !empty ($this-&gt;element-&gt;options)) { ?&gt; &lt;div id="hikashop_product_options" class="hikashop_product_options"&gt; &lt;?php $this-&gt;setLayout('option'); echo $this-&gt;loadTemplate(); ?&gt; &lt;/div&gt; &lt;br /&gt; &lt;?php $form = ',\'hikashop_product_form\''; if ($this-&gt;config-&gt;get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') { ?&gt; &lt;input type="hidden" name="popup" value="1"/&gt; &lt;?php } } if (!$this-&gt;params-&gt;get('catalogue') &amp;&amp; ($this-&gt;config-&gt;get('display_add_to_cart_for_free_products') &#124;&#124; ($this-&gt;config-&gt;get('display_add_to_wishlist_for_free_products', 1) &amp;&amp; hikashop_level(1) &amp;&amp; $this-&gt;params-&gt;get('add_to_wishlist') &amp;&amp; $config-&gt;get('enable_wishlist', 1)) &#124;&#124; !empty($this-&gt;element-&gt;prices))) { if (!empty ($this-&gt;itemFields)) { $form = ',\'hikashop_product_form\''; if ($this-&gt;config-&gt;get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') { ?&gt; &lt;input type="hidden" name="popup" value="1"/&gt; &lt;?php } $this-&gt;setLayout('show_block_custom_item'); echo $this-&gt;loadTemplate(); } } $this-&gt;formName = $form; if($this-&gt;params-&gt;get('show_price')){ ?&gt; &lt;span id="hikashop_product_price_with_options_main" class="hikashop_product_price_with_options_main"&gt; &lt;/span&gt; &lt;?php } if(empty ($this-&gt;element-&gt;characteristics) &#124;&#124; $this-&gt;params-&gt;get('characteristic_display')!='list'){ ?&gt; &lt;div id="hikashop_product_quantity_main" class="hikashop_product_quantity_main"&gt; &lt;?php $this-&gt;row = &amp; $this-&gt;element; $this-&gt;ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this-&gt;row-&gt;product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }'; $this-&gt;setLayout('quantity'); echo $this-&gt;loadTemplate(); ?&gt; &lt;/div&gt; &lt;?php } ?&gt; &lt;?php if(hikashop_loadUser() != null){ ?&gt; &lt;div id="hikashop_product_contact_main" class="hikashop_product_contact_main"&gt; &lt;?php $contact = $this-&gt;config-&gt;get('product_contact',0); if (hikashop_level(1) &amp;&amp; ($contact == 2 &#124;&#124; ($contact == 1 &amp;&amp; !empty ($this-&gt;element-&gt;product_contact)))) { $empty = ''; $params = new HikaParameter($empty); global $Itemid; $url_itemid=''; if(!empty($Itemid)){ $url_itemid='&amp;Itemid='.$Itemid; } echo $this-&gt;cart-&gt;displayButton(JText :: _('CONTACT_US_FOR_INFO'), 'contact_us', $params, hikashop_completeLink('product&amp;task=contact&amp;cid=' . $this-&gt;element-&gt;product_id.$url_itemid), 'window.location=\'' . hikashop_completeLink('product&amp;task=contact&amp;cid=' . $this-&gt;element-&gt;product_id.$url_itemid) . '\';return false;'); } ?&gt; &lt;/div&gt; &lt;?php } ?&gt; &lt;?php if(!empty($this-&gt;fields)){ $this-&gt;setLayout('show_block_custom_main'); echo $this-&gt;loadTemplate(); } if(HIKASHOP_J30) { $this-&gt;setLayout('show_block_tags'); echo $this-&gt;loadTemplate(); } ?&gt; &lt;span id="hikashop_product_id_main" class="hikashop_product_id_main"&gt; &lt;input type="hidden" name="product_id" value="&lt;?php echo $this-&gt;element-&gt;product_id; ?&gt;" /&gt; &lt;/span&gt; &lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;rightEnd)) echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;rightEnd); ?&gt; &lt;/div&gt; &lt;?php if(HIKASHOP_RESPONSIVE){ ?&gt; &lt;/div&gt; &lt;?php } ?&gt; &lt;div id="hikashop_product_bottom_part" class="hikashop_product_bottom_part"&gt; &lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;bottomBegin)) echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;bottomBegin); ?&gt; &lt;div id="hikashop_product_description_main" class="hikashop_product_description_main"&gt; &lt;?php echo JHTML::_('content.prepare',preg_replace('#&lt;hr *id="system-readmore" */&gt;#i','',$this-&gt;element-&gt;product_description)); ?&gt; &lt;/div&gt; &lt;span id="hikashop_product_url_main" class="hikashop_product_url_main"&gt; &lt;?php if (!empty ($this-&gt;element-&gt;product_url)) { echo JText :: sprintf('MANUFACTURER_URL', '&lt;a href="' . $this-&gt;element-&gt;product_url . '" target="_blank"&gt;' . $this-&gt;element-&gt;product_url . '&lt;/a&gt;'); } ?&gt; &lt;/span&gt; &lt;?php $this-&gt;setLayout('show_block_product_files'); echo $this-&gt;loadTemplate(); ?&gt; &lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;bottomMiddle)) echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;bottomMiddle); ?&gt; &lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;bottomEnd)) echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;bottomEnd); ?&gt; &lt;/div&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NzAwOTktcmVzdHJpY3QtY29udGFjdC1idXR0b24tdG8tcmVnaXN0ZXJlZC11c2Vycz90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14296
-
-

10 years 1 month ago [\#251297](#251297) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[restrict contact button to registered users](/forum/26-product-category-display/870099-restrict-contact-button-to-registered-users#251297 "-- HikaShop version -- : 2.3.2  Hi,  I was looking for an option to prevent someone from contacting the vendor without registering? (on the product page)  i.e. send them to the registration page when they attempt to contact vendor  or is there code I could add to do this?  thanks")*

Hi,

The code looks correct.
If you still have the problem, please provide a link to the product page.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NzAwOTktcmVzdHJpY3QtY29udGFjdC1idXR0b24tdG8tcmVnaXN0ZXJlZC11c2Vycz90bXBsPW1hcmtkb3du) 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.145 seconds

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