Пример #1
0
 public function onPurchase($list_id = null, $user = null, $status = null)
 {
     $db = JFactory::getDBO();
     // See if the user is already there
     $query = 'SELECT * FROM `#__mkpostman_subscribers` WHERE `email`=' . $db->Quote($user->email) . ' LIMIT 1';
     $db->setQuery($query);
     $row = $db->loadObject();
     // Add the customer email to the subscribers table
     if (empty($row)) {
         $now = JFactory::getDate()->toMySQL();
         $fields = array('user_id' => (int) $user->id, 'name' => $db->Quote($user->name), 'email' => $db->Quote($user->email), 'status' => 1, 'registration_date' => $db->Quote($now), 'confirmation_date' => $db->Quote($now));
         $query = 'INSERT INTO `#__mkpostman_subscribers` SET ' . MageBridgeHelper::arrayToSql($fields);
         $db->setQuery($query);
         $db->query();
         // See if the user is already there
         $query = 'SELECT * FROM `#__mkpostman_subscribers` WHERE `email`=' . $db->Quote($user->email) . ' LIMIT 1';
         $db->setQuery($query);
         $row = $db->loadObject();
     }
     // Continue to add the subscriber to the actual list
     if (!empty($row->id)) {
         $subscriber_id = $row->id;
         $query = 'SELECT * FROM `#__mkpostman_subscribers_lists` WHERE `subscriber_id`=' . (int) $subscriber_id . ' AND `list_id`=' . (int) $list_id;
         $db->setQuery($query);
         $row = $db->loadObject();
         if (empty($row)) {
             $query = 'INSERT INTO `#__mkpostman_subscribers_lists` SET `subscriber_id`=' . (int) $subscriber_id . ', `list_id`=' . (int) $list_id;
             $db->setQuery($query);
             $db->query();
         }
     }
     return true;
 }
 public function onPurchase($level_id = null, $user = null, $status = null)
 {
     $db = JFactory::getDBO();
     // See if the user is already there
     $query = 'SELECT * FROM `#__akeebasubs_subscriptions` WHERE `user_id`=' . (int) $user->id . ' AND `akeebasubs_level_id`=' . (int) $level_id . ' LIMIT 1';
     $db->setQuery($query);
     $row = $db->loadObject();
     if (empty($row)) {
         $values = array('user_id' => (int) $user->id, 'akeebasubs_level_id' => (int) $level_id, 'enabled' => 1, 'processor' => 'none', 'processor_key' => 'magento', 'state' => 'X');
         $query = 'INSERT INTO `#__akeebasubs_subscriptions` SET ' . MageBridgeHelper::arrayToSql($values);
         $db->setQuery($query);
         $db->query();
     }
     return true;
 }
Пример #3
0
 public function onPurchase($event_id = null, $user = null, $status = null)
 {
     $db = JFactory::getDBO();
     // See if the user is already there
     $query = 'SELECT id FROM `#__eventlist_register` WHERE `event`=' . (int) $event_id . ' AND `uid`=' . (int) $user->id . ' LIMIT 1';
     $db->setQuery($query);
     $row = $db->loadObject();
     // Add the customer email to the subscribers list
     if (empty($row)) {
         $values = array('event' => (int) $event_id, 'uid' => (int) $user->id, 'uip' => '127.0.0.1');
         $query = 'INSERT INTO `#__eventlist_register` SET ' . MageBridgeHelper::arrayToSql($values) . ', `uregdate`=NOW()';
         $db->setQuery($query);
         $db->query();
     }
     return true;
 }
 public function onPurchase($list_id = null, $user = null, $status = null)
 {
     $db = JFactory::getDBO();
     // See if the user is already there
     $query = 'SELECT * FROM `#__communicator_subscribers` WHERE `email`=' . $db->Quote($user->email) . ' LIMIT 1';
     $db->setQuery($query);
     $row = $db->loadObject();
     // Add the customer email to the subscribers table
     if (empty($row)) {
         $now = JFactory::getDate()->toMySQL();
         $fields = array('user_id' => (int) $user->id, 'subscriber_name' => $db->Quote($user->name), 'subscriber_email' => $db->Quote($user->email), 'confirmed' => 1, 'subscribe_date' => $db->Quote($now));
         $query = 'INSERT INTO `#__communicator_subscribers` SET ' . MageBridgeHelper::arrayToSql($fields);
         $db->setQuery($query);
         $db->query();
     }
     return true;
 }
Пример #5
0
 public function onPurchase($list_id = null, $user = null, $status = null)
 {
     $db = JFactory::getDBO();
     // See if the user is already there
     $query = 'SELECT id FROM `#__acajoom_subscribers` WHERE `email`=' . $db->Quote($user->email) . ' LIMIT 1';
     $db->setQuery($query);
     $subscriber_id = $db->loadResult();
     // Add the customer email to the subscribers list
     if (empty($subscriber_id)) {
         $values = array('user_id' => $user->id, 'name' => $user->name, 'email' => $user->email, 'confirmed' => 1);
         $query = 'INSERT INTO `#__acajoom_subscribers` SET ' . MageBridgeHelper::arrayToSql($values) . ', `sdate`=NOW()';
         $db->setQuery($query);
         $db->query();
         $subscriber_id = $db->insertid();
     }
     if ($subscriber_id > 0) {
         // See if the user is already there
         $query = 'SELECT * FROM `#__acajoom_queue` WHERE `subscriber_id`=' . (int) $subscriber_id . ' AND `list_id`=' . (int) $list_id . ' LIMIT 1';
         $db->setQuery($query);
         $row = $db->loadObject();
         if (empty($row)) {
             $values = array('subscriber_id' => (int) $subscriber_id, 'list_id' => (int) $list_id, 'type' => 1);
             $query = 'INSERT INTO `#__acajoom_queue` SET ' . MageBridgeHelper::arrayToSql($values);
             $db->setQuery($query);
             $db->query();
         }
     }
     return true;
 }