Create standard layout for product description

  • Posts: 154
  • Thank you received: 10
12 years 2 months ago #65572

Hi!

Im trying to create a standard (default) description page. What I mean is that if I create a new product, the description is pre-filled in with images and headlines like the attachment

I am copy-pasting from old products now, but the layout tends to screw-up when I do that.
I would really love having this stuff filled in by default when I create a new product. Anybody know where I put this?

It's like te custom field I created for EAN, that one's pre-filled with zeros.


Proud of my website www.hetcomputerwinkeltje.nl

Currently just running catalog mode, but hope to go live soon again :)
Attachments:

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

  • Posts: 82818
  • Thank you received: 13362
  • MODERATOR
12 years 2 months ago #65748

Hi,

If you use the "copy" button of the Business edition, you can simply duplicate your existing products when creating new ones so that would do what you want already.

Otherwise, you can edit the file "form" of the view "product" for your backend template and add your HTML directly in the product element if it's a new product with such code:
<?php if(empty($this->element->product_description)) $this->element->product_description='My default HTML'; ?>

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

  • Posts: 154
  • Thank you received: 10
12 years 2 months ago #65767

Thanx! But im curious as to where I need to place this piece of code.
I'm guessing somewhere in the main info but I'm unsure where exactly.

When I place this code, I need to edit the 'My default HTML' and create a HTML based template with that?

Sorry for being a pain-in-the-ass ;)


Proud of my website www.hetcomputerwinkeltje.nl

Currently just running catalog mode, but hope to go live soon again :)

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

  • Posts: 82818
  • Thank you received: 13362
  • MODERATOR
12 years 2 months ago #65905

You can edit the file "form" of the view "product" for your backend template via the menu Display>Views of HikaShop and add the code after the first <?php tag.

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

  • Posts: 154
  • Thank you received: 10
12 years 1 month ago #65973

Ive been trying for about an hour now, but it doesn't seem to work :(

I get the code, if its empty show this and this.

I'm using this code now:

<?php

