Example #1
0
 public static function getConfig()
 {
     static $config;
     if (!is_object($config)) {
         JPluginHelper::importPlugin('jshopping');
         $dispatcher = JDispatcher::getInstance();
         $db = JFactory::getDBO();
         $config = new jshopConfig($db);
         include dirname(__FILE__) . "/default_config.php";
         if (file_exists(dirname(__FILE__) . "/user_config.php")) {
             include dirname(__FILE__) . "/user_config.php";
         }
         $dispatcher->trigger('onBeforeLoadJshopConfig', array($config));
         $config->load($config->load_id);
         $config->loadOtherConfig();
         $config->loadCurrencyValue();
         $config->loadFrontLand();
         $config->loadLang();
         $config->parseConfigVars();
         $dispatcher->trigger('onLoadJshopConfig', array(&$config));
     }
     return $config;
 }
Example #2
0
 function setdefault()
 {
     $jshopConfig = JSFactory::getConfig();
     $cid = JRequest::getVar("cid");
     $db = JFactory::getDBO();
     if ($cid[0]) {
         $config = new jshopConfig($db);
         $config->id = $jshopConfig->load_id;
         $config->mainCurrency = $cid[0];
         $config->store();
     }
     $this->setRedirect("index.php?option=com_jshopping&controller=currencies");
 }
Example #3
0
 public static function getConfig()
 {
     static $config;
     if (!is_object($config)) {
         JPluginHelper::importPlugin('jshopping');
         $dispatcher = JDispatcher::getInstance();
         $db = JFactory::getDBO();
         $config = new jshopConfig($db);
         include dirname(__FILE__) . "/default_config.php";
         if (file_exists(dirname(__FILE__) . "/user_config.php")) {
             include dirname(__FILE__) . "/user_config.php";
         }
         $dispatcher->trigger('onBeforeLoadJshopConfig', array($config));
         $config->load($config->load_id);
         $config->loadOtherConfig();
         $config->loadCurrencyValue();
         $config->loadFrontLand();
         $config->loadLang();
         list($config->pdf_header_width, $config->pdf_header_height, $config->pdf_footer_width, $config->pdf_footer_height) = explode(":", $config->pdf_parameters);
         if (!$config->allow_reviews_prod) {
             unset($config->sorting_products_field_select[5]);
             unset($config->sorting_products_name_select[5]);
             unset($config->sorting_products_field_s_select[5]);
             unset($config->sorting_products_name_s_select[5]);
         }
         if ($config->product_count_related_in_row < 1) {
             $config->product_count_related_in_row = 1;
         }
         if ($config->user_as_catalog) {
             $config->show_buy_in_category = 0;
         }
         if (!$config->stock) {
             $config->hide_product_not_avaible_stock = 0;
             $config->hide_buy_not_avaible_stock = 0;
             $config->hide_text_product_not_available = 1;
             $config->product_list_show_qty_stock = 0;
             $config->product_show_qty_stock = 0;
         }
         if ($config->hide_product_not_avaible_stock || $config->hide_buy_not_avaible_stock) {
             $config->controler_buy_qty = 1;
         } else {
             $config->controler_buy_qty = 0;
         }
         $config->display_price_front_current = $config->getDisplayPriceFront();
         // 0 - Brutto, 1 - Netto
         if ($config->template == "") {
             $config->template = "default";
         }
         if ($config->show_product_code || $config->show_product_code_in_cart) {
             $config->show_product_code_in_order = 1;
         } else {
             $config->show_product_code_in_order = 0;
         }
         if ($config->admin_show_vendors == 0) {
             $config->vendor_order_message_type = 0;
             //0 - none, 1 - mesage, 2 - order if not multivendor
             $config->admin_not_send_email_order_vendor_order = 0;
             $config->product_show_vendor = 0;
             $config->product_show_vendor_detail = 0;
         }
         $config->copyrightText = '<span id="mxcpr"><a target="_blank" href="https://www.webdesigner-profi.de/">' . $config->getCopyrightText() . '</a></span>';
         if ($config->image_resize_type == 0) {
             $config->image_cut = 1;
             $config->image_fill = 2;
         } elseif ($config->image_resize_type == 1) {
             $config->image_cut = 0;
             $config->image_fill = 2;
         } else {
             $config->image_cut = 0;
             $config->image_fill = 0;
         }
         if (!$config->tax) {
             $config->show_tax_in_product = 0;
             $config->show_tax_product_in_cart = 0;
             $config->hide_tax = 1;
         }
         if (!$config->admin_show_delivery_time) {
             $config->show_delivery_time = 0;
             $config->show_delivery_time_checkout = 0;
             $config->show_delivery_time_step5 = 0;
             $config->display_delivery_time_for_product_in_order_mail = 0;
             $config->show_delivery_date = 0;
         }
         if (!$config->admin_show_product_basic_price) {
             $config->cart_basic_price_show = 0;
         }
         if (!$config->admin_show_weight) {
             $config->product_show_weight = 0;
             $config->product_list_show_weight = 0;
         }
         $config->use_ssl = intval($config->use_ssl);
         $dispatcher->trigger('onLoadJshopConfig', array(&$config));
     }
     return $config;
 }
Example #4
0
 function save()
 {
     $jshopConfig = JSFactory::getConfig();
     $tab = JRequest::getVar('tab');
     $db = JFactory::getDBO();
     $dispatcher = JDispatcher::getInstance();
     $extconf = array('imageheader' => 'header.jpg', 'imagefooter' => 'footer.jpg');
     $post = JRequest::get("post");
     $dispatcher->trigger('onBeforeSaveConfig', array(&$post, &$extconf));
     //general
     $array = array('display_price_admin', 'display_price_front', 'use_ssl', 'savelog', 'savelogpaymentdata');
     if ($tab == 1) {
         foreach ($array as $key => $value) {
             if (!isset($post[$value])) {
                 $post[$value] = 0;
             }
         }
     }
     if ($tab == 3) {
         $result = array();
         if ($jshopConfig->other_config != '') {
             $result = unserialize($jshopConfig->other_config);
         }
         $config = new stdClass();
         include $jshopConfig->path . 'lib/default_config.php';
         foreach ($image_other_config as $k) {
             $result[$k] = $post[$k];
         }
         $post['other_config'] = serialize($result);
     }
     if ($tab == 5) {
         $vendor = JSFactory::getTable('vendor', 'jshop');
         $post = JRequest::get("post");
         $vendor->id = $post['vendor_id'];
         $vendor->main = 1;
         $vendor->bind($post);
         $vendor->store();
     }
     //category/product
     $array = array('show_buy_in_category', 'show_tax_in_product', 'show_tax_product_in_cart', 'show_plus_shipping_in_product', 'hide_product_not_avaible_stock', 'hide_buy_not_avaible_stock', 'show_sort_product', 'show_count_select_products', 'show_delivery_time', 'demo_type', 'product_show_manufacturer_logo', 'product_show_weight', 'product_attribut_first_value_empty', 'show_hits', 'allow_reviews_prod', 'allow_reviews_only_registered', 'hide_text_product_not_available', 'use_plugin_content', 'product_list_show_weight', 'product_list_show_manufacturer', 'show_product_code', 'product_list_show_min_price', 'show_product_list_filters', 'product_list_show_vendor', 'product_show_vendor', 'product_show_vendor_detail', 'product_show_button_back', 'product_list_show_product_code', 'radio_attr_value_vertical', 'attr_display_addprice', 'product_list_show_price_description', 'display_button_print', 'product_list_show_price_default');
     if ($tab == 6) {
         foreach ($array as $key => $value) {
             if (!isset($post[$value])) {
                 $post[$value] = 0;
             }
         }
         $result = array();
         if ($jshopConfig->other_config != '') {
             $result = unserialize($jshopConfig->other_config);
         }
         $config = new stdClass();
         include $jshopConfig->path . 'lib/default_config.php';
         foreach ($catprod_other_config as $k) {
             $result[$k] = $post[$k];
         }
         $post['other_config'] = serialize($result);
     }
     //case
     $array = array('hide_shipping_step', 'hide_payment_step', 'order_send_pdf_client', 'order_send_pdf_admin', 'hide_tax', 'show_registerform_in_logintemplate', 'sorting_country_in_alphabet', 'show_weight_order', 'discount_use_full_sum', 'show_cart_all_step_checkout', "show_product_code_in_cart", 'show_return_policy_in_email_order', 'client_allow_cancel_order', 'admin_not_send_email_order_vendor_order', 'not_redirect_in_cart_after_buy', 'calcule_tax_after_discount');
     if ($tab == 7) {
         if (!$post['next_order_number']) {
             unset($post['next_order_number']);
         }
         foreach ($array as $key => $value) {
             if (!isset($post[$value])) {
                 $post[$value] = 0;
             }
         }
         $result = array();
         if ($jshopConfig->other_config != '') {
             $result = unserialize($jshopConfig->other_config);
         }
         $config = new stdClass();
         include $jshopConfig->path . 'lib/default_config.php';
         foreach ($checkout_other_config as $k) {
             $result[$k] = $post[$k];
         }
         $post['other_config'] = serialize($result);
     }
     //shop function
     $array = array('without_shipping', 'without_payment', 'enable_wishlist', 'shop_user_guest', 'user_as_catalog', 'use_rabatt_code', 'admin_show_product_basic_price', 'admin_show_attributes', 'admin_show_delivery_time', 'admin_show_languages', 'use_different_templates_cat_prod', 'admin_show_product_video', 'admin_show_product_related', 'admin_show_product_files', 'admin_show_product_bay_price', 'admin_show_product_basic_price', 'admin_show_product_labels', 'admin_show_product_extra_field', 'admin_show_vendors', 'admin_show_freeattributes', 'use_extend_attribute_data');
     if ($tab == 8) {
         foreach ($array as $key => $value) {
             if (!isset($post[$value])) {
                 $post[$value] = 0;
             }
         }
         $post['without_shipping'] = intval(!$post['without_shipping']);
         $post['without_payment'] = intval(!$post['without_payment']);
         $result = array();
         if ($jshopConfig->other_config != '') {
             $result = unserialize($jshopConfig->other_config);
         }
         $config = new stdClass();
         include $jshopConfig->path . 'lib/default_config.php';
         foreach ($adminfunction_other_config as $k) {
             $result[$k] = $post[$k];
         }
         $post['other_config'] = serialize($result);
     }
     if ($tab == 9) {
         $config = new stdClass();
         include $jshopConfig->path . 'lib/default_config.php';
         foreach ($fields_client_sys as $k => $v) {
             foreach ($v as $v2) {
                 $post['field'][$k][$v2]['require'] = 1;
                 $post['field'][$k][$v2]['display'] = 1;
             }
         }
         foreach ($post['field'] as $k => $v) {
             foreach ($v as $k2 => $v2) {
                 if (!$post['field'][$k][$k2]['display']) {
                     $post['field'][$k][$k2]['require'] = 0;
                 }
             }
         }
         $post['fields_register'] = serialize($post['field']);
     }
     if ($tab == 10) {
         $result = array();
         $config = new stdClass();
         include $jshopConfig->path . 'lib/default_config.php';
         if ($jshopConfig->other_config != '') {
             $result = unserialize($jshopConfig->other_config);
         }
         foreach ($other_config as $k) {
             $result[$k] = $post[$k];
         }
         $post['other_config'] = serialize($result);
     }
     if ($tab != 4) {
         $config = new jshopConfig($db);
         $config->id = $jshopConfig->load_id;
         if (!$config->bind($post)) {
             JError::raiseWarning("", _JSHOP_ERROR_BIND);
             $this->setRedirect('index.php?option=com_jshopping&controller=config');
             return 0;
         }
         if ($tab == 6 && $jshopConfig->admin_show_product_extra_field) {
             if (!isset($post['product_list_display_extra_fields'])) {
                 $post['product_list_display_extra_fields'] = array();
             }
             if (!isset($post['filter_display_extra_fields'])) {
                 $post['filter_display_extra_fields'] = array();
             }
             if (!isset($post['product_hide_extra_fields'])) {
                 $post['product_hide_extra_fields'] = array();
             }
             if (!isset($post['cart_display_extra_fields'])) {
                 $post['cart_display_extra_fields'] = array();
             }
             $config->setProductListDisplayExtraFields($post['product_list_display_extra_fields']);
             $config->setFilterDisplayExtraFields($post['filter_display_extra_fields']);
             $config->setProductHideExtraFields($post['product_hide_extra_fields']);
             $config->setCartDisplayExtraFields($post['cart_display_extra_fields']);
         }
         $config->transformPdfParameters();
         if (!$config->store()) {
             JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE . " " . $config->_error);
             $this->setRedirect('index.php?option=com_jshopping&controller=config');
             return 0;
         }
     }
     if (isset($_FILES['header'])) {
         if ($_FILES['header']['size']) {
             @unlink($jshopConfig->path . "images/" . $extconf['imageheader']);
             move_uploaded_file($_FILES['header']['tmp_name'], $jshopConfig->path . "images/" . $extconf['imageheader']);
         }
     }
     if (isset($_FILES['footer'])) {
         if ($_FILES['footer']['size']) {
             @unlink($jshopConfig->path . "images/" . $extconf['imagefooter']);
             move_uploaded_file($_FILES['footer']['tmp_name'], $jshopConfig->path . "images/" . $extconf['imagefooter']);
         }
     }
     if (isset($post['update_count_prod_rows_all_cats']) && $tab == 6 && $post['update_count_prod_rows_all_cats']) {
         $count_products_to_page = intval($post['count_products_to_page']);
         $count_products_to_row = intval($post['count_products_to_row']);
         $query = "update `#__jshopping_categories` set `products_page`='" . $count_products_to_page . "', `products_row`='" . $count_products_to_row . "'";
         $db->setQuery($query);
         $db->query();
         $query = "update `#__jshopping_manufacturers` set `products_page`='" . $count_products_to_page . "', `products_row`='" . $count_products_to_row . "'";
         $db->setQuery($query);
         $db->query();
     }
     $dispatcher->trigger('onAfterSaveConfig', array());
     if ($this->getTask() == 'apply') {
         switch ($tab) {
             case 1:
                 $task = "general";
                 break;
             case 2:
                 $task = "currency";
                 break;
             case 3:
                 $task = "image";
                 break;
             case 5:
                 $task = "storeinfo";
                 break;
             case 6:
                 $task = "catprod";
                 break;
             case 7:
                 $task = "checkout";
                 break;
             case 8:
                 $task = "adminfunction";
                 break;
             case 9:
                 $task = "fieldregister";
                 break;
             case 10:
                 $task = "otherconfig";
                 break;
         }
         $this->setRedirect('index.php?option=com_jshopping&controller=config&task=' . $task, _JSHOP_CONFIG_SUCCESS);
     } else {
         $this->setRedirect('index.php?option=com_jshopping&controller=config', _JSHOP_CONFIG_SUCCESS);
     }
 }
Example #5
0
require_once JPATH_COMPONENT_SITE . "/lib/factory.php";
require_once JPATH_COMPONENT_ADMINISTRATOR . '/functions.php';
$ajax = JRequest::getInt('ajax');
$admin_load_user_id = JRequest::getInt('admin_load_user_id');
$adminlang = JFactory::getLanguage();
if ($admin_load_user_id) {
    JSFactory::setLoadUserId($admin_load_user_id);
}
if (!JRequest::getVar("js_nolang")) {
    JSFactory::loadAdminLanguageFile();
}
$db = JFactory::getDBO();
$jshopConfig = JSFactory::getConfig();
$jshopConfig->setLang($jshopConfig->getFrontLang());
if ($jshopConfig->adminLanguage != $adminlang->getTag()) {
    $config = new jshopConfig($db);
    $config->id = $jshopConfig->load_id;
    $config->adminLanguage = $adminlang->getTag();
    if (!$config->store()) {
        JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
        return 0;
    }
}
if (!$ajax) {
    installNewLanguages();
} else {
    header('Content-Type: text/html;charset=UTF-8');
}
JPluginHelper::importPlugin('jshopping');
JPluginHelper::importPlugin('jshoppingadmin');
JPluginHelper::importPlugin('jshoppingmenu');
Example #6
0
    function install($parent)
    {
        $db = JFactory::getDBO();
        $adminlang = JFactory::getLanguage();
        if (file_exists(JPATH_SITE . '/administrator/components/com_jshopping/lang/' . $adminlang->getTag() . '.php')) {
            require_once JPATH_SITE . '/administrator/components/com_jshopping/lang/' . $adminlang->getTag() . '.php';
        } else {
            require_once JPATH_SITE . '/administrator/components/com_jshopping/lang/en-GB.php';
        }
        require_once JPATH_SITE . '/components/com_jshopping/lib/factory.php';
        require_once JPATH_SITE . '/components/com_jshopping/lib/functions.php';
        $params = JComponentHelper::getParams('com_languages');
        $frontend_lang = $params->get('site', 'en-GB');
        $query = 'SELECT email FROM #__users AS U LEFT JOIN #__user_usergroup_map AS UM ON UM.user_id = U.id WHERE UM.group_id = "8" ORDER BY U.id';
        $db->setQuery($query);
        $email_admin = $db->loadResult();
        $config = new jshopConfig($db);
        $config->id = 1;
        $config->adminLanguage = $adminlang->getTag();
        $config->defaultLanguage = $frontend_lang;
        if ($email_admin) {
            $config->contact_email = $email_admin;
        }
        $config->securitykey = md5($email_admin . time() . JPATH_SITE);
        $config->store();
        $session = JFactory::getSession();
        $checkedlanguage = array();
        $session->set("jshop_checked_language", $checkedlanguage);
        installNewLanguages("en-GB", 0);
        @chmod(JPATH_SITE . '/components/com_jshopping/files', 0755);
        @mkdir(JPATH_SITE . '/components/com_jshopping/files/img_manufs', 0755);
        @mkdir(JPATH_SITE . '/components/com_jshopping/files/demo_products', 0755);
        @mkdir(JPATH_SITE . '/components/com_jshopping/files/img_attributes', 0755);
        @mkdir(JPATH_SITE . '/components/com_jshopping/files/pdf_orders', 0755);
        @chmod(JPATH_SITE . '/components/com_jshopping/files/img_manufs', 0755);
        @chmod(JPATH_SITE . '/components/com_jshopping/files/img_categories', 0755);
        @chmod(JPATH_SITE . '/components/com_jshopping/files/img_products', 0755);
        @chmod(JPATH_SITE . '/components/com_jshopping/files/img_labels', 0755);
        @chmod(JPATH_SITE . '/components/com_jshopping/files/video_products', 0755);
        @chmod(JPATH_SITE . '/components/com_jshopping/files/files_products', 0755);
        @chmod(JPATH_SITE . '/components/com_jshopping/files/importexport', 0755);
        @chmod(JPATH_SITE . '/components/com_jshopping/files/importexport/simpleexport', 0755);
        @chmod(JPATH_SITE . '/components/com_jshopping/files/importexport/simpleimport', 0755);
        print "<br>";
        $jshopConfig = JSFactory::getConfig();
        print '<link rel="stylesheet" type="text/css" href="' . $jshopConfig->live_admin_path . 'css/style.css" />';
        include_once JPATH_ADMINISTRATOR . "/components/com_jshopping/views/panel/view.html.php";
        $view_config = array("base_path" => JPATH_ADMINISTRATOR . "/components/com_jshopping/", "template_path" => JPATH_ADMINISTRATOR . "/components/com_jshopping/views/panel/tmpl/");
        $view = new JshoppingViewPanel($view_config);
        $view->setLayout("info");
        $view->displayInfo();
        ?>
        <br/>
        <table align="center" style="font-weight:bold">
        <tr>
        <td width="250">
        <a href="index.php?option=com_jshopping">
            <img src="components/com_jshopping/images/jshop_categories_b.png" align="left" style="margin-right:10px;" /><div style="line-height:48px;">JoomShopping</div>
        </a>
        </td>
        <td width="250">
        <a href="index.php?option=com_jshopping&controller=update&task=update&installtype=url&install_url=<?php 
        print urlencode("http://demo.joomshopping.com/demo/demo_products_4.0.0.zip");
        ?>
&back=<?php 
        print urldecode("index.php?option=com_jshopping");
        ?>
">
            <img src="components/com_jshopping/images/jshop_import_export_b.png" align="left" style="margin-right:8px;" /><div style="line-height:48px;">&nbsp;<?php 
        print _JSHOP_LOAD_SAMPLE_DATA;
        ?>
</div>
        </a>
        </td>
        </tr>
        </table><br/>
    <?php 
    }
    require_once JPATH_SITE . '/administrator/components/com_jshopping/lang/' . $adminlang->getTag() . '.php';
} else {
    require_once JPATH_SITE . '/administrator/components/com_jshopping/lang/en-GB.php';
}
require_once JPATH_SITE . '/components/com_jshopping/lib/jtableauto.php';
require_once JPATH_SITE . '/components/com_jshopping/lib/multilangfield.php';
require_once JPATH_SITE . '/components/com_jshopping/tables/config.php';
require_once JPATH_SITE . '/components/com_jshopping/lib/factory.php';
require_once JPATH_SITE . '/components/com_jshopping/lib/functions.php';
$params = JComponentHelper::getParams('com_languages');
$frontend_lang = $params->get('site', 'en-GB');
$query = 'SELECT email FROM #__users AS U LEFT JOIN #__user_usergroup_map AS UM ON UM.user_id = U.id WHERE UM.group_id = "8" ORDER BY U.id';
$db->setQuery($query);
$email_admin = $db->loadResult();
$db = JFactory::getDBO();
$config = new jshopConfig($db);
$config->id = 1;
$config->adminLanguage = $adminlang->getTag();
$config->defaultLanguage = $frontend_lang;
if ($email_admin) {
    $config->contact_email = $email_admin;
}
$config->securitykey = md5($email_admin . time() . JPATH_SITE);
$config->store();
$session = JFactory::getSession();
$checkedlanguage = array();
$session->set("jshop_checked_language", $checkedlanguage);
installNewLanguages("en-GB", 0);
@chmod(JPATH_SITE . '/components/com_jshopping/files', 0755);
@mkdir(JPATH_SITE . '/components/com_jshopping/files/img_manufs', 0755);
@mkdir(JPATH_SITE . '/components/com_jshopping/files/demo_products', 0755);