- Posts: 110
- Thank you received: 4
Display no Specifications when no are available
12 years 11 months ago #135066
by mike
Display no Specifications when no are available was created by mike
-- url of the page with the problem -- :
www.waffenmarti.ch/shop
-- HikaShop version -- : HikaShop [1308241414] /
-- Joomla version -- : 2.5.14
-- PHP version -- : 5.3.27
-- Browser(s) name and version -- : 31.0.1650.57 (Official Build 235101)
-- Error-message(debug-mod must be tuned on) -- : No error message / miss behave
Hello there
I have a problem with the custom fields / specification feature. I have on the products table some custom fields defined (via the Hika-Shop-Interface of course). I have a flag "Special Online Sale" and I use that boolean type field for internal stuff. I said, that this flag shall not be displayed on the front-end. I have other flags also booleans that shall be displayed on the front-end (like if the product need a license or not).
Now, i have the problem that all products has the specifications table on their page, but some product has nothing to display.
E.g. this one...
www.waffenmarti.ch/shop/waffenreinigung/...l-remington-oel.html
This Oil has no flags, but the Specifications-Title (Wichtige Produktehinweise) is displayed, regardless if there are specification or not.
How can I avoid that. If there are no flags set, then no title shall be displayed.
Best regards
Michael
-- HikaShop version -- : HikaShop [1308241414] /
-- Joomla version -- : 2.5.14
-- PHP version -- : 5.3.27
-- Browser(s) name and version -- : 31.0.1650.57 (Official Build 235101)
-- Error-message(debug-mod must be tuned on) -- : No error message / miss behave
Hello there
I have a problem with the custom fields / specification feature. I have on the products table some custom fields defined (via the Hika-Shop-Interface of course). I have a flag "Special Online Sale" and I use that boolean type field for internal stuff. I said, that this flag shall not be displayed on the front-end. I have other flags also booleans that shall be displayed on the front-end (like if the product need a license or not).
Now, i have the problem that all products has the specifications table on their page, but some product has nothing to display.
E.g. this one...
www.waffenmarti.ch/shop/waffenreinigung/...l-remington-oel.html
This Oil has no flags, but the Specifications-Title (Wichtige Produktehinweise) is displayed, regardless if there are specification or not.
How can I avoid that. If there are no flags set, then no title shall be displayed.
Best regards
Michael
Please Log in or Create an account to join the conversation.
12 years 11 months ago #135209
by nicolas
Replied by nicolas on topic Display no Specifications when no are available
Hi,
You would have to edit the file "show_block_custom_main" via the menu Display>Views and change its code to:
You would have to edit the file "show_block_custom_main" via the menu Display>Views and change its code to:
Code:
<?php
$this->fieldsClass->prefix = '';
$displayTitle = false;
ob_start();
foreach ($this->fields as $fieldName => $oneExtraField) {
$value = '';
if(empty($this->element->$fieldName) && !empty($this->element->main->$fieldName))$this->element->$fieldName = $this->element->main->$fieldName;
if(isset($this->element->$fieldName))
$value = trim($this->element->$fieldName);
if (!empty ($value)) {
$displayTitle = true;
?>
<tr class="hikashop_product_custom_<?php echo $oneExtraField->field_namekey;?>_line">
<td class="key">
<span id="hikashop_product_custom_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_name">
<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
</span>
</td>
<td>
<span id="hikashop_product_custom_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_value">
<?php echo $this->fieldsClass->show($oneExtraField,$value); ?>
</span>
</td>
</tr>
<?php
}
}
$specifFields = ob_get_clean();
if($displayTitle){
?>
<div id="hikashop_product_custom_info_main" class="hikashop_product_custom_info_main">
<h4><?php echo JText::_('SPECIFICATIONS');?></h4>
<table width="100%">
<?php echo $specifFields; ?>
</table>
</div>
<?php }
The following user(s) said Thank You: mike, pepecortez
Please Log in or Create an account to join the conversation.
12 years 11 months ago #135745
by mike
Replied by mike on topic Display no Specifications when no are available
Hello Nicolas
I added the code and it worked fine! Thank you very much for your help!
Here you can see the result!
www.waffenmarti.ch/shop/waffenreinigung/...l-remington-oel.html
(shows no information!)
www.waffenmarti.ch/shop/diverse-gewehre/...liber-12-20-410.html
(show, the additional information!)
Very nice! Thank you for your help!
Best regards
Mike
I added the code and it worked fine! Thank you very much for your help!
Here you can see the result!
www.waffenmarti.ch/shop/waffenreinigung/...l-remington-oel.html
(shows no information!)
www.waffenmarti.ch/shop/diverse-gewehre/...liber-12-20-410.html
(show, the additional information!)
Very nice! Thank you for your help!
Best regards
Mike
Please Log in or Create an account to join the conversation.
Time to create page: 0.053 seconds