예제 #1
0
 /**
  * constructs a VmModel
  * setMainTable defines the maintable of the model
  *
  * @author Max Milbers
  */
 function __construct()
 {
     parent::__construct('virtuemart_product_id');
     $this->setMainTable('products');
     $this->starttime = microtime(TRUE);
     $this->maxScriptTime = VmConfig::getExecutionTime() * 0.95 - 1;
     $this->memory_limit = VmConfig::getMemoryLimit() - 4;
     // 	$this->addvalidOrderingFieldName(array('m.mf_name','pp.product_price'));
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         $this->_validOrderingFieldName = array();
         $browseOrderByFields = VmConfig::get('browse_orderby_fields', array('product_sku', 'category_name', 'mf_name', 'product_name'));
     } else {
         if (!class_exists('shopFunctions')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
         }
         $browseOrderByFields = ShopFunctions::getValidProductFilterArray();
         $this->addvalidOrderingFieldName(array('product_price', 'product_sales'));
         //$this->addvalidOrderingFieldName (array('product_price'));
         // 	vmdebug('$browseOrderByFields',$browseOrderByFields);
     }
     $this->addvalidOrderingFieldName((array) $browseOrderByFields);
     $this->removevalidOrderingFieldName('virtuemart_product_id');
     //$this->removevalidOrderingFieldName ('product_sales');
     //unset($this->_validOrderingFieldName[0]);//virtuemart_product_id
     array_unshift($this->_validOrderingFieldName, 'p.virtuemart_product_id');
     $this->_selectedOrdering = VmConfig::get('browse_orderby_field', '`p`.virtuemart_product_id');
     $this->setToggleName('product_special');
     $this->initialiseRequests();
     //This is just done now for the moment for developing, the idea is of course todo this only when needed.
     $this->updateRequests();
 }
예제 #2
0
 /**
  * Ensures a certain Memory limit for php (if server supports it)
  * @author Max Milbers
  * @param int $minMemory
  */
 static function ensureMemoryLimit($minMemory = 0)
 {
     if ($minMemory === 0) {
         $minMemory = VmConfig::get('minMemory', '128M');
     }
     $memory_limit = VmConfig::getMemoryLimit();
     if ($memory_limit < $minMemory) {
         @ini_set('memory_limit', $minMemory . 'M');
     }
 }