Advertisement:

Author Topic: [SOLVED]Showing attributes of custom_attributes in Listing items Premium  (Read 2408 times)

Yellowtown

  • Newbie
  • *
  • Posts: 11
Hi. Following the instructions of Teseo I Had got to show the Attributes from Custom _Attributes plugin in each item in Search page adding in loop-single.php:

Code: [Select]
<?php osc_run_hook('item_detail', array($this,'item_detail')) ?>
When I use

Code: [Select]
<?php osc_add_hook('item_detail', array($this,'item_detail')) ?>
don´t works... then I use run...

I had some problem with Youtube plugin it show the video in the listing grid(I supposed I was calling both with osc_run_hook but i solved it changing some code in loop-single.php)

But I have a problem... I do the same step but adding this code to loop-single-premium.php to show the attributes in each item_premium in search page... But it don´t works. I was thinking about that but I can´t identify the matter... Am I using osc_run_hook wrongly? Do you have idea whats the matter?

osclass 3.4.3
custom_attributes 1.0.0
Bender Theme
« Last Edit: December 20, 2014, 08:32:10 pm by Yellowtown »

Yellowtown

  • Newbie
  • *
  • Posts: 11
Re: Showing attributes of custom_attributes in Listing items Premium
« Reply #1 on: December 19, 2014, 04:13:39 pm »
Some idea?

Yellowtown

  • Newbie
  • *
  • Posts: 11
Re: Showing attributes of custom_attributes in Listing items Premium
« Reply #2 on: December 19, 2014, 08:12:09 pm »
More information:

The next code show custom attributes in each item in listing

LOOP-SINGLE.PHP:
Code: [Select]
<div class="listing-detail">
        <div class="listing-cell">
            <div class="listing-data">
                <div class="listing-basicinfo">
                    <a href="<?php echo osc_item_url() ; ?>" class="title" title="<?php echo osc_esc_html(osc_item_title()) ; ?>"><?php echo osc_item_title() ; ?></a>
                    <p><?php echo osc_highlightosc_item_description() ,80) ; ?></p>
                    <div class="listing-attributes">
                      <div align="left" style="margin-right:5px;">
                      <?php osc_run_hook('item_detail', array($this,'item_detail')); ?></br>
                      <span class="category"><?php echo osc_item_category() ; ?></span>
                       <span class="location" ><?php echo osc_item_city(); ?>
                          <?php if( osc_item_region()!='' ) { ?> (<?php echo osc_item_region(); ?>) <?php echo osc_item_country(); ?><?php ?>
                          </span> <span class="g-hide"></span><?php /*?> <?php echo osc_format_date(osc_item_pub_date()); ?> <?php */?><br /> <div align="right" style="margin-right:5px;">
                        <?php if( osc_price_enabled_at_items() ) { ?>
                        <span class="currency-value"> <?php echo osc_format_price(osc_item_price()); ?></span></div>
                        <?php ?>
                      </div>
                    </div>
                   
                </div>

But in the next code don´t show the attributes.....
LOOP-SINGLE-PREMIUM.PHP:

Code: [Select]
<div class="listing-detail">
        <div class="listing-cell">
            <div class="listing-data">
                <div class="listing-basicinfo">
                    <a href="<?php echo osc_premium_url() ; ?>" class="title" title="<?php echo osc_esc_html(osc_premium_title()) ; ?>"><?php echo osc_premium_title() ; ?></a>
                    <p><?php echo osc_highlightosc_premium_description(), 175 );?></p>
                    <div class="listing-attributes">
                        <div align="left" style="margin-right:5px;">
                        <?php osc_run_hook('item_detail',array($this,'item_detail'));?>
                        <span class="category"><?php echo osc_premium_category(); ?></span>
                        <span class="location"><?php echo osc_premium_city(); ?> <?php if(osc_premium_region()!='') { ?>(<?php echo osc_premium_region(); ?>) <br /><?php echo osc_premium_country(); ?><?php ?></span> <span class="g-hide"></span><?php /*?>< <?php echo osc_format_date(osc_premium_pub_date()); ?><?php */?>
                         <div align="right" style="margin-right:5px;">
                         <?php if( osc_price_enabled_at_items() ) { ?><span class="currency-value"><?php echo osc_format_price(osc_premium_price(),osc_premium_currency_symbol() ); ?></span><?php ?>
                     </div>
                    </div>
                </div>

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Showing attributes of custom_attributes in Listing items Premium
« Reply #3 on: December 19, 2014, 08:32:23 pm »
Hi,

Inside loop-single.php:

Code: [Select]
<?php osc_run_hook('item_detail'osc_item() ); ?>
Inside loop-single-premium.php, problem is that in the plugin osc_item_id() is hardcoded, nothing about osc_premium_id(), so you need to make both equal before invoking the plugin, try:

Code: [Select]
                        <div align="left" style="margin-right:5px;">
                        <?php View::newInstance()->_exportVariableToView('item'View::newInstance()->_current('premiums'));
                              
osc_run_hook('item_detail'osc_item() ); ?>

                        <span class="category"><?php echo osc_premium_category(); ?></span>

Regards

Yellowtown

  • Newbie
  • *
  • Posts: 11
Re: Showing attributes of custom_attributes in Listing items Premium
« Reply #4 on: December 20, 2014, 08:30:07 pm »

I have changed mi code in LOOOP-SINGLE.PHP:
Code: [Select]
<?php osc_run_hook('item_detail', array($this,'item_detail')) ?>by yours Teseo:

Hi,

Inside loop-single.php:

Code: [Select]
<?php osc_run_hook('item_detail'osc_item() ); ?>
         

It works too!!!

And then I added your code inside LOOP-SINGLE-PREMIUM.PHP:


Inside loop-single-premium.php, problem is that in the plugin osc_item_id() is hardcoded, nothing about osc_premium_id(), so you need to make both equal before invoking the plugin, try:

Code: [Select]
                        <div align="left" style="margin-right:5px;">
                        <?php View::newInstance()->_exportVariableToView('item'View::newInstance()->_current('premiums'));
                              
osc_run_hook('item_detail'osc_item() ); ?>

                        <span class="category"><?php echo osc_premium_category(); ?></span>

Regards

And it Works Perfectly. Thanks Teseo Solved!!!

lukaszo86

  • Newbie
  • *
  • Posts: 32
According to this topic I'm configuring by Real Estate Theme and Custom Attributes.

Is it possible to: (search gallery.php)
Quote
<h3><a href="<?php echo osc_item_url() ; ?>"><?php if(strlen(osc_item_title()) > 31){ echo substr(osc_item_title(), 0, 28).'...'; } else { echo osc_item_title(); } ?></a></h3>
                    </div>
                    <div class="data"><?php item_realestate_attributes(); ?></div>
                    <div class="author">
                        <?php echo osc_format_date(osc_item_pub_date()); ?><br />
                        <?php echo osc_item_city(); ?> (<?php echo osc_item_region();?>)
                        <?php osc_run_hook('item_detail', osc_item() ) ; ?>
                        </div>
                </div>
            </div>

Red code accordes to Custom Attribute and when it's on in the search gallery I have a list of all Custom Attributes. I want to show only one custom attribute - is it possible??

Thank you for help in advance.



abc500x500

  • Jr. Member
  • **
  • Posts: 96
Hi,

Inside loop-single.php:

Code: [Select]
<?php osc_run_hook('item_detail'osc_item() ); ?>
Inside loop-single-premium.php, problem is that in the plugin osc_item_id() is hardcoded, nothing about osc_premium_id(), so you need to make both equal before invoking the plugin, try:

Code: [Select]
                        <div align="left" style="margin-right:5px;">
                        <?php View::newInstance()->_exportVariableToView('item'View::newInstance()->_current('premiums'));
                              
osc_run_hook('item_detail'osc_item() ); ?>

                        <span class="category"><?php echo osc_premium_category(); ?></span>

Regards

Hi teseo.
I had this problem.
Thanks for your solution.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Glad this helped you, regards