Ejemplo n.º 1
0
 function traverse_tree_down(&$mymenu_content, $category_id = '0', $level = '0')
 {
     static $ibg = 0;
     global $db, $mosConfig_live_site;
     $db = new ps_DB();
     $level++;
     $query = "SELECT category_name as cname, category_id as cid, category_child_id as ccid " . "FROM #__{vm}_category as a, #__{vm}_category_xref as b " . "WHERE a.category_publish='Y' AND " . " b.category_parent_id='{$category_id}' AND a.category_id=b.category_child_id " . "ORDER BY category_parent_id, list_order, category_name ASC";
     $db->query($query);
     $categories = $db->record;
     if (!($categories == null)) {
         $i = 1;
         $numCategories = count($categories);
         foreach ($categories as $category) {
             $ibg++;
             $Treeid = $ibg;
             $itemid = isset($_REQUEST['Itemid']) ? '&Itemid=' . intval($_REQUEST['Itemid']) : "";
             $mymenu_content .= str_repeat("\t", $level - 1);
             if ($level > 1 && $i == 1) {
                 $mymenu_content .= ",";
             }
             $mymenu_content .= "['" . $category->cname;
             $mymenu_content .= "','href=\\'" . sefRelToAbs('index.php?option=com_virtuemart&page=shop.browse&category_id=' . $category->cid . '&Treeid=' . $Treeid . $itemid) . "\\''\n ";
             /* recurse through the subcategories */
             $this->traverse_tree_down($mymenu_content, $category->ccid, $level);
             $mymenu_content .= str_repeat("\t", $level - 1);
             /* let's see if the loop has reached its end */
             if ($i == sizeof($categories) && $level == 1) {
                 $mymenu_content .= "]\n";
             } else {
                 $mymenu_content .= "],\n";
             }
             $i++;
         }
     }
 }
Ejemplo n.º 2
0
function authUser($acc, $pwd)
{
    if ($acc && $pwd) {
        $db = new ps_DB();
        $pwd = md5($pwd);
        $sql = "select ID, name, authority from account where username='******' and password='******' ";
        $db->query($sql);
        if ($db->next_record()) {
            return $db->f('ID');
        } else {
            return 0;
        }
    } else {
        return 0;
    }
}
Ejemplo n.º 3
0
 function traverse_tree_down(&$mymenu_content, $category_id = '0', $level = '0')
 {
     static $ibg = 0;
     global $mosConfig_live_site, $sess;
     $level++;
     $query = "SELECT category_name, category_id, category_child_id " . "FROM #__{vm}_category as a, #__{vm}_category_xref as b " . "WHERE a.category_publish='Y' AND " . " b.category_parent_id='{$category_id}' AND a.category_id=b.category_child_id " . "ORDER BY category_parent_id, list_order, category_name ASC";
     $db = new ps_DB();
     $db->query($query);
     while ($db->next_record()) {
         $itemid = '&Itemid=' . $sess->getShopItemid();
         if ($ibg != 0) {
             $mymenu_content .= ",";
         }
         $mymenu_content .= "\n[ '<img src=\"' + ctThemeXPBase + 'darrow.png\" alt=\"arr\" />','" . $db->f("category_name", false) . "','" . sefRelToAbs('index.php?option=com_virtuemart&page=shop.browse&category_id=' . $db->f("category_id") . $itemid) . "',null,'" . $db->f("category_name", false) . "'\n ";
         $ibg++;
         /* recurse through the subcategories */
         $this->traverse_tree_down($mymenu_content, $db->f("category_child_id"), $level);
         /* let's see if the loop has reached its end */
         $mymenu_content .= "]";
     }
 }
Ejemplo n.º 4
0
 function _tax_based_on_vendor_address($ship_to_info_id = '')
 {
     global $auth;
     global $vmLogger;
     switch (TAX_MODE) {
         case '0':
             return false;
         case '1':
             return true;
         case '17749':
             $ship_to_info_id = !empty($ship_to_info_id) ? $ship_to_info_id : vmGet($_REQUEST, 'ship_to_info_id');
             $db = new ps_DB();
             $q = "SELECT country FROM #__{vm}_user_info WHERE user_info_id='" . $ship_to_info_id . "'";
             $db->query($q);
             $db->next_record();
             $ship_country = $db->f("country");
             if (!array_key_exists('country', $auth) || empty($ship_country)) {
                 $vmLogger->debug('shopper\'s country is not known; defaulting to vendor-based tax');
                 return true;
             }
             if ($ship_to_info_id) {
                 $vmLogger->debug('shopper shipping in ' . $ship_country);
                 $auth_country = $ship_country;
             } else {
                 $vmLogger->debug('shopper is in ' . $auth['country']);
                 $auth_country = $auth['country'];
             }
             return ps_checkout::country_in_eu_common_vat_zone($auth_country);
         default:
             $vmLogger->warning('unknown TAX_MODE "' . TAX_MODE . '"');
             return true;
     }
 }
Ejemplo n.º 5
0
 /**
  * update export module
  * @param array
  * @return bool
  * @author Manfred Dennerlein
  */
 function update(&$d)
 {
     global $vmLogger, $VM_LANG;
     $db = new ps_DB();
     $ps_vendor_id = $_SESSION['ps_vendor_id'];
     $timestamp = time();
     if (!$this->validate_update($d)) {
         return False;
     }
     if (!empty($d['export_class'])) {
         $export_class = basename($d['export_class']);
         if (include_once CLASSPATH . 'export/' . $export_class . '.php') {
             $_EXPORT = new $export_class();
         }
     } else {
         include_once CLASSPATH . 'export/ps_xmlexport.php';
         $_EXPORT = new ps_xmlexport();
     }
     if ($_EXPORT->configfile_writeable()) {
         $_EXPORT->write_configuration($d);
         $vmLogger->info($VM_LANG->_('VM_CONFIGURATION_CHANGE_SUCCESS', false));
     } else {
         $vmLogger->err(sprintf($VM_LANG->_('VM_CONFIGURATION_CHANGE_FAILURE', false), CLASSPATH . "export/" . $_EXPORT->classname . ".cfg.php"));
         return false;
     }
     $fields = array('export_enabled' => $d['export_enabled'], 'export_config' => $d['export_config']);
     if (!$d['iscore']) {
         $fields['export_name'] = $d['export_name'];
         $fields['export_desc'] = $d['export_desc'];
         $fields['export_class'] = $d['export_class'];
     }
     $db->buildQuery('INSERT', '#__{vm}_export', $fields, 'WHERE export_id=' . (int) $d['export_id'] . " AND vendor_id='{$ps_vendor_id}'");
     return $db->query() !== false;
 }
Ejemplo n.º 6
0
    $closeSameLevel = "false";
}
$menu_htmlcode = "";
// what should be used as the base of the tree?
// ( could be *first* menu item, *site* name, *module*, *menu* name or *text* )
$base = "first";
// in case *text* should be the base node, what text should be displayed?
$basetext = "";
// what category_id is selected?
$category_id = vmRequest::getInt('category_id');
// select menu items from database
$query = "SELECT category_id,category_parent_id,category_name FROM #__{vm}_category, #__{vm}_category_xref ";
$query .= "WHERE #__{vm}_category.category_publish='Y' AND ";
$query .= "#__{vm}_category.category_id=#__{vm}_category_xref.category_child_id ";
$query .= "ORDER BY category_parent_id, list_order, category_name ASC";
$db->query($query);
$db->next_record();
// how many menu items in this menu?
$row = $db->num_rows();
// create a unique tree identifier, in case multiple dtrees are used
// (max one per module)
$tree = "d" . uniqid("tree_");
// start creating the content
// create left aligned table, load the CSS stylesheet and dTree code
$menu_htmlcode .= "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" width=\"100%\"><tr><td align=\"left\">\n";
$menu_htmlcode .= "<link rel=\"stylesheet\" href=\"{$js_src}/dtree/dtree.css\" type=\"text/css\" />\n";
$menu_htmlcode .= "<script type=\"text/javascript\" src=\"{$js_src}/dtree/dtree.js\"></script>\n";
$menu_htmlcode .= "<script type=\"text/javascript\">\n";
// create the tree, using the unique name
// pass the live_site parameter on so dTree can find the icons
$menu_htmlcode .= "{$tree} = new dTree('{$tree}',\"{$js_src}\");\n";
Ejemplo n.º 7
0
 /**
  * Voids a previous transaction with Payflow Pro
  *
  * @param array $d
  * @return boolean
  */
 function void_authorization(&$d)
 {
     global $vendor_mail, $vendor_currency, $VM_LANG, $vmLogger;
     $database = new ps_DB();
     require_once CLASSPATH . "connectionTools.class.php";
     if (empty($d['order_number'])) {
         $vmLogger->err("Error: No Order Number provided.");
         return false;
     }
     /*** Get the Configuration File for authorize.net ***/
     require_once CLASSPATH . "payment/" . __CLASS__ . ".cfg.php";
     if (PFP_TYPE != 'A') {
         return true;
     }
     // Get the Account Password securely from the database
     $database->query("SELECT " . VM_DECRYPT_FUNCTION . "(payment_passkey,'" . ENCODE_KEY . "') as passkey FROM #__{vm}_payment_method WHERE payment_class='" . __CLASS__ . "'");
     $transaction = $database->record[0];
     if (empty($transaction->passkey)) {
         $vmLogger->err($VM_LANG->_('PHPSHOP_PAYMENT_ERROR'), false);
         return false;
     }
     $db = new ps_DB();
     $q = "SELECT * FROM #__{vm}_orders, #__{vm}_order_payment WHERE ";
     $q .= "order_number='" . $d['order_number'] . "' ";
     $q .= "AND #__{vm}_orders.order_id=#__{vm}_order_payment.order_id";
     $db->query($q);
     if (!$db->next_record()) {
         $vmLogger->err("Error: Order not found.");
         return false;
     }
     $expire_date = date("my", $db->f("order_payment_expire"));
     $cvv2_code = $db->f("order_payment_code");
     // DECODE Account Number
     $dbaccount = new ps_DB();
     $q = "SELECT " . VM_DECRYPT_FUNCTION . "(order_payment_number,'" . ENCODE_KEY . "')\r\n          AS account_number from #__{vm}_order_payment WHERE order_id='" . $db->f("order_id") . "'";
     $dbaccount->query($q);
     $dbaccount->next_record();
     // Get user billing information
     $dbbt = new ps_DB();
     $qt = "SELECT * FROM #__{vm}_user_info WHERE user_id='" . $db->f("user_id") . "'";
     $dbbt->query($qt);
     $dbbt->next_record();
     $user_info_id = $dbbt->f("user_info_id");
     if ($user_info_id != $db->f("user_info_id")) {
         // Get user's alternative shipping information
         $dbst = new ps_DB();
         $qt = "SELECT * FROM #__{vm}_user_info WHERE user_info_id='" . $db->f("user_info_id") . "' AND address_type='ST'";
         $dbst->query($qt);
         $dbst->next_record();
     } else {
         $dbst = $dbbt;
     }
     $tempstr = $dbaccount->f('account_number') . $db->f('order_total') . date('YmdGis');
     $request_id = md5($tempstr);
     //Authnet vars to send
     $formdata = array('PARTNER' => PFP_PARTNER, 'VENDOR' => PFP_VENDOR, 'USER' => PFP_USER, 'PWD' => $transaction->passkey, 'TEST' => PFP_TEST_REQUEST, 'AMT' => $db->f('order_total'), 'TRXTYPE' => 'V', 'TENDER' => 'C', 'CURRENCY' => $vendor_currency, 'NAME' => strtoupper(substr($dbbt->f("first_name"), 0, 15) . substr($dbbt->f("last_name"), 0, 15)), 'STREET' => substr($dbbt->f("address_1"), 0, 30), 'CITY' => substr($dbbt->f("city"), 0, 40), 'STATE' => substr($dbbt->f("state"), 0, 40), 'ZIP' => substr($dbbt->f("zip"), 0, 9), 'CUSTREF' => substr($db->f('order_number'), 0, 12), 'ORIGID' => $db->f('order_payment_trans_id'), 'ACCT' => $dbaccount->f('account_number'), 'CVV2' => $cvv2_code, 'EXPDATE' => $expire_date);
     //build the post string
     $poststring = '';
     foreach ($formdata as $key => $val) {
         $poststring .= urlencode($key) . "=" . urlencode($val) . "&";
     }
     // strip off trailing ampersand
     $poststring = substr($poststring, 0, -1);
     if (PFP_TEST_REQUEST == 'TRUE') {
         $host = 'pilot-payflowpro.verisign.com';
     } else {
         $host = 'payflowpro.verisign.com';
     }
     $headers[] = "X-VPS-Timeout: 30";
     $headers[] = "X-VPS-VIT-OS-Name: " . PHP_OS;
     // Name of your OS
     $headers[] = "X-VPS-VIT-OS-Version: " . PHP_OS;
     // OS Version
     $headers[] = "X-VPS-VIT-Client-Type: PHP/cURL";
     // What you are using
     $headers[] = "X-VPS-VIT-Client-Version: 0.01";
     // For your info
     $headers[] = "X-VPS-VIT-Client-Architecture: x86";
     // For your info
     $headers[] = "X-VPS-VIT-Client-Certification-Id: " . PFP_CLIENT_CERTIFICATION_ID;
     // get this from Todd @ payflowintegrator@paypal.com
     $headers[] = "X-VPS-VIT-Integration-Product: " . phpversion() . "::cURL";
     // For your info, would populate with application name
     $headers[] = "X-VPS-VIT-Integration-Version: 0.01";
     // Application version
     $headers[] = "X-VPS-Request-ID: " . $request_id;
     $result = vmConnector::handleCommunication("https://{$host}:443/transaction", $poststring, $headers);
     if (!$result) {
         $vmLogger->err('The transaction could not be completed.');
         return false;
     }
     $result = strstr($result, 'RESULT');
     $valArray = explode('&', $result);
     foreach ($valArray as $val) {
         $valArray2 = explode('=', $val);
         $pfpro[$valArray2[0]] = $valArray2[1];
     }
     $vmLogger->debug('Beginning to analyse the response from ' . $host);
     $RESULT_CODE = vmGet($pfpro, 'RESULT');
     $TRANSACTION_ID = vmGet($pfpro, 'PNREF');
     $RESPMSG = vmGet($pfpro, 'RESPMSG', '');
     $CVV2MATCH = vmGet($pfpro, 'CVV2MATCH', '');
     $success = false;
     switch ($RESULT_CODE) {
         case '0':
             // Approved - Success!
             $success = true;
             $d["order_payment_log"] = $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS') . ": ";
             $d["order_payment_log"] .= $RESPMSG;
             $q = "UPDATE #__{vm}_order_payment SET ";
             $q .= "order_payment_log='" . $d["order_payment_log"] . "',";
             $q .= "order_payment_trans_id='" . $TRANSACTION_ID . "' ";
             $q .= "WHERE order_id='" . $db->f("order_id") . "' ";
             $db->query($q);
             $vmLogger->debug($d['order_payment_log']);
             break;
         default:
             $d["order_payment_log"] = payflow_pro::getResponseMsg($RESULT_CODE);
             if (!empty($d["order_payment_log"])) {
                 $vmLogger->err($d["order_payment_log"]);
             } else {
                 $vmLogger->err('An unknown Error occured while voiding the transaction.');
             }
             break;
     }
     return $success;
 }
Ejemplo n.º 8
0
 function deleteState(&$d)
 {
     $db = new ps_DB();
     if (empty($d['state_id'])) {
         $GLOBALS['vmLogger']->err('Please select a state to delete!');
         return false;
     }
     if (!is_array($d['state_id'])) {
         $d['state_id'] = array($d['state_id']);
     }
     foreach ($d['state_id'] as $state_id) {
         $q = 'DELETE FROM #__{vm}_state where state_id=' . (int) $state_id . ' LIMIT 1';
         $db->query($q);
     }
     return True;
 }
Ejemplo n.º 9
0
    /**
     * Show all configuration parameters for this payment method
     * @returns boolean False when the Payment method has no configration
     */
    function show_configuration()
    {
        global $VM_LANG;
        $database = new ps_DB();
        /** Read current Configuration ***/
        require_once CLASSPATH . "payment/" . $this->classname . ".cfg.php";
        ?>
      <table>
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_2CHECKOUT_LOGIN');
        ?>
</strong></td>
            <td>
                <input type="text" name="TWOCO_LOGIN" class="inputbox" value="<?php 
        echo TWOCO_LOGIN;
        ?>
" />
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_2CHECKOUT_LOGIN_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_2CHECKOUT_SECRETWORD');
        ?>
</strong></td>
            <td>
                <input type="text" name="TWOCO_SECRETWORD" class="inputbox" value="<?php 
        echo TWOCO_SECRETWORD;
        ?>
" />
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_2CHECKOUT_SECRETWORD_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_SUCC');
        ?>
</strong></td>
            <td>
                <select name="TWOCO_VERIFIED_STATUS" class="inputbox" >
                <?php 
        $q = "SELECT order_status_name,order_status_code FROM #__{vm}_order_status ORDER BY list_order";
        $database->query($q);
        $rows = $database->record;
        $order_status_code = array();
        $order_status_name = array();
        foreach ($rows as $row) {
            $order_status_code[] = $row->order_status_code;
            $order_status_name[] = $row->order_status_name;
        }
        for ($i = 0; $i < sizeof($order_status_code); $i++) {
            echo "<option value=\"" . $order_status_code[$i];
            if (TWOCO_VERIFIED_STATUS == $order_status_code[$i]) {
                echo "\" selected=\"selected\">";
            } else {
                echo "\">";
            }
            echo $order_status_name[$i] . "</option>\n";
        }
        ?>
                    </select>
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_SUCC_EXPLAIN');
        ?>
            </td>
        </tr>
            <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_FAIL');
        ?>
</strong></td>
            <td>
                <select name="TWOCO_INVALID_STATUS" class="inputbox" >
                <?php 
        for ($i = 0; $i < sizeof($order_status_code); $i++) {
            echo "<option value=\"" . $order_status_code[$i];
            if (TWOCO_INVALID_STATUS == $order_status_code[$i]) {
                echo "\" selected=\"selected\">";
            } else {
                echo "\">";
            }
            echo $order_status_name[$i] . "</option>\n";
        }
        ?>
                    </select>
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_FAIL_EXPLAIN');
        ?>
            </td>
        </tr>
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_2CHECKOUT_MERCHANT_NOTIF');
        ?>
</strong></td>
            <td>
                <select name="TWOCO_MERCHANT_EMAIL" class="inputbox" >
                  <option <?php 
        if (TWOCO_MERCHANT_EMAIL == 'True') {
            echo "selected=\"selected\"";
        }
        ?>
 value="True"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES');
        ?>
</option>
                  <option <?php 
        if (TWOCO_MERCHANT_EMAIL == 'False') {
            echo "selected=\"selected\"";
        }
        ?>
 value="False"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO');
        ?>
</option>
                </select>
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_2CHECKOUT_MERCHANT_NOTIF_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_ENABLE_AUTORIZENET_TESTMODE');
        ?>
</strong></td>
            <td>
                <select name="TWOCO_TESTMODE" class="inputbox" >
                  <option <?php 
        if (TWOCO_TESTMODE == 'Y') {
            echo "selected=\"selected\"";
        }
        ?>
 value="Y"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES');
        ?>
</option>
                  <option <?php 
        if (TWOCO_TESTMODE == 'N') {
            echo "selected=\"selected\"";
        }
        ?>
 value="N"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO');
        ?>
</option>
                </select>
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_ENABLE_AUTORIZENET_TESTMODE_EXPLAIN');
        ?>
</td>
        </tr>
      </table>
   <?php 
        // return false if there's no configuration
        return true;
    }
Ejemplo n.º 10
0
    /**
     * Show all configuration parameters for this payment method
     * @returns boolean False when the Payment method has no configration
     */
    function show_configuration()
    {
        global $VM_LANG, $mosConfig_live_site;
        $db = new ps_DB();
        /** Read current Configuration ***/
        require_once CLASSPATH . "payment/" . __CLASS__ . ".cfg.php";
        ?>
    
			<table style="text-align: left;">
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_MERCHANTNUMBER');
        ?>
</strong></td>
            <td>
                <input type="text" name="EPAY_MERCHANTNUMBER" class="inputbox" value="<?php 
        echo EPAY_MERCHANTNUMBER;
        ?>
" />
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_MERCHANTNUMBER_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYPAL_STATUS_SUCCESS');
        ?>
</strong></td>
            <td>
                <select name="EPAY_VERIFIED_STATUS" class="inputbox" >
                <?php 
        $q = "SELECT order_status_name,order_status_code FROM #__{vm}_order_status where order_status_code != 'P' ORDER BY list_order";
        $db->query($q);
        $order_status_code = array();
        $order_status_name = array();
        while ($db->next_record()) {
            $order_status_code[] = $db->f("order_status_code");
            $order_status_name[] = $db->f("order_status_name");
        }
        for ($i = 0; $i < sizeof($order_status_code); $i++) {
            echo "<option value=\"" . $order_status_code[$i];
            if (EPAY_VERIFIED_STATUS == $order_status_code[$i]) {
                echo "\" selected=\"selected\">";
            } else {
                echo "\">";
            }
            echo $order_status_name[$i] . "</option>\n";
        }
        ?>
                    </select>
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYPAL_STATUS_SUCCESS_EXPLAIN');
        ?>
            </td>
        </tr>
            <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYPAL_STATUS_FAILED');
        ?>
</strong></td>
            <td>
                <select name="EPAY_INVALID_STATUS" class="inputbox" >
                <?php 
        $q = "SELECT order_status_name,order_status_code FROM #__{vm}_order_status ORDER BY list_order";
        $db->query($q);
        $order_status_code = array();
        $order_status_name = array();
        while ($db->next_record()) {
            $order_status_code[] = $db->f("order_status_code");
            $order_status_name[] = $db->f("order_status_name");
        }
        for ($i = 0; $i < sizeof($order_status_code); $i++) {
            echo "<option value=\"" . $order_status_code[$i];
            if (EPAY_INVALID_STATUS == $order_status_code[$i]) {
                echo "\" selected=\"selected\">";
            } else {
                echo "\">";
            }
            echo $order_status_name[$i] . "</option>\n";
        }
        ?>
                    </select>
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYPAL_STATUS_FAILED_EXPLAIN');
        ?>
</td>
        </tr>
        <script language="JavaScript">
          function enableDisableAll() {
            if (document.all.EPAY_CARDTYPES_0.checked) {
              document.all.EPAY_CARDTYPES_1.disabled = true;
              document.all.EPAY_CARDTYPES_2.disabled = true;
              document.all.EPAY_CARDTYPES_3.disabled = true;
              document.all.EPAY_CARDTYPES_4.disabled = true;
              document.all.EPAY_CARDTYPES_5.disabled = true;
              document.all.EPAY_CARDTYPES_6.disabled = true;
              document.all.EPAY_CARDTYPES_7.disabled = true;
              document.all.EPAY_CARDTYPES_8.disabled = true;
              document.all.EPAY_CARDTYPES_9.disabled = true;
              document.all.EPAY_CARDTYPES_10.disabled = true;
              document.all.EPAY_CARDTYPES_12.disabled = true;
              document.all.EPAY_CARDTYPES_13.disabled = true;
              document.all.EPAY_CARDTYPES_14.disabled = true;
              document.all.EPAY_CARDTYPES_15.disabled = true;
              document.all.EPAY_CARDTYPES_16.disabled = true;
              document.all.EPAY_CARDTYPES_17.disabled = true;
              document.all.EPAY_CARDTYPES_18.disabled = true;
              document.all.EPAY_CARDTYPES_19.disabled = true;
              document.all.EPAY_CARDTYPES_21.disabled = true;
              document.all.EPAY_CARDTYPES_22.disabled = true;
            } else {
              document.all.EPAY_CARDTYPES_1.disabled = false;
              document.all.EPAY_CARDTYPES_2.disabled = false;
              document.all.EPAY_CARDTYPES_3.disabled = false;
              document.all.EPAY_CARDTYPES_4.disabled = false;
              document.all.EPAY_CARDTYPES_5.disabled = false;
              document.all.EPAY_CARDTYPES_6.disabled = false;
              document.all.EPAY_CARDTYPES_7.disabled = false;
              document.all.EPAY_CARDTYPES_8.disabled = false;
              document.all.EPAY_CARDTYPES_9.disabled = false;
              document.all.EPAY_CARDTYPES_10.disabled = false;
              document.all.EPAY_CARDTYPES_12.disabled = false;
              document.all.EPAY_CARDTYPES_13.disabled = false;
              document.all.EPAY_CARDTYPES_14.disabled = false;
              document.all.EPAY_CARDTYPES_15.disabled = false;
              document.all.EPAY_CARDTYPES_16.disabled = false;
              document.all.EPAY_CARDTYPES_17.disabled = false;
              document.all.EPAY_CARDTYPES_18.disabled = false;
              document.all.EPAY_CARDTYPES_19.disabled = false;
              document.all.EPAY_CARDTYPES_21.disabled = false;
              document.all.EPAY_CARDTYPES_22.disabled = false;
            }
          }
        </script>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_CARDTYPES');
        ?>
</strong></td>
        	<td>
        	    <input type="checkbox" name="EPAY_CARDTYPES_0" <?php 
        if (EPAY_CARDTYPES_0 == '1') {
            echo "checked";
        }
        ?>
 value="1" onclick="javascript:enableDisableAll();"><?php 
        echo $VM_LANG->_('PHPSHOP_ALL');
        ?>
 <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_1" <?php 
        if (EPAY_CARDTYPES_1 == '1') {
            echo "checked";
        }
        ?>
 value="1">DANKORT <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_2" <?php 
        if (EPAY_CARDTYPES_2 == '1') {
            echo "checked";
        }
        ?>
 value="1">VISA DANKORT <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_3" <?php 
        if (EPAY_CARDTYPES_3 == '1') {
            echo "checked";
        }
        ?>
 value="1">VISA ELECTRON<br>
        			<input type="checkbox" name="EPAY_CARDTYPES_4" <?php 
        if (EPAY_CARDTYPES_4 == '1') {
            echo "checked";
        }
        ?>
 value="1">MASTERCARD (DK) <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_5" <?php 
        if (EPAY_CARDTYPES_5 == '1') {
            echo "checked";
        }
        ?>
 value="1">MASTERCARD <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_6" <?php 
        if (EPAY_CARDTYPES_6 == '1') {
            echo "checked";
        }
        ?>
 value="1">VISA ELECTRON (DK)<br>
        			<input type="checkbox" name="EPAY_CARDTYPES_7" <?php 
        if (EPAY_CARDTYPES_7 == '1') {
            echo "checked";
        }
        ?>
 value="1">JCB <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_8" <?php 
        if (EPAY_CARDTYPES_8 == '1') {
            echo "checked";
        }
        ?>
 value="1">DINERS (DK)<br>
        			<input type="checkbox" name="EPAY_CARDTYPES_9" <?php 
        if (EPAY_CARDTYPES_9 == '1') {
            echo "checked";
        }
        ?>
 value="1">MAESTRO (DK)<br>
        			<input type="checkbox" name="EPAY_CARDTYPES_10" <?php 
        if (EPAY_CARDTYPES_10 == '1') {
            echo "checked";
        }
        ?>
 value="1">AMERICAN EXPRESS (DK)<br>
        			<input type="checkbox" name="EPAY_CARDTYPES_12" <?php 
        if (EPAY_CARDTYPES_12 == '1') {
            echo "checked";
        }
        ?>
 value="1">DINERS <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_13" <?php 
        if (EPAY_CARDTYPES_13 == '1') {
            echo "checked";
        }
        ?>
 value="1">JCB Secure (3D-Secure) <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_14" <?php 
        if (EPAY_CARDTYPES_14 == '1') {
            echo "checked";
        }
        ?>
 value="1">AMERICAN EXPRESS <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_15" <?php 
        if (EPAY_CARDTYPES_15 == '1') {
            echo "checked";
        }
        ?>
 value="1">MAESTRO  <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_16" <?php 
        if (EPAY_CARDTYPES_16 == '1') {
            echo "checked";
        }
        ?>
 value="1">FORBRUGSFORENINGEN <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_17" <?php 
        if (EPAY_CARDTYPES_17 == '1') {
            echo "checked";
        }
        ?>
 value="1">EWIRE <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_18" <?php 
        if (EPAY_CARDTYPES_18 == '1') {
            echo "checked";
        }
        ?>
 value="1">VISA <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_19" <?php 
        if (EPAY_CARDTYPES_19 == '1') {
            echo "checked";
        }
        ?>
 value="1">IKANO <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_21" <?php 
        if (EPAY_CARDTYPES_21 == '1') {
            echo "checked";
        }
        ?>
 value="1">NORDEA <br>
        			<input type="checkbox" name="EPAY_CARDTYPES_22" <?php 
        if (EPAY_CARDTYPES_22 == '1') {
            echo "checked";
        }
        ?>
 value="1">DANSKE BANK <br>
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_CARDTYPES_EXPLAIN');
        ?>
</td>
        </tr>
        <script language="JavaScript">enableDisableAll();</script>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_LANGUAGE');
        ?>
</strong></td>
        	<td>
        			<select name="EPAY_LANGUAGE" class="inputbox">
        			<option <?php 
        if (EPAY_LANGUAGE == '1') {
            echo "selected=\"selected\"";
        }
        ?>
 value="1">Danish</option>
        			<option <?php 
        if (EPAY_LANGUAGE == '2') {
            echo "selected=\"selected\"";
        }
        ?>
 value="2">English</option>
        			<option <?php 
        if (EPAY_LANGUAGE == '3') {
            echo "selected=\"selected\"";
        }
        ?>
 value="3">Swedish</option>
        			<option <?php 
        if (EPAY_LANGUAGE == '4') {
            echo "selected=\"selected\"";
        }
        ?>
 value="4">Norwegian</option>
        			<option <?php 
        if (EPAY_LANGUAGE == '5') {
            echo "selected=\"selected\"";
        }
        ?>
 value="5">Greenland</option>
        			<option <?php 
        if (EPAY_LANGUAGE == '6') {
            echo "selected=\"selected\"";
        }
        ?>
 value="6">Icelandic</option>
        			<option <?php 
        if (EPAY_LANGUAGE == '7') {
            echo "selected=\"selected\"";
        }
        ?>
 value="7">German</option>
        			</select>
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_LANGUAGE_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_INSTANT_CAPTURE');
        ?>
</strong></td>
        	<td>
        			<select name="EPAY_INSTANT_CAPTURE" class="inputbox">
        			<option <?php 
        if (EPAY_INSTANT_CAPTURE == '0') {
            echo "selected=\"selected\"";
        }
        ?>
 value="0"><?php 
        echo $VM_LANG->_('VM_DISABLED');
        ?>
</option>
        			<option <?php 
        if (EPAY_INSTANT_CAPTURE == '1') {
            echo "selected=\"selected\"";
        }
        ?>
 value="1"><?php 
        echo $VM_LANG->_('VM_ENABLED');
        ?>
</option>
        			</select>
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_INSTANT_CAPTURE_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_GROUP');
        ?>
</strong></td>
        	<td>
        			<input type="text" name="EPAY_GROUP" class="inputbox" value ="<?php 
        echo EPAY_GROUP;
        ?>
">
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_GROUP_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong>MD5</strong></td>
        	<td>
        			<select name="EPAY_MD5_TYPE" class="inputbox">
        			<option <?php 
        if (EPAY_MD5_TYPE == '0') {
            echo "selected=\"selected\"";
        }
        ?>
 value="0"><?php 
        echo $VM_LANG->_('VM_DISABLED');
        ?>
 (0)</option>
        			<option <?php 
        if (EPAY_MD5_TYPE == '1') {
            echo "selected=\"selected\"";
        }
        ?>
 value="1"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_MD5_TYPE_1');
        ?>
 (1)</option>
        			<option <?php 
        if (EPAY_MD5_TYPE == '2') {
            echo "selected=\"selected\"";
        }
        ?>
 value="2"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_MD5_TYPE_2');
        ?>
 (2)</option>
        			</select>
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_MD5_TYPE_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_MD5_KEY');
        ?>
</strong></td>
        	<td>
        			<input type="text" name="EPAY_MD5_KEY" class="inputbox" value ="<?php 
        echo EPAY_MD5_KEY;
        ?>
">
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_MD5_KEY_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_AUTHSMS');
        ?>
</strong></td>
        	<td>
        			<input type="text" name="EPAY_AUTH_SMS" class="inputbox" value ="<?php 
        echo EPAY_AUTH_SMS;
        ?>
">
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_AUTHSMS_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_AUTHEMAIL');
        ?>
</strong></td>
        	<td>
        			<input type="text" name="EPAY_AUTH_MAIL" class="inputbox" value ="<?php 
        echo EPAY_AUTH_MAIL;
        ?>
">
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_AUTHEMAIL_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_WINDOWSTATE');
        ?>
</strong></td>
        	<td>
        			<select name="EPAY_WINDOW_STATE" class="inputbox">
        			<option <?php 
        if (EPAY_WINDOW_STATE == '1') {
            echo "selected=\"selected\"";
        }
        ?>
 value="1"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_WINDOWSTATE_1');
        ?>
 (1)</option>
        			<option <?php 
        if (EPAY_WINDOW_STATE == '2') {
            echo "selected=\"selected\"";
        }
        ?>
 value="2"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_WINDOWSTATE_2');
        ?>
 (2)</option>
        			</select>
        	</td>
        	<td>&nbsp;</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_3DSECURE');
        ?>
</strong></td>
        	<td>
        			<select name="EPAY_3DSECURE" class="inputbox">
        			<option <?php 
        if (EPAY_3DSECURE == '1') {
            echo "selected=\"selected\"";
        }
        ?>
 value="1"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_3DSECURE_1');
        ?>
 (1)</option>
        			<option <?php 
        if (EPAY_3DSECURE == '2') {
            echo "selected=\"selected\"";
        }
        ?>
 value="2"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_3DSECURE_2');
        ?>
 (2)</option>
        			<option <?php 
        if (EPAY_3DSECURE == '3') {
            echo "selected=\"selected\"";
        }
        ?>
 value="3"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_3DSECURE_3');
        ?>
 (3)</option>
        			</select>
        	</td>
        	<td>&nbsp;</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_CALLBACK');
        ?>
</strong></td>
        	<td>
        			<select name="EPAY_CALLBACK" class="inputbox">
        			<option <?php 
        if (EPAY_CALLBACK == '0') {
            echo "selected";
        }
        ?>
 value="0"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_CALLBACK_0');
        ?>
 (0)</option>
        			<option <?php 
        if (EPAY_CALLBACK == '1') {
            echo "selected";
        }
        ?>
 value="1"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_CALLBACK_1');
        ?>
 (1)</option>
        			</select>
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_CALLBACK_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_ADDFEE');
        ?>
</strong></td>
        	<td>
        			<select name="EPAY_ADDFEE" class="inputbox">
        			<option <?php 
        if (EPAY_ADDFEE == '0') {
            echo "selected=\"selected\"";
        }
        ?>
 value="0"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_ADDFEE_0');
        ?>
 (0)</option>
        			<option <?php 
        if (EPAY_ADDFEE == '1') {
            echo "selected=\"selected\"";
        }
        ?>
 value="1"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_ADDFEE_1');
        ?>
 (1)</option>
        			</select>
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_ADDFEE_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_SUBSCRIPTION');
        ?>
</strong></td>
        	<td>
        			<select name="EPAY_SUBSCRIPTION" class="inputbox">
        			<option <?php 
        if (EPAY_SUBSCRIPTION == '0') {
            echo "selected=\"selected\"";
        }
        ?>
 value="0"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_SUBSCRIPTION_0');
        ?>
 (0)</option>
        			<option <?php 
        if (EPAY_SUBSCRIPTION == '1') {
            echo "selected=\"selected\"";
        }
        ?>
 value="1"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_SUBSCRIPTION_1');
        ?>
 (1)</option>
        			</select>
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_SUBSCRIPTION_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
        	<td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_AUTHEMAIL');
        ?>
</strong></td>
        	<td>
        			<select name="EPAY_AUTHEMAILCUSTOMER" class="inputbox">
        			<option <?php 
        if (EPAY_AUTHEMAILCUSTOMER == '1') {
            echo "selected=\"selected\"";
        }
        ?>
 value="1"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_AUTHEMAIL_1');
        ?>
 (1)</option>
        			<option <?php 
        if (EPAY_AUTHEMAILCUSTOMER == '0') {
            echo "selected=\"selected\"";
        }
        ?>
 value="0"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_AUTHEMAIL_0');
        ?>
 (0)</option>
        			</select>
        	</td>
        	<td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_AUTHEMAIL_EXPLAIN');
        ?>
</td>
        </tr>
        
      </table>
      
      <script language="JavaScript">
      		function resetExtraInfo()
      		{
      			var form = document.adminForm;
      			form.payment_extrainfo.value = "";
      		}
      </script>
      
      <br/><br/>
      <div align="center">
      	<span style="color:red"><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_EXTRAINFO_RESET_EXPLAIN');
        ?>
</span>
      	<br/><br/>
      	<input type="button" onclick="resetExtraInfo();" value="<?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_EPAY_EXTRAINFO_RESET');
        ?>
" />
      	<br/><br/>
      </div>	

   <?php 
        // return false if there\'s no configuration
        return true;
    }
Ejemplo n.º 11
0
    <a class="vmicon vmicon-16-editadd" href="<?php 
    $sess->purl($_SERVER['PHP_SELF'] . "?page={$modulename}.user_address_form&amp;user_id={$user_id}");
    ?>
" >
	(<?php 
    echo $VM_LANG->_('PHPSHOP_USER_FORM_ADD_SHIPTO_LBL');
    ?>
)</a> 
	
	<table class="adminlist"> 
		<tr> 
			<td > 
				  <?php 
    $qt = "SELECT * from #__{vm}_user_info WHERE user_id='{$user_id}' AND address_type='ST'";
    $dbt = new ps_DB();
    $dbt->query($qt);
    if (!$dbt->num_rows()) {
        echo "No shipping addresses.";
    } else {
        while ($dbt->next_record()) {
            $url = $sess->url($_SERVER['PHP_SELF'] . "?page={$modulename}.user_address_form&user_id={$user_id}&user_info_id=" . $dbt->f("user_info_id"));
            echo '&raquo; <a href="' . $sess->url($url) . '">';
            echo $dbt->f("address_type_name") . "</a><br/>";
        }
    }
    ?>
 
			</td> 
		</tr> 
	</table>
	</fieldset>
Ejemplo n.º 12
0
 /**
  * Retrieves the Customer Number of the user specified by ID
  *
  * @param int $id
  * @return string
  */
 function get_customer_num($id)
 {
     $db = new ps_DB();
     $q = "SELECT customer_number FROM #__{vm}_shopper_vendor_xref ";
     $q .= "WHERE user_id='" . $id . "' ";
     $db->query($q);
     $db->next_record();
     return $db->f("customer_number");
 }

$query  = "SELECT DISTINCT m.manufacturer_id, m.mf_name
					FROM #__{vm}_manufacturer m
					LEFT JOIN #__{vm}_product_mf_xref mx ON mx.manufacturer_id = m.manufacturer_id
					LEFT JOIN #__{vm}_product p ON p.product_id = mx.product_id
					LEFT JOIN #__{vm}_product_category_xref cx ON cx.product_id = p.product_id
					WHERE cx.category_id =".(int)$category_id;
$query .= " ORDER BY m.mf_name ASC";

$query_all  = "SELECT m.manufacturer_id,m.mf_name FROM #__{vm}_manufacturer m ";
$query_all .= "ORDER BY m.mf_name ASC";

$db = new ps_DB;
if ($auto == 1 && !empty( $category_id ) ) {
	$db->query( $query );
} else {
	$db->query( $query_all );
}
$res = $db->record;
if( empty( $res )) {
	if( $auto == 1 ) {
		$db->query( $query_all );
		$res = $db->record;
	} else {
		echo 'No manufacturers defined!';
		return;
	}
}
?>
<?php if( $show_linklist == 1 ) { ?>
Ejemplo n.º 14
0
 /**
  * Build a Credit Card list for each CreditCard Payment Method
  * Uses JavsScript from mambojavascript: changeDynaList()
  *
  * @param ps_DB $db_cc
  * @return string
  */
 function creditcard_lists(&$db_cc)
 {
     global $mainframe;
     if (vmIsJoomla('1.5')) {
         $document = JFactory::getDocument();
         $document->addScript('includes/js/joomla.javascript.js');
     }
     $db = new ps_DB();
     $db_cc->next_record();
     // Build the Credit Card lists for each CreditCard Payment Method
     $script = "<script language=\"javascript\" type=\"text/javascript\">\n";
     $script .= "<!--\n";
     $script .= "var originalOrder = '1';\n";
     $script .= "var originalPos = '" . $db_cc->f("payment_method_name") . "';\n";
     $script .= "var orders = new Array();\t// array in the format [key,value,text]\n";
     $i = 0;
     $db_cc->reset();
     while ($db_cc->next_record()) {
         $accepted_creditcards = explode(",", $db_cc->f("accepted_creditcards"));
         $cards = array();
         foreach ($accepted_creditcards as $value) {
             if (!empty($value)) {
                 $q = 'SELECT creditcard_code,creditcard_name FROM #__{vm}_creditcard WHERE creditcard_id=' . (int) $value;
                 $db->query($q);
                 $db->next_record();
                 $cards[$db->f('creditcard_code')] = shopMakeHtmlSafe($db->f('creditcard_name'));
             }
         }
         foreach ($cards as $code => $name) {
             $script .= "orders[" . $i++ . "] = new Array( '" . addslashes($db_cc->f("payment_method_name")) . "','{$code}','{$name}' );\n";
         }
     }
     $script .= "function changeCreditCardList() { \n";
     $script .= "var selected_payment = null;\n      for (var i=0; i<document.adminForm.payment_method_id.length; i++)\n         if (document.adminForm.payment_method_id[i].checked)\n            selected_payment = document.adminForm.payment_method_id[i].id;\n";
     $script .= "changeDynaList('creditcard_code',orders,selected_payment, originalPos, originalOrder);\n";
     $script .= "}\n";
     $script .= "//-->\n";
     $script .= "</script>\n";
     $script .= '<noscript>' . ps_html::selectList('creditcard_code', key($cards), $cards) . '</noscript>';
     return $script;
 }
Ejemplo n.º 15
0
    $file = new stdClass();
    $file->file_id = 'product_images';
    $file->file_name = IMAGEPATH . 'product/' . $db->f('file_name');
    $file->product_name = $db->f('product_name');
    $file->file_url = IMAGEURL . 'product/' . $db->f('file_name');
    $file->product_thumb_image = $db->f('product_thumb_image');
    $file->file_title = $db->f('file_name');
    $file->file_is_image = 1;
    $file->file_product_id = $product_id;
    $file->file_extension = strrchr($db->f('file_name'), '.');
    $file->file_published = $db->f('product_publish');
    $files[] = $file;
}
$dbf = new ps_DB();
$sql = 'SELECT attribute_value FROM #__{vm}_product_attribute WHERE `product_id` = ' . $product_id . ' AND attribute_name=\'download\'';
$dbf->query($sql);
$downloadFiles = array();
while ($dbf->next_record()) {
    $downloadFiles[] = $dbf->f('attribute_value');
}
$q = "SELECT file_id, file_is_image, file_product_id, file_extension, file_url, file_published, file_name, file_title, file_image_thumb_height, file_image_thumb_width FROM #__{vm}_product_files  ";
$q .= "WHERE file_product_id = '{$product_id}' ";
$q .= "ORDER BY file_is_image DESC";
$db->query($q);
$db->next_record();
if (!empty($files)) {
    $db->record = array_merge($files, $db->record);
}
if ($db->num_rows() < 1 && $task != "cancel") {
    vmRedirect($_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.file_form&product_id={$product_id}&no_menu=" . @$_REQUEST['no_menu']);
}
Ejemplo n.º 16
0
     }
 } else {
     $templatefile = "browse_lite_pdf";
 }
 $tpl->set('buttons_header', $buttons_header);
 $tpl->set('products_per_row', $products_per_row);
 $tpl->set('templatefile', $templatefile);
 $db_browse->reset();
 $products = array();
 $counter = 0;
 /*** Start printing out all products (in that category) ***/
 while ($db_browse->next_record()) {
     // If it is item get parent:
     $product_parent_id = $db_browse->f("product_parent_id");
     if ($product_parent_id != 0) {
         $dbp->query("SELECT product_full_image,product_thumb_image,product_name,product_s_desc FROM #__{vm}_product WHERE product_id='{$product_parent_id}'");
         $dbp->next_record();
     }
     // Set the flypage for this product based on the category.
     // If no flypage is set then use the default as set in virtuemart.cfg.php
     $flypage = $db_browse->sf("category_flypage");
     if (empty($flypage)) {
         $flypage = FLYPAGE;
     }
     $url_parameters = "page=shop.product_details&amp;flypage={$flypage}&amp;product_id=" . $db_browse->f("product_id") . "&amp;category_id=" . $db_browse->f("category_id");
     if ($manufacturer_id) {
         $url_parameters .= "&amp;manufacturer_id=" . $manufacturer_id;
     }
     if ($keyword != '') {
         $url_parameters .= "&amp;keyword=" . urlencode($keyword);
     }
    /**
     * This is the main function which stores the order information in the database
     * 
     * @author Ashish Solanki!
     * @return boolean
     */
    function updateRecords($order_number, $order_total, &$d)
    {
        require_once CLASSPATH . 'ps_checkout.php';
        $ps_chkout = new ps_checkout();
        global $order_tax_details, $afid, $VM_LANG, $auth, $my, $mosConfig_offset, $vmLogger, $vmInputFilter, $discount_factor;
        $ps_vendor_id = $_SESSION["ps_vendor_id"];
        $cart = $_SESSION['cart'];
        require_once CLASSPATH . 'ps_payment_method.php';
        $ps_payment_method = new ps_payment_method();
        require_once CLASSPATH . 'ps_product.php';
        $ps_product = new ps_product();
        require_once CLASSPATH . 'ps_cart.php';
        $ps_cart = new ps_cart();
        $db = new ps_DB();
        $totals = $ps_chkout->calc_order_totals($d);
        extract($totals);
        $timestamp = time();
        //Custom
        $vmLogger->debug('-- Checkout Debug--
							Subtotal: ' . $order_subtotal . '
							Taxable: ' . $order_taxable . '
							Payment Discount: ' . $payment_discount . '
							Coupon Discount: ' . $coupon_discount . '
							Shipping: ' . $order_shipping . '
							Shipping Tax : ' . $order_shipping_tax . '
							Tax : ' . $order_tax . '
							------------------------
							Order Total: ' . $order_total . '
							----------------------------');
        // Check to see if Payment Class File exists
        $payment_class = $ps_payment_method->get_field($d["payment_method_id"], "payment_class");
        $d['new_order_status'] = 'P';
        // This is meant to be updated by a payment modules' process_payment method
        if (!class_exists($payment_class)) {
            include CLASSPATH . "payment/{$payment_class}.php";
        }
        $_PAYMENT = new $payment_class();
        // Remove the Coupon, because it is a Gift Coupon and now is used!!
        if (@$_SESSION['coupon_type'] == "gift") {
            $d['coupon_id'] = $_SESSION['coupon_id'];
            include_once CLASSPATH . 'ps_coupon.php';
            ps_coupon::remove_coupon_code($d);
        }
        // Get the IP Address
        if (!empty($_SERVER['REMOTE_ADDR'])) {
            $ip = $_SERVER['REMOTE_ADDR'];
        } else {
            $ip = 'unknown';
        }
        // Collect all fields and values to store them!
        $fields = array('user_id' => $auth["user_id"], 'vendor_id' => $ps_vendor_id, 'order_number' => $order_number, 'user_info_id' => $d["ship_to_info_id"], 'ship_method_id' => @urldecode($d["shipping_rate_id"]), 'order_total' => $order_total, 'order_subtotal' => $order_subtotal, 'order_tax' => $order_tax, 'order_tax_details' => serialize($order_tax_details), 'order_shipping' => $order_shipping, 'order_shipping_tax' => $order_shipping_tax, 'order_discount' => $payment_discount, 'coupon_discount' => $coupon_discount, 'coupon_code' => @$_SESSION['coupon_code'], 'order_currency' => $GLOBALS['product_currency'], 'order_status' => 'P', 'cdate' => $timestamp, 'mdate' => $timestamp, 'customer_note' => htmlspecialchars(vmRequest::getString('customer_note', '', 'POST', 'none'), ENT_QUOTES), 'ip_address' => $ip);
        // Insert the main order information
        $db->buildQuery('INSERT', '#__{vm}_orders', $fields);
        $result = $db->query();
        $d["order_id"] = $order_id = $db->last_insert_id();
        if ($result === false || empty($order_id)) {
            $vmLogger->crit('Adding the Order into the Database failed! User ID: ' . $auth["user_id"]);
            return false;
        }
        // Insert the initial Order History.
        $mysqlDatetime = date("Y-m-d G:i:s", $timestamp);
        $fields = array('order_id' => $order_id, 'order_status_code' => 'P', 'date_added' => $mysqlDatetime, 'customer_notified' => 1, 'comments' => '');
        $db->buildQuery('INSERT', '#__{vm}_order_history', $fields);
        $db->query();
        /**
         * Insert the Order payment info 
         */
        $payment_number = str_replace(array(' ', '|', '-'), '', @$_SESSION['ccdata']['order_payment_number']);
        $d["order_payment_code"] = @$_SESSION['ccdata']['credit_card_code'];
        // Payment number is encrypted using mySQL encryption functions.
        $fields = array('order_id' => $order_id, 'payment_method_id' => $d["payment_method_id"], 'order_payment_log' => @$d["order_payment_log"], 'order_payment_trans_id' => $vmInputFilter->safeSQL(@$d["order_payment_trans_id"]));
        if (!empty($payment_number) && VM_STORE_CREDITCARD_DATA == '1') {
            // Store Credit Card Information only if the Store Owner has decided to do so
            $fields['order_payment_code'] = $d["order_payment_code"];
            $fields['order_payment_expire'] = @$_SESSION["ccdata"]["order_payment_expire"];
            $fields['order_payment_name'] = @$_SESSION["ccdata"]["order_payment_name"];
            $fields['order_payment_number'] = VM_ENCRYPT_FUNCTION . "( '{$payment_number}','" . ENCODE_KEY . "')";
            $specialfield = array('order_payment_number');
        } else {
            $specialfield = array();
        }
        $db->buildQuery('INSERT', '#__{vm}_order_payment', $fields, '', $specialfield);
        $db->query();
        /**
         * Insert the User Billto & Shipto Info
         */
        // First: get all the fields from the user field list to copy them from user_info into the order_user_info
        $fields = array();
        require_once CLASSPATH . 'ps_userfield.php';
        $userfields = ps_userfield::getUserFields('', false, '', true, true);
        foreach ($userfields as $field) {
            if ($field->name == 'email') {
                $fields[] = 'user_email';
            } else {
                $fields[] = $field->name;
            }
        }
        $fieldstr = implode(',', $fields);
        // Save current Bill To Address
        $q = "INSERT INTO `#__{vm}_order_user_info` \n\t\t\t(`order_info_id`,`order_id`,`user_id`,address_type, " . $fieldstr . ") ";
        $q .= "SELECT NULL, '{$order_id}', '" . $auth['user_id'] . "', address_type, " . $fieldstr . " FROM #__{vm}_user_info WHERE user_id='" . $auth['user_id'] . "' AND address_type='BT'";
        $db->query($q);
        // Save current Ship to Address if applicable
        $q = "INSERT INTO `#__{vm}_order_user_info` \n\t\t\t(`order_info_id`,`order_id`,`user_id`,address_type, " . $fieldstr . ") ";
        $q .= "SELECT NULL, '{$order_id}', '" . $auth['user_id'] . "', address_type, " . $fieldstr . " FROM #__{vm}_user_info WHERE user_id='" . $auth['user_id'] . "' AND user_info_id='" . $d['ship_to_info_id'] . "' AND address_type='ST'";
        $db->query($q);
        /**
         * Insert all Products from the Cart into order line items; 
         * one row per product in the cart 
         */
        $dboi = new ps_DB();
        for ($i = 0; $i < $cart["idx"]; $i++) {
            $r = "SELECT product_id,product_in_stock,product_sales,product_parent_id,product_sku,product_name ";
            $r .= "FROM #__{vm}_product WHERE product_id='" . $cart[$i]["product_id"] . "'";
            $dboi->query($r);
            $dboi->next_record();
            $product_price_arr = $ps_product->get_adjusted_attribute_price($cart[$i]["product_id"], $cart[$i]["description"]);
            $product_price = $GLOBALS['CURRENCY']->convert($product_price_arr["product_price"], $product_price_arr["product_currency"]);
            if (empty($_SESSION['product_sess'][$cart[$i]["product_id"]]['tax_rate'])) {
                $my_taxrate = $ps_product->get_product_taxrate($cart[$i]["product_id"]);
            } else {
                $my_taxrate = $_SESSION['product_sess'][$cart[$i]["product_id"]]['tax_rate'];
            }
            // Attribute handling
            $product_parent_id = $dboi->f('product_parent_id');
            $description = '';
            if ($product_parent_id > 0) {
                $db_atts = $ps_product->attribute_sql($dboi->f('product_id'), $product_parent_id);
                while ($db_atts->next_record()) {
                    $description .= $db_atts->f('attribute_name') . ': ' . $db_atts->f('attribute_value') . '; ';
                }
            }
            $description .= $ps_product->getDescriptionWithTax($_SESSION['cart'][$i]["description"], $dboi->f('product_id'));
            $product_final_price = round($product_price * ($my_taxrate + 1), 2);
            $vendor_id = $ps_vendor_id;
            $fields = array('order_id' => $order_id, 'user_info_id' => $d["ship_to_info_id"], 'vendor_id' => $vendor_id, 'product_id' => $cart[$i]["product_id"], 'order_item_sku' => $dboi->f("product_sku"), 'order_item_name' => $dboi->f("product_name"), 'product_quantity' => $cart[$i]["quantity"], 'product_item_price' => $product_price, 'product_final_price' => $product_final_price, 'order_item_currency' => $GLOBALS['product_currency'], 'order_status' => 'P', 'product_attribute' => $description, 'cdate' => $timestamp, 'mdate' => $timestamp);
            $db->buildQuery('INSERT', '#__{vm}_order_item', $fields);
            $db->query();
            // Update Stock Level and Product Sales, decrease - no matter if in stock or not!
            $q = "UPDATE #__{vm}_product ";
            $q .= "SET product_in_stock = product_in_stock - " . (int) $cart[$i]["quantity"];
            $q .= " WHERE product_id = '" . $cart[$i]["product_id"] . "'";
            $db->query($q);
            $q = "UPDATE #__{vm}_product ";
            $q .= "SET product_sales= product_sales + " . (int) $cart[$i]["quantity"];
            $q .= " WHERE product_id='" . $cart[$i]["product_id"] . "'";
            $db->query($q);
            // Update stock of parent product, if all child products are sold, thanks Ragnar Brynjulfsson
            if ($dboi->f("product_parent_id") != 0) {
                $q = "SELECT COUNT(product_id) ";
                $q .= "FROM #__{vm}_product ";
                $q .= "WHERE product_parent_id = " . $dboi->f("product_parent_id");
                $q .= " AND product_in_stock > 0";
                $db->query($q);
                $db->next_record();
                if (!$db->f("COUNT(product_id)")) {
                    $q = "UPDATE #__{vm}_product ";
                    $q .= "SET product_in_stock = 0 ";
                    $q .= "WHERE product_id = " . $dboi->f("product_parent_id") . " LIMIT 1";
                    $db->query($q);
                }
            }
        }
        ######## BEGIN DOWNLOAD MOD ###############
        if (ENABLE_DOWNLOADS == "1") {
            require_once CLASSPATH . 'ps_order.php';
            for ($i = 0; $i < $cart["idx"]; $i++) {
                // only handle downloadable products here
                if (ps_product::is_downloadable($cart[$i]["product_id"])) {
                    $params = array('product_id' => $cart[$i]["product_id"], 'order_id' => $order_id, 'user_id' => $auth["user_id"]);
                    ps_order::insert_downloads_for_product($params);
                    if (@VM_DOWNLOADABLE_PRODUCTS_KEEP_STOCKLEVEL == '1') {
                        // Update the product stock level back to where it was.
                        $q = "UPDATE #__{vm}_product ";
                        $q .= "SET product_in_stock = product_in_stock + " . (int) $cart[$i]["quantity"];
                        $q .= " WHERE product_id = '" . (int) $cart[$i]["product_id"] . "'";
                        $db->query($q);
                    }
                }
            }
        }
        ################## END DOWNLOAD MOD ###########
        // Export the order_id so the checkout complete page can get it
        $d["order_id"] = $order_id;
        /*
         * Let the shipping module know which shipping method
         * was selected.  This way it can save any information
         * it might need later to print a shipping label.
         */
        if (is_callable(array($this->_SHIPPING, 'save_rate_info'))) {
            $this->_SHIPPING->save_rate_info($d);
        }
        // Now as everything else has been done, we can update the Order Status
        $update_order = false;
        if ($order_total == 0.0) {
            // code moved out of $_PAYMENT check as no payment will be needed when $order_total=0.0
            // If the Order Total is zero, we can confirm the order to automatically enable the download
            $d['order_status'] = ENABLE_DOWNLOAD_STATUS;
            $update_order = true;
        } elseif (isset($_PAYMENT)) {
            if ($d['new_order_status'] != 'P') {
                $d['order_status'] = $d['new_order_status'];
                $update_order = true;
            }
        }
        if ($update_order) {
            require_once CLASSPATH . "ps_order.php";
            $ps_order = new ps_order();
            $ps_order->order_status_update($d);
        }
        // Send the e-mail confirmation messages
        $ps_chkout->email_receipt($order_id);
        // Reset the cart (=empty it)
        $ps_cart->reset();
        $_SESSION['savedcart']['idx'] = 0;
        $ps_cart->saveCart();
        // Unset the payment_method variables
        $d["payment_method_id"] = "";
        $d["order_payment_number"] = "";
        $d["order_payment_expire"] = "";
        $d["order_payment_name"] = "";
        $d["credit_card_code"] = "";
        // Clear the sensitive Session data
        $_SESSION['ccdata']['order_payment_name'] = "";
        $_SESSION['ccdata']['order_payment_number'] = "";
        $_SESSION['ccdata']['order_payment_expire_month'] = "";
        $_SESSION['ccdata']['order_payment_expire_year'] = "";
        $_SESSION['ccdata']['credit_card_code'] = "";
        $_SESSION['coupon_discount'] = "";
        $_SESSION['coupon_id'] = "";
        $_SESSION['coupon_redeemed'] = false;
        $_POST["payment_method_id"] = "";
        $_POST["order_payment_number"] = "";
        $_POST["order_payment_expire"] = "";
        $_POST["order_payment_name"] = "";
        $_SESSION['order_id'] = $order_id;
    }
Ejemplo n.º 18
0
 $q = "SELECT * FROM `#__{vm}_order_user_info` WHERE order_id='" . $db->f("order_id") . "' ORDER BY address_type ASC";
 $dbbt->query($q);
 $dbbt->next_record();
 $old_user = '';
 if (!empty($user) && is_object($user)) {
     $old_user = $user;
 }
 $user = $dbbt->record[0];
 /** Retrieve Payment Info **/
 $dbpm = new ps_DB();
 $q = "SELECT * FROM `#__{vm}_payment_method` p, `#__{vm}_order_payment` op, `#__{vm}_orders` o ";
 $q .= "WHERE op.order_id='{$order_id}' ";
 $q .= "AND p.payment_method_id=op.payment_method_id ";
 $q .= "AND o.user_id='" . $auth["user_id"] . "' ";
 $q .= "AND o.order_id='{$order_id}' ";
 $dbpm->query($q);
 $dbpm->next_record();
 $registrationfields = ps_userfield::getUserFields('registration', false, '', true, true);
 $shippingfields = ps_userfield::getUserFields('shipping', false, '', true, true);
 $tpl->set('db', $db);
 $tpl->set('dbbt', $dbbt);
 $tpl->set('dbpm', $dbpm);
 $tpl->set('user', $user);
 $tpl->set('order_id', $order_id);
 $tpl->set('registrationfields', $registrationfields);
 $tpl->set('shippingfields', $shippingfields);
 $tpl->set('time_offset', $mosConfig_offset);
 // Get the template for this page
 echo $tpl->fetch('pages/account.order_details.tpl.php');
 if (!empty($old_user) && is_object($old_user)) {
     $user = $old_user;
$varname = 'PHPSHOP_CHECKOUT_MSG_' . CHECK_OUT_GET_FINAL_CONFIRMATION;
echo '<h5>'. $VM_LANG->_($varname) . '</h5>';
$db = new ps_DB();

echo '<table>';
// Begin with Shipping Address
if(!ps_checkout::noShipToNecessary()) {

	$db->query("SELECT * FROM #__{vm}_user_info WHERE user_info_id='".strip_tags($_REQUEST['ship_to_info_id'])."'");
	$db->next_record();

	echo '<tr><td valign="top"><strong>'.$VM_LANG->_('PHPSHOP_ADD_SHIPTO_2') . ":</strong></td>";
	echo '<td>';
	$dbs = new ps_DB();
	$q = "SELECT * FROM #__{vm}_country WHERE country_3_code='".$db->f("country")."'";
	$dbs->query($q);
	$country_id = $dbs->f("country_id");
	$q = "SELECT * FROM #__{vm}_state WHERE country_id=".$country_id." AND state_2_code='".$db->f("state")."'";
	$dbs->query($q);
	$state_name = $dbs->f("state_name");
	echo vmFormatAddress( array('name' => $db->f("first_name")." ".$db->f("last_name"),
        								'address_1' => $db->f("address_1"),
        								'address_2' => $db->f("address_2"),
        								'state' => $db->f("state"),
        								'state_name' => $state_name,
        								'zip' => $db->f("zip"),
        								'city' => $db->f("city"),
        								'country' => $db->f('country')
        							), true );
	
	echo "</td></tr>";
Ejemplo n.º 20
0
    /**
     * Show all configuration parameters for this payment method
     * @returns boolean False when the Payment method has no configration
     */
    function show_configuration()
    {
        global $VM_LANG;
        $db = new ps_DB();
        /** Read current Configuration ***/
        require_once CLASSPATH . "payment/" . $this->classname . ".cfg.php";
        ?>
      <table>
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PN_LOGIN');
        ?>
</strong></td>
            <td>
                <input type="text" name="PN_LOGIN" class="inputbox" value="<?php 
        echo PN_LOGIN;
        ?>
" />
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PN_LOGIN_EXPLAIN');
        ?>
</td>
        </tr>
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_PAYMENT_CVV2');
        ?>
</strong></td>
            <td>
                <select name="PN_CHECK_CARD_CODE" class="inputbox">
                <option <?php 
        if (PN_CHECK_CARD_CODE == 'YES') {
            echo "selected=\"selected\"";
        }
        ?>
 value="YES">
                <?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES');
        ?>
</option>
                <option <?php 
        if (PN_CHECK_CARD_CODE == 'NO') {
            echo "selected=\"selected\"";
        }
        ?>
 value="NO">
                <?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO');
        ?>
</option>
                </select>
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_PAYMENT_CVV2_TOOLTIP');
        ?>
</td>
        </tr>
        <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_SUCC');
        ?>
</strong></td>
            <td>
                <select name="PN_VERIFIED_STATUS" class="inputbox" >
                <?php 
        $q = "SELECT order_status_name,order_status_code FROM #__{vm}_order_status ORDER BY list_order";
        $db->query($q);
        $order_status_code = array();
        $order_status_name = array();
        while ($db->next_record()) {
            $order_status_code[] = $db->f("order_status_code");
            $order_status_name[] = $db->f("order_status_name");
        }
        for ($i = 0; $i < sizeof($order_status_code); $i++) {
            echo "<option value=\"" . $order_status_code[$i];
            if (PN_VERIFIED_STATUS == $order_status_code[$i]) {
                echo "\" selected=\"selected\">";
            } else {
                echo "\">";
            }
            echo $order_status_name[$i] . "</option>\n";
        }
        ?>
                    </select>
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_SUCC_EXPLAIN');
        ?>
</td>
        </tr>
            <tr>
            <td><strong><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_FAIL');
        ?>
</strong></td>
            <td>
                <select name="PN_INVALID_STATUS" class="inputbox" >
                <?php 
        for ($i = 0; $i < sizeof($order_status_code); $i++) {
            echo "<option value=\"" . $order_status_code[$i];
            if (PN_INVALID_STATUS == $order_status_code[$i]) {
                echo "\" selected=\"selected\">";
            } else {
                echo "\">";
            }
            echo $order_status_name[$i] . "</option>\n";
        }
        ?>
                    </select>
            </td>
            <td><?php 
        echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_FAIL_EXPLAIN');
        ?>
</td>
        </tr>
      </table>
   <?php 
        // return false if there's no configuration
        return true;
    }
Ejemplo n.º 21
0
 /**
  */
 function mail_question(&$d)
 {
     global $vmLogger, $Itemid, $_SESSION, $VM_LANG, $mosConfig_live_site, $mosConfig_lang, $sess;
     $db = new ps_DB();
     $product_id = (int) $d["product_id"];
     $q = 'SELECT * FROM #__{vm}_product WHERE product_id=' . $product_id . ' AND product_publish=\'Y\'';
     $db->query($q);
     if (!$db->next_record()) {
         $vmLogger->err($VM_LANG->_('NOT_AUTH', false));
         return false;
     }
     if ($db->f("product_sku") != @$d["product_sku"]) {
         $vmLogger->err($VM_LANG->_('NOT_AUTH', false));
         return false;
     }
     $Itemid = $sess->getShopItemid();
     $flypage = vmGet($_REQUEST, "flypage", null);
     // product url
     $product_url = $mosConfig_live_site . "/index.php?option=com_virtuemart&page=shop.product_details&flypage=" . urlencode($flypage) . "&product_id={$product_id}&Itemid={$Itemid}";
     $dbv = new ps_DB();
     $qt = "SELECT * from #__{vm}_vendor ";
     $qt .= "WHERE vendor_id = '" . $_SESSION['ps_vendor_id'] . "'";
     $dbv->query($qt);
     $dbv->next_record();
     $vendor_email = $dbv->f("contact_email");
     $shopper_email = $d["email"];
     $shopper_name = $d["name"];
     $subject_msg = vmRequest::getVar('text', '', 'post');
     $shopper_subject = sprintf($VM_LANG->_('VM_ENQUIRY_SHOPPER_EMAIL_SUBJECT'), $dbv->f("vendor_name"));
     $shopper_msg = str_replace('{vendor_name}', $dbv->f("vendor_name"), $VM_LANG->_('VM_ENQUIRY_SHOPPER_EMAIL_MESSAGE'));
     $shopper_msg = str_replace('{product_name}', $db->f("product_name"), $shopper_msg);
     $shopper_msg = str_replace('{product_sku}', $db->f("product_sku"), $shopper_msg);
     $shopper_msg = str_replace('{product_url}', $product_url, $shopper_msg);
     $shopper_msg = vmHtmlEntityDecode($shopper_msg);
     //
     $vendor_subject = sprintf($VM_LANG->_('VM_ENQUIRY_VENDOR_EMAIL_SUBJECT'), $dbv->f("vendor_name"), $db->f("product_name"));
     $vendor_msg = str_replace('{shopper_name}', $shopper_name, $VM_LANG->_('VM_ENQUIRY_VENDOR_EMAIL_MESSAGE'));
     $vendor_msg = str_replace('{shopper_message}', $subject_msg, $vendor_msg);
     $vendor_msg = str_replace('{shopper_email}', $shopper_email, $vendor_msg);
     $vendor_msg = str_replace('{product_name}', $db->f("product_name"), $vendor_msg);
     $vendor_msg = str_replace('{product_sku}', $db->f("product_sku"), $vendor_msg);
     $vendor_msg = str_replace('{product_url}', $product_url, $vendor_msg);
     $vendor_msg = vmHtmlEntityDecode($vendor_msg);
     //END: set up text mail
     /////////////////////////////////////
     // Send text email
     //
     if (ORDER_MAIL_HTML == '0') {
         // Mail receipt to the shopper
         vmMail($vendor_email, $dbv->f("vendor_name"), $shopper_email, $shopper_subject, $shopper_msg, "");
         // Mail receipt to the vendor
         vmMail($shopper_email, $shopper_name, $vendor_email, $vendor_subject, $vendor_msg, "");
     } elseif (ORDER_MAIL_HTML == '1') {
         // Mail receipt to the vendor
         $template = vmTemplate::getInstance();
         $template->set_vars(array('vendorname' => $dbv->f("vendor_name"), 'subject' => nl2br($subject_msg), 'contact_name' => $shopper_name, 'contact_email' => $shopper_email, 'product_name' => $db->f("product_name"), 'product_s_description' => $db->f("product_s_desc"), 'product_url' => $product_url, 'product_sku' => $db->f("product_sku")));
         if ($db->f("product_thumb_image")) {
             $imagefile = pathinfo($db->f("product_thumb_image"));
             $extension = $imagefile['extension'] == "jpg" ? "jpeg" : "jpeg";
             $EmbeddedImages[] = array('path' => IMAGEPATH . "product/" . $db->f("product_thumb_image"), 'name' => "product_image", 'filename' => $db->f("product_thumb_image"), 'encoding' => "base64", 'mimetype' => "image/" . $extension);
             $template->set('product_thumb', '<img src="cid:product_image" alt="product_image" border="0" />');
             $body = $template->fetch('order_emails/enquiry_email.tpl.php');
             $vendor_mail = vmMail($shopper_email, $shopper_name, $vendor_email, $vendor_subject, $body, $vendor_msg, true, null, null, $EmbeddedImages);
         } else {
             $template->set('product_thumb', '');
             $body = $template->fetch('order_emails/enquiry_email.tpl.php');
             $vendor_mail = vmMail($shopper_email, $shopper_name, $vendor_email, $vendor_subject, $body, $vendor_msg, true, null, null, null);
         }
         //Send sender confirmation email
         $sender_mail = vmMail($vendor_email, $dbv->f("vendor_name"), $shopper_email, $shopper_subject, $shopper_msg, "");
         if (!$vendor_mail || !$sender_mail) {
             $vmLogger->debug('Something went wrong while sending the enquiry email to ' . $vendor_email . ' and ' . $shopper_email);
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 22
0
 /**
  * This function returns an array with all "advanced" attributes of the product specified by
  * $product_id
  *
  * @param int $product_id
  */
 function getAdvancedAttributes($product_id, $base_price_only = false)
 {
     global $ps_product, $auth;
     if (is_null($ps_product)) {
         $ps_product = new ps_product();
     }
     $attributes_array = array();
     $attributes = $ps_product->get_field($product_id, 'attribute');
     if (!$attributes) {
         $db = new ps_DB();
         //get parent_id and try again
         $q = "SELECT product_parent_id FROM #__{vm}_product WHERE product_id={$product_id}";
         $db->query($q);
         $db->next_record();
         $attributes = $ps_product->get_field($db->f("product_parent_id"), 'attribute');
     }
     // Get each of the attributes into an array
     $product_attribute_keys = explode(";", $attributes);
     foreach ($product_attribute_keys as $attribute) {
         $attribute_name = substr($attribute, 0, strpos($attribute, ","));
         $attribute_values = substr($attribute, strpos($attribute, ",") + 1);
         $attributes_array[$attribute_name]['name'] = $attribute_name;
         // Read the different attribute values into an array
         $attribute_values = explode(',', $attribute_values);
         $operand = '';
         $my_mod = 0;
         foreach ($attribute_values as $value) {
             // Get the price modification for this attribute value
             $start = strpos($value, "[");
             $finish = strpos($value, "]", $start);
             $o = substr_count($value, "[");
             $c = substr_count($value, "]");
             // check to see if we have a bracket (means: a price modifier)
             if (True == is_int($finish)) {
                 $length = $finish - $start;
                 // We found a pair of brackets (price modifier?)
                 if ($length > 1) {
                     $my_mod = substr($value, $start + 1, $length - 1);
                     //echo "before: ".$my_mod."<br>\n";
                     if ($o != $c) {
                         // skip the tests if we don't have to process the string
                         if ($o < $c) {
                             $char = "]";
                             $offset = $start;
                         } else {
                             $char = "[";
                             $offset = $finish;
                         }
                         $s = substr_count($my_mod, $char);
                         for ($r = 1; $r < $s; $r++) {
                             $pos = strrpos($my_mod, $char);
                             $my_mod = substr($my_mod, $pos + 1);
                         }
                     }
                     $operand = substr($my_mod, 0, 1);
                     $my_mod = substr($my_mod, 1);
                 }
             }
             if ($start > 0) {
                 $value = substr($value, 0, $start);
             }
             $attributes_array[$attribute_name]['values'][$value]['name'] = $value;
             $attributes_array[$attribute_name]['values'][$value]['operand'] = $operand;
             if ($base_price_only) {
                 $attributes_array[$attribute_name]['values'][$value]['adjustment'] = $my_mod;
             } else {
                 $attributes_array[$attribute_name]['values'][$value]['adjustment'] = $my_mod * (1 - $auth["shopper_group_discount"] / 100);
             }
             $operand = '';
             $my_mod = 0;
         }
     }
     return $attributes_array;
 }
        $title .= $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_UPDATE_FOR_ITEM') . " ";
    }
} else {
    if (empty($product_parent_id)) {
        $title .= $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_NEW_FOR_PRODUCT') . " ";
    } else {
        $title .= $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_NEW_FOR_ITEM') . " ";
    }
}
$url = $_SERVER['PHP_SELF'] . "?page={$modulename}.product_form&product_id={$product_id}&product_parent_id={$product_parent_id}";
$title .= '<a href="' . $sess->url($url) . '">' . $ps_product->get_field($product_id, 'product_name') . '</a>';
if ($attribute_name) {
    $db = new ps_DB();
    $q = "SELECT * FROM #__{vm}_product_attribute_sku WHERE product_id='{$product_id}' ";
    $q .= "AND attribute_name = '{$attribute_name}' ";
    $db->query($q);
    $db->next_record();
}
//First create the object and let it print a form heading
$formObj = new formFactory($title);
//Then Start the form
$formObj->startForm();
?>
 
<table class="adminform">
	<tr> 
		<td width="23%" height="20" valign="top"> 
			<div align="right"><?php 
echo $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_NAME');
?>
:</div>
Ejemplo n.º 24
0
 /**
  * Returns the order status name for a given order status code
  *
  * @param string $order_status_code
  * @return string
  */
 function getOrderStatusName($order_status_code)
 {
     if (empty($GLOBALS['order_status'][$order_status_code])) {
         $db = new ps_DB();
         $q = "SELECT order_status_id, order_status_name FROM #__{vm}_order_status WHERE `order_status_code`='" . $order_status_code . "'";
         $db->query($q);
         $db->next_record();
         $GLOBALS['order_status'][$order_status_code] = $db->f("order_status_name");
     }
     return $GLOBALS['order_status'][$order_status_code];
 }
Ejemplo n.º 25
0
 function get_field($vendor_id, $field_name)
 {
     $db = new ps_DB();
     $q = "SELECT {$field_name} FROM #__{vm}_vendor WHERE vendor_id='{$vendor_id}'";
     $db->query($q);
     if ($db->next_record()) {
         return $db->f($field_name);
     } else {
         return False;
     }
 }
Ejemplo n.º 26
0
 function recentProducts($product_id, $maxitems)
 {
     global $db, $VM_LANG, $sess;
     if ($maxitems == 0) {
         return;
     }
     $recentproducts = $_SESSION['recent'];
     //No recent products so return empty
     if ($recentproducts['idx'] == 0) {
         //return "";
     }
     $tpl = new $GLOBALS['VM_THEMECLASS']();
     $db = new ps_DB();
     $dbp = new ps_DB();
     $k = 0;
     $recent = array();
     // Iterate through loop backwards (newest to oldest)
     for ($i = $recentproducts['idx'] - 1; $i >= 0; $i--) {
         //Check if on current product and don't display
         if ($recentproducts[$i]['product_id'] == $product_id) {
             continue;
         }
         // If we have not reached max products add the next product
         if ($k < $maxitems) {
             $prod_id = $recentproducts[$i]['product_id'];
             $category_id = $recentproducts[$i]['category_id'];
             $q = "SELECT product_name, category_name, c.category_flypage,product_s_desc,product_thumb_image ";
             $q .= "FROM #__{vm}_product as p,#__{vm}_category as c,#__{vm}_product_category_xref as cx ";
             $q .= "WHERE p.product_id = '{$prod_id}' ";
             $q .= "AND c.category_id = '{$category_id}' ";
             $q .= "AND p.product_id = cx.product_id ";
             $q .= "AND c.category_id=cx.category_id ";
             $q .= "AND p.product_publish='Y' ";
             $q .= "AND c.category_publish='Y' ";
             $q .= "LIMIT 0,1";
             $db->query($q);
             if (!$db->next_record()) {
                 continue;
             }
             if (!$this->is_product($prod_id)) {
                 $prod_id_p = $this->get_field($prod_id, "product_parent_id");
                 $q = "SELECT product_name,category_name, c.category_flypage,product_s_desc,product_thumb_image ";
                 $q .= "FROM #__{vm}_product as p,#__{vm}_category as c,#__{vm}_product_category_xref as cx ";
                 $q .= "WHERE p.product_id = '{$prod_id_p}' ";
                 $q .= "AND c.category_id = '{$category_id}' ";
                 $q .= "AND p.product_id = cx.product_id ";
                 $q .= "AND c.category_id=cx.category_id LIMIT 0,1";
                 $dbp->query($q);
             }
             $recent[$k]['product_s_desc'] = $db->f("product_s_desc");
             if ($recent[$k]['product_s_desc'] == "" && !empty($prod_id_p)) {
                 $recent[$k]['product_s_desc'] = $dbp->f("product_s_desc");
             }
             $flypage = $db->f("category_flypage");
             if (empty($flypage) && !empty($prod_id_p)) {
                 $flypage = $dbp->sf("category_flypage");
             }
             if (empty($flypage)) {
                 $flypage = FLYPAGE;
             }
             $flypage = str_replace('shop.', '', $flypage);
             $flypage = stristr($flypage, '.tpl') ? $flypage : $flypage . '.tpl';
             $recent[$k]['product_url'] = $sess->url("page=shop.product_details&amp;product_id={$prod_id}&amp;category_id={$category_id}&amp;flypage={$flypage}");
             $recent[$k]['category_url'] = $sess->url("page=shop.browse&amp;category_id={$category_id}");
             $recent[$k]['product_name'] = $db->f("product_name");
             if ($recent[$k]['product_name'] == "" && !empty($prod_id_p)) {
                 $recent[$k]['product_name'] = $dbp->f("product_name");
             }
             $recent[$k]['product_name'] = shopMakeHtmlSafe($recent[$k]['product_name']);
             $recent[$k]['category_name'] = $db->f("category_name");
             if ($recent[$k]['category_name'] == "" && !empty($prod_id_p)) {
                 $recent[$k]['category_name'] = $dbp->f("category_name");
             }
             $recent[$k]['product_thumb_image'] = $db->f("product_thumb_image");
             if ($recent[$k]['product_thumb_image'] == "" && !empty($prod_id_p)) {
                 $recent[$k]['product_thumb_image'] = $dbp->f("product_thumb_image");
             }
             $k++;
         }
     }
     if ($k == 0) {
         return "";
     }
     $tpl->set("recent_products", $recent);
     return $tpl->fetch('common/recent.tpl.php');
 }
Ejemplo n.º 27
0
 /**
  * Retrieves a list of available user groups and returns the ps_DB object
  *
  * @return ps_DB
  */
 function get_groups()
 {
     $db = new ps_DB();
     $query = 'SELECT group_id,group_name,group_level FROM `' . $this->_table_name . '` ORDER BY group_level ASC';
     $db->query($query);
     return $db;
 }
Ejemplo n.º 28
0
 function process_payment($order_number, $order_total, &$d)
 {
     global $vendor_mail, $vendor_currency, $VM_LANG, $vmLogger;
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     $auth = $_SESSION['auth'];
     $ps_checkout = new ps_checkout();
     /*** Get the Configuration File for authorize.net ***/
     require_once CLASSPATH . "payment/" . $this->classname . ".cfg.php";
     // Get user billing information
     $dbbt = new ps_DB();
     $qt = "SELECT * FROM #__{vm}_user_info WHERE user_id='" . $auth["user_id"] . "' AND address_type='BT'";
     $dbbt->query($qt);
     $dbbt->next_record();
     $user_info_id = $dbbt->f("user_info_id");
     if ($user_info_id != $d["ship_to_info_id"]) {
         // Get user billing information
         $dbst = new ps_DB();
         $qt = "SELECT * FROM #__{vm}_user_info WHERE user_info_id='" . $d["ship_to_info_id"] . "' AND address_type='ST'";
         $dbst->query($qt);
         $dbst->next_record();
     } else {
         $dbst = $dbbt;
     }
     $host = "posh.montrada.de";
     $port = 443;
     $path = "/posh/cmd/posh/tpl/txn_result.tpl";
     //Montrada vars to send
     $formdata = array('command' => 'authorization', 'orderid' => substr($order_number, 0, 20), 'creditc' => $_SESSION['ccdata']['order_payment_number'], 'expdat' => substr($_SESSION['ccdata']['order_payment_expire_year'], 2, 2) . $_SESSION['ccdata']['order_payment_expire_month'], 'currency' => $vendor_currency, 'amount' => $order_total * 100, 'cvcode' => $_SESSION['ccdata']['credit_card_code']);
     //build the post string
     $poststring = '';
     foreach ($formdata as $key => $val) {
         $poststring .= urlencode($key) . "=" . urlencode($val) . "&";
     }
     // strip off trailing ampersand
     $poststring = substr($poststring, 0, -1);
     /* DEBUG Message */
     if ($this->debug) {
         $vmLogger->debug(wordwrap($poststring, 60, "<br/>", 1));
     }
     if (function_exists("curl_init")) {
         $CR = curl_init();
         curl_setopt($CR, CURLOPT_URL, "https://" . $host . $path);
         curl_setopt($CR, CURLOPT_POST, 1);
         curl_setopt($CR, CURLOPT_FAILONERROR, true);
         curl_setopt($CR, CURLOPT_POSTFIELDS, $poststring);
         curl_setopt($CR, CURLOPT_USERPWD, MO_USERNAME . ":" . MO_PASSWORD);
         curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);
         // No PEER certificate validation...as we don't have
         // a certificate file for it to authenticate the host www.ups.com against!
         curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0);
         //curl_setopt($CR, CURLOPT_SSLCERT , "/usr/locale/xxxx/clientcertificate.pem");
         $result = curl_exec($CR);
         $error = curl_error($CR);
         if (!empty($error)) {
             $vmLogger->err(curl_error($CR) . "<br/><span class=\"message\">" . $VM_LANG->_('PHPSHOP_PAYMENT_INTERNAL_ERROR') . " authorize.net</span>");
             return false;
         } else {
             //echo $result; exit();
         }
         curl_close($CR);
     } else {
         $fp = fsockopen("ssl://" . $host, $port, $errno, $errstr, $timeout = 60);
         if (!$fp) {
             //error tell us
             $vmLogger->err("{$errstr} ({$errno})");
         } else {
             //send the server request
             fputs($fp, "POST {$path} HTTP/1.1\r\n");
             fputs($fp, "Host: {$host}\r\n");
             fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
             fputs($fp, "Content-length: " . strlen($poststring) . "\r\n");
             fputs($fp, "Authorization: Basic " . base64_encode(MO_USERNAME . ":" . MO_PASSWORD) . "\r\n");
             fputs($fp, "Connection: close\r\n\r\n");
             fputs($fp, $poststring . "\r\n\r\n");
             //Get the response header from the server
             $data = "";
             while (!feof($fp)) {
                 $data .= fgets($fp, 1024);
             }
             $data = explode("\r\n\r\n", $data);
             $result = trim($data[1]);
         }
     }
     /* DEBUG Message */
     if ($this->debug) {
         $vmLogger->debug(wordwrap(urldecode($result), 60, "<br/>", 1));
     }
     // Split Response-Data
     $data = explode("&", $result);
     foreach ($data as $var) {
         $var = explode("=", $var);
         $key = urldecode($var[0]);
         $value = urldecode($var[1]);
         $response[$key] = $value;
     }
     // Array of posherr values that get displayed
     $posherr1 = array("0", "100", "2014", "2016", "2018", "2040", "2042", "2048", "2090" . "2092", "2094", "2202", "2204");
     /* Display these error messages (ordered by id)
            0	(Transaktion erfolgreich abgeschlossen)
            100	(Transaktion ohne Erfolg abgeschlossen)
            2014	(Kartennummer, Parameter 'creditc' falsch)
            2016	(G�ltigkeitsdatum, Parameter 'expdat' falsch)
            2018	(Kartenpr�fwert, Parameter 'cvcode' falsch)
            2040	(Anfang oder L�nge der Kartennummer falsch)
            2042	(Pr�fsumme der Kartennummer falsch)
            2048	(Karte abgelaufen)
            2090	(Bankleitzahl, Parameter 'bankcode' falsch)
            2092	(Kontonummer, Parameter 'account' falsch)
            2094	(Name, Parameter 'cname' falsch)
            2202	(Bankleitzahl unbekannt)
            2204	(Kontonummer paSst nicht zur Bankleitzahl)        
        */
     // Array of rc values that get display if posherr=100
     $rc1 = array("000", "005", "033", "091", "096");
     // Approved - Success!
     if (isset($response['posherr']) && $response['posherr'] == 0) {
         $d["order_payment_log"] = $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS') . ": ";
         $d["order_payment_log"] .= $response['rmsg'];
         // Catch Transaction ID
         $d["order_payment_trans_id"] = $response['trefnum'];
         return True;
         $db = new ps_DB();
         $q = "UPDATE #__{vm}_order_payment SET order_payment_code='',order_payment_number='',order_payment_expire='' WHERE order_id={$order_number}";
         $db->query($q);
         $db->next_record();
     } else {
         if ($response['posherr'] = "") {
             $response['posherr'] = -1;
         }
         $vmLogger->err($VM_LANG->_('PHPSHOP_PAYMENT_ERROR', false) . " ({$response['posherr']})");
         if (in_array($response['posherr'], $posherr1)) {
             if ($response['posherr'] == 100) {
                 if (in_array($response['rc'], $rc1)) {
                     $vmLogger->err($response['rmsg']);
                 }
             } else {
                 $vmLogger->err($response['rmsg']);
             }
         }
         $d["order_payment_log"] = $response['rmsg'];
         // Catch Transaction ID
         $d["order_payment_trans_id"] = $response['retrefnr'];
         return False;
     }
 }
Ejemplo n.º 29
0
 function sendEmailAdmin($order_ids, $status = null)
 {
     global $sess, $VM_LANG, $vmLogger;
     $urls = array();
     foreach ($order_ids as $order_id) {
         $urls[$order_id]['site'] = SECUREURL . "index.php?option=com_virtuemart&page=account.order_details&order_id=" . $order_id . '&order_key=' . md5('AIR' . $order_id . 'SOFT' . $order_id . 'STORE') . '&Itemid=' . $sess->getShopItemid();
         $urls[$order_id]['admin'] = SECUREURL . '/administrator/index.php?page=order.order_print&limitstart=0&order_id=' . $order_id . '&option=com_virtuemart';
     }
     $db = new ps_DB();
     $dbv = new ps_DB();
     $q = "SELECT vendor_name,contact_email FROM #__{vm}_vendor ";
     $q .= "WHERE vendor_id='" . $_SESSION['ps_vendor_id'] . "'";
     $dbv->query($q);
     $dbv->next_record();
     //	  $q = "SELECT first_name,last_name,user_email,order_status_name FROM #__{vm}_order_user_info,#__{vm}_orders,#__{vm}_order_status ";
     //	  $q .= "WHERE #__{vm}_orders.order_id = '" . $db->getEscaped($order_id) . "' ";
     //	  $q .= "AND #__{vm}_orders.user_id = #__{vm}_order_user_info.user_id ";
     //	  $q .= "AND #__{vm}_orders.order_id = #__{vm}_order_user_info.order_id ";
     //	  $q .= "AND order_status = order_status_code ";
     //	  $db->query($q);
     //	  $db->next_record();
     /*
      $providerlist	 = $this->getProviderlist();
      $tracking		 = $this->getTracking($order_id);
      if ($tracking->provider) {
      $provider = $this->getProvider($tracking->provider);
      $provider->setData($tracking);
      }
      $siteTrackingUrl = $provider->getSiteUrlTracking();
     
      $provider	 = $tracking->provider;
      $tracknumber = $tracking->tracknumber;
      $date		 = $tracking->date;
     
      if (!$tracknumber) {
      return false;
      }
     *
     */
     $statusText = '';
     $statusText = 'Следующие заказы были доставлены: ';
     ob_start();
     require CLASSPATH . 'sc_trackingpost/tmpl/email/admin_email_tracking.php';
     $message = ob_get_contents();
     ob_end_clean();
     $mail_Body = $message;
     //	  $mail_Body = html_entity_decode($message);
     //$mail_Subject = 'Данные для отслеживания посылки по к заказу№' . $order_id;
     //Inf Временная заглушка
     //	  $admin_email = $dbv->f("contact_email");
     $admin_email = '*****@*****.**';
     $result = vmMail($admin_email, 'admin', $admin_email, $status, $mail_Body, '', true);
     return $result;
 }
Ejemplo n.º 30
0
$db = new ps_DB();
$action = $_GET['action'];
if ($action == 'logout') {
    unset($_SESSION['name']);
    unset($_SESSION['username']);
    unset($_SESSION['authority']);
    unset($_SESSION['userID']);
} else {
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    if (!$errormsg) {
        $errormsg = "";
    }
    if ($username) {
        $sql = "select ID, name, authority from account where username='******' and password='******' ";
        $db->query($sql);
        if ($db->next_record() && $db->f('authority') == 'ADMIN') {
            $_SESSION['username'] = $username;
            $_SESSION['name'] = $db->f('name');
            $_SESSION['authority'] = $db->f('authority');
            $_SESSION['userID'] = $db->f('ID');
            ?>
		<script language="javascript">
		document.location="index.php";
		</script>
		<?php 
        } else {
            unset($_SESSION['name']);
            unset($_SESSION['username']);
            unset($_SESSION['authority']);
            unset($_SESSION['userID']);