Product page voting

  • Posts: 15
  • Thank you received: 0
11 years 1 week ago #155964

Hi guys,

I need one thing....but I dont know how to do.

I need hide voting stars and "contact us" button on product page, but just for one category. All other products ( in other categories) need have voting stars and contact button.

Thanks

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 week ago #156001

Hi,

To hide these parts only for one category, you have to edit the view "product / show_default" and add an if condition based on the category around the contact us and vote parts.

An if condition like:

if($this->element->product_category_id != XX){
    // Vote or contact part.
}
You have to set the desired category id instead of XX.

ps: the given code need to be between php tags.

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

  • Posts: 15
  • Thank you received: 0
11 years 1 week ago #156056

can you be more specific where to put this code. I am not php devolper. Here is part of code I think I need to put code you gave me:

<?php
if(!empty($this->element->extraData->rightBegin))
echo implode("\r\n",$this->element->extraData->rightBegin);
?>
<div id="hikashop_product_vote_mini" class="hikashop_product_vote_mini">
<?php
$config =& hikashop_config();
if($this->params->get('show_vote_product') == '-1'){
$this->params->set('show_vote_product',$config->get('show_vote_product'));
}
if($this->params->get('show_vote_product')){
$js = '';
$this->params->set('vote_type','product');
if(isset($this->element->main)){
$product_id = $this->element->main->product_id;
}else{
$product_id = $this->element->product_id;
}
$this->params->set('vote_ref_id',$product_id);
echo hikashop_getLayout('vote', 'mini', $this->params, $js);
}
?>

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

  • Posts: 12953
  • Thank you received: 1778
11 years 1 week ago #156088

You'll just have to use the code that Xavier said around these lines for the contact button:

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

And around these lines for the vote stars :
  <div id="hikashop_product_vote_mini" class="hikashop_product_vote_mini">
    <?php
    //LAYOUT show the rating stars
    $config =& hikashop_config();
    if($this->params->get('show_vote_product') == '-1'){
      $this->params->set('show_vote_product',$config->get('show_vote_product'));
    }
    if($this->params->get('show_vote_product')){
      $js = '';
      $this->params->set('vote_type','product');
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('vote_ref_id',$product_id);
      echo hikashop_getLayout('vote', 'mini', $this->params, $js);
    }
    ?>
  </div>

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

Time to create page: 0.056 seconds
Powered by Kunena Forum