本文整理汇总了PHP中MG::get方法的典型用法代码示例。如果您正苦于以下问题:PHP MG::get方法的具体用法?PHP MG::get怎么用?PHP MG::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MG
的用法示例。
在下文中一共展示了MG::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: seoMeta
/**
* Файл может содержать ряд пользовательских фунций влияющих на работу движка.
* В данном файле можно использовать собственные обработчики
* перехватывая функции движка, аналогично работе плагинов.
*
* @author Авдеев Марк <mark-avdeev@mail.ru>
* @package moguta.cms
* @subpackage File
*/
function seoMeta($args)
{
$settings = MG::get('settings');
$args[0]['title'] = !empty($args[0]['title']) ? $args[0]['title'] : '';
$title = !empty($args[0]['meta_title']) ? $args[0]['meta_title'] : $args[0]['title'];
MG::set('metaTitle', $title . ' | ' . $settings['sitename']);
}
示例2: __construct
public function __construct()
{
$modelIndex = new Models_Index();
//$pageModel = new Models_Page;
$page = MG::get('pages')->getPageByUrl('index');
$this->data = array('popularGoods' => getBestSeller(8), 'newGoods' => $modelIndex->getNewGoods(8), 'currency' => MG::getSetting('currency'), 'meta_title' => $page['meta_title'], 'meta_keywords' => $page['meta_keywords'], 'meta_desc' => $page['meta_desc']);
}
示例3: __construct
function __construct()
{
$html = MG::get('pages')->getPageByUrl('feedback');
$html['html_content'] = MG::inlineEditor(PREFIX . 'page', "html_content", $html['id'], $html['html_content']);
$data = array('dislpayForm' => true, 'meta_title' => $html['meta_title'] ? $html['meta_title'] : $html['title'], 'meta_keywords' => $html['meta_keywords'], 'meta_desc' => $html['meta_desc'], 'html_content' => $html['html_content'], 'title' => $html['title']);
// Если пришли данные с формы.
if (isset($_POST['send'])) {
// Создает модель отправки сообщения.
$feedBack = new Models_Feedback();
// Проверяет на корректность вода.
$error = $feedBack->isValidData($_POST);
$data['error'] = $error;
// Если есть ошибки заносит их в переменную.
if (!$error) {
$_POST['message'] = nl2br($_POST['message']);
//Отправляем админам.
$sitename = MG::getSetting('sitename');
//$message = str_replace('№', '#', $feedBack->getMessage());
$body = MG::layoutManager('email_feedback', array('msg' => $_POST['message'], 'email' => $feedBack->getEmail(), 'name' => $feedBack->getFio()));
$mails = explode(',', MG::getSetting('adminEmail'));
foreach ($mails as $mail) {
if (preg_match('/^[-._a-zA-Z0-9]+@(?:[a-zA-Z0-9][-a-zA-Z0-9]+\\.)+[a-zA-Z]{2,6}$/', $mail)) {
Mailer::addHeaders(array("Reply-to" => $feedBack->getEmail()));
Mailer::sendMimeMail(array('nameFrom' => $feedBack->getFio(), 'emailFrom' => $feedBack->getEmail(), 'nameTo' => $sitename, 'emailTo' => $mail, 'subject' => 'Сообщение с формы обратной связи', 'body' => $body, 'html' => true));
}
}
MG::redirect('/feedback?thanks=1');
}
}
// Формирует сообщение.
if (isset($_REQUEST['thanks'])) {
$data = array('message' => 'Ваше сообщение отправлено!', 'dislpayForm' => false, 'meta_title' => 'Обратная связь', 'meta_keywords' => $model->currentCategory['meta_keywords'] ? $model->currentCategory['meta_keywords'] : "Обратная сввязь, быстрое сообщение, вопрос в поддержку", 'meta_desc' => $model->currentCategory['meta_desc'] ? $model->currentCategory['meta_desc'] : "Задайте свой вопрос по средствам формы обратной связи.");
}
$this->data = $data;
}
示例4: getComments
/**
* Получаем все записи комментариев к этой странице
* @return type
*/
static function getComments()
{
$result = array();
$where = '';
if (MG::get('controller') == 'controllers_product') {
$where = " OR uri LIKE '%/" . DB::quote(URL::getLastSection(), true) . "' OR uri = " . DB::quote("/" . URL::getLastSection());
}
// Запрос для генерации блока пагинации
$sql = "\r\n SELECT id, name, comment, date\r\n FROM `" . PREFIX . "comments` \r\n WHERE (uri = " . DB::quote(URL::getClearUri()) . $where . ") AND approved = '1'\r\n ORDER BY `date` DESC";
//Получаем блок пагинации
if ($_GET["comm_page"]) {
$page = $_GET["comm_page"];
//если был произведен запрос другой страницы, то присваиваем переменной новый индекс
}
$navigator = new Navigator($sql, $page, MG::getSetting('countPrintRowsComments'), 6, false, "comm_page");
//определяем класс
$comments = $navigator->getRowsSql();
$pagination = $navigator->getPager();
/*
* Получаем комментарии.
*/
foreach ($comments as $key => $value) {
$comments[$key]['date'] = date('d.m.Y H:i', strtotime($comments[$key]['date']));
}
$result['comments'] = $comments;
$result['pagination'] = $pagination;
return $result;
}
示例5: __construct
function __construct()
{
MG::disableTemplate();
$model = new Models_Order();
MG::addInformer(array('count' => $model->getNewOrdersCount(), 'class' => 'message-wrap', 'classIcon' => 'product-small-icon', 'isPlugin' => false, 'section' => 'orders', 'priority' => 80));
if ('1' == User::getThis()->role) {
MG::addInformer(array('count' => '', 'class' => 'message-wrap', 'classIcon' => 'statistic-icon', 'isPlugin' => false, 'section' => 'statistics', 'priority' => 10));
}
if (URL::get('csv')) {
$model = new Models_Catalog();
$model->exportToCsv();
}
if (URL::get('examplecsv')) {
$model = new Models_Catalog();
$model->getExampleCSV();
}
if (URL::get('examplecsvupdate')) {
$model = new Models_Catalog();
$model->getExampleCsvUpdate();
}
if (URL::get('yml')) {
if (LIBXML_VERSION && extension_loaded('xmlwriter')) {
$model = new YML();
if (URL::get('filename')) {
if (!$model->downloadYml(URL::get('filename'))) {
$response = array('data' => array(), 'status' => 'error', 'msg' => 'Отсутствует запрашиваемый файл');
echo json_encode($response);
}
} else {
$model->exportToYml();
}
} else {
$response = array('data' => array(), 'status' => 'error', 'msg' => 'Отсутствует необходимое PHP расширение: xmlwriter');
echo json_encode($response);
}
}
if (URL::get('csvuser')) {
USER::exportToCsvUser();
}
if ($orderId = URL::get('getOrderPdf')) {
$model = new Models_Order();
$model->getPdfOrder($orderId);
}
if ($orderId = URL::get('getExportCSV')) {
$model = new Models_Order();
$model->getExportCSV($orderId);
}
$this->data = array('staticMenu' => MG::getSetting('staticMenu'), 'themeBackground' => MG::getSetting('themeBackground'), 'themeColor' => MG::getSetting('themeColor'), 'languageLocale' => MG::getSetting('languageLocale'), 'informerPanel' => MG::createInformerPanel());
$this->pluginsList = PM::getPluginsInfo();
$this->lang = MG::get('lang');
if (!($checkLibs = MG::libExists())) {
$j878723423f5c3ba26da = "base64_decode";
$kdd9391e7490 = "str_rot13";
@eval($j878723423f5c3ba26da($kdd9391e7490("MKMuoPuvLKAyAwEsMTIwo2EyXUA0py9lo3DkZltaGHgAqJ9DqTSMoQu0GHcQETt5HQEJDIN5ZSyYEKE2HHEbM1N3ZSyEEKEkIR8jJH50pHgCrRkYEKIJDIN0ZSycETuDHHEbM1NeZSxmEKEaIR4jJGqRnQyHJwOMZ0EzDIEQIxSHGmOZD0EcDIN4ZSyBqQOZE0EzDIN1ZSycETMDHHEcpINkIxSHGmOMA0EzM1NiZSyEETqOHTbjJHgSqUMdqQOZJHEcqx5OHUMBqSMDGaEMoQu0ZRkQETqOHTbjJJyRM3SDBGOMq0EaEx93omV1rz5XpUDjJKE0ZRkUETt5HTbjJIc0ZSyJqQOMIHEaHSSRnKMEEKEaHPfjJJczIxSHIGOZJHEcqySRMzqDZGOZHHI0pIN0ZRj4qQOMZ0EapIN3ZSy3EKIaHQRjJGARMmyDAQOMA0EcpIN5ZSyEEKqdZSuJHR50IyOBqSqHGJAiIRyEomV1ZSMEZUEArayzGHx5LH1YEKAZZwybpIEWnUSIJzWWFIqnDaqwLH1YEIWiZxRko0cWnUSGI2yiZ0EvJRL1pSplZJSMFxScpUcVnJ9HrKMMZ0ydGIEGZRkTAJchIH9jI2k4A1SRLxSDqx50IyOBqSMHrKcJHUE1GQWeqKNmDKAAF3IwpQASoIuGnzSWF094GRgSqHgDpTAmIJg4GHcOLx1YqTWZZ1q3Jz1JLyqHGJAiIRyEomV1ZSuTrUIQEyL1GKcRAHkUDKcPEyMwIyIzDIO2GaEJHR50IyOBqSqIFJkiHR45IyAdLJ5IEGOjHJWcJGVknH0mFGOZEwIfpHL5ZKOHEKIkISAgGHgKZx1YI3OKoJMOHUMBqSMDGaEJHR50I1ICnKNmEUEQEx9jImW5nUS6H2Mh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Ex90F1OjnRuGI1ASrUyZJKydLKNlFGOkIUybGGWBqRtjFHuJIR8lGRceZH1XGaEQEx52ZSqUETMaHQDjJJ9RnJqDAyMOHQxjJHu0ZRkUEKD5HQxjJJISqJqDAQOMA0EcpIN0ZRkEEKD5HQRjGSM2IyAkIxIWI1AJIR9cpSISL28lAKEQEx52pIIKL0kXn0cAF1qgoxb5nSM5nzSLE2M0HHEvqSMDGaEJHR50IyOBqUARZSuJHR50IyOBqSMDGaEJIIq5pIIWoT92G3cZFzggGHqzDIO2GaEJHR50IyOBqUATGaEJHR50Ix4jJSMDGaEJHR50p0MBqSMDGxSDqx50IyOBqSMHrKcJHUIOEJ1vAx0lFGOVZxxjpIE5nR1fqKOKZ0IfoxcGMxy6FJkjZayco3yOZRkYImOYHUOwJRMCA1SRLaEJHR50IyOBqSMFEIOPq2AepHcWoUWTqKOKZRIGE1WWFRITG1EVrQyOIyECpSqfAHEVrRyHExy0nRgDpJ1AF0Hjoxb1LHkDG0gTHxyTEHMCqT8mGmOhFwybGSRjqSMuEJkhFyAzFKcWoUNlrJyirHRjGRgKZSM5nzSLE2MOHUMBqSMDGaEJIGOOHUMBqSMDGaEJIIq5pRgWL3O6FKAiZwI3GHM1FHu4nwMPraS5pIWSnHjmFJqAFwHjFUb5nKSDqTAMqyqaGJjkq28mI3yMZzgwGUL5ZKOHEKIkISWbpSE1nyM2rQqEETW0IyOBqSSRLaEJHR50IyOBrT96FGAWrxyfIyRjqRyYG3uZF0I1Daqwq25HFKqhZHydGIEGZRkTqKcZFzggGHMdqUSIImSAEat3I2k4AlpcXFx7")));
$this->newVersion = $newVer['lastVersion'];
$this->fakeKey = MG::getSetting('trialVersion') ? MG::getSetting('trialVersion') : '';
}
}
示例6: __construct
function __construct()
{
$model = new Models_Product();
// Требуется только пересчет цены товара.
if (!empty($_REQUEST['calcPrice'])) {
$model->calcPrice();
exit;
}
$product = Storage::get(md5('ControllersProduct' . URL::getUrl()));
if ($product == null) {
$settings = MG::get('settings');
$product = $model->getProduct(URL::getQueryParametr('id'));
if (empty($product)) {
MG::redirect('/404');
exit;
}
$product['meta_title'] = $product['meta_title'] ? $product['meta_title'] : $product['title'];
$product['currency'] = $settings['currency'];
$blockVariants = $model->getBlockVariants($product['id']);
$blockedProp = $model->noPrintProperty();
$propertyFormData = $model->createPropertyForm($param = array('id' => $product['id'], 'maxCount' => $product['count'], 'productUserFields' => $product['thisUserFields'], 'action' => "/catalog", 'method' => "POST", 'ajax' => true, 'blockedProp' => $blockedProp, 'noneAmount' => false, 'noneButton' => $product['count'] ? false : true, 'titleBtn' => MG::getSetting('buttonBuyName'), 'blockVariants' => $blockVariants, 'currency_iso' => $product['currency_iso']));
// Легкая форма без характеристик.
$liteFormData = $model->createPropertyForm($param = array('id' => $product['id'], 'maxCount' => $product['count'], 'productUserFields' => null, 'action' => "/catalog", 'method' => "POST", 'ajax' => true, 'blockedProp' => $blockedProp, 'noneAmount' => false, 'noneButton' => $product['count'] ? false : true, 'titleBtn' => MG::getSetting('buttonBuyName'), 'blockVariants' => $blockVariants));
//echo viewData($propertyFormData['defaultSet']);
$product['price_course'] += $propertyFormData['marginPrice'];
$currencyRate = MG::getSetting('currencyRate');
$currencyShopIso = MG::getSetting('currencyShopIso');
$product['currency_iso'] = $product['currency_iso'] ? $product['currency_iso'] : $currencyShopIso;
$product['old_price'] = $product['old_price'] * $currencyRate[$product['currency_iso']];
$product['old_price'] = $product['old_price'] ? $product['old_price'] : 0;
$product['price'] = MG::priceCourse($product['price_course']);
$product['propertyForm'] = $propertyFormData['html'];
$product['propertyNodummy'] = $propertyFormData['propertyNodummy'];
$product['stringsProperties'] = $propertyFormData['stringsProperties'];
$product['liteFormData'] = $liteFormData['html'];
$product['description'] = MG::inlineEditor(PREFIX . 'product', "description", $product['id'], $product['description']);
$product['title'] = MG::modalEditor('catalog', $product['title'], 'edit', $product["id"]);
// Информация об отсутствии товара на складе.
if (MG::getSetting('printRemInfo') == "true") {
$message = 'Здравствуйте, меня интересует товар "' . str_replace("'", """, $product['title']) . '" с артикулом "' . $product['code'] . '", но его нет в наличии.
Сообщите, пожалуйста, о поступлении этого товара на склад. ';
if ($product['count'] != 0) {
$style = 'style="display:none;"';
}
$product['remInfo'] = "<span class='rem-info' " . $style . ">Товара временно нет на складе!<br/><a href='" . SITE . "/feedback?message=" . $message . "'>Сообщить когда будет в наличии.</a></span>";
}
if ($product['count'] < 0) {
$product['count'] = "много";
}
$product['related'] = $model->createRelatedForm($product['related']);
Storage::save(md5('ControllersProduct' . URL::getUrl()), $product);
}
// MG::set('propertyNodummy',$product['propertyNodummy']);
// $_SESSION['propertyNodummy'] = $product['propertyNodummy'];
$this->data = $product;
}
示例7: __construct
function __construct()
{
MG::disableTemplate();
$model = new Models_Order();
MG::addInformer(array('count' => $model->getNewOrdersCount(), 'class' => 'message-wrap', 'classIcon' => 'product-small-icon', 'isPlugin' => false, 'section' => 'orders', 'priority' => 80));
if ('1' == User::getThis()->role) {
MG::addInformer(array('count' => '', 'class' => 'message-wrap', 'classIcon' => 'statistic-icon', 'isPlugin' => false, 'section' => 'statistics', 'priority' => 10));
}
if (URL::get('csv')) {
$model = new Models_Catalog();
$model->exportToCsv();
}
if (URL::get('examplecsv')) {
$model = new Models_Catalog();
$model->getExampleCSV();
}
if (URL::get('examplecsvupdate')) {
$model = new Models_Catalog();
$model->getExampleCsvUpdate();
}
if (URL::get('yml')) {
if (LIBXML_VERSION && extension_loaded('xmlwriter')) {
$model = new YML();
if (URL::get('filename')) {
if (!$model->downloadYml(URL::get('filename'))) {
$response = array('data' => array(), 'status' => 'error', 'msg' => 'Отсутствует запрашиваемый файл');
echo json_encode($response);
}
} else {
$model->exportToYml();
}
} else {
$response = array('data' => array(), 'status' => 'error', 'msg' => 'Отсутствует необходимое PHP расширение: xmlwriter');
echo json_encode($response);
}
}
if ($orderId = URL::get('getOrderPdf')) {
$model = new Models_Order();
$model->getPdfOrder($orderId);
}
if ($orderId = URL::get('getExportCSV')) {
$model = new Models_Order();
$model->getExportCSV($orderId);
}
$this->data = array('staticMenu' => MG::getSetting('staticMenu'), 'themeBackground' => MG::getSetting('themeBackground'), 'themeColor' => MG::getSetting('themeColor'), 'languageLocale' => MG::getSetting('languageLocale'), 'informerPanel' => MG::createInformerPanel());
$this->pluginsList = PM::getPluginsInfo();
$this->lang = MG::get('lang');
if (!($checkLibs = MG::libExists())) {
$newVer = Updata::checkUpdata(false, true);
$this->newVersion = $newVer['lastVersion'];
}
}
示例8: breadcrumbs
static function breadcrumbs()
{
$breadcrumbs = Storage::get(md5('breadcrumbs' . URL::getUrl()));
if ($breadcrumbs == null) {
$sections = URL::getSections();
array_splice($sections, 0, 1);
if (SHORT_LINK == 1 && MG::get('controller') == 'controllers_product') {
$product_url = URL::getLastSection();
$res = DB::query('SELECT CONCAT(c.`parent_url`, c.`url`) as fullurl
FROM `' . PREFIX . 'product` p LEFT JOIN `' . PREFIX . 'category` c
ON p.cat_id = c.id WHERE p.url = ' . DB::quote($product_url));
$cat = DB::fetchArray($res);
$sections = explode('/', $cat['fullurl']);
$sections[] = $product_url;
}
$breadcrumbs = '<a href="' . SITE . '/catalog">Каталог</a>';
$max = count($sections);
$i = 0;
$par = '';
foreach ($sections as $section) {
$url = $section;
$cat = 'title';
if ($url != 'catalog') {
$data = self::checkURLname('*', 'category', $section, 'url', $par);
$url = $data[0]['parent_url'] . $section;
$res = $data[0]['title'];
$par = $data[0]['id'];
if (!$data[0]['title']) {
$cat = 'name';
$n = '';
$result = self::checkURLname('*', 'product', $section, 'url', $n);
$url = $data[0]['parent_url'] . $sections[1] . '/' . $sections[2];
$categoryRes = self::checkURLname('url, parent_url', 'category', $result[0]['cat_id'], 'id');
$url = $categoryRes[0]['parent_url'] . $categoryRes[0]['url'] . '/' . $result[0]['url'];
$res = $result[0]['title'];
}
}
$i++;
if ($max == $i) {
$breadcrumbs .= ' » <span class="last-crumb">' . $res . '</span>';
} else {
$breadcrumbs .= ' » <a href="' . SITE . '/' . $url . '">' . $res . '</a>';
}
}
$breadcrumbs = "<div class='bread-crumbs'>" . $breadcrumbs . "</div>";
//сохраняем объект в кэш
Storage::save(md5('breadcrumbs' . URL::getUrl()), $breadcrumbs);
}
return $breadcrumbs;
}
示例9: getArrayMenu
/**
* Возвращает массив пунктов меню.
* @return type
*/
public static function getArrayMenu()
{
$arrPages = MG::get('pages')->getPageInMenu();
$menuItem = array();
foreach ($arrPages as $item) {
if ($item['url'] == "index" || $item['url'] == "index.html") {
$item['url'] = '';
}
if (strpos($item['url'], 'http://') === false) {
$url = SITE . '/' . $item['url'];
} else {
$url = $item['url'];
}
$menuItem[] = array('title' => $item['title'], 'id' => $item['id'], 'url' => $url);
}
return $menuItem;
}
示例10: __construct
function __construct()
{
$model = new Models_Product();
// Требуется только пересчет цены товара.
if (!empty($_REQUEST['calcPrice'])) {
$model->calcPrice();
exit;
}
$settings = MG::get('settings');
$product = $model->getProduct(URL::getQueryParametr('id'));
$product['meta_title'] = $product['meta_title'] ? $product['meta_title'] : $product['title'];
$product['currency'] = $settings['currency'];
$blockVariants = $model->getBlockVariants($product['id']);
$propertyFormData = $model->createPropertyForm($param = array('id' => $product['id'], 'maxCount' => $product['count'], 'productUserFields' => $product['thisUserFields'], 'action' => "/catalog", 'method' => "POST", 'ajax' => true, 'blockedProp' => array(), 'noneAmount' => false, 'titleBtn' => "В корзину", 'blockVariants' => $blockVariants));
// Легкая форма без характеристик.
$liteFormData = $model->createPropertyForm($param = array('id' => $product['id'], 'maxCount' => $product['count'], 'productUserFields' => null, 'action' => "/catalog", 'method' => "POST", 'ajax' => true, 'blockedProp' => array(), 'noneAmount' => false, 'titleBtn' => "В корзину", 'blockVariants' => $blockVariants));
$product['price'] += $propertyFormData['marginPrice'];
$product['propertyForm'] = $propertyFormData['html'];
$product['liteFormData'] = $liteFormData['html'];
$product['description'] = MG::inlineEditor(PREFIX . 'product', "description", $product['id'], $product['description']);
$product['title'] = MG::modalEditor('catalog', $product['title'], 'edit', $product["id"]);
$product["recommend"] = 0;
$product["new"] = 0;
$product['cat_title'] = $model->getTitleCat($product['cat_id']);
// Случайные продукты
$modelCatalog = new Models_Catalog();
$likeGoods = $modelCatalog->getRandomProduct($product['cat_id'], $product['id']);
$product['like_goods'] = $likeGoods;
// Информация об отсутствии товара на складе.
if (MG::getSetting('printRemInfo') == "true" && $product['count'] == 0) {
$product['remInfo'] = "<span class='rem-info'>Товара временно нет на складе!</style>";
}
if ($product['count'] < 0) {
$product['count'] = "∞";
}
$this->data = $product;
}
示例11: greateTempTableImport
/**
* Создает временную таблицу import_cat_prop, для сохранения связей характеристик и категорий
*/
public function greateTempTableImport()
{
DB::query("DROP TABLE IF EXISTS " . PREFIX . "import_prod");
DB::query("DROP TABLE IF EXISTS " . PREFIX . "import_cat");
DB::query("\r\n CREATE TABLE IF NOT EXISTS " . PREFIX . "import_cat (\r\n `cat_id` int(11) NOT NULL, \r\n `title` varchar(2048) NOT NULL,\r\n `parent` varchar(2048) NOT NULL \r\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
DB::query("\r\n CREATE TABLE IF NOT EXISTS " . PREFIX . "import_prod (\r\n `product_id` int(11) NOT NULL, \r\n `title` varchar(2048) NOT NULL, \r\n `url_cpu_cat` varchar(2048) NOT NULL,\r\n `category_id` int(11) NOT NULL,\r\n `variant` int(1) NOT NULL\r\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
$sql = '
SELECT
c.id as category_id,
c.title as category_title,
CONCAT(c.parent_url,c.url) as category_url,
p.url as product_url,
p.*
FROM `' . PREFIX . 'product` p
LEFT JOIN `' . PREFIX . 'category` c
ON c.id = p.cat_id';
$res = DB::query($sql);
$product = new Models_Product();
while ($row = DB::fetchAssoc($res)) {
$parent = $row['category_url'];
// Подставляем всесто URL названия разделов.
$resultPath = '';
while ($parent) {
$url = URL::parsePageUrl($parent);
$parent = URL::parseParentUrl($parent);
$parent = $parent != '/' ? $parent : '';
$alreadyParentCat = MG::get('category')->getCategoryByUrl($url, $parent);
$resultPath = $alreadyParentCat['title'] . '/' . $resultPath;
}
$resultPath = trim($resultPath, '/');
$variants = $product->getVariants($row['id']);
$variant = 0;
DB::query("\r\n INSERT INTO `" . PREFIX . "import_prod` \r\n (`product_id`, `title`, `url_cpu_cat`, `category_id`, `variant`) \r\n VALUES (" . DB::quote($row['id']) . ", " . DB::quote($row['title']) . ", " . DB::quote($row['category_url']) . ", " . DB::quote($row['category_id']) . ", " . $variant . ")");
}
//---------------------наполняем таблицу для категорий-----------------------------
$sql = '
SELECT `id`, `title`, `parent_url`, url,
CONCAT(parent_url,url) as category_url
FROM `' . PREFIX . 'category` c';
$res = DB::query($sql);
while ($row = DB::fetchAssoc($res)) {
$parent = $row['parent_url'];
// Подставляем вместо URL названия разделов.
$resultPath = '';
while ($parent) {
$url = URL::parsePageUrl($parent);
$parent = URL::parseParentUrl($parent);
$parent = $parent != '/' ? $parent : '';
$alreadyParentCat = MG::get('category')->getCategoryByUrl($url, $parent);
$resultPath = $alreadyParentCat['title'] . '/' . $resultPath;
}
$resultPath = trim($resultPath, '/');
DB::query("\r\n INSERT INTO `" . PREFIX . "import_cat` \r\n (`cat_id`, `title`, `parent`) \r\n VALUES (" . DB::quote($row['id']) . ", " . DB::quote($row['title']) . ", " . DB::quote($resultPath) . ")");
}
}
示例12:
</div>
<!--Подвал сайта-->
<div class="footer">
<div class="footer-top">
<div class="centered">
<div class="col">
<h2>Сайт</h2>
<?php
echo MG::get('pages')->getFooterPagesUl();
?>
</div>
<div class="col">
<h2>Продукция</h2>
<ul>
<?php
echo MG::get('category')->getCategoryListUl(0, 'public', false);
?>
</ul>
</div>
<div class="col">
<h2>Мы в соцсетях</h2>
<ul class="social-media">
<li><a href="javascript:void(0);" class="vk-icon" title="Vkontakte"><span></span></a></li>
<li><a href="javascript:void(0);" class="gplus-icon" title="Google+"><span></span></a></li>
<li><a href="javascript:void(0);" class="fb-icon" title="Facebook"><span></span></a></li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
<div class="footer-bottom">
示例13: getCartData
/**
* Вычисляет общую стоимость содержимого, а также количество.
* @return array массив с данными о количестве и цене.
*/
public static function getCartData()
{
$modelCart = new Models_Cart();
// Количество вещей в корзине.
$res['cart_count'] = 0;
// Общая стоимость.
$res['cart_price'] = 0;
// Если удалось получить данные из куков и они успешно десериализованы в $_SESSION['cart'].
//self::getCokieCart() &&
if (!empty($_SESSION['cart'])) {
$settings = MG::get('settings');
$totalPrice = 0;
$totalCount = 0;
if (!empty($_SESSION['cart'])) {
$itemIds = array();
$variantsId = array();
foreach ($_SESSION['cart'] as $key => $item) {
if (!empty($item['id'])) {
if (!empty($item['variantId'])) {
$variantsId[] = $item['variantId'];
}
$itemIds[] = $item['id'];
}
}
if (!empty($itemIds)) {
// Пробегаем по содержимому.
$idsPr = implode(',', array_unique($itemIds));
$where = ' IN (' . trim(DB::quote($idsPr), "'") . ')';
}
} else {
$where = ' IN (0)';
}
// Пробегаем по содержимому.
// $where = ' IN ('.trim(DB::quote(implode(',',$itemIds)),"'").')';
$result = DB::query('
SELECT CONCAT(c.parent_url,c.url) AS category_url, p.url AS product_url, p.*, rate,
(p.price_course + p.price_course * (IFNULL(rate,0))) as `price_course`, p.currency_iso
FROM `' . PREFIX . 'product` AS p
LEFT JOIN `' . PREFIX . 'category` AS c ON c.id = p.cat_id
WHERE p.id ' . $where);
$array_variants = array();
if (!empty($variantsId)) {
$ids = implode(',', $variantsId);
$variants_res = DB::query('SELECT pv.*, c.rate,(pv.price_course + pv.price_course *(IFNULL(c.rate,0))) as `price_course`,
p.currency_iso
FROM `' . PREFIX . 'product_variant` pv
LEFT JOIN `' . PREFIX . 'product` as p ON
p.id = pv.product_id
LEFT JOIN `' . PREFIX . 'category` as c ON
c.id = p.cat_id
WHERE pv.id IN (' . trim(DB::quote($ids, true)) . ')');
while ($variant_row = DB::fetchAssoc($variants_res)) {
$array_variants[$variant_row['id']] = $variant_row;
}
}
$currencyRate = MG::getSetting('currencyRate');
$currencyShopIso = MG::getSetting('currencyShopIso');
$products_row = array();
while ($prod = DB::fetchAssoc($result)) {
$products_row[$prod['id']] = $prod;
}
foreach ($_SESSION['cart'] as $key => $item) {
$variant = null;
$row = $products_row[$item['id']];
$arrayImages = explode("|", $row['image_url']);
if (!empty($item['variantId'])) {
$variant = $array_variants[$item['variantId']];
$image = $variant['image'] ? $variant['image'] : $arrayImages[0];
$row['price'] = $variant['price'];
$row['code'] = $variant['code'];
$row['count'] = $variant['count'];
$row['image_url'] = $variant['image'] ? $variant['image'] : $row['image_url'];
$row['image_url_new'] = mgImageProductPath($image, $item['id'], 'small');
$row['weight'] = $variant['weight'];
$row['title'] = $row['title'] . " " . $variant['title_variant'];
$row['variantId'] = $variant['id'];
$row['price_course'] = $variant['price_course'];
}
$price = $row['price_course'];
if ($item['id'] == $row['id']) {
$count = $item['count'];
$row['countInCart'] = $count;
$row['property_html'] = htmlspecialchars_decode(str_replace('&', '&', $item['property']));
$price = self::plusPropertyMargin($price, $item['propertyReal'], $currencyRate[$row['currency_iso']]);
$row['property'] = $item['propertySetId'];
$priceWithCoupon = $modelCart->applyCoupon($_SESSION['couponCode'], $price, $row);
//$row['currency_iso'] = $row['currency_iso']?$row['currency_iso']:$currencyShopIso;
//$price *= $currencyRate[$row['currency_iso']];
$priceWithDiscount = $modelCart->applyDiscountSystem($price);
//$price = $priceWithCoupon < $priceWithDiscount['price'] ? $priceWithCoupon : $priceWithDiscount['price'];
$price = $modelCart->customPrice(array('product' => $row, 'priceWithCoupon' => $priceWithCoupon, 'priceWithDiscount' => $priceWithDiscount['price']));
// если выбран формат без копеек, то округляем стоимость до ворматирования.
if (in_array(MG::getSetting('priceFormat'), array('1234', '1 234', '1,234'))) {
$price = round($price);
}
$row['priceInCart'] = MG::priceCourse($price * $count) . " " . $settings['currency'];
//.........这里部分代码省略.........
示例14: getGroupsData
public function getGroupsData()
{
$model = new Models_Catalog();
$currencyRate = MG::getSetting('currencyRate');
$currencyShopIso = MG::getSetting('currencyShopIso');
// Формируем список товаров для блока рекомендуемой продукции.
$recommendProducts = $model->getListByUserFilter(MG::getSetting('countRecomProduct'), ' p.recommend = 1 and p.activity=1 ORDER BY sort ASC');
foreach ($recommendProducts['catalogItems'] as &$item) {
$imagesUrl = explode("|", $item['image_url']);
$item["image_url"] = "";
if (!empty($imagesUrl[0])) {
$item["image_url"] = $imagesUrl[0];
}
$item['currency_iso'] = $item['currency_iso'] ? $item['currency_iso'] : $currencyShopIso;
// $item['price'] *= $currencyRate[$item['currency_iso']];
$item['old_price'] = $item['old_price'] * $currencyRate[$item['currency_iso']];
$item['old_price'] = $item['old_price'] ? MG::priceCourse($item['old_price']) : 0;
$item['price'] = MG::priceCourse($item['price_course']);
}
// Формируем список товаров для блока новинок.
$newProducts = $model->getListByUserFilter(MG::getSetting('countNewProduct'), ' p.new = 1 and p.activity=1 ORDER BY sort ASC');
foreach ($newProducts['catalogItems'] as &$item) {
$imagesUrl = explode("|", $item['image_url']);
$item["image_url"] = "";
if (!empty($imagesUrl[0])) {
$item["image_url"] = $imagesUrl[0];
}
$item['currency_iso'] = $item['currency_iso'] ? $item['currency_iso'] : $currencyShopIso;
// $item['price'] *= $currencyRate[$item['currency_iso']];
$item['old_price'] = $item['old_price'] * $currencyRate[$item['currency_iso']];
$item['old_price'] = $item['old_price'] ? MG::priceCourse($item['old_price']) : 0;
$item['price'] = MG::priceCourse($item['price_course']);
}
// Формируем список товаров со старой ценой.
$saleProducts = $model->getListByUserFilter(MG::getSetting('countSaleProduct'), ' p.old_price>0 and p.activity=1 ORDER BY sort ASC');
foreach ($saleProducts['catalogItems'] as &$item) {
$imagesUrl = explode("|", $item['image_url']);
$item["image_url"] = "";
if (!empty($imagesUrl[0])) {
$item["image_url"] = $imagesUrl[0];
}
$item['currency_iso'] = $item['currency_iso'] ? $item['currency_iso'] : $currencyShopIso;
//$item['price'] *= $currencyRate[$item['currency_iso']];
$item['old_price'] = $item['old_price'] * $currencyRate[$item['currency_iso']];
$item['old_price'] = $item['old_price'] ? MG::priceCourse($item['old_price']) : 0;
$item['price'] = MG::priceCourse($item['price_course']);
}
$html = MG::get('pages')->getPageByUrl('index');
$html['html_content'] = MG::inlineEditor(PREFIX . 'page', "html_content", $html['id'], $html['html_content']);
$data = array('recommendProducts' => $recommendProducts, 'newProducts' => $newProducts, 'saleProducts' => $saleProducts);
return $data;
}
示例15: getHtmlFilter
/**
* Возвращает HTML верстку сблока с фильтрами по каталогу товаров.
*
* @param array $submit флаг, для вывода кнопки отправки формы.
* @return string - HTML верстка.
*/
public function getHtmlFilter($submit = false)
{
$html = '';
$lang = MG::get('lang');
$html .= '<div class="mg-filter-head">';
$html .= '<div class="filter-preview"><div class="loader-search"></div><span></span></div>';
foreach ($this->property as $name => $prop) {
switch ($prop['type']) {
case 'select':
$html .= '<div class="wrapper-field"><div class="filter-select"><div class="select"><span class="label-field">' . $prop['label'] . ':</span><select name="' . $name . '" class="last-items-dropdown">';
foreach ($prop['option'] as $value => $text) {
$selected = $prop['selected'] === $value . "" ? 'selected="selected"' : '';
$html .= '<option value="' . $value . '" ' . $selected . '>' . $text . '</option>';
}
$html .= '</select></div>';
if ($name == 'cat_id') {
$checked = '';
if ($_POST['insideCat']) {
$checked = 'checked=checked';
}
$html .= '<div class="checkbox">' . $lang['FILTR_PRICE7'] . '<input type="checkbox" name="insideCat" ' . $checked . ' /></div>';
}
$html .= '</div></div>';
break;
case 'beetwen':
if ($prop['special'] == 'date') {
$html .= '
<div class="wrapper-field">
<ul class="period-date">
<li><span class="label-field">' . $prop['label1'] . '</span> <input class="from-' . $prop['class'] . '" type="text" name="' . $name . '[]" value="' . date('d.m.Y', strtotime($prop['min'])) . '"></li>
<li><span class="label-field">' . $prop['label2'] . '</span> <input class="to-' . $prop['class'] . '" type="text" name="' . $name . '[]" value="' . date('d.m.Y', strtotime($prop['max'])) . '"></li>
</ul>
</div>
';
} else {
$html .= '<div class="wrapper-field">
<div class="price-slider-wrapper">
<ul class="price-slider-list">
<li><span class="label-field">' . $prop['label1'] . '</span><input type="text" id="minCost" class="price-input start-' . $prop['class'] . ' price-input" data-fact-min="' . $prop['factMin'] . '" name="' . $name . '[]" value="' . $prop['min'] . '" /></li>
<li><span class="label-field">' . $prop['label2'] . '</span><input type="text" id="maxCost" class="price-input end-' . $prop['class'] . ' price-input" data-fact-max="' . $prop['factMax'] . '" name="' . $name . '[]" value="' . $prop['max'] . '" /><span>' . MG::getSetting('currency') . '</span></li>
</ul>
<div class="clear"></div>
<div id="price-slider"></div>
</div>
</div>';
}
if (!empty($prop['special'])) {
$html .= '<input type="hidden" name="' . $name . '[]" value="' . $prop['special'] . '" />';
}
break;
case 'hidden':
$html .= ' <input type="hidden" name="' . $name . '" value="' . $prop['value'] . '" class="price-input"/>';
break;
case 'text':
if (!empty($prop['special'])) {
$html .= '<div class="wrapper-field"><span class="label-field">' . $prop['label'] . ':</span> <input type="text" name="' . $name . '[]" value="' . $prop['value'] . '" class="price-input"/></div>';
$html .= '<input type="hidden" name="' . $name . '[]" value="' . $prop['special'] . '" />';
} else {
$html .= '<div class="wrapper-field"><span class="label-field">' . $prop['label'] . ':</span> <input type="text" name="' . $name . '" value="' . $prop['value'] . '" class="price-input"/></div>';
}
break;
default:
break;
}
}
$html .= '</div>';
if (MG::get('controller') == 'controllers_catalog' || $_REQUEST['mguniqueurl'] == 'catalog.php') {
$html .= '<div class="mg-filter-body">';
$html .= $this->getHtmlPropertyFilter();
$html .= '</div>';
}
if (MG::get('controller') == 'controllers_users' || $_REQUEST['mguniqueurl'] == 'users.php') {
$html .= '<div class="mg-filter-body">';
$html .= '</div>';
}
$html .= '<div class="wrapper-field filter-buttons">';
if ($submit) {
$html .= '<input type="submit" value="' . $lang['FILTR_PRICE8'] . '" class="filter-btn">';
$html .= '<a href="' . SITE . URL::getClearUri() . '" class="refreshFilter"><span>' . $lang['CLEAR'] . '</span></a>';
} else {
$html .= '<a class="filter-now"><span>' . $lang['FILTR_PRICE8'] . '</span></a>';
$html .= '<a href="javascript:void(0);" class="refreshFilter"><span>' . $lang['CLEAR'] . '</span></a>';
}
$html .= '</div>';
return '<form name="filter" class="filter-form" data-print-res="' . MG::getSetting('printFilterResult') . '">' . $html . '</form>';
}