Ejemplo n.º 1
0
 /**
  * The event which runs before storing (saving) data to the database
  *
  * @param   boolean  $updateNulls  Should nulls be saved as nulls (true) or just skipped over (false)?
  *
  * @return  boolean  True to allow saving
  */
 protected function onBeforeStore($updateNulls)
 {
     // BLOB/TEXT default value
     if (!isset($this->params)) {
         $this->params = '';
     }
     return parent::onBeforeStore($updateNulls);
 }
Ejemplo n.º 2
0
 protected function onBeforeStore($updateNulls = false)
 {
     if (!isset($this->sku) || empty($this->sku)) {
         //sku is empty. Auto generate it based on product name
         $product_helper = J2Store::product();
         $this->sku = $product_helper->generateSKU($this);
     }
     return parent::onBeforeStore($updateNulls);
 }
Ejemplo n.º 3
0
 /**
  * The event which runs before storing (saving) data to the database
  *
  * @param   boolean  $updateNulls  Should nulls be saved as nulls (true) or just skipped over (false)?
  *
  * @return  boolean  True to allow saving
  */
 protected function onBeforeStore($updateNulls)
 {
     $result = parent::onBeforeStore($updateNulls);
     if ($result) {
         $params = json_decode($this->params);
         $this->evergreentype_id = $params->evergreen;
     }
     return $result;
 }
Ejemplo n.º 4
0
 /**
  * Run the onAKUserSaveData event on the plugins before saving a row
  *
  * @param boolean $updateNulls
  * @return bool
  */
 function onBeforeStore($updateNulls)
 {
     if ($result = parent::onBeforeStore($updateNulls)) {
         JLoader::import('joomla.plugin.helper');
         JPluginHelper::importPlugin('akeebasubs');
         $dispatcher = JDispatcher::getInstance();
         $jResponse = $dispatcher->trigger('onAKUserSaveData', array($this));
         if (in_array(false, $jResponse)) {
             $this->setError($dispatcher->getError());
             return false;
         }
     }
     return $result;
 }
Ejemplo n.º 5
0
 protected function onBeforeStore($updateNulls)
 {
     if (parent::onBeforeStore($updateNulls)) {
         $tz = JFactory::getConfig()->get('offset');
         $date = F0FPlatform::getInstance()->getDate('now', $tz, false);
         if (!$this->j2store_cart_id) {
             //get the IP of the customer
             $this->customer_ip = $_SERVER['REMOTE_ADDR'];
             $browser = JBrowser::getInstance();
             $this->cart_browser = $browser->getBrowser();
             $analytics = array();
             $analytics['is_mobile'] = $browser->isMobile();
             $this->cart_analytics = json_encode($analytics);
             $this->created_on = $date->toSql(true);
         } else {
             $this->modified_on = $date->toSql(true);
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 6
0
 protected function onBeforeStore($updateNulls)
 {
     $result = parent::onBeforeStore($updateNulls);
     if ($result) {
         $slug = $this->getColumnAlias('slug');
         if (property_exists($this, $slug)) {
             $this->{$slug} = str_replace('-', '_', $this->{$slug});
         }
     }
     // Make sure assigned subscription levels really do exist and normalize the list
     if (!empty($this->akeebasubs_level_id)) {
         if (is_array($this->akeebasubs_level_id)) {
             $subs = $this->akeebasubs_level_id;
         } else {
             $subs = explode(',', $this->akeebasubs_level_id);
         }
         if (empty($subs)) {
             $this->akeebasubs_level_id = '';
         } else {
             $subscriptions = array();
             foreach ($subs as $id) {
                 $subObject = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($id)->getItem();
                 $id = null;
                 if (is_object($subObject)) {
                     if ($subObject->akeebasubs_level_id > 0) {
                         $id = $subObject->akeebasubs_level_id;
                     }
                 }
                 if (!is_null($id)) {
                     $subscriptions[] = $id;
                 }
             }
             $this->akeebasubs_level_id = implode(',', $subscriptions);
         }
     }
     return $result;
 }
Ejemplo n.º 7
0
 /**
  * The event which runs before storing (saving) data to the database
  *
  * @param   boolean  $updateNulls  Should nulls be saved as nulls (true) or just skipped over (false)?
  *
  * @return  boolean  True to allow saving
  */
 protected function onBeforeStore($updateNulls)
 {
     $result = parent::onBeforeStore($updateNulls);
     $this->modified = '0000-00-00 00:00:00';
     return $result;
 }