Ejemplo n.º 1
0
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($mode == 'search') {
    fn_add_breadcrumb(__('store_locator'));
    list($store_locations, $search) = fn_get_store_locations($_REQUEST);
    Registry::get('view')->assign('sl_settings', fn_get_store_locator_settings());
    Registry::get('view')->assign('store_locations', $store_locations);
    Registry::get('view')->assign('store_locator_search', $search);
}
if ($mode == "show_store") {
    fn_add_breadcrumb(__('store_locator'));
    if (intval($_REQUEST['store_location_id'])) {
        $store_locations[0] = fn_get_store_location(intval($_REQUEST['store_location_id']));
        Registry::get('view')->assign('sl_settings', fn_get_store_locator_settings());
        Registry::get('view')->assign('store_locations', $store_locations);
    }
}
if ($mode == "show_all_stores") {
    fn_add_breadcrumb(__('store_locator'));
    $aviable_cities = array();
Ejemplo n.º 2
0
        }
    }
    return array(CONTROLLER_STATUS_OK, 'store_locator' . $suffix);
}
if ($mode == 'delete') {
    if (!empty($_REQUEST['store_location_id'])) {
        if (fn_delete_store_location($_REQUEST['store_location_id'])) {
            $count = db_get_field("SELECT COUNT(*) FROM ?:store_locations");
            if (empty($count)) {
                Registry::get('view')->display('addons/store_locator/views/store_locator/manage.tpl');
            }
        }
    }
    exit;
} elseif ($mode == 'manage') {
    list($store_locations, $search) = fn_get_store_locations($_REQUEST, Registry::get('settings.Appearance.admin_elements_per_page'), DESCR_SL);
    Registry::get('view')->assign('sl_settings', fn_get_store_locator_settings());
    Registry::get('view')->assign('store_locations', $store_locations);
    Registry::get('view')->assign('search', $search);
} elseif ($mode == 'add') {
    // [Page sections]
    Registry::set('navigation.tabs', array('detailed' => array('title' => __('general'), 'js' => true), 'addons' => array('title' => __('addons'), 'js' => true)));
    // [/Page sections]
} elseif ($mode == 'update') {
    $store_location = fn_get_store_location($_REQUEST['store_location_id'], DESCR_SL);
    if (empty($store_location)) {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
    Registry::get('view')->assign('store_location', $store_location);
    // [Page sections]
    $tabs = array('detailed' => array('title' => __('general'), 'js' => true), 'addons' => array('title' => __('addons'), 'js' => true));
Ejemplo n.º 3
0
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($mode == 'configure') {
    if (!empty($_REQUEST['shipping_id'])) {
        $module = !empty($_REQUEST['module']) ? $_REQUEST['module'] : '';
        if ($module == 'pickup') {
            $shipping = Tygh::$app['view']->getTemplateVars('shipping');
            $params = array();
            list($locations, $params) = fn_get_store_locations($params);
            $active_stores = array();
            if (!empty($shipping['service_params']['active_stores']) && is_array($shipping['service_params']['active_stores'])) {
                $_active_stores = $shipping['service_params']['active_stores'];
                foreach ($_active_stores as $store_location_id) {
                    $active_stores[$store_location_id] = $locations[$store_location_id]['city'] . ' (' . $locations[$store_location_id]['name'] . ')';
                    $locations[$store_location_id]['name'];
                }
            }
            if (!empty($locations)) {
                $stores = $all_stores = $select_stores = array();
                foreach ($locations as $location) {
                    if ($location['pickup_avail'] == 'Y') {
                        $result = array_search($location['store_location_id'], $active_stores);
                        if ($result === false) {
                            $select_stores[$location['store_location_id']] = $location['city'] . ' (' . $location['name'] . ')';