Modify Layout on product page

  • Posts: 184
  • Thank you received: 4
11 years 10 months ago #89933

Hello everybody

I am testing the version 2.1.0 on my labs environment.

I was using an old version (1.6.0) and for this reason i am recreating all the custom views.

I have some problem to use in the correct way the tabber plugin.
I was trying to replicate the old modifications but i have some problems with the comments block.

www.labs.madeinvino.it/la-nostra-cantina...ti.html#degustazione

As you can see the comments is outside the tabber.

The reason is that now the comment block is no more inside the view product show_default.php

Could you give me an advise?

Last edit: 11 years 10 months ago by Teto.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #89989

Hi,

Yes the comments have been moved in the view "product / show" to be present only in one place instead of in each views.
So you have to add the tabber tags in the view "product / show" to have the comments in tabber.

Or use the show "tabular" view of HikaShop ;)

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

  • Posts: 184
  • Thank you received: 4
11 years 10 months ago #89996

Hello Xavier and thank you for your feedback

I tested the "tabular" view but it is a little bit different from what i want.

I tried to add the tabbae tags into the product / show view but unfortunately I was not able to do it :unsure: , could you give me some additional help?

My custom views are:
You can identify the customizations between the tag "Stefano Start" and "Stefano End".

File Attachment:

File Name: show.txt
File Size:16 KB


File Attachment:

File Name: show_default.txt
File Size:8 KB

Attachments:
Last edit: 11 years 10 months ago by Teto.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #90019

You have to add the tag: {tab=Comment}
before: <form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form">

And remove:

from "show_default" to put it in show after the first </form>

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

  • Posts: 184
  • Thank you received: 4
11 years 10 months ago #90038

Hello Xavier

this is what i tried but unfortunately it doesn't work fine

File Attachment:

File Name: show_2013-02-14.txt
File Size:16 KB


File Attachment:

File Name: show_defau...2-14.txt
File Size:8 KB




Did I do something wrong? :huh:

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #90146

What you can do is move back the comment part in the view "product / show_default" and remove it from "product / show".
You can re-use your old views.

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

  • Posts: 184
  • Thank you received: 4
11 years 10 months ago #90240

hello Xavier

I found out how to move this part from show to show_default:

<div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
    <?php
    if($this->params->get('show_vote_product')){
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'listing', $this->params, $js);
      ?>
  </div>
  <div id="hikashop_product_vote_form" class="hikashop_product_vote_form">
      <?php
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'form', $this->params, $js);
    }
    ?>
  </div>

is there a way to move also these parts:
$config =& hikashop_config();
if($config->get('enable_status_vote') == "comment" || $config->get('enable_status_vote') == "two" || $config->get('enable_status_vote') == "both" ){ ?>

  
<form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form">
<input type="hidden" name="add" value="1"/>
  <input type="hidden" name="ctrl" value="product"/>
  <input type="hidden" name="task" value="show"/>
  <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>

Probably I also found out a bug, when you leave a comment, hika stores it into the database with the apex (quote):



I also enabled the Jcomments, do you think is possible easely insert it inside the tabber?

Attachments:
Last edit: 11 years 10 months ago by Teto.

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

  • Posts: 83050
  • Thank you received: 13410
  • MODERATOR
11 years 10 months ago #90488

To fix the quotes, edit the file administrator/components/com_hikashop/classes/vote.php and change the lines (2 occurrences):
$vElement->vote_comment = $db->quote($safeHtmlFilter->clean($element->comment, 'string'));

to:
$vElement->vote_comment = $safeHtmlFilter->clean($element->comment, 'string');


You can move

<input type="hidden" name="add" value="1"/>
  <input type="hidden" name="ctrl" value="product"/>
  <input type="hidden" name="task" value="show"/>
  <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>
juste before the display of the tabs in the show_default and that should be fine.

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

  • Posts: 184
  • Thank you received: 4
11 years 10 months ago #90581

Hello Nicolas.

thank you now the bug is fixed.

Where do i excatly have to move the indicated codes?

I moved all this code from show to show_default and it seems fine

<form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form">
 
  <div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
    <?php
    if($this->params->get('show_vote_product')){
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'listing', $this->params, $js);
      ?>
  </div>
  <div id="hikashop_product_vote_form" class="hikashop_product_vote_form">
      <?php
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'form', $this->params, $js);
    }
    ?>
  </div>
  
  <input type="hidden" name="add" value="1"/>
  <input type="hidden" name="ctrl" value="product"/>
  <input type="hidden" name="task" value="show"/>
  <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>

