Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 735 Bytes

README.md

File metadata and controls

31 lines (19 loc) · 735 Bytes

#Cotya_StatisticsBase

a base module targeted at devs to implement tracking of various statistics over time

Example usage

    $now = strtotime('now');
    $numberOfActiveProducts = 0;
    
    $collection =  Mage::getModel('catalog/product')->getCollection();
    $collection->addAttributeToSelect('status');
    
    foreach( $collection as $product ){
        if($product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED){
            $numberOfActiveProducts++;
        }
    }

    $entry = Mage::getModel('cotya_statisticsbase/entry');
    $entry->setType('my_example/number_of_active_products');
    $entry->setWhen($now);
    $entry->setValue($numberOfActiveProducts);
    $entry->save();