function dealSetLocationCookie() { $locationId = JRequest::getInt('locationId', null); $email = JRequest::getVar('email'); $oMenu = JFactory::getApplication()->getMenu(); $oItem = $oMenu->getItems('link', 'index.php?option=com_enmasse&view=dealtoday', true); ////////// Integration with ACY Mailing ////////// $integrationClass = EnmasseHelper::getSubscriptionClassFromSetting(); $acy_path = JPATH_SITE . DS . 'components' . DS . 'com_acymailing'; if (file_exists($acy_path)) { if ($integrationClass == 'acystarter' || $integrationClass == 'acyenterprise') { require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "subscription" . DS . $integrationClass . DS . $integrationClass . ".class.php"; if ($integrationClass == 'acystarter') { $acy = new acystarter(); } elseif ($integrationClass == 'acyenterprise') { $acy = new acyenterprise(); } $acy->updateSubscriptionList($locationId, $email); } } ///////////////////////////////////////////////// if (!empty($locationId)) { //set cookie locationId with lifetime is 365 days $dtLifeTime = time() + 365 * 24 * 60 * 60; setcookie(self::CS_SESSION_LOCATIONID, $locationId, $dtLifeTime, '/'); $oDeal = JModel::getInstance('deal', 'enmasseModel')->getDealMaxSoldQtyFromLocation($locationId); if ($oDeal->id) { JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_enmasse&controller=deal&task=view&id=' . $oDeal->id . '&Itemid=' . $oItem->id, false)); } } $link = JRoute::_('index.php?option=com_enmasse&controller=deal&task=today&Itemid=' . $oItem->id, false); JFactory::getApplication()->redirect($link); }
function removeAcyLocation($locationId) { $locationList = explode("\n", acyenterprise::getAcyLocation()); for ($i = 0; $i < count($locationList); $i++) { $locationItem = explode("::", $locationList[$i]); if ($locationItem[0] != $locationId) { $newLocationList[] = $locationList[$i]; } } $db = JFactory::getDBO(); $query = "UPDATE #__acymailing_fields SET value='" . implode("\n", $newLocationList) . "' WHERE namekey = 'location'"; $db->setQuery($query); $db->query(); }