Is what you mean?

I also tried to move the Jcomments part from show to show_default
<div class="hikashop_external_comments" id="hikashop_external_comments" style="clear:both">
  <?php

$config = & hikashop_config();
if ($config->get('comments_feature') == 'jcomments') {
  $comments = HIKASHOP_ROOT . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
  if (file_exists($comments)) {
    require_once ($comments);
    if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name)){
      $product_id = $this->element->main->product_id;
      $product_name = $this->element->main->product_name;
    }else{
      $product_id = $this->element->product_id;
      $product_name = $this->element->product_name;
    }
    echo JComments::showComments($product_id, 'com_hikashop', $product_name);
  }
}
elseif ($config->get('comments_feature') == 'jomcomment') {
  $comments = HIKASHOP_ROOT . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php';
  if (file_exists($comments)) {
    require_once ($comments);
    if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name))
      $product_id = $this->element->main->product_id;
    else
      $product_id = $this->element->product_id;
    echo jomcomment($product_id, 'com_hikashop');
  }
}
?>
  </div>

But unfortunately in this case it doen't work perfectly.
I can see the Jcommnets in the right tab, but i lose CSS styles and I can not post any new comment.
Could you give me any suggestion?

Thank you very much

Last edit: 11 years 10 months ago by Teto.

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

  • Posts: 26171
  • Thank you received: 4030
  • MODERATOR
11 years 10 months ago #90956

Hi,

JComments could not be inserted into the "form" of the HikaShop product page.
At this moment, the form of jcomments would be into the form of HikaShop and it generates the post problems.

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.
The following user(s) said Thank You: Teto

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

  • Posts: 184
  • Thank you received: 4
11 years 10 months ago #93555

Dear all

I found a problem on Internet Explorer (I hate IE.... :( )

www.madeinvino.com/la-nostra-cantina/pro...0-vie-di-romans.html

Everything looks fine with Chrome and Safari



On Internet Explorer 9 there is an unexpected tab and there is no tab active (is the same problem on IE8).



I think it is not a problem of TABBER because I use it to on an article and I have no problem
www.madeinvino.com/abbonati.html

I also upgraded the tabber extension to the last available version (3.0.6) but the error is the same.

Do you have any idea or suggestion? :dry:

09-03-2013 15:00

I found the reason, this is the customized view product/show_default.php
<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.1.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikashop_product_top_part" class="hikashop_product_top_part">
<?php if(!empty($this->element->extraData->topBegin)) { echo implode("\r\n",$this->element->extraData->topBegin); } ?>
  <h1>
    <span id="hikashop_product_name_main" class="hikashop_product_name_main">
      <?php
      if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name))
        echo $this->element->main->product_name;
      else
        echo $this->element->product_name;
      ?>
    </span>
    <?php if ($this->config->get('show_code')) { ?>
    <span id="hikashop_product_code_main" class="hikashop_product_code_main">
      <?php
      echo $this->element->product_code;
      ?>
    </span>
    <?php } ?>
  </h1>
<?php if(!empty($this->element->extraData->topEnd)) { echo implode("\r\n",$this->element->extraData->topEnd); } ?>
<?php
  $pluginsClass = hikashop_get('class.plugins');
  $plugin = $pluginsClass->getByName('content', 'hikashopsocial');
  if(!empty($plugin) && (@$plugin->published || @ $plugin->enabled)) {
    echo '{hikashop_social}';
  }
?>
</div>
<?php if(HIKASHOP_RESPONSIVE){ ?>
  <div class="row-fluid">
<?php } ?>
<div id="hikashop_product_left_part" class="hikashop_product_left_part span6">
  <?php
  if(!empty($this->element->extraData->leftBegin)) { echo implode("\r\n",$this->element->extraData->leftBegin); }

  $this->row = & $this->element;
  $this->setLayout('show_block_img');
  echo $this->loadTemplate();

  if(!empty($this->element->extraData->leftEnd)) { echo implode("\r\n",$this->element->extraData->leftEnd); }
  ?>
</div>

