Location custom fields in the product page - Dj-Catalog2 -

edited November 2017 in DJ-Catalog2
Hi,
I have a product with 2 prices extra fiels that I want only show when this fields contain a value.

For that, Custom Field Plugin work fine in articles, descriptions, etc...
Ref https://dj-extensions.com/faq/dj-catalog2-faq/how-to-use-custom-field-plugin-for-dj-catalog2

But my problem is that I need show this extra fiels inside the product page next to the name product and description.

I think that the best solution is edit file (via overrides) html/com_djcatalog2/item/default.php
...and insert next code where I need the data.
<?php echo $this->item->_ef_custom_services; ?>
as custom_services is alias custom field
Ref. https://community.dj-extensions.com/discussion/1515/add-the-tabs-in-the-core-templates

That work fine, and field only shown when it contains a value.
but, how can I show the name of the field, and show it only when the field contains a value?

Example:

<div class="prices_property">
<span><!-- here name custom field sale if exist price ---><?php echo $this->item->_ef_sale_price; ?></span><br>
<span><!-- here name custom field rental if exist price -><?php echo $this->item->_ef_rental_price; ?></span>
</div>


Thank you
Best regards
Javier
Tagged:

Comments

  • oloolo
    edited December 2017
    Hi Javier

    you need to check whether the attribute is holding any value first, eg.:

    <?php if ( !empty($this->item->_ef_sale_price) ) { ?>
    <!-- your code goes here -->
    <?php } ?>

Sign In or Register to comment.