/**
 * @package    HikaShop for Joomla!
 * @version    1.6.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');
?>
<?php if(empty($this->element->product_description)) $this->element->product_description='TEST TEST TEST TEST <hr> TEST TEST TEST TEST'; ?>
<div class="iframedoc" id="iframedoc"></div>
<form action="index.php?option=<?php echo HIKASHOP_COMPONENT ?>&amp;ctrl=product" method="post"  name="adminForm" id="adminForm" enctype="multipart/form-data">
  <table width="100%">
    <tr>
      <td width="70%" valign="top">
        <?php
          $this->product_name_input = "data[product][product_name]";
          $this->product_url_input = "data[product][product_url]";
          $this->product_meta_description_input = "data[product][product_meta_description]";
          $this->product_keywords_input = "data[product][product_keywords]";
          $this->product_page_title_input = "data[product][product_page_title]";
          if($this->translation){
            $this->setLayout('translation');
            echo $this->loadTemplate();
          }else{
            ?>
            <fieldset class="adminform" id="htmlfieldset">
              <legend><?php echo JText::_( 'MAIN_INFORMATION' ); ?></legend>
              <?php
                $this->setLayout('normal');
                echo $this->loadTemplate();
              ?>
            </fieldset>
            <?php
          }
        ?>
        <?php
          if($this->element->product_type=='main'){
            $this->setLayout('info');
            echo $this->loadTemplate();
          }else{
            $this->setLayout('infovariant');
            echo $this->loadTemplate();
          }
          if(!empty($this->fields)){?>
            <table class="admintable" width="100%">
            <?php foreach($this->fields as $fieldName => $oneExtraField){
              if(!$oneExtraField->field_backend){
                if($oneExtraField->field_type != "customtext"){?>
              <tr><td><input type="hidden" name="data[product][<?php echo $fieldName; ?>]" value="<?php echo $this->element->$fieldName; ?>" /></td></tr>
              <?php }
              }else{ ?>
              <tr id="hikashop_product_<?php echo $fieldName; ?>">
                <td class="key">
                  <?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
                </td>
                <td>
                  <?php
                    if(!isset($this->element->$fieldName))
                      $this->element->$fieldName = $oneExtraField->field_default;
                  ?>
                  <?php $onWhat='onchange'; if($oneExtraField->field_type=='radio') $onWhat='onclick'; ?>
                  <?php echo $this->fieldsClass->display($oneExtraField,$this->element->$fieldName,'data[product]['.$fieldName.']',false,' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'product\',0);"'); ?>
                </td>
              </tr>
              <?php }
            } ?>
            </table>
        
          <?php }?>
      </td>
      <td valign="top">
        <?php if($this->element->product_type=='main'){?>
          <fieldset class="adminform hikashop_product_categories" id="htmlfieldset">
            <legend><?php echo JText::_( 'HIKA_CATEGORIES' ); ?></legend>
          <?php
              $this->setLayout('category');
              echo $this->loadTemplate();
          ?>
          </fieldset>
          <fieldset class="adminform hikashop_product_related" id="htmlfieldset">
            <legend><?php echo JText::_( 'RELATED_PRODUCTS' ); ?></legend>
          <?php
              $this->type='related';
              $this->setLayout('related');
              echo $this->loadTemplate();
          ?>
          </fieldset>
          <fieldset class="adminform hikashop_product_options" id="htmlfieldset">
            <legend><?php echo JText::_( 'OPTIONS' ); ?></legend>
          <?php
          if(hikashop_level(1)){
            $this->type='options';
            $this->setLayout('related');
            echo $this->loadTemplate();
          }else{
            echo '<small style="color:red">'.JText::_('ONLY_COMMERCIAL').'</small>';
          }
          ?>
          </fieldset>
          <fieldset class="adminform hikashop_product_characteristics" id="htmlfieldset">
            <legend><?php echo JText::_('CHARACTERISTICS');?></legend>
            <?php
              $this->setLayout('characteristic');
              echo $this->loadTemplate();
            ?>
          </fieldset>
        <?php }?>
        <fieldset class="adminform hikashop_product_prices" id="htmlfieldset">
          <legend><?php echo JText::_('PRICES');?></legend>
          <?php
            $this->setLayout('price');
            echo $this->loadTemplate();
          ?>
        </fieldset>
        <fieldset class="adminform hikashop_product_images" id="htmlfieldset">
          <legend><?php echo JText::_('HIKA_IMAGES');?></legend>
          <?php
            $this->setLayout('image');
            echo $this->loadTemplate();
          ?>
        </fieldset>
        <fieldset class="adminform hikashop_product_files" id="htmlfieldset">
          <legend><?php echo JText::_('HIKA_FILES');?></legend>
          <?php
            $this->setLayout('file');
            echo $this->loadTemplate();
          ?>
        </fieldset>
<?php
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$html = array();
$dispatcher->trigger('onProductBlocksDisplay', array(&$this->element, &$html));
if(!empty($html)){
  foreach($html as $h){
    echo $h;
  }
}
?>
      </td>
    </tr>
    </table>
  <div class="clr"></div>
  <input type="hidden" name="data[product][product_type]" value="<?php echo @$this->element->product_type; ?>" />
  <input type="hidden" name="cid[]" value="<?php echo @$this->element->product_id; ?>" />
  <input type="hidden" name="option" value="<?php echo HIKASHOP_COMPONENT; ?>" />
  <input type="hidden" name="task" value="" />
  <input type="hidden" name="ctrl" value="product" />
  <?php echo JHTML::_( 'form.token' ); ?>
</form>


Proud of my website www.hetcomputerwinkeltje.nl

Currently just running catalog mode, but hope to go live soon again :)

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

  • Posts: 82818
  • Thank you received: 13362
  • MODERATOR
12 years 1 month ago #66092

Make sure that you're editing it for your backend template and not another one.
I don't see another reason why it wouldn't work.

The following user(s) said Thank You: anypc

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

  • Posts: 154
  • Thank you received: 10
12 years 1 month ago #66094

My deepest apology! I edited for my template, forgot that the backend uses bluestork ^^

Silly me :D

Kudo's to you and your plugin!


Proud of my website www.hetcomputerwinkeltje.nl

Currently just running catalog mode, but hope to go live soon again :)

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

  • Posts: 154
  • Thank you received: 10
12 years 1 month ago #66095

It was a bit of a challange to get the right font, because we can't use the ' because of the format, but the old formatting <font face=""> works great. (For any people that have this question in the future.


Proud of my website www.hetcomputerwinkeltje.nl

Currently just running catalog mode, but hope to go live soon again :)

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

Time to create page: 0.077 seconds
Powered by Kunena Forum