Exemplo n.º 1
0
function magiczoom($content, $currentController = false, $type = false, $info = false)
{
    if ($currentController->config->get('magiczoom_status') != 0) {
        $tool =& magiczoom_load_core_class($currentController);
        //set_params_from_config($currentController->config);
        $enabled_on_this_page = false;
        unset($GLOBALS['magictoolbox']['items']);
        $tool->params->set('disable-zoom', 'No');
        if ($tool->type == 'standard') {
            //do not apply MSS-like modules to category & product pages
            if ($type && $type == 'category' && !$tool->params->checkValue('use-effect-on-category-page', 'No')) {
                $enabled_on_this_page = true;
            }
            if ($type && $type == 'manufacturers' && !$tool->params->checkValue('use-effect-on-manufacturers-page', 'No')) {
                $enabled_on_this_page = true;
            }
            if ($type && $type == 'product' && !$tool->params->checkValue('use-effect-on-product-page', 'No')) {
                $enabled_on_this_page = true;
                $tool->params->set('disable-zoom', $GLOBALS['magictoolbox']['product-disable-zoom']);
            }
        }
        if ($tool->type == 'circle') {
            //Apply 360 only to Products Page
            if ($type && $type == 'product') {
                $enabled_on_this_page = true;
            }
        } else {
            if ($type && ($type == 'latest_home_category' || $type == 'latest_home' || $type == 'latest_right' || $type == 'latest_left' || $type == 'latest_content_top' || $type == 'latest_content_bottom' || $type == 'latest_column_left' || $type == 'latest_column_right') && !$tool->params->checkValue('use-effect-on-latest-box', 'No')) {
                $enabled_on_this_page = true;
            }
            if ($type && ($type == 'featured_home' || $type == 'featured_right' || $type == 'featured_left' || $type == 'featured_left' || $type == 'featured_content_top' || $type == 'featured_content_bottom' || $type == 'featured_column_left' || $type == 'featured_column_right') && !$tool->params->checkValue('use-effect-on-featured-box', 'No')) {
                $enabled_on_this_page = true;
            }
            if ($type && ($type == 'special_home' || $type == 'special_right' || $type == 'special_left' || $type == 'special_content_top' || $type == 'special_content_bottom' || $type == 'special_column_left' || $type == 'special_column_right') && !$tool->params->checkValue('use-effect-on-special-box', 'No')) {
                $enabled_on_this_page = true;
            }
            if ($type && ($type == 'bestseller_home' || $type == 'bestseller_right' || $type == 'bestseller_left' || $type == 'bestseller_content_top' || $type == 'bestseller_content_bottom' || $type == 'bestseller_column_left' || $type == 'bestseller_column_right') && !$tool->params->checkValue('use-effect-on-bestsellers-box', 'No')) {
                $enabled_on_this_page = true;
            }
        }
        //if ($type == 'product' || $type == 'category')  { //hack! TODO: load headers only if we need them
        //    $content = set_headers($content);
        //}
        if ($enabled_on_this_page) {
            if ($type) {
                $GLOBALS['magictoolbox']['page_type'] = $type;
            }
            if ($info) {
                $GLOBALS['magictoolbox']['prods_info'] = $info;
            }
            $content = set_headers($content);
            $content = parse_contents($content, $currentController);
            if ($type == 'product' && $tool->type == 'standard' && isset($GLOBALS['magictoolbox']['MagicZoom']['main'])) {
                // template helper class
                require_once dirname(__FILE__) . '/magictoolbox.templatehelper.class.php';
                MagicToolboxTemplateHelperClass::setPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates');
                MagicToolboxTemplateHelperClass::setOptions($tool->params);
                $html = MagicToolboxTemplateHelperClass::render(array('main' => $GLOBALS['magictoolbox']['MagicZoom']['main'], 'thumbs' => count($GLOBALS['magictoolbox']['MagicZoom']['selectors']) > 1 ? $GLOBALS['magictoolbox']['MagicZoom']['selectors'] : array(), 'pid' => $GLOBALS['magictoolbox']['prods_info']['product_id']));
                $content = str_replace('MAGICTOOLBOX_PLACEHOLDER', $html, $content);
            }
        }
    }
    return $content;
}
Exemplo n.º 2
0
<?php

// error_reporting(E_ALL);
// ini_set('display_errors', '1');
require_once dirname(__FILE__) . '/magictoolbox/module.php';
$tool =& magiczoom_load_core_class();
class ControllerModuleMagicZoom extends Controller
{
    private $error = array();
    private $params = array();
    public function index()
    {
        $tool = $GLOBALS["magictoolbox"]["magiczoom"];
        $shop_dir = str_replace('system/', '', DIR_SYSTEM);
        $image_dir = str_replace($shop_dir, '', DIR_IMAGE);
        $pathToCache = '/' . $image_dir . 'magictoolbox_cache';
        /*STANDARD CODE*/
        $this->load->language('module/magiczoom');
        // load lang. file
        /*$this->document->title = $this->language->get('heading_title'); //load title*/
        $this->load->model('setting/setting');
        //just include file admin/model/setting/setting.php and create object ModelSettingSetting
        $token = isset($this->session->data['token']) ? '&token=' . $this->session->data['token'] : '';
        if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
            if (isset($this->request->post['clear_cache']) && $this->request->post['clear_cache'] == '1') {
                //clear cache
                $this->params = $this->model_setting_setting->getSetting('magiczoom');
                //load settings from DB
                foreach ($tool->params->getArray() as $param => $values) {
                    if (isset($this->params[$values['id']])) {
                        $tool->params->set($values['id'], $this->params[$values['id']]);