1
amaranth
Olédrion 1.64 > Blocks > oeldrion_top.php
  • 2008/12/21 20:11

  • amaranth

  • Just popping in

  • Posts: 9

  • Since: 2008/12/21


I've installed Olédrion on my site and it is working great. However, I have one problem with the block called oeldrion_top.php. Currently, it shows the top products of all time. Is there a way to make it only show the top products in the last seven days?

2
amaranth
Re: Olédrion 1.64 > Blocks > oeldrion_top.php
  • 2008/12/28 22:35

  • amaranth

  • Just popping in

  • Posts: 9

  • Since: 2008/12/21


bump

3
trabis
Re: Olédrion 1.64 > Blocks > oeldrion_top.php
  • 2008/12/28 23:06

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


You would have to hack 3 files to do this the right way but, maybe you can go directly to the source without secondary effects.

Try edit class/oledrion_products.php and add this:
function getMostViewedProducts($start 0$limit 0$category 0$sort 'product_hits'$order 'DESC')
    {
        
$tbl_datas = array();
        
$criteria = new CriteriaCompo();
        
$criteria->add(new Criteria('product_online'1'='));
        if(
oledrion_utils::getModuleOption('show_unpublished') == 0) {    // Ne pas afficher les produits qui ne sont pas publiés
            
$criteria->add(new Criteria('product_submitted'time(), '<='));
        }
        if(
oledrion_utils::getModuleOption('nostock_display') == 0) {    // Se limiter aux seuls produits encore en stock
            
$criteria->add(new Criteria('product_stock'0'>'));
        }
        if(
is_array($category)) {
            
$criteria->add(new Criteria('product_cid''('.implode(',',$category).')''IN'));
        } elseif(
$category != 0) {
            
$criteria->add(new Criteria('product_cid'intval($category), '='));
        }
        
$criteria->add(new Criteria('product_hits'0'>'));
//add this line
        
$criteria->add(new Criteria('product_submitted'time()-7*24*60*60'>='));
//end
        
$criteria->setLimit($limit);
        
$criteria->setStart($start);
        
$criteria->setSort($sort);
        
$criteria->setOrder($order);
        
$tbl_datas $this->getObjects($criteriatrue);
        return 
$tbl_datas;
    }



4
amaranth
Re: Olédrion 1.64 > Blocks > oeldrion_top.php
  • 2008/12/31 19:42

  • amaranth

  • Just popping in

  • Posts: 9

  • Since: 2008/12/21


Thank you trabis, I'll give this a shot.

5
Rickb
Re: Olédrion 1.64 > Blocks > oeldrion_top.php
  • 2009/1/8 16:07

  • Rickb

  • Not too shy to talk

  • Posts: 118

  • Since: 2004/10/24


Amaranth,

Did that hack work?

Rick

Login

Who's Online

92 user(s) are online (65 user(s) are browsing Support Forums)


Members: 0


Guests: 92


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits