Пример #1
0
  ** END: FRONTEND ADMIN - MOD
  *****************************/
 // Here is the most important part of the whole Shop:
 // LOADING the requested page for displaying it to the customer.
 // I have wrapped it with a function, because it becomes
 // cacheable that way.
 // It's just an "include" statement which loads the page
 $vmDoCaching = ($page == "shop.browse" || $page == "shop.product_details") && (empty($keyword) && empty($keyword1) && empty($keyword2));
 // IE6 PNG transparency fix
 $vm_mainframe->addScript("{$mosConfig_live_site}/components/{$option}/js/sleight.js");
 echo '<div id="vmMainPage">' . "\n";
 // Load requested PAGE
 if (file_exists(PAGEPATH . $modulename . "." . $pagename . ".php")) {
     if ($only_page) {
         require_once CLASSPATH . 'connectionTools.class.php';
         vmConnector::sendHeaderAndContent(200);
         if ($func) {
             echo vmCommonHTML::getSuccessIndicator($ok, $vmDisplayLogger);
         }
         /*@MWM1: Log/Debug enhancements*/
         include PAGEPATH . $modulename . "." . $pagename . ".php";
         // Exit gracefully
         $vm_mainframe->close(true);
     }
     include PAGEPATH . $modulename . "." . $pagename . ".php";
 } elseif (file_exists(PAGEPATH . HOMEPAGE . '.php')) {
     include PAGEPATH . HOMEPAGE . '.php';
 } else {
     include PAGEPATH . 'shop.index.php';
 }
 if (!empty($mosConfig_caching) && $vmDoCaching) {
Пример #2
0
         $currency_code = $price['product_currency'];
     }
     $formName = 'priceForm';
     $content = '<form id="' . $formName . '" method="post" name="priceForm">';
     $content .= '<table class="adminform"><tr><td><strong>' . $VM_LANG->_('PHPSHOP_PRICE_FORM_PRICE') . ':</strong></td><td><input type="text" name="product_price" value="' . $price['product_price'] . '" class="inputbox" id="product_price_' . $formName . '" size="11" /></td></tr>';
     $content .= '<tr><td><strong>' . $VM_LANG->_('PHPSHOP_PRICE_FORM_GROUP') . ':</strong></td><td>' . $ps_shopper_group->list_shopper_groups('shopper_group_id', $shopper_group_id, 'onchange="reloadForm( \'' . $product_id . '\', \'shopper_group_id\', this.options[this.selectedIndex].value);"') . '</td></tr>';
     $content .= '<tr><td><strong>' . $VM_LANG->_('PHPSHOP_PRICE_FORM_CURRENCY') . ':</strong></td><td>' . ps_html::getCurrencyList('product_currency', $currency_code, 'currency_code', 'style="max-width:120px;"') . '</td></tr></table>';
     $content .= '<input type="hidden" name="product_price_id" value="' . $price['product_price_id'] . '" id="product_price_id_' . $formName . '" />';
     $content .= '<input type="hidden" name="product_id" value="' . $product_id . '" />';
     $content .= '<input type="hidden" name="func" value="' . (empty($price['product_price_id']) ? 'productPriceAdd' : 'productPriceUpdate') . '" />';
     $content .= '<input type="hidden" name="ajax_request" value="1" />';
     $content .= '<input type="hidden" name="no_html" value="1" />';
     $content .= '<input type="hidden" name="vmtoken" value="' . vmSpoofValue($sess->getSessionId()) . '" />';
     $content .= '<input type="hidden" name="option" value="' . $option . '" />';
     $content .= '</form>';
     vmConnector::sendHeaderAndContent(200, $content);
     break;
 case 'getproducts':
     if (!defined('SERVICES_JSON_SLICE')) {
         require_once CLASSPATH . 'JSON.php';
     }
     $db =& new ps_DB();
     $keyword = $db->getEscaped(vmGet($_REQUEST, 'query'));
     $q = "SELECT SQL_CALC_FOUND_ROWS #__{vm}_product.product_id,category_name,product_name\r\n\t\t\tFROM #__{vm}_product,#__{vm}_product_category_xref,#__{vm}_category ";
     if (empty($_REQUEST['show_items'])) {
         $q .= "WHERE product_parent_id='0'\r\n\t\t\t\t\tAND #__{vm}_product.product_id <> '{$product_id}' \r\n\t\t\t\t\tAND #__{vm}_product.product_id=#__{vm}_product_category_xref.product_id\r\n\t\t\t\t\tAND #__{vm}_product_category_xref.category_id=#__{vm}_category.category_id";
     } else {
         $q .= "WHERE #__{vm}_product.product_id <> '{$product_id}' \r\n\t\t\t\t\tAND  #__{vm}_product.product_id=#__{vm}_product_category_xref.product_id \r\n\t\t\t\t\tAND #__{vm}_product_category_xref.category_id=#__{vm}_category.category_id";
     }
     if ($keyword) {
         $q .= ' AND (product_name LIKE \'%' . $keyword . '%\'';
Пример #3
0
 /**
  * export zasilkovna orders from db in CSV format
  */
 public function exportCSV()
 {
     $lg =& JFactory::getLanguage();
     if (file_exists(CLASSPATH . 'shipping/' . $this->classname . '/' . $lg->getTag() . '.' . $this->classname . '.php')) {
         require_once CLASSPATH . 'shipping/' . $this->classname . '/' . $lg->getTag() . '.' . $this->classname . '.php';
     } elseif (file_exists(CLASSPATH . 'shipping/' . $this->classname . '/' . $lg->getDefault() . '.' . $this->classname . '.php')) {
         require_once CLASSPATH . 'shipping/' . $this->classname . '/' . $lg->getDefault() . '.' . $this->classname . '.php';
     } elseif (file_exists(CLASSPATH . 'shipping/' . $this->classname . '/cs-CZ.' . $this->classname . '.php')) {
         require_once CLASSPATH . 'shipping/' . $this->classname . '/cs-CZ.' . $this->classname . '.php';
     }
     require_once CLASSPATH . 'connectionTools.class.php';
     //vmConnector::
     if ($this->updateBranchesInfo() == false || $this->errors) {
         //check if branches info is up to date
         echo $this->return_errors();
         return false;
     }
     if ($this->warnings) {
         echo $this->return_warnings();
     }
     if (isset($_REQUEST['cod_orders'])) {
         $vm_db = new ps_DB();
         $cod_arr = explode('|', $_REQUEST['cod_orders']);
         foreach ($cod_arr as $cod_order) {
             if ($cod_order > 0) {
                 $is_cod = '1';
             } else {
                 $is_cod = '0';
             }
             $cod_order = abs($cod_order);
             $q = "INSERT INTO #__zasilkovna_orders (order_id, is_cod,exported) values ('{$cod_order}', '{$is_cod}','0')\n         ON DUPLICATE KEY UPDATE is_cod = '{$is_cod}'";
             $vm_db->query($q);
         }
     }
     if (isset($_REQUEST['orders_id'])) {
         //if have some orders to export
         $vm_db = new ps_DB();
         $orders_arr = explode('|', $_REQUEST['orders_id']);
         //musi se delat array_map floor?
         $q = "SELECT o.order_id, o.cdate, o.order_currency, o.order_total, o.ship_method_id, oui.first_name, oui.last_name, oui.phone_1, oui.phone_2, oui.user_email, pm.payment_method_id from  #__{vm}_orders o \n        join #__{vm}_order_user_info oui on(oui.order_id=o.order_id) \n        join #__{vm}_order_payment pm on(pm.order_id=o.order_id)    \n        ";
         $q .= " WHERE o.order_id in (" . implode(',', $orders_arr) . ") ORDER BY o.cdate DESC;";
         $vm_db->query($q);
         //head for exported query;
         $mark_exp_q = "UPDATE #__zasilkovna_orders SET exported='1' WHERE ";
         $first = true;
         while ($vm_db->next_record()) {
             //prepare exported query for each order
             if ($first) {
                 $first = false;
             } else {
                 $mark_exp_q .= ' OR ';
             }
             $mark_exp_q .= " order_id='" . $vm_db->f('order_id') . "' ";
             foreach (array('phone_1', 'phone_2') as $field) {
                 $phone_n = $this->normalize_phone($vm_db->f($field));
                 if (preg_match('/^\\+42[01][0-9]{9}$|^$/', $phone_n)) {
                     $phone = $phone_n;
                 }
             }
             //get destination branch id from ship_method.. Adresa - [id=ID]
             $ship_method = $vm_db->f('ship_method_id');
             $ship_info = explode('|', $ship_method);
             $ship_info = $ship_info[2];
             $branch_id = substr($ship_info, strpos($ship_info, '[id=') + strlen('[id='), -1);
             //-1 removes closing ]
             $b_db = new ps_DB();
             $b_db->query('SELECT currency,country FROM #__zasilkovna_branches WHERE id=' . $branch_id);
             $branch_currency = $b_db->f('currency');
             $total = $vm_db->f('order_total');
             //currency conversion
             if ($vm_db->f('order_currency') != $branch_currency) {
                 $total = $GLOBALS['CURRENCY']->convert($total, $vm_db->f('order_currency'), $branch_currency);
             }
             //rounding
             if ($branch_currency == 'CZK') {
                 $total = round($total);
             } else {
                 $total = round($total, 2);
             }
             //is cod?
             $exp_o = new ps_DB();
             $q = "SELECT is_cod from #__zasilkovna_orders WHERE order_id='" . $vm_db->f('order_id') . "';";
             $exp_o->query($q);
             if ($exp_o->f('is_cod') == 1) {
                 $cod_cash = $total;
             } else {
                 $cod_cash = '0';
             }
             $csv_out .= ';"' . $this->csv_escape($vm_db->f('order_id')) . '";"' . $this->csv_escape($vm_db->f('first_name')) . '";"' . $this->csv_escape($vm_db->f('last_name')) . '";;"' . $this->csv_escape($vm_db->f('user_email')) . '";"' . $this->csv_escape($phone) . '";"' . $this->csv_escape($cod_cash) . '";"' . $this->csv_escape($total) . '";"' . $this->csv_escape($branch_id) . '";"' . $this->csv_escape($this->getConfig('eshop_domain')) . '"' . "\r\n";
             //$csv_out.=';"'.$this->csv_escape($vm_db->f('order_id')).'";"'.$this->csv_escape($vm_db->f('first_name')).'";"'.$this->csv_escape($vm_db->f('last_name')).'";;"'.$this->csv_escape($vm_db->f('user_email')).'";"'.$this->csv_escape($phone).'";"'.$this->csv_escape(($this->getConfig('cod'.$vm_db->f('payment_method_id')) ? $total : "0")).'";"'.$this->csv_escape($total).'";"'.$this->csv_escape($branch_id).'";"'.$this->csv_escape($this->getConfig('eshop_domain')).'"'."\r\n";
         }
         //close and exec exported query
         $mark_exp_q .= ';';
         $vm_db->query($mark_exp_q);
         header("Content-Type: text/csv");
         header("Content-Disposition: attachment; filename=\"export-" . date("Ymd-His") . ".csv\"");
     } else {
         //when no orders for export and just want to update cod info
         $csv_out .= $zas_lang['saved_ok'];
     }
     vmConnector::sendHeaderAndContent(200, $csv_out);
     //echo $csv_out;
     exit;
 }
        if (file_exists(CLASSPATH . $classfile)) {
            require_once CLASSPATH . $classfile;
            $class = str_replace('.class', '', $class);
            $methods = get_class_methods($class);
            if (empty($methods)) {
                $methods = get_class_methods('vm' . $class);
            }
            foreach ($methods as $method) {
                if ($method == $class) {
                    continue;
                }
                $method_array[$method] = $method;
            }
        }
        vmConnector::sendHeaderAndContent(200, ps_html::selectList('function_method', $function, $method_array));
        break;
    case 'checkforupdate':
        require_once CLASSPATH . 'update.class.php';
        $result = vmUpdate::checkLatestVersion();
        if (!empty($result)) {
            // Convert a String like "1.1.1" => "1.11", so we can use it as float in Javascript
            $version_as_float = substr($result, 0, 3) . substr($result, 4);
            $version_as_json = '{version_string:"' . $result . '",version:"' . $version_as_float . '"}';
            vmConnector::sendHeaderAndContent('200', $version_as_json);
        } else {
            vmConnector::sendHeaderAndContent('200', 'Connection Failed');
        }
    default:
        die;
}
exit;
<?php

if (!defined('_VALID_MOS') && !defined('_JEXEC')) {
    die('Direct Access to ' . basename(__FILE__) . ' is not allowed.');
}
require_once CLASSPATH . 'connectionTools.class.php';
//vmConnector::
$s_p_arr = explode('|', urldecode($_REQUEST['s_p']));
$db =& JFactory::getDBO();
$q = "TRUNCATE TABLE #__zasilkovna_ship_payment;";
$db->setQuery($q);
$db->query();
foreach ($s_p_arr as $s_p) {
    $s_p = explode('/', $s_p);
    $q = "INSERT IGNORE INTO #__zasilkovna_ship_payment ";
    $q .= "(\n      `carrier` ,\n      `payment_method_id`\n      ) ";
    $q .= " VALUES (\n      '{$s_p['0']}',  '{$s_p['1']}'\n      );";
    $db->setQuery($q);
    $db->query();
}
vmConnector::sendHeaderAndContent(200, "Saved");
exit;
Пример #6
0
* @version $Id: shop.feed.php 1958 2009-10-08 20:09:57Z soeren_nb $
* @package VirtueMart
* @subpackage html
* @copyright Copyright (C) 2007-2009 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
require_once CLASSPATH . 'connectionTools.class.php';
if (VM_FEED_ENABLED == '') {
    vmConnector::sendHeaderAndContent(403, 'This Feed is currently not available.', '');
    exit;
}
switch (strtoupper(vmGet($_GET, "feed", "RSS2.0"))) {
    case "2.0":
    case "RSS2":
    case "RSS2.0":
        $info['feed'] = 'RSS2.0';
        break;
    case "1.0":
    case "RSS1.0":
        $info['feed'] = 'RSS1.0';
        break;
    case "0.91":
    case "RSS0.91":
        $info['feed'] = 'RSS0.91';