<div id="hikashop_product_right_part" class="hikashop_product_right_part span6">
  <?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('product_id',$product_id);
      echo hikashop_getLayout('vote', 'mini', $this->params, $js);
    }
    ?>
  </div>
  <span id="hikashop_product_price_main" class="hikashop_product_price_main">
    <?php
    if ($this->params->get('show_price')) {
      $this->row = & $this->element;
      $this->setLayout('listing_price');
      echo $this->loadTemplate();
    }
    ?>
  </span>
  <?php
  if(!empty($this->element->extraData->rightMiddle))
    echo implode("\r\n",$this->element->extraData->rightMiddle);
  ?>
  <?php
    $this->setLayout('show_block_dimensions');
    echo $this->loadTemplate();
  ?><br />
  <?php
  $this->setLayout('show_block_characteristic');
  echo $this->loadTemplate();
  ?>
  <br />
  <?php
  $form = ',0';
  if (!$this->config->get('ajax_add_to_cart', 1)) {
    $form = ',\'hikashop_product_form\'';
  }
  if (hikashop_level(1) && !empty ($this->element->options)) {
  ?>
    <div id="hikashop_product_options" class="hikashop_product_options">
      <?php
      $this->setLayout('option');
      echo $this->loadTemplate();
      ?>
    </div>
    <br />
    <?php
    $form = ',\'hikashop_product_form\'';
    if ($this->config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') {
    ?>
      <input type="hidden" name="popup" value="1"/>
    <?php
    }
  }
  if (!$this->params->get('catalogue') && ($this->config->get('display_add_to_cart_for_free_products') || !empty ($this->element->prices))) {
    if (!empty ($this->itemFields)) {
      $form = ',\'hikashop_product_form\'';
      if ($this->config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') {
      ?>
        <input type="hidden" name="popup" value="1"/>
      <?php
      }
      $this->setLayout('show_block_custom_item');
      echo $this->loadTemplate();
    }
  }
  $this->formName = $form;
  if($this->params->get('show_price')){ ?>
    <span id="hikashop_product_price_with_options_main" class="hikashop_product_price_with_options_main">
    </span>
  <?php } ?>
  <div id="hikashop_product_quantity_main" class="hikashop_product_quantity_main">
    <?php
    $this->row = & $this->element;
    $this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }';
    $this->setLayout('quantity');
    echo $this->loadTemplate();
    ?>
  </div>
  <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);
      echo $this->cart->displayButton(JText :: _('CONTACT_US_FOR_INFO'), 'contact_us', $params, hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id) . '\';return false;');
    }
    ?>
  </div>
  
  <?php // Stefano Start - Le 5 righe qui si seguito vengono spostate e cambiate per mettere le caratteristiche in una Tab in basso  ?>
  <?php
  //  if(!empty($this->fields)){
  //  $this->setLayout('show_block_custom_main');
  //  echo $this->loadTemplate();
  //  }
  ?>
  <?php // Stefano End ?> 
  
  <span id="hikashop_product_id_main" class="hikashop_product_id_main">
    <input type="hidden" name="product_id" value="<?php echo $this->element->product_id; ?>" />
  </span>
  <?php
  if(!empty($this->element->extraData->rightEnd))
    echo implode("\r\n",$this->element->extraData->rightEnd);
  ?>
</div>
<?php if(HIKASHOP_RESPONSIVE){ ?>
  </div>
<?php } ?>
<div id="hikashop_product_bottom_part" class="hikashop_product_bottom_part">
  
  <?php // Stefano Start - Inserimento PlugIn per Tabulazione  ?>
  {tab=Degustazione|grey}
  <?php // Stefano End ?>  

  <?php
  if(!empty($this->element->extraData->bottomBegin))
    echo implode("\r\n",$this->element->extraData->bottomBegin);
  ?>
  <div id="hikashop_product_description_main" class="hikashop_product_description_main">
    <?php
    echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description));
    ?>
  </div>
  <span id="hikashop_product_url_main" class="hikashop_product_url_main">
    <?php
    if (!empty ($this->element->product_url)) {
      echo JText :: sprintf('MANUFACTURER_URL', '<a href="' . $this->element->product_url . '" target="_blank">' . $this->element->product_url . '</a>');
    }
    ?>
  </span>
  
  <?php // Stefano Start - Le 5 righe di cui sopra sono state spostate qui ed è stata aggiunta la stringa per abilitare la TAB?>
  <?php 
  if(!empty($this->fields)){
    ?> {tab=Caratteristiche|grey} <?php
    $this->setLayout('show_block_custom_main');
    echo $this->loadTemplate();
  }
  ?>
  <?php // Stefano End ?> 
  
  <?php // Stefano Start - Inserimento PlugIn per Tabulazione  ?>
  {tab=Le vostre opinioni|grey}
  <?php // Stefano End ?>

  <?php // Stefano Start - Aggiungo parte presa da product_show.php  ?>
  <form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form">
  <div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
    <?php
    if($this->params->get('show_vote_product')){
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'listing', $this->params, $js);
      ?>
  </div>
  <div id="hikashop_product_vote_form" class="hikashop_product_vote_form">
      <?php
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'form', $this->params, $js);
    }
    ?>
  </div>
    <input type="hidden" name="add" value="1"/>
  <input type="hidden" name="ctrl" value="product"/>
  <input type="hidden" name="task" value="show"/>
  <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
  </form>
  <?php // Stefano End ?>
  
  
  <?php
  $this->setLayout('show_block_product_files');
  echo $this->loadTemplate();
  ?>
  <?php
  if(!empty($this->element->extraData->bottomMiddle))
    echo implode("\r\n",$this->element->extraData->bottomMiddle);
  ?>
  <?php
  if(!empty($this->element->extraData->bottomEnd))
    echo implode("\r\n",$this->element->extraData->bottomEnd);
  ?>
  
  <?php // Stefano Start - Inserimento PlugIn per Tabulazione  ?>
  
<?php // Stefano End ?> </div>

The problem seems due to this part of code I moved from product/show to product/show_default
<?php // Stefano Start - Aggiungo parte presa da product_show.php  ?>
  <form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form">
  <div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
    <?php
    if($this->params->get('show_vote_product')){
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'listing', $this->params, $js);
      ?>
  </div>
  <div id="hikashop_product_vote_form" class="hikashop_product_vote_form">
      <?php
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'form', $this->params, $js);
    }
    ?>
  </div>
    <input type="hidden" name="add" value="1"/>
  <input type="hidden" name="ctrl" value="product"/>
  <input type="hidden" name="task" value="show"/>
  <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
  </form>
  <?php // Stefano End ?>

To solve the problem I had to move back to product/show.php these lines:

<form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form">


<input type="hidden" name="add" value="1"/>
<input type="hidden" name="ctrl" value="product"/>
<input type="hidden" name="task" value="show"/>
<input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>


Do you know how solve the problem?

Attachments:
Last edit: 11 years 10 months ago by Teto.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #93824

Hi,

Can you try to put the code "

" just after the "</form>" of the vote part in the show_default view ?

Last edit: 11 years 10 months ago by Xavier.

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

  • Posts: 184
  • Thank you received: 4
11 years 10 months ago #93848

Hello Xavier

I did it but the problem is the same.

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

  • Posts: 83050
  • Thank you received: 13410
  • MODERATOR
11 years 10 months ago #94026

Hi,

I checked on my end with IE 9 but the tabs work fine on the page www.madeinvino.com/la-nostra-cantina/pro...l#le-vostre-opinioni and I don't see the "unexpected tab".

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

  • Posts: 184
  • Thank you received: 4
11 years 10 months ago #94066

Hello

On the live environment to solve the problem I used the modification I wrote in the previous post

***********************

<form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form">


<input type="hidden" name="add" value="1"/>
<input type="hidden" name="ctrl" value="product"/>
<input type="hidden" name="task" value="show"/>
<input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>


***********************

You can check the TEST env here: www.labs.madeinvino.it/la-nostra-cantina...10-ca-dei-frati.html

I will send you a PM with the information to access the test env.

Thanks

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

  • Posts: 83050
  • Thank you received: 13410
  • MODERATOR
11 years 10 months ago #94176

Hi,

Then if it is already solved, I don't see what you want ?
I actually don't know why that happens on IE9. It's probably coming from your modifications as you said.

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

  • Posts: 184
  • Thank you received: 4
11 years 10 months ago #94177

Yes it works, but in a previous post you told me:

******************************
You can move
<input type="hidden" name="add" value="1"/>
<input type="hidden" name="ctrl" value="product"/>
<input type="hidden" name="task" value="show"/>
<input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>
juste before the display of the tabs in the show_default and that should be fine.

******************************

Anyway if you think the current solution is fine for me the case is closed.

Last edit: 11 years 10 months ago by Teto.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 9 months ago #94269

If it's actually working, you can use the current solution.

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

Time to create page: 0.128 seconds
Powered by Kunena Forum