Loading

Author Topic: Anuncios relacionados  (Read 1754 times)

trains58554

  • Super Moderator
  • Hero Member
  • *****
  • Posts: 1805
  • The Ghostbuster
Re: Anuncios relacionados
« Reply #30 on: January 20, 2012, 10:50:47 pm »
Hi chofi,

Sorry for taking so long to get back to you. Try this code.


//save the osclass items so we can return them once we are done with our search data.
$osclassItems View::newInstance()->_get('items');

$search1 = new search();
// you can use this line to sort the results down by category.
$search1->addCategory(1);   // this accepts category id numbers
// you can use the following line to add a condition to the search results. This is an example from the carousel plugin.
$search1->addConditions(sprintf("%st_item_resource.fk_i_item_id = %st_item.pk_i_id"DB_TABLE_PREFIXDB_TABLE_PREFIX));
//you can use this to set a limit on the number of items to load
$search1->limit (010);
//the following line does the search
$aItems $search1->doSearch();
//this line returns the number of records it found by doing the search
    
$iTotalItems $search1->count();
//the following line exports the search results so you can view the results of the search
    
View::newInstance()->_exportVariableToView('items'$aItems);


Then you can go about calling the items as you would normally.


<?php while ( osc_has_items() ) { ?>
 <a href="<?php echo osc_item_url() ; ?>"><?php echo osc_item_title() ; ?></a>
<?php ?>
// call the following line to return the view back to the default items not our search results.
View::newInstance()->_exportVariableToView('items', $osclassItems);


Now you can use the helpers found in oc-includes/osclass/helpers/hItems.php

Jay

Chofi

  • Full Member
  • ***
  • Posts: 117
Re: Anuncios relacionados
« Reply #31 on: January 21, 2012, 02:30:15 am »
hi Jay
Thank for reply
Can you show me the steps to put the codes. I tried but does not work

Chofi

trains58554

  • Super Moderator
  • Hero Member
  • *****
  • Posts: 1805
  • The Ghostbuster
Re: Anuncios relacionados
« Reply #32 on: January 21, 2012, 09:43:03 pm »

<?php
//save the osclass items so we can return them once we are done with our search data.
$osclassItems View::newInstance()->_get('items');

MSearch = new Search ();
MSearch-> addCategory (osc_item_category_id ());
MSearch-> limit (04);
AItems = $ mSearch-> doSearch ();
 
View::newInstance()->_exportVariableToView('items'$AItems);
?>
<ul>
<?php $class "even"?>
                                    <?php while ( osc_has_items() ) { ?>
                                    <li>   <span class="feat_left"> 
                                         
                                        <?php if(osc_item_is_premium()){ echo 'Premium Ad';}else{echo '<br />';}?>
                                                <?php if( osc_count_item_resources() ) { ?>
                                                
                                                    <a href="<?php echo osc_item_url() ; ?>" title="<?php echo osc_item_title() ; ?>" >
                                                        <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75px" height="56px" title="<?php echo osc_item_title() ; ?>" alt="<?php echo osc_item_title() ; ?>" /> 
                                                    </a>
                                                <?php } else { ?>
                                                    <a href="<?php echo osc_item_url() ; ?>" title="<?php echo osc_item_title() ; ?>"><img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="<?php echo osc_item_title() ; ?>" width="75px" height="56px" title="<?php echo osc_item_title() ; ?>"/></a>
                                                <?php ?>
                                             <div class="clr"></div>
                                             <?php if( osc_price_enabled_at_items() ) { if($price == 1){?><span class="price_sm"><?php echo osc_item_formated_price() ; ?></span><?php }} ?>
                                             <div class="clr"></div> 

                                        <a href="<?php echo osc_item_url() ; ?>"><?php echo substr(osc_item_title(),0,30) ; ?></a>
                                        
                                        </span>
                                    </li>

                                        <?php $class = ($class == 'even') ? 'odd' 'even' ?>
                                    <?php ?>
</ul>
<?php 
View
::newInstance()->_exportVariableToView('items'$osclassItems);
?>


Try this code in your item.php file

Jay
« Last Edit: January 22, 2012, 04:57:58 am by trains58554 »

Chofi

  • Full Member
  • ***
  • Posts: 117
Re: Anuncios relacionados
« Reply #33 on: January 22, 2012, 01:30:58 am »
Hi Jay
Place the code you sent me, but does not work, fails.
Now put some of your code.
I show
========================================================================0
<?php
    $mSearch = new Search() ;
    $mSearch->addCategory(osc_item_category_id()) ;
    $mSearch->limit(0, 4) ;
    echo $aItems = $mSearch->doSearch();
?></h6>
<?php foreach($aItems as $item) { ?>
<p><?php echo $item['s_title'];  ?></p>

<?php } ?>
           <ul>
<?php $class = "even"; ?>
                                    <?php while ( osc_has_items() ) { ?>
                                    <li>   <span class="feat_left">
                                         
                                        <?php if(osc_item_is_premium()){ echo '';}else{echo '<br />';}?>
                                                <?php if( osc_count_item_resources() ) { ?>
                                               
                                                    <a href="<?php echo osc_item_url() ; ?>" title="<?php echo osc_item_title() ; ?>" >
                                                        <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75px" height="56px" title="<?php echo osc_item_title() ; ?>" alt="<?php echo osc_item_title() ; ?>" />
                                                    </a>
                                                <?php } else { ?>
                                                    <a href="<?php echo osc_item_url() ; ?>" title="<?php echo osc_item_title() ; ?>"><img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="<?php echo osc_item_title() ; ?>" width="75px" height="56px" title="<?php echo osc_item_title() ; ?>"/></a>
                                                <?php } ?>
                                             <div class="clr"></div>
                                             <?php if( osc_price_enabled_at_items() ) { if($price == 1){?><span class="price_sm"><?php echo osc_item_formated_price() ; ?></span><?php }} ?>
                                             <div class="clr"></div>

                                        <a href="<?php echo osc_item_url() ; ?>"><?php echo substr(osc_item_title(),0,30) ; ?></a>
                                       
                                        </span>
                                    </li>

                                        <?php $class = ($class == 'even') ? 'odd' : 'even' ; ?>
                                    <?php } ?>
</ul>
         
===========================================================================                       
sorry for give you too much work

Chofi

trains58554

  • Super Moderator
  • Hero Member
  • *****
  • Posts: 1805
  • The Ghostbuster
Re: Anuncios relacionados
« Reply #34 on: January 22, 2012, 05:01:01 am »
Try this code for some reason the forum decided to modify my above code and put spaces in where they do not belong.


<?php
//save the osclass items so we can return them once we are done with our search data.
$osclassItems View::newInstance()->_get('items');

$mSearch = new Search ();
$mSearch-> addCategory (osc_item_category_id ());
$mSearch-> limit (04);
$AItems $mSearch->doSearch();
 
View::newInstance()->_exportVariableToView('items'$AItems);
?>
<ul>
<?php $class "even"?>
                                    <?php while ( osc_has_items() ) { ?>
                                    <li>   <span class="feat_left"> 
                                         
                                        <?php if(osc_item_is_premium()){ echo 'Premium Ad';}else{echo '<br />';}?>
                                                <?php if( osc_count_item_resources() ) { ?>
                                                
                                                    <a href="<?php echo osc_item_url() ; ?>" title="<?php echo osc_item_title() ; ?>" >
                                                        <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75px" height="56px" title="<?php echo osc_item_title() ; ?>" alt="<?php echo osc_item_title() ; ?>" /> 
                                                    </a>
                                                <?php } else { ?>
                                                    <a href="<?php echo osc_item_url() ; ?>" title="<?php echo osc_item_title() ; ?>"><img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="<?php echo osc_item_title() ; ?>" width="75px" height="56px" title="<?php echo osc_item_title() ; ?>"/></a>
                                                <?php ?>
                                             <div class="clr"></div>
                                             <?php if( osc_price_enabled_at_items() ) { if($price == 1){?><span class="price_sm"><?php echo osc_item_formated_price() ; ?></span><?php }} ?>
                                             <div class="clr"></div> 

                                        <a href="<?php echo osc_item_url() ; ?>"><?php echo substr(osc_item_title(),0,30) ; ?></a>
                                        
                                        </span>
                                    </li>

                                        <?php $class = ($class == 'even') ? 'odd' 'even' ?>
                                    <?php ?>
</ul>
<?php 
View
::newInstance()->_exportVariableToView('items'$osclassItems);
?>


You will have to do some css styling for this as currently it will just be displaying up and down not across the page.

Jay
« Last Edit: January 22, 2012, 05:03:20 am by trains58554 »

Chofi

  • Full Member
  • ***
  • Posts: 117
Re: Anuncios relacionados
« Reply #35 on: January 22, 2012, 05:23:11 am »
Hi Jay
I tried it now and works perfectly.  Bravo , Very, very good.
Now I have to work with some css
Thank you for helping realize my idea
Regards
Chofi

trains58554

  • Super Moderator
  • Hero Member
  • *****
  • Posts: 1805
  • The Ghostbuster
Re: Anuncios relacionados
« Reply #36 on: January 22, 2012, 06:59:53 am »
Hi chofi,

I am glad the code is working for you.

You will have to let me know once it is all done.

Jay

Chofi

  • Full Member
  • ***
  • Posts: 117
Re: Anuncios relacionados
« Reply #37 on: January 26, 2012, 01:40:58 am »
Jay
How to make announcements related to static, I do not want slider
Regards
Chofi

asimshaz

  • Full Member
  • ***
  • Posts: 118
  • OLXADs Free Classifieds ads in Pakistan
    • Free Classifieds, Online Classifieds, Classifieds in Pakistan
    • Email
Re: Anuncios relacionados
« Reply #38 on: May 12, 2012, 09:51:20 pm »
i want to ad related items to my item page but did not understand this whole post please some body explain what to do and how to do please
Visit my site and see the wonders of OSClass
http://www.olxads.com OLX ADs

Chofi

  • Full Member
  • ***
  • Posts: 117
Re: Anuncios relacionados
« Reply #39 on: May 12, 2012, 11:08:55 pm »
hi asimshaz
All credit to Jay. (trains58554)
put this code within a <div></ div> in item.php

<?php
//save the osclass items so we can return them once we are done with our search data.
$osclassItems = View::newInstance()->_get('items');

$mSearch = new Search ();
$mSearch-> addCategory (osc_item_category_id ());
$mSearch-> limit (0, 5);
$AItems = $mSearch->doSearch();
 
View::newInstance()->_exportVariableToView('items', $AItems);
?>
<ul>
<?php $class = "even"; ?>
                                    <?php while ( osc_has_items() ) { ?>
                                    <li>   <span class="feat_left">
                                         
                                        <?php if(osc_item_is_premium()){ echo '';}else{echo '<br />';}?>
                                                <?php if( osc_count_item_resources() ) { ?>
                                               
                                                    <a href="<?php echo osc_item_url() ; ?>" title="<?php echo osc_item_title() ; ?>" >
                                                        <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75px" height="56px" title="<?php echo osc_item_title() ; ?>" alt="<?php echo osc_item_title() ; ?>" />
                                                    </a>
                                                <?php } else { ?>
                                                    <a href="<?php echo osc_item_url() ; ?>" title="<?php echo osc_item_title() ; ?>"><img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="<?php echo osc_item_title() ; ?>" width="75px" height="56px" title="<?php echo osc_item_title() ; ?>"/></a>
                                                <?php } ?>
                                                   <?php if( osc_price_enabled_at_items() ) { if($price == 1){?><span class="price_sm"><?php echo osc_item_formated_price() ; ?></span><?php }} ?>
                                             <div class="clr"></div>

                                        <a href="<?php echo osc_item_url() ; ?>"><?php echo substr(osc_item_title(),0,30) ; ?></a>
                                       
                                        </span>
                                    </li>

                                        <?php $class = ($class == 'even') ? 'odd' : 'even' ; ?>
                                    <?php } ?>
</ul>    </div>
<?php
View::newInstance()->_exportVariableToView('items', $osclassItems);
?>

Then put some css code to <div "class">
Here works well
http://ydetodo.com/vehiculos/motocicletas-scooters/scooter_205

I hope you understand
Regards
Chofi

asimshaz

  • Full Member
  • ***
  • Posts: 118
  • OLXADs Free Classifieds ads in Pakistan
    • Free Classifieds, Online Classifieds, Classifieds in Pakistan
    • Email
Re: Anuncios relacionados
« Reply #40 on: May 14, 2012, 11:10:04 pm »
@ chofi
thanks a lot for the help
i don't have any knowledge of ccs please help me also in css i want to apply this on www.olxads.com and please tell me how you do this
Visit my site and see the wonders of OSClass
http://www.olxads.com OLX ADs

asimshaz

  • Full Member
  • ***
  • Posts: 118
  • OLXADs Free Classifieds ads in Pakistan
    • Free Classifieds, Online Classifieds, Classifieds in Pakistan
    • Email
Re: Anuncios relacionados
« Reply #41 on: May 14, 2012, 11:50:57 pm »
i have tried your code but got this problem
Visit my site and see the wonders of OSClass
http://www.olxads.com OLX ADs

Chofi

  • Full Member
  • ***
  • Posts: 117
Re: Anuncios relacionados
« Reply #42 on: May 15, 2012, 12:14:38 am »