Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

sergeantpepper

Newbie
  
  • Posts

    8
  • Joined

  • Last visited

Everything posted by sergeantpepper

  1. Ладно, ок. Вот рабочий код (версия 1.5.5): <?php error_reporting (E_ALL); // Version define('VERSION', '1.5.5.1.2'); // Configuration if (file_exists('config.php')) { require_once('config.php'); } // VirtualQMOD require_once('./vqmod/vqmod.php'); VQMod::bootup(); // VQMODDED Startup require_once(VQMod::modCheck(DIR_SYSTEM . 'startup.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/customer.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/affiliate.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/currency.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/tax.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/weight.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/length.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/cart.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/ocstore.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/proudly_define.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/proudly_common.php')); // Registry $registry = new Registry(); // Loader $loader = new Loader($registry); $registry->set('load', $loader); // Config $config = new Config(); $registry->set('config', $config); // Database $db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE); $registry->set('db', $db); // Store if (isset($_SERVER['HTTPS']) && (($_SERVER['HTTPS'] == 'on') || ($_SERVER['HTTPS'] == '1'))) { $store_query = $db->query("SELECT * FROM " . DB_PREFIX . "store WHERE REPLACE(`ssl`, 'www.', '') = '" . $db->escape('https://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/') . "'"); } else { $store_query = $db->query("SELECT * FROM " . DB_PREFIX . "store WHERE REPLACE(`url`, 'www.', '') = '" . $db->escape('http://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/') . "'"); } if ($store_query->num_rows) { $config->set('config_store_id', $store_query->row['store_id']); } else { $config->set('config_store_id', 0); } // Settings $query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0' OR store_id = '" . (int)$config->get('config_store_id') . "' ORDER BY store_id ASC"); foreach ($query->rows as $setting) { if (!$setting['serialized']) { $config->set($setting['key'], $setting['value']); } else { $config->set($setting['key'], unserialize($setting['value'])); } } if (!$store_query->num_rows) { $config->set('config_url', HTTP_SERVER); $config->set('config_ssl', HTTPS_SERVER); } // Url $url = new Url($config->get('config_url'), $config->get('config_secure') ? $config->get('config_ssl') : $config->get('config_url')); $registry->set('url', $url); // Log $log = new Log($config->get('config_error_filename')); $registry->set('log', $log); function error_handler($errno, $errstr, $errfile, $errline) { global $log, $config; switch ($errno) { case E_NOTICE: case E_USER_NOTICE: $error = 'Notice'; break; case E_WARNING: case E_USER_WARNING: $error = 'Warning'; break; case E_ERROR: case E_USER_ERROR: $error = 'Fatal Error'; break; default: $error = 'Unknown'; break; } if ($config->get('config_error_display')) { echo '<b>' . $error . '</b>: ' . $errstr . ' in <b>' . $errfile . '</b> on line <b>' . $errline . '</b>'; } if ($config->get('config_error_log')) { $log->write('PHP ' . $error . ': ' . $errstr . ' in ' . $errfile . ' on line ' . $errline); } return true; } // Error Handler set_error_handler('error_handler'); // Request $request = new Request(); $registry->set('request', $request); // Response $response = new Response(); $response->addHeader('Content-Type: text/html; charset=utf-8'); $response->setCompression($config->get('config_compression')); $registry->set('response', $response); // Cache $cache = new Cache(); $registry->set('cache', $cache); // Session $session = new Session(); $registry->set('session', $session); // Language Detection $languages = array(); $query = $db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE status = '1'"); foreach ($query->rows as $result) { $languages[$result['code']] = $result; } $detect = ''; if (isset($request->server['HTTP_ACCEPT_LANGUAGE']) && $request->server['HTTP_ACCEPT_LANGUAGE']) { $browser_languages = explode(',', $request->server['HTTP_ACCEPT_LANGUAGE']); foreach ($browser_languages as $browser_language) { foreach ($languages as $key => $value) { if ($value['status']) { $locale = explode(',', $value['locale']); if (in_array($browser_language, $locale)) { $detect = $key; } } } } } if (isset($session->data['language']) && array_key_exists($session->data['language'], $languages) && $languages[$session->data['language']]['status']) { $code = $session->data['language']; } elseif (isset($request->cookie['language']) && array_key_exists($request->cookie['language'], $languages) && $languages[$request->cookie['language']]['status']) { $code = $request->cookie['language']; } elseif ($detect) { $code = $detect; } else { $code = $config->get('config_language'); } if (!isset($session->data['language']) || $session->data['language'] != $code) { $session->data['language'] = $code; } if (!isset($request->cookie['language']) || $request->cookie['language'] != $code) { setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $request->server['HTTP_HOST']); } $config->set('config_language_id', $languages[$code]['language_id']); $config->set('config_language', $languages[$code]['code']); // Language $language = new Language($languages[$code]['directory']); $language->load($languages[$code]['filename']); $registry->set('language', $language); // Document $registry->set('document', new Document()); // Customer $registry->set('customer', new Customer($registry)); // Affiliate $registry->set('affiliate', new Affiliate($registry)); if (isset($request->get['tracking'])) { setcookie('tracking', $request->get['tracking'], time() + 3600 * 24 * 1000, '/'); } // Currency $registry->set('currency', new Currency($registry)); // Tax $registry->set('tax', new Tax($registry)); // Weight $registry->set('weight', new Weight($registry)); // Length $registry->set('length', new Length($registry)); // Cart $registry->set('cart', new Cart($registry)); // ocStore features $registry->set('ocstore', new ocStore($registry)); // Encryption $registry->set('encryption', new Encryption($config->get('config_encryption'))); // Front Controller $controller = new Front($registry); // Maintenance Mode $controller->addPreAction(new Action('common/maintenance')); /** CRON actions */ // yandex market yml $yandex_market = new Action('feed/yandex_market'); $controller->dispatch($yandex_market, new Action('error/not_found')); ?>
  2. Прошу помочь советом, $yandex_market = new Action('feed/yandex_market'); echo 'a'; Нормально отрабатывает, выводится «a». Однако код die('controller'); В начале файла контроллера по адресу catalog/controller/feed/yandex_market.php не срабатывает.
  3. Уважаемый, halfhope, прошу прощения, если туплю на ровном месте. Но пока так и не разобрался с запуском функции. Файл index.php и system/startup.php смотрел (в последнем, кстати, кажется нет таких вызовов, по крайней мере в моей версии opencart 1.5.5). Подскажите, пожалуйста, мб я вообще имею какую стороннюю проблему, так как дебаггинг выводит, что приведенная строчка норм работает, но die() в начале файла контроллера не срабатывает.
  4. Как при этом вызвать функцию index()? halfhope, большое спасибо за статьи! Долго искал нечто похожее для знакомства с движком. Только здесь http://halfhope.ru/2015/02/09/полезный-код-для-разработчиков-opencart-2/ не работает якорная навигация.
  5. halfhope, подскажите, пожалуйста, вы привели код, который запускает функцию модели. Не могли бы помочь с подобной ситуацией — необходимо запустить функцию контроллера. Речь правда идет о функции index(). Для примера необходимо подключить этот котроллер: feed -> yandex_market
  6. Добрый день! В корне сайта есть файл cron.php с кодом: <?php error_reporting (E_ALL); // Version define('VERSION', '1.5.5.1.2'); // Configuration if (file_exists('config.php')) { require_once('config.php'); } // VirtualQMOD require_once('./vqmod/vqmod.php'); VQMod::bootup(); // VQMODDED Startup require_once(VQMod::modCheck(DIR_SYSTEM . 'startup.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/customer.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/affiliate.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/currency.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/tax.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/weight.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/length.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/cart.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/ocstore.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/proudly_define.php')); require_once(VQMod::modCheck(DIR_SYSTEM . 'library/proudly_common.php')); // Registry $registry = new Registry(); // Loader $loader = new Loader($registry); $registry->set('load', $loader); // Config $config = new Config(); $registry->set('config', $config); // Database $db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE); $registry->set('db', $db); // currency $currency = new cbCurrency(); $dollar = $currency->GetDollarRubCourse(); $euro = $currency->GetEuroRubCourse(); if($dollar) $db->query('UPDATE ' . DB_PREFIX .'product SET price=price_dollar*'.$dollar.' WHERE price_dollar<>0'); if($euro) $db->query('UPDATE ' . DB_PREFIX .'product SET price=price_euro*'.$euro.' WHERE price_euro<>0'); ?> В конце кода необходимо запустить функцию модели (или контроллера). Пытался гуглить это, но тщетно. В контроллере я бы это сделал так: $this->load->model('catalog/category'); $this->model_catalog_category->syncAllCategoriesManufacturers(); Не знаю от имени чего запускать :oops:
  7. Здравствуйте! Есть работающий магазин на OpenCart 1.5.6. Возникла необходимость сделать редизайн, добавить и видоизменить функционал. Для того, чтобы не задевать работающую версию было решено сделать полную копию файлов сайта и бд и развернуть ее в подпапке "dev". Однако, по всей видимости, настройки .htaccess мешают этому. Прошу простить, так как не очень хорошо разбираюсь в .htaccess. Сейчас при обращении к подпапке открывается оригинал со страницей "Запрашиваемая страница не найдена!". Подскажите, как можно устранить данную проблему? Спасибо.
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.