public function plgVmAddToSearch(&$where, &$PluginJoinTables, $custom_id)
 {
     if ($keyword = vmRequest::uword('custom_specification_name1', null, ' ')) {
         $db = JFactory::getDBO();
         if ($this->_name != $this->GetNameByCustomId($custom_id)) {
             return;
         }
         $keyword = '"%' . $db->getEscaped($keyword, true) . '%"';
         $where[] = $this->_name . '.`custom_specification_default1` LIKE ' . $keyword;
         $PluginJoinTables[] = $this->_name;
     }
     return true;
 }
Example #2
0
 /**
  * Validates the input parameters onBeforeUserAdd
  *
  * @param array $d
  * @return boolean
  */
 function validate_add(&$d)
 {
     global $my, $perm, $vmLogger, $VM_LANG;
     $db = new ps_DB();
     $valid = true;
     $missing = "";
     require_once CLASSPATH . 'ps_userfield.php';
     $requiredFields = ps_userfield::getUserFields('registration', true);
     $skipFields = array('username', 'password', 'password2', 'email', 'agreed');
     foreach ($requiredFields as $field) {
         if (in_array($field->name, $skipFields)) {
             continue;
         }
         switch ($field->type) {
             case 'age_verification':
                 // The Age Verification here is just a simple check if the selected date
                 // is a birthday older than the minimum age (default: 18)
                 $d[$field->name] = vmRequest::getInt('birthday_selector_year') . '-' . vmRequest::getInt('birthday_selector_month') . '-' . vmRequest::getInt('birthday_selector_day');
                 break;
             default:
                 if (empty($d[$field->name]) && $field->sys == 1) {
                     $valid = false;
                     $fieldtitle = $field->title;
                     if ($VM_LANG->exists($fieldtitle)) {
                         $fieldtitle = $VM_LANG->_($fieldtitle);
                     }
                     $vmLogger->err(sprintf($VM_LANG->_('VM_USER_ERR_MISSINGVALUE'), $fieldtitle));
                 }
                 break;
         }
     }
     $d['user_email'] = @$d['email'];
     if (!$d['perms']) {
         $vmLogger->warning($VM_LANG->_('VM_USER_ERR_GROUP'));
         $valid = false;
     } else {
         if (!$perm->hasHigherPerms($d['perms'])) {
             $vmLogger->err(sprintf($VM_LANG->_('VM_USER_ADD_ERR_NOPERMS'), $d['perms']));
             $valid = false;
         }
     }
     return $valid;
 }
Example #3
0
 /**
  * Cleans the request from script injection.
  *
  * @static
  * @return	void
  * @since	1.1
  */
 function clean()
 {
     vmRequest::_cleanArray($_FILES);
     vmRequest::_cleanArray($_ENV);
     vmRequest::_cleanArray($_GET);
     vmRequest::_cleanArray($_POST);
     vmRequest::_cleanArray($_COOKIE);
     vmRequest::_cleanArray($_SERVER);
     if (isset($_SESSION)) {
         vmRequest::_cleanArray($_SESSION);
     }
     $REQUEST = $_REQUEST;
     $GET = $_GET;
     $POST = $_POST;
     $COOKIE = $_COOKIE;
     $FILES = $_FILES;
     $ENV = $_ENV;
     $SERVER = $_SERVER;
     if (isset($_SESSION)) {
         $SESSION = $_SESSION;
     }
     foreach ($GLOBALS as $key => $value) {
         if ($key != 'GLOBALS') {
             unset($GLOBALS[$key]);
         }
     }
     $_REQUEST = $REQUEST;
     $_GET = $GET;
     $_POST = $POST;
     $_COOKIE = $COOKIE;
     $_FILES = $FILES;
     $_ENV = $ENV;
     $_SERVER = $SERVER;
     if (isset($SESSION)) {
         $_SESSION = $SESSION;
     }
     // Make sure the request hash is clean on file inclusion
     $GLOBALS['_VMREQUEST'] = array();
 }
Example #4
0
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
global $ps_shopper_group, $ps_product;
global $acl, $database;
include_class('shopper');
include_class('product');
if (!isset($ps_shopper_group)) {
    $ps_shopper_group = new ps_shopper_group();
}
$user_id = intval(vmGet($_REQUEST, 'user_id'));
$cid = vmRequest::getVar('cid', array(0), '', 'array');
if (!empty($user_id)) {
    $q = "SELECT * FROM #__users AS u LEFT JOIN #__{vm}_user_info AS ui ON id=user_id ";
    $q .= "WHERE id={$user_id} ";
    $q .= "AND (address_type='BT' OR address_type IS NULL ) ";
    $q .= "AND gid <= " . $my->gid;
    $db->query($q);
    $db->next_record();
}
// Set up the CMS General User Information
$row = new mosUser($database);
$row->load((int) $user_id);
if ($user_id) {
    $query = "SELECT *" . "\n FROM #__contact_details" . "\n WHERE user_id = " . (int) $row->id;
    $database->setQuery($query);
    $contact = $database->loadObjectList();
    /**
     * 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;
    }
 /**
  * Updates an Order Status
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $VM_LANG;
     $db = new ps_DB();
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     if (!$this->validate_update($d)) {
         return False;
     }
     $fields = array('order_status_code' => vmGet($d, 'order_status_code'), 'order_status_name' => vmGet($d, 'order_status_name'), 'order_status_description' => vmGet($d, 'order_status_description'), 'list_order' => vmRequest::getInt('list_order'));
     $db->buildQuery('UPDATE', $this->_table_name, $fields, "WHERE order_status_id=" . (int) $d["order_status_id"] . " AND vendor_id={$ps_vendor_id}");
     if ($db->query() !== false) {
         $GLOBALS['vmLogger']->info($VM_LANG->_('VM_ORDERSTATUS_UPDATED'));
         return true;
     }
     return false;
 }
 /**
  * Adds a new Shopper Group
  *
  * @param array $d
  * @return boolean
  */
 function add(&$d)
 {
     global $perm, $vmLogger, $VM_LANG;
     $hash_secret = "virtuemart";
     if ($perm->check("admin")) {
         $vendor_id = $d["vendor_id"];
     } else {
         $vendor_id = $_SESSION["ps_vendor_id"];
     }
     $db = new ps_DB();
     $timestamp = time();
     $default = @$d["default"] == "1" ? "1" : "0";
     if (!$this->validate_add($d)) {
         return False;
     }
     $user_id = md5(uniqid($hash_secret));
     $fields = array('vendor_id' => $vendor_id, 'shopper_group_name' => $d["shopper_group_name"], 'shopper_group_desc' => $d["shopper_group_desc"], 'shopper_group_discount' => $d["shopper_group_discount"], 'show_price_including_tax' => $d["show_price_including_tax"], 'default' => $default);
     $db->buildQuery('INSERT', '#__{vm}_shopper_group', $fields);
     if ($db->query() !== false) {
         $shopper_group_id = $db->last_insert_id();
         vmRequest::setVar('shopper_group_id', $shopper_group_id);
         $vmLogger->info($VM_LANG->_('SHOPPER_GROUP_ADDED'));
         // Set all other shopper groups to be non-default, if this new shopper group shall be "default"
         if ($default == "1") {
             $q = "UPDATE #__{vm}_shopper_group ";
             $q .= "SET `default`=0 ";
             $q .= "WHERE shopper_group_id !=" . $shopper_group_id;
             $q .= " AND vendor_id ={$vendor_id}";
             $db->query($q);
             $db->next_record();
         }
         return $_REQUEST['shopper_group_id'];
     }
     $vmLogger->err($VM_LANG->_('SHOPPER_GROUP_ADD_FAILED'));
     return false;
 }
Example #8
0
$only_page = vmRequest::getInt('only_page', 0);
if (PSHOP_IS_OFFLINE == '1' && !$perm->hasHigherPerms('storeadmin')) {
    echo PSHOP_OFFLINE_MESSAGE;
} else {
    if (PSHOP_IS_OFFLINE == '1') {
        echo '<h2>' . $VM_LANG->_('OFFLINE_MODE') . '</h2>';
    }
    if ($is_popup) {
        echo "<style type='text/css' media='print'>.vmNoPrint { display: none }</style>";
        echo vmCommonHTML::PrintIcon('', true, ' ' . $VM_LANG->_('CMN_PRINT'));
    }
    // The Vendor ID is important
    $ps_vendor_id = $_SESSION['ps_vendor_id'];
    // The authentication array
    $auth = $_SESSION['auth'];
    $no_menu = vmRequest::getInt('no_menu', 0);
    // Timer Start
    if (vmShouldDebug()) {
        /*@MWM1: Log/Debug enhancements */
        $start = utime();
        $GLOBALS["mosConfig_debug"] = 1;
    }
    // update the cart because something could have
    // changed while running a function
    $cart = $_SESSION["cart"];
    if ((!$pagePermissionsOK || !$funcParams) && $_REQUEST['page'] != 'checkout.index') {
        if (!$pagePermissionsOK && defined('_VM_PAGE_NOT_AUTH')) {
            $page = 'checkout.login_form';
            echo '<br/><br/>' . $VM_LANG->_('DO_LOGIN') . '<br/><br/>';
        } elseif (!$pagePermissionsOK && defined('_VM_PAGE_NOT_FOUND')) {
            $page = HOMEPAGE;
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
if (!isset($_REQUEST["shopper_id"]) || empty($_REQUEST["shopper_id"])) {
    echo $VM_LANG->_('VM_CHECKOUT_ORDERIDNOTSET');
} else {
    include CLASSPATH . "payment/ps_ipayment.cfg.php";
    $order_number = vmrequest::getVar('shopper_id');
    $q = 'SELECT order_id,order_total,order_status,order_currency FROM #__{vm}_orders WHERE ';
    $q .= '#__{vm}_orders.user_id= ' . $auth["user_id"] . "\n";
    $q .= 'AND #__{vm}_orders.order_number=\'' . $db->getEscaped($order_number) . "'";
    $db->query($q);
    if ($db->next_record()) {
        if (vmRequest::getVar('ret_status') == 'SUCCESS') {
            ?>
 
        <img src="<?php 
            echo VM_THEMEURL;
            ?>
images/button_ok.png" align="middle" alt="<?php 
            echo $VM_LANG->_('VM_CHECKOUT_SUCCESS');
            ?>
" border="0" />
        <h2><?php 
            echo $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS');
            ?>
</h2>
    
    <?php 
require_once CLASSPATH . 'ps_product.php';
require_once CLASSPATH . 'ps_order_status.php';
require_once CLASSPATH . 'ps_checkout.php';
require_once CLASSPATH . 'ps_order_change.php';
require_once CLASSPATH . 'ps_order_change_html.php';
$ps_product = new ps_product();
$order_id = vmRequest::getInt('order_id');
$ps_order_change_html = new ps_order_change_html($order_id);
//Added Option to resend the Confirmation Mail
$resend_action = vmRequest::getVar('func');
if ($resend_action == 'resendconfirm' && $order_id) {
    ps_checkout::email_receipt($order_id);
    $redirurl = $_SERVER['PHP_SELF'];
    foreach ($_POST as $key => $value) {
        if ($value != 'resendconfirm') {
            $redirurl .= !strpos($redirurl, '?') ? '?' : '&' . $key . '=' . vmRequest::getVar($key);
        }
    }
    vmRedirect($redirurl, $VM_LANG->_('PHPSHOP_ORDER_RESEND_CONFIRMATION_MAIL_SUCCESS'));
}
if (!is_numeric($order_id)) {
    echo "<h2>The Order ID {$order_id} is not valid.</h2>";
} else {
    $dbc = new ps_DB();
    $q = "SELECT * FROM #__{vm}_orders WHERE order_id='{$order_id}'";
    $db->query($q);
    if ($db->next_record()) {
        // Print View Icon
        $print_url = $_SERVER['PHP_SELF'] . "?page=order.order_printdetails&amp;order_id={$order_id}&amp;no_menu=1&pop=1";
        if (vmIsJoomla('1.5', '>=')) {
            $print_url .= "&amp;tmpl=component";
Example #11
0
 /**
  * Returns a link tag
  *
  * @param string $href
  * @param string $type
  * @param string $rel
  * @return string
  */
 function linkTag($href, $type = 'text/css', $rel = 'stylesheet', $media = "screen, projection")
 {
     global $mosConfig_gzip, $mosConfig_live_site;
     if (isset($_REQUEST['usefetchscript'])) {
         $use_fetchscript = vmRequest::getBool('usefetchscript', 1);
         vmRequest::setVar('usefetchscript', $use_fetchscript, 'session');
     } else {
         $use_fetchscript = vmRequest::getBool('usefetchscript', 1, 'session');
     }
     if (stristr($href, 'com_virtuemart') && $use_fetchscript) {
         $base_href = str_replace(URL, '', $href);
         $base_href = str_replace(SECUREURL, '', $base_href);
         $base_href = str_replace('components/com_virtuemart/', '', $base_href);
         $href = $mosConfig_live_site . '/components/com_virtuemart/fetchscript.php?gzip=' . $mosConfig_gzip . '&amp;subdir[0]=' . dirname($base_href) . '&amp;file[0]=' . basename($href);
     }
     return '<link type="' . $type . '" href="' . $href . '" rel="' . $rel . '"' . (empty($media) ? '' : ' media="' . $media . '"') . ' />' . "\n";
 }
Example #12
0
   <input type="hidden" name="Itemid" value="' . $sess->getShopItemid() . '" />
   <input type="hidden" name="description" value="' . stripslashes($cart[$i]["description"]) . '" />
   <input type="image" name="update" title="' . $VM_LANG->_('PHPSHOP_CART_UPDATE') . '" src="' . VM_THEMEURL . 'images/update_quantity_cart.png" alt="' . $VM_LANG->_('PHPSHOP_UPDATE') . '" align="middle" />
 </form>';
       $product_rows[$i]['delete_form'] = '<form action="' . $action_url . '" method="post" name="delete" style="display: inline;">
   <input type="hidden" name="option" value="com_virtuemart" />
   <input type="hidden" name="page" value="' . $page . '" />
   <input type="hidden" name="Itemid" value="' . $sess->getShopItemid() . '" />
   <input type="hidden" name="func" value="cartDelete" />
   <input type="hidden" name="product_id" value="' . $_SESSION['cart'][$i]["product_id"] . '" />
   <input type="hidden" name="description" value="' . $cart[$i]["description"] . '" />
 	<input type="image" name="delete" title="' . $VM_LANG->_('PHPSHOP_CART_DELETE') . '" src="' . VM_THEMEURL . 'images/remove_from_cart.png" alt="' . $VM_LANG->_('PHPSHOP_CART_DELETE') . '" align="middle" />
 </form>';
   }
   // End of for loop through the Cart
   vmRequest::setVar('zone_qty', $vars['zone_qty']);
   $total = $total_undiscounted = round($total, 5);
   $vars["total"] = $total;
   $subtotal_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($grandSubtotal);
   if (!empty($_POST["do_coupon"]) || in_array(strtolower($func), array('cartadd', 'cartupdate', 'cartdelete')) && !empty($_SESSION['coupon_redeemed'])) {
       /* process the coupon */
       require_once CLASSPATH . "ps_coupon.php";
       $vars["total"] = $total;
       ps_coupon::process_coupon_code($vars);
   }
   /* HANDLE SHIPPING COSTS */
   if (!empty($shipping_rate_id) && !ps_checkout::noShippingMethodNecessary()) {
       $shipping = true;
       $vars["weight"] = $weight_total;
       $shipping_total = round($ps_checkout->_SHIPPING->get_rate($vars), 5);
       $shipping_taxrate = $ps_checkout->_SHIPPING->get_tax_rate();
Example #13
0
 /**
  * Updates a Payment Entry
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $VM_LANG;
     global $vmLogger, $VM_LANG;
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     $db = new ps_DB();
     if (!$this->validate_update($d)) {
         return False;
     }
     if (!empty($d["payment_class"])) {
         $payment_class = basename($d["payment_class"]);
         @(include CLASSPATH . "payment/" . $payment_class . ".php");
         if (class_exists($payment_class)) {
             $_PAYMENT = new $payment_class();
         } else {
             $GLOBALS['vmLogger']->err($VM_LANG->_('VM_PAYMENTMETHOD_CLASS_NOT_EXIST'));
             return false;
         }
     } else {
         include CLASSPATH . "payment/ps_payment.php";
         $_PAYMENT = new ps_payment();
     }
     if ($_PAYMENT->configfile_writeable() || $_PAYMENT->classname == 'ps_payment') {
         $_PAYMENT->write_configuration($d);
         $vmLogger->info($VM_LANG->_('VM_CONFIGURATION_CHANGE_SUCCESS', false));
     } else {
         $vmLogger->err(sprintf($VM_LANG->_('VM_CONFIGURATION_CHANGE_FAILURE', false), CLASSPATH . "payment/" . $_PAYMENT->classname . ".cfg.php"));
         return false;
     }
     $fields = array('payment_method_name' => vmGet($d, 'payment_method_name'), 'payment_class' => vmGet($d, 'payment_class'), 'shopper_group_id' => vmRequest::getInt('shopper_group_id'), 'payment_method_discount' => vmRequest::getFloat('payment_method_discount'), 'payment_method_discount_is_percent' => vmGet($d, 'payment_method_discount_is_percent'), 'payment_method_discount_max_amount' => (double) str_replace(',', '.', $d["payment_method_discount_max_amount"]), 'payment_method_discount_min_amount' => (double) str_replace(',', '.', $d["payment_method_discount_min_amount"]), 'payment_method_code' => vmGet($d, 'payment_method_code'), 'enable_processor' => vmGet($d, 'enable_processor'), 'list_order' => vmRequest::getInt('list_order'), 'is_creditcard' => vmGet($d, 'is_creditcard'), 'payment_enabled' => vmGet($d, 'payment_enabled'), 'accepted_creditcards' => vmGet($d, 'accepted_creditcards'), 'payment_extrainfo' => vmGet($_POST, 'payment_extrainfo', null, VMREQUEST_ALLOWRAW));
     $db->buildQuery('UPDATE', '#__{vm}_payment_method', $fields, 'WHERE payment_method_id=' . (int) $d["payment_method_id"] . ' AND vendor_id=' . $ps_vendor_id);
     $db->query();
     return True;
 }
Example #14
0
 public function display($tpl = null)
 {
     $show_prices = VmConfig::get('show_prices', 1);
     if ($show_prices == '1') {
         if (!class_exists('calculationHelper')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
         }
     }
     $this->assignRef('show_prices', $show_prices);
     $document = JFactory::getDocument();
     // add javascript for price and cart
     vmJsApi::jPrice();
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     /* Set the helper path */
     $this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
     //Load helpers
     $this->loadHelper('image');
     $categoryModel = VmModel::getModel('category');
     $productModel = VmModel::getModel('product');
     $categoryId = JRequest::getInt('virtuemart_category_id', false);
     $vendorId = 1;
     $category = $categoryModel->getCategory($categoryId);
     $categoryModel->addImages($category, 1);
     $perRow = empty($category->products_per_row) ? VmConfig::get('products_per_row', 3) : $category->products_per_row;
     // 		$categoryModel->setPerRow($perRow);
     $this->assignRef('perRow', $perRow);
     //No redirect here, category id = 0 means show ALL categories! note by Max Milbers
     /*		if(empty($category->virtuemart_vendor_id) && $search == null ) {
         	$app -> enqueueMessage(JText::_('COM_VIRTUEMART_CATEGORY_NOT_FOUND'));
         	$app -> redirect( 'index.php');
         }*/
     // Add the category name to the pathway
     if ($category->parents) {
         foreach ($category->parents as $c) {
             $pathway->addItem(strip_tags($c->category_name), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id));
         }
     }
     // 		static $counter = 0;
     // 		static $counter2 = 0;
     //if($category->children)	$categoryModel->addImages($category->children);
     $categoryModel->addImages($category, 1);
     $cache = JFactory::getCache('com_virtuemart', 'callback');
     $category->children = $cache->call(array('VirtueMartModelCategory', 'getChildCategoryList'), $vendorId, $categoryId);
     // self::$categoryTree = self::categoryListTreeLoop($selectedCategories, $cid, $level, $disabledFields);
     // 		vmTime('end loop categoryListTree '.$counter);
     $categoryModel->addImages($category->children, 1);
     if (VmConfig::get('enable_content_plugin', 0)) {
         // add content plugin //
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('content');
         $category->text = $category->category_description;
         if (!class_exists('JParameter')) {
             require JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'parameter.php';
         }
         $params = new JParameter('');
         if (JVM_VERSION === 2) {
             $results = $dispatcher->trigger('onContentPrepare', array('com_virtuemart.category', &$category, &$params, 0));
             // More events for 3rd party content plugins
             // This do not disturb actual plugins, because we don't modify $product->text
             $res = $dispatcher->trigger('onContentAfterTitle', array('com_virtuemart.category', &$category, &$params, 0));
             $category->event->afterDisplayTitle = trim(implode("\n", $res));
             $res = $dispatcher->trigger('onContentBeforeDisplay', array('com_virtuemart.category', &$category, &$params, 0));
             $category->event->beforeDisplayContent = trim(implode("\n", $res));
             $res = $dispatcher->trigger('onContentAfterDisplay', array('com_virtuemart.category', &$category, &$params, 0));
             $category->event->afterDisplayContent = trim(implode("\n", $res));
         } else {
             $results = $dispatcher->trigger('onPrepareContent', array(&$category, &$params, 0));
         }
         $category->category_description = $category->text;
     }
     $this->assignRef('category', $category);
     // Set Canonic link
     if (!empty($tpl)) {
         $format = $tpl;
     } else {
         $format = JRequest::getWord('format', 'html');
     }
     if ($format == 'html') {
         $document->addHeadLink(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $categoryId), 'canonical', 'rel', '');
     }
     // Set the titles
     if ($category->customtitle) {
         $title = strip_tags($category->customtitle);
     } elseif ($category->category_name) {
         $title = strip_tags($category->category_name);
     } else {
         $menus = $app->getMenu();
         $menu = $menus->getActive();
         if ($menu) {
             $title = $menu->title;
         }
         // $title = $this->params->get('page_title', '');
         // Check for empty title and add site name if param is set
         if (empty($title)) {
             $title = $app->getCfg('sitename');
         } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
             $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
         } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
             $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
         }
     }
     if (JRequest::getInt('error')) {
         $title .= ' ' . JText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
     }
     // set search and keyword
     if ($keyword = vmRequest::uword('keyword', '', ' ')) {
         $pathway->addItem($keyword);
         $title .= ' (' . $keyword . ')';
     }
     $search = JRequest::getvar('keyword', null);
     if ($search !== null) {
         $searchcustom = $this->getSearchCustom();
     }
     $this->assignRef('keyword', $keyword);
     $this->assignRef('search', $search);
     // Load the products in the given category
     $products = $productModel->getProductsInCategory($categoryId);
     $productModel->addImages($products, 1);
     $this->assignRef('products', $products);
     foreach ($products as $product) {
         $product->stock = $productModel->getStockIndicator($product);
     }
     $ratingModel = VmModel::getModel('ratings');
     $showRating = $ratingModel->showRating();
     $this->assignRef('showRating', $showRating);
     $virtuemart_manufacturer_id = JRequest::getInt('virtuemart_manufacturer_id', 0);
     if ($virtuemart_manufacturer_id and !empty($products[0])) {
         $title .= ' ' . $products[0]->mf_name;
     }
     $document->setTitle($title);
     // Override Category name when viewing manufacturers products !IMPORTANT AFTER page title.
     if (JRequest::getInt('virtuemart_manufacturer_id') and !empty($products[0])) {
         $category->category_name = $products[0]->mf_name;
     }
     $pagination = $productModel->getPagination($perRow);
     $this->assignRef('vmPagination', $pagination);
     $orderByList = $productModel->getOrderByList($categoryId);
     $this->assignRef('orderByList', $orderByList);
     // 	    $productRelatedManufacturerList = $productModel->getProductRelatedManufacturerList($categoryId);
     // 	    $this->assignRef('productRelatedManufacturerList', $productRelatedManufacturerList);
     //$sortOrderButton = $productModel->getsortOrderButton();
     //$this->assignRef('sortOrder', $sortOrderButton);
     if ($category->metadesc) {
         $document->setDescription($category->metadesc);
     }
     if ($category->metakey) {
         $document->setMetaData('keywords', $category->metakey);
     }
     if ($category->metarobot) {
         $document->setMetaData('robots', $category->metarobot);
     }
     if ($app->getCfg('MetaTitle') == '1') {
         $document->setMetaData('title', $title);
     }
     if ($app->getCfg('MetaAuthor') == '1') {
         $document->setMetaData('author', $category->metaauthor);
     }
     if ($products) {
         $currency = CurrencyDisplay::getInstance();
         $this->assignRef('currency', $currency);
     }
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     $showBasePrice = Permissions::getInstance()->check('admin');
     //todo add config settings
     $this->assignRef('showBasePrice', $showBasePrice);
     //set this after the $categoryId definition
     $paginationAction = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $categoryId);
     $this->assignRef('paginationAction', $paginationAction);
     shopFunctionsF::setLastVisitedCategoryId($categoryId);
     shopFunctionsF::setLastVisitedManuId($virtuemart_manufacturer_id);
     if (empty($category->category_template)) {
         $category->category_template = VmConfig::get('categorytemplate');
     }
     shopFunctionsF::setVmTemplate($this, $category->category_template, 0, $category->category_layout);
     parent::display($tpl);
 }
Example #15
0
 /**
  * updates Product Type information
  * @author Zdenek Dvorak
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     $db = new ps_DB();
     if ($this->validate_update($d)) {
         if (empty($d["product_type_publish"])) {
             $d["product_type_publish"] = "N";
         }
         $fields = array('product_type_name' => vmGet($d, 'product_type_name'), 'product_type_description' => vmGet($d, 'product_type_description'), 'product_type_publish' => vmGet($d, 'product_type_publish'), 'product_type_browsepage' => vmGet($d, 'product_type_browsepage'), 'product_type_flypage' => vmGet($d, 'product_type_flypage'), 'product_type_list_order' => vmRequest::getInt('list_order'));
         $db->buildQuery('UPDATE', '#__{vm}_product_type', $fields, 'WHERE product_type_id=' . (int) $d["product_type_id"]);
         $db->query();
         // Re-Order the Product Type table IF the list_order has been changed
         if (intval($d['list_order']) != intval($d['currentpos'])) {
             $dbu = new ps_DB();
             /* Moved UP in the list order */
             if (intval($d['list_order']) < intval($d['currentpos'])) {
                 $q = "SELECT product_type_id FROM #__{vm}_product_type WHERE ";
                 $q .= "product_type_id <> '" . $d["product_type_id"] . "' ";
                 $q .= "AND product_type_list_order >= '" . intval($d["list_order"]) . "'";
                 $db->query($q);
                 while ($db->next_record()) {
                     $dbu->query("UPDATE #__{vm}_product_type SET product_type_list_order=product_type_list_order+1 WHERE product_type_id='" . $db->f("product_type_id") . "'");
                 }
             } else {
                 $q = "SELECT product_type_id FROM #__{vm}_product_type WHERE ";
                 $q .= "product_type_id <> '" . $d["product_type_id"] . "' ";
                 $q .= "AND product_type_list_order > '" . intval($d["currentpos"]) . "'";
                 $q .= "AND product_type_list_order <= '" . intval($d["list_order"]) . "'";
                 $db->query($q);
                 while ($db->next_record()) {
                     $dbu->query("UPDATE #__{vm}_product_type SET product_type_list_order=product_type_list_order-1 WHERE product_type_id='" . $db->f("product_type_id") . "'");
                 }
             }
         }
         // END Re-Ordering
         return True;
     } else {
         return False;
     }
 }
Example #16
0
 /**
  * Updates a state entry
  *
  * @param array $d
  * @return boolean
  */
 function updateState(&$d)
 {
     $db = new ps_DB();
     if (empty($d['state_id']) || empty($d['country_id'])) {
         $GLOBALS['vmLogger']->err('Please select a state or country for update!');
         return False;
     }
     $fields = array('state_name' => vmGet($d, 'state_name'), 'country_id' => vmRequest::getInt('country_id'), 'state_2_code' => vmGet($d, 'state_2_code'), 'state_3_code' => vmGet($d, 'state_3_code'));
     $db->buildQuery('UPDATE', '#__{vm}_state', $fields, 'WHERE state_id=' . (int) $d["state_id"]);
     if ($db->query()) {
         $GLOBALS['vmLogger']->info('The state has been updated.');
         return True;
     }
     return false;
 }
 function getFirstLevelItem($mitem)
 {
     global $Itemid, $mosConfig_live_site, $mainframe, $sess;
     $txt = '';
     switch ($mitem->type) {
         case 'separator':
         case 'component_item_link':
             break;
         case 'content_item_link':
             $temp = split("&task=view&id=", $mitem->link);
             $mitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1]);
             break;
         case 'url':
             if (eregi('index.php\\?', $mitem->link)) {
                 if (!eregi('Itemid=', $mitem->link)) {
                     $mitem->link .= '&Itemid=' . $mitem->id;
                 }
             }
             break;
         case 'content_typed':
         default:
             $mitem->link .= '&Itemid=' . $sess->getShopItemid();
             break;
     }
     $id = 'id="menu' . $mitem->id . '"';
     $mitem->link = vmAmpReplace($mitem->link);
     if (strcasecmp(substr($mitem->link, 0, 4), 'http')) {
         $mitem->link = sefRelToAbs($mitem->link);
     }
     $menuclass = 'mainlevel' . $this->parent->_params->get('class_sfx');
     // Active Menu highlighting
     $current_itemid = trim(vmRequest::getInt('Itemid'));
     if (in_array($mitem->id, $this->parent->open)) {
         $menuclass = 'mainlevel_active' . $this->parent->_params->get('class_sfx');
     }
     switch ($mitem->browserNav) {
         // cases are slightly different
         case 1:
             // open in a new window
             $txt = '<a href="' . $mitem->link . '" target="_blank" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>';
             break;
         case 2:
             // open in a popup window
             $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $mitem->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\" " . $id . ">" . $mitem->name . "</a>\n";
             break;
         case 3:
             // don't link it
             $txt = '<span class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</span>';
             break;
         default:
             // formerly case 2
             // open in parent window
             $txt = '<a href="' . $mitem->link . '" class="' . $menuclass . '" ' . $id . '>' . $mitem->name;
             if ($this->parent->hasSubItems($mitem->id)) {
                 $txt .= '&nbsp;&nbsp;<img border="0" src="' . $this->parent->_params->get('LSPath') . '/img/tabarrow.gif" alt="arrow" />';
             }
             $txt .= '</a>';
             break;
     }
     if ($this->parent->_params->get('menu_images')) {
         $menu_params = new stdClass();
         $menu_params =& new mosParameters($mitem->params);
         $menu_image = $menu_params->def('menu_image', -1);
         if ($menu_image != '-1' && $menu_image) {
             $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $mitem->name . '"/>';
             if ($this->parent->_params->get('menu_images_align')) {
                 $txt = $txt . ' ' . $image;
             } else {
                 $txt = $image . ' ' . $txt;
             }
         }
     }
     return $txt;
 }
Example #18
0
 /**
  * This functions updates the variables of the model which are used in the sortSearchListQuery
  *  with the variables from the Request
  *
  * @author Max Milbers
  */
 function updateRequests()
 {
     //hmm how to trigger that in the module or so?
     $this->keyword = vmRequest::uword('keyword', "0", ' ');
     if ($this->keyword == "0") {
         $this->keyword = vmRequest::uword('filter_product', "0", ' ');
     }
     $app = JFactory::getApplication();
     $option = 'com_virtuemart';
     $view = 'product';
     //Filter order and dir  This is unecessary complex and maybe even wrong, but atm it seems to work
     if ($app->isSite()) {
         $filter_order = JRequest::getString('orderby', VmConfig::get('browse_orderby_field', 'p.virtuemart_product_id'));
         $filter_order = $this->checkFilterOrder($filter_order);
         $filter_order_Dir = strtoupper(JRequest::getWord('order', 'ASC'));
         $valid_search_fields = VmConfig::get('browse_search_fields');
     } else {
         $filter_order = strtolower($app->getUserStateFromRequest('com_virtuemart.' . $view . '.filter_order', 'filter_order', $this->_selectedOrdering, 'cmd'));
         $filter_order = $this->checkFilterOrder($filter_order);
         $filter_order_Dir = strtoupper($app->getUserStateFromRequest($option . '.' . $view . '.filter_order_Dir', 'filter_order_Dir', '', 'word'));
         $valid_search_fields = array('product_name');
     }
     $filter_order_Dir = $this->checkFilterDir($filter_order_Dir);
     $this->filter_order = $filter_order;
     $this->filter_order_Dir = $filter_order_Dir;
     $this->valid_search_fields = $valid_search_fields;
     $this->product_parent_id = JRequest::getInt('product_parent_id', false);
     $this->virtuemart_manufacturer_id = JRequest::getInt('virtuemart_manufacturer_id', false);
     $this->search_type = JRequest::getVar('search_type', '');
     $this->searchcustoms = JRequest::getVar('customfields', array(), 'default', 'array');
     $this->searchplugin = JRequest::getInt('custom_parent_id', 0);
 }
Example #19
0
		<th><?php 
echo $this->sort('product_weight', 'COM_VIRTUEMART_PRODUCT_INVENTORY_WEIGHT');
?>
</th>
		<th><?php 
echo $this->sort('published');
?>
</th>
	</tr>
	</thead>
	<tbody>
	<?php 
if (count($this->inventorylist) > 0) {
    $i = 0;
    $k = 0;
    $keyword = vmRequest::uword('keyword', "", ' ,-,+,.,_,#,/');
    foreach ($this->inventorylist as $key => $product) {
        $checked = JHTML::_('grid.id', $i, $product->virtuemart_product_id);
        $published = JHTML::_('grid.published', $product, $i);
        //<!-- low_stock_notification  -->
        if ($product->product_in_stock - $product->product_ordered < 1) {
            $stockstatut = "out";
        } elseif ($product->product_in_stock - $product->product_ordered < $product->low_stock_notification) {
            $stockstatut = "low";
        } else {
            $stockstatut = "normal";
        }
        $stockstatut = 'class="stock-' . $stockstatut . '" title="' . jText::_('COM_VIRTUEMART_STOCK_LEVEL_' . $stockstatut) . '"';
        ?>
			<tr class="row<?php 
        echo $k;
    /**
     * The function to handle all default page situations
     * not responsible for lists!
     */
    function FORMS_MENU_SAVE_CANCEL()
    {
        global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $VM_LANG, $product_id, $page, $limitstart, $mosConfig_editor, $vmIcons;
        $bar =& JToolBar::getInstance('toolbar');
        $product_id = vmGet($_REQUEST, 'product_id', 0);
        $no_menu = vmGet($_REQUEST, 'no_menu', 0);
        $is_iframe = vmGet($_REQUEST, 'is_iframe', 0);
        $product_parent_id = vmGet($_REQUEST, 'product_parent_id', 0);
        $script = '';
        $clone_product = vmRequest::getInt('clone_product', 0);
        if (is_array($product_id)) {
            $product_id = "";
        }
        // These editor arrays tell the toolbar to load correct "getEditorContents" script parts
        // This is necessary for WYSIWYG Editors like TinyMCE / mosCE / FCKEditor
        $editor1_array = array('product.product_form' => 'product_desc', 'shopper.shopper_group_form' => 'shopper_group_desc', 'product.product_category_form' => 'category_description', 'manufacturer.manufacturer_form' => 'mf_desc', 'store.store_form' => 'vendor_store_desc', 'product.product_type_parameter_form' => 'parameter_description', 'product.product_type_form' => 'product_type_description', 'vendor.vendor_form' => 'vendor_store_desc');
        $editor2_array = array('store.store_form' => 'vendor_terms_of_service', 'vendor.vendor_form' => 'vendor_terms_of_service');
        $editor1 = isset($editor1_array[$page]) ? $editor1_array[$page] : '';
        $editor2 = isset($editor2_array[$page]) ? $editor2_array[$page] : '';
        if ($no_menu) {
            vmCommonHTML::loadExtjs();
        }
        $script .= '<script type="text/javascript">
        	function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == \'cancel\') {
				submitform( pressbutton );
				return;
			}
			';
        if ($editor1 != '') {
            if (vmIsJoomla(1.5)) {
                jimport('joomla.html.editor');
                $editor_type = $GLOBALS['mainframe']->getCfg('editor');
                if ($editor_type != 'none') {
                    $editor = JEditor::getInstance();
                    $script .= $editor->getContent($editor1);
                }
            } else {
                ob_start();
                getEditorContents('editor1', $editor1);
                $script .= ob_get_contents();
                ob_end_clean();
            }
        }
        if ($editor2 != '') {
            if (vmIsJoomla(1.5)) {
                jimport('joomla.html.editor');
                $editor_type = $GLOBALS['mainframe']->getCfg('editor');
                if ($editor_type != 'none') {
                    $editor = JEditor::getInstance();
                    $script .= $editor->getContent($editor2);
                }
            } else {
                ob_start();
                getEditorContents('editor2', $editor2);
                $script .= ob_get_contents();
                ob_end_clean();
            }
        }
        if ($no_menu) {
            $admin = defined('_VM_IS_BACKEND') ? '/administrator' : '';
            $script .= "\n\t\t\t\n    // define some private variables\n    var dialog, showBtn;\n\n   // the second argument is true to indicate file upload.\n   YAHOO.util.Connect.setForm(form, true);\n   \n    var showDialog = function( content ) {\n    \tExt.MessageBox.show( { \n            \t\ttitle: '" . $VM_LANG->_('PEAR_LOG_NOTICE') . "',\n            \t\tmsg: content,\n            \t\tautoCreate: true,\n                    width:400,\n                    height:180,\n                    modal: false,\n                    resizable: false,\n                    buttons: Ext.MessageBox.OK,\n                    shadow:true,\n                    animEl:Ext.get( 'vm-toolbar' )\n            });\n        setTimeout('Ext.MessageBox.hide()', 3000);\n    };\n    \n    // return a public interface\n    var callback = {\n    \tsuccess: function(o) {\n    \t\t//Ext.DomHelper.insertHtml( document.body, o.responseText );\n    \t\tshowDialog( o.responseText );\n    \t},\n    \tfailure: function(o) {\n    \t\tExt.DomHelper.append( document.body, { tag: 'div', id: 'vmLogResult', html: 'Save action failed: ' + o.statusText } );\n    \t\tshowDialog( o.responseText );\n    \t},\n        upload : function(o){\n            //Ext.DomHelper.insertHtml( 'beforeEnd', document.body, o.responseText );\n    \t\tshowDialog( o.responseText );\n        }\n    };\n    \n   \tvar cObj = YAHOO.util.Connect.asyncRequest('POST', '{$_SERVER['PHP_SELF']}', callback);\n\t\n\t\t\t\n";
        } else {
            $script .= "\n\t\t\tsubmitform( pressbutton );\n";
        }
        $script .= "\t\t}\n\t\t</script>";
        $bar->appendButton('Custom', $script);
        vmMenuBar::startTable();
        if ($page == "product.product_form" && !empty($product_id) && $clone_product != 1) {
            if (empty($product_parent_id)) {
                // add new attribute
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_attribute_form&product_id=" . $product_id . "&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_MNU');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
            } else {
                // back to parent product
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_RETURN_LBL');
                vmMenuBar::customHref($href, $vmIcons['back_icon'], $vmIcons['back_icon2'], $alt);
                vmMenuBar::spacer();
                // new child product
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_ADD_ANOTHER_ITEM_MNU');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
            }
            // Go to Price list
            $href = $_SERVER['PHP_SELF'] . "?page=product.product_price_list&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&return_args=&option=com_virtuemart&no_menu={$no_menu}";
            $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRICE_LIST_MNU');
            vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
            vmMenuBar::spacer();
            // add product type
            $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_product_type_form&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&no_menu={$no_menu}";
            $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_PRODUCT_TYPE_FORM_MNU');
            vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
            vmMenuBar::spacer();
            /*** Adding an item is only pssible, if the product has attributes ***/
            if (ps_product::product_has_attributes($product_id)) {
                // Add Item
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_id}&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_NEW_ITEM_LBL');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
            }
            vmMenuBar::divider();
        } elseif ($page == "admin.country_form") {
            if (!empty($_REQUEST['country_id'])) {
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_form&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_ADD_STATE');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_list&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_LIST_STATES');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
                vmMenuBar::divider();
            }
        }
        vmMenuBar::spacer();
        vmMenuBar::save('save', $VM_LANG->_('CMN_SAVE'));
        if ($no_menu == 0) {
            vmMenuBar::spacer();
            vmMenuBar::apply('apply', $VM_LANG->_('E_APPLY'));
        }
        if ((strstr(@$_SERVER['HTTP_REFERER'], $page) || strstr(@$_SERVER['HTTP_REFERER'], $_SERVER['PHP_SELF'])) && $no_menu && !$is_iframe) {
            // offer a back button
            vmMenuBar::spacer();
            vmMenuBar::back();
        }
        vmMenuBar::spacer();
        vmMenuBar::cancel();
        vmMenuBar::spacer();
        vmMenuBar::endTable();
    }
Example #21
0
                $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 .= "]";
            }
        }
    }
}
$Itemid = vmRequest::getInt('Itemid');
$TreeId = vmRequest::getInt('TreeId');
if (vmIsJoomla('1.5')) {
    $js_src = 'modules/mod_virtuemart';
} else {
    $js_src = 'modules';
}
echo vmCommonHTML::scriptTag('', 'var ctThemeXPBase = "' . $js_src . '/ThemeXP/";');
if ($jscook_type == "tree") {
    if ($jscookTree_style == "ThemeXP") {
        $jscook_tree = "ctThemeXP1";
    }
    if ($jscookTree_style == "ThemeNavy") {
        $jscook_tree = "ctThemeNavy";
    }
    echo vmCommonHTML::scriptTag($js_src . '/JSCookTree.js');
    echo vmCommonHTML::linkTag($js_src . "/{$jscookTree_style}/theme.css");
Example #22
0
 /**
  * Updates a Shipping Adress for the specified user info ID
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $perm, $VM_LANG;
     require_once CLASSPATH . 'ps_userfield.php';
     $db = new ps_DB();
     $timestamp = time();
     if (!$this->validate_update($d)) {
         return false;
     }
     // Get all fields which where shown to the user
     $shippingFields = ps_userfield::getUserFields('shipping', false, '', true);
     $skip_fields = ps_userfield::getSkipFields();
     foreach ($shippingFields as $userField) {
         if (!in_array($userField->name, $skip_fields)) {
             $fields[$userField->name] = ps_userfield::prepareFieldDataSave($userField->type, $userField->name, vmGet($d, $userField->name, strtoupper($userField->name)));
         }
     }
     // These are pre-defined fields.
     $fields['user_id'] = !$perm->check("admin,storeadmin") ? $_SESSION['auth']['user_id'] : (int) $d["user_id"];
     $fields['address_type'] = 'ST';
     $fields['mdate'] = time();
     $db->buildQuery('UPDATE', '#__{vm}_user_info', $fields, "WHERE user_info_id='" . $db->getEscaped($d["user_info_id"]) . "'" . (!$perm->check("admin,storeadmin") ? " AND user_id=" . $_SESSION['auth']['user_id'] : ''));
     if ($db->query() === false) {
         $GLOBALS['vmLogger']->err($VM_LANG->_('VM_USERADDRESS_UPDATED_FAILED'));
         return false;
     }
     $GLOBALS['vmLogger']->info($VM_LANG->_('VM_USERADDRESS_UPDATED'));
     vmRequest::setVar('ship_to_info_id', $d['user_info_id']);
     return true;
 }
Example #23
0
 function featuredProducts($random, $products, $categories)
 {
     global $VM_LANG;
     require_once CLASSPATH . 'ps_product_attribute.php';
     $ps_product_attribute = new ps_product_attribute();
     $db = new ps_DB();
     $tpl = new $GLOBALS['VM_THEMECLASS']();
     $category_id = null;
     if ($categories) {
         $category_id = vmRequest::getInt('category_id');
     }
     if ($category_id) {
         $q = "SELECT DISTINCT product_sku,#__{vm}_product.product_id,product_name,product_s_desc,product_thumb_image, product_full_image, product_in_stock, product_url FROM #__{vm}_product, #__{vm}_product_category_xref, #__{vm}_category WHERE \n";
         $q .= "(#__{vm}_product.product_parent_id='' OR #__{vm}_product.product_parent_id='0') \n";
         $q .= "AND #__{vm}_product.product_id=#__{vm}_product_category_xref.product_id \n";
         $q .= "AND #__{vm}_category.category_id=#__{vm}_product_category_xref.category_id \n";
         $q .= "AND #__{vm}_category.category_id='{$category_id}' \n";
         $q .= "AND #__{vm}_product.product_publish='Y' \n";
         $q .= "AND #__{vm}_product.product_special='Y' \n";
         if (CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
             $q .= " AND product_in_stock > 0 \n";
         }
         $q .= 'ORDER BY RAND() LIMIT 0, ' . (int) $products;
     } else {
         $q = "SELECT DISTINCT product_sku,product_id,product_name,product_s_desc,product_thumb_image, product_full_image, product_in_stock, product_url FROM #__{vm}_product WHERE ";
         $q .= "(#__{vm}_product.product_parent_id='' OR #__{vm}_product.product_parent_id='0') AND vendor_id='" . $_SESSION['ps_vendor_id'] . "' ";
         $q .= "AND #__{vm}_product.product_publish='Y' ";
         $q .= "AND #__{vm}_product.product_special='Y' ";
         if (CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
             $q .= " AND product_in_stock > 0 ";
         }
         $q .= 'ORDER BY RAND() LIMIT 0, ' . (int) $products;
     }
     $db->query($q);
     // Output using template
     if ($db->num_rows() > 0) {
         $i = 0;
         $featured_products = array();
         while ($db->next_record()) {
             $flypage = $this->get_flypage($db->f("product_id"));
             $featured_products[$i]['product_sku'] = $db->f("product_sku");
             $featured_products[$i]['product_name'] = $db->f("product_name");
             $price = "";
             if (_SHOW_PRICES == '1') {
                 // Show price, but without "including X% tax"
                 $price = $this->show_price($db->f("product_id"), false);
             }
             $featured_products[$i]['product_price'] = $price;
             $featured_products[$i]['product_s_desc'] = $db->f("product_s_desc");
             $featured_products[$i]['product_url'] = $db->f("product_url");
             $featured_products[$i]['product_thumb'] = $db->f("product_thumb_image");
             $featured_products[$i]['product_full_image'] = $db->f("product_full_image");
             $featured_products[$i]['product_id'] = $db->f("product_id");
             $featured_products[$i]['flypage'] = $flypage;
             $featured_products[$i]['form_addtocart'] = "";
             if (USE_AS_CATALOGUE != '1' && $price != "" && !stristr($price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL')) && !$this->product_has_attributes($db->f('product_id'), true) && $tpl->get_cfg('showAddtocartButtonOnProductList')) {
                 $tpl->set('i', $i);
                 $tpl->set('product_id', $db->f('product_id'));
                 $tpl->set('ps_product_attribute', $ps_product_attribute);
                 $tpl->set('product_in_stock', $db->f('product_in_stock'));
                 $featured_products[$i]['form_addtocart'] = $tpl->fetch('browse/includes/addtocart_form.tpl.php');
                 $featured_products[$i]['has_addtocart'] = true;
             }
             $i++;
         }
         $tpl->set('featured_products', $featured_products);
         return $tpl->fetch('common/featuredProducts.tpl.php');
     }
 }
Example #24
0
 /**
  * Save user registration and notify users and admins if required
  * for Joomla! 1.5
  * @return boolean
  */
 function register_save()
 {
     global $mainframe, $mosConfig_live_site;
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     // Get required system objects
     $user = clone JFactory::getUser();
     $pathway =& $mainframe->getPathway();
     $config =& JFactory::getConfig();
     $authorize =& JFactory::getACL();
     $document =& JFactory::getDocument();
     // If user registration is not allowed, show 403 not authorized.
     $usersConfig =& JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration') == '0') {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return false;
     }
     // Initialize new usertype setting
     $newUsertype = $usersConfig->get('new_usertype');
     if (!$newUsertype) {
         $newUsertype = 'Registered';
     }
     // Bind the post array to the user object
     $_post_ =& vmRequest::get('post');
     if (!$user->bind($_post_, 'usertype')) {
         JError::raiseError(500, $user->getError());
     }
     // Set some initial user values
     $user->set('id', 0);
     $user->set('usertype', $newUsertype);
     $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
     // TODO: Should this be JDate?
     $user->set('registerDate', date('Y-m-d H:i:s'));
     // If user activation is turned on, we need to set the activation information
     $useractivation = $usersConfig->get('useractivation');
     if ($useractivation == '1') {
         jimport('joomla.user.helper');
         $user->set('activation', md5(JUserHelper::genRandomPassword()));
         $user->set('block', '1');
     }
     // If there was an error with registration, set the message and display form
     if (!$user->save()) {
         JError::raiseWarning('', JText::_($user->getError()));
         return false;
     }
     // Send registration confirmation mail
     $password = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     $name = $user->get('name');
     $email = $user->get('email');
     $username = $user->get('username');
     $component = 'com_user';
     $activation_link = $mosConfig_live_site . "/index.php?option={$component}&task=activate&activation=" . $user->get('activation');
     // Send the registration email
     $this->_sendMail($name, $email, $username, $password, $activation_link);
     return true;
 }
		// so we don't have to make safe if "&gt;" is found
		if (strpos($v,"&gt;")===false) {
			$v = shopMakeHtmlSafe($v);
		}
		if( $k == 3 ) {
			echo $CURRENCY_DISPLAY->getFullValue( $v )."; ";
		} elseif( $k > 0 && $k < 4) {
			echo $v.'; ';
		}
	}
	echo "</td></tr>";
}

unset( $row );
if( !isset($order_total) || $order_total > 0.00 ) {
	$payment_method_id = vmRequest::getInt( 'payment_method_id' );
	
	$db->query("SELECT payment_method_id, payment_method_name FROM #__{vm}_payment_method WHERE payment_method_id='$payment_method_id'");
	$db->next_record();
	echo '<tr><td valign="top"><strong>'.$VM_LANG->_('PHPSHOP_ORDER_PRINT_PAYMENT_LBL') . ":</strong></td>";
	echo '<td>';
	echo $db->f("payment_method_name");
	echo "</td></tr>";
}
echo '</table>';
?>
<br />
<div>
    <?php echo $VM_LANG->_('PHPSHOP_CHECKOUT_CUSTOMER_NOTE') ?>:<br />
    <textarea title="<?php echo $VM_LANG->_('PHPSHOP_CHECKOUT_CUSTOMER_NOTE') ?>" cols="50" rows="5" name="customer_note"></textarea>
    <br /><br />
Example #26
0
 /**
  * Updates a Vendor (and the Store) Record
  *
  * @param array $d
  * @return boolean
  */
 function update(&$d)
 {
     global $vendor_currency, $VM_LANG;
     $db = new ps_DB();
     $timestamp = time();
     if (!$this->validate_update($d)) {
         return False;
     }
     if (!vmImageTools::process_images($d)) {
         return false;
     }
     foreach ($d as $key => $value) {
         if (!is_array($value)) {
             $d[$key] = addslashes($value);
         }
     }
     $d['display_style'][1] = ps_vendor::checkCurrencySymbol($d['display_style'][1]);
     $d['display_style'] = implode("|", $d['display_style']);
     if (empty($d['vendor_accepted_currencies'])) {
         $d['vendor_accepted_currencies'] = array($vendor_currency);
     }
     $fields = array('vendor_name' => $d["vendor_name"], 'contact_last_name' => $d["contact_last_name"], 'contact_first_name' => $d["contact_first_name"], 'contact_middle_name' => $d["contact_middle_name"], 'contact_title' => $d["contact_title"], 'contact_phone_1' => $d["contact_phone_1"], 'contact_phone_2' => $d["contact_phone_2"], 'contact_fax' => $d["contact_fax"], 'contact_email' => $d["contact_email"], 'vendor_phone' => $d["vendor_phone"], 'vendor_address_1' => $d["vendor_address_1"], 'vendor_address_2' => $d["vendor_address_2"], 'vendor_city' => $d["vendor_city"], 'vendor_state' => $d["vendor_state"], 'vendor_country' => $d["vendor_country"], 'vendor_zip' => $d["vendor_zip"], 'vendor_store_name' => $d["vendor_store_name"], 'vendor_store_desc' => $d["vendor_store_desc"], 'vendor_category_id' => vmRequest::getInt('vendor_category_id'), 'vendor_image_path' => vmGet($d, 'vendor_image_path'), 'vendor_thumb_image' => vmGet($d, 'vendor_thumb_image'), 'vendor_full_image' => vmGet($d, 'vendor_full_image'), 'vendor_currency' => $d["vendor_currency"], 'vendor_url' => $d["vendor_url"], 'mdate' => $timestamp, 'vendor_terms_of_service' => $d["vendor_terms_of_service"], 'vendor_min_pov' => $d["vendor_min_pov"], 'vendor_currency_display_style' => $d["display_style"], 'vendor_freeshipping' => $d['vendor_freeshipping'], 'vendor_accepted_currencies' => implode(',', $d['vendor_accepted_currencies']), 'vendor_address_format' => $d['vendor_address_format'], 'vendor_date_format' => $d['vendor_date_format']);
     if (!empty($d["vendor_category_id"])) {
         $fields['vendor_category_id'] = $d["vendor_category_id"];
     }
     if (!empty($d["vendor_image_path"])) {
         $fields['vendor_image_path'] = $d["vendor_image_path"];
     }
     $db->buildQuery('UPDATE', '#__{vm}_vendor', $fields, 'WHERE vendor_id = ' . $d["vendor_id"]);
     $db->query();
     if ($d['vendor_id'] == 1) {
         $GLOBALS['vmLogger']->info($VM_LANG->_('VM_STORE_UPDATED'));
     } else {
         $GLOBALS['vmLogger']->info($VM_LANG->_('VM_VENDOR_UPDATED'));
     }
     return True;
 }
Example #27
0
 function sendRecommendation(&$d)
 {
     global $vmLogger, $VM_LANG, $vendor_store_name;
     if (!$this->validate($d)) {
         return false;
     }
     $subject = sprintf($VM_LANG->_('VM_RECOMMEND_SUBJECT', false), $vendor_store_name);
     $msg = vmRequest::getVar('recommend_message', '', 'post');
     $send = vmMail($d['sender_mail'], $d['sender_name'], $d['recipient_mail'], $subject, $msg, '');
     if ($send) {
         $vmLogger->info($VM_LANG->_('VM_RECOMMEND_DONE', false));
     } else {
         $vmLogger->warning($VM_LANG->_('VM_RECOMMEND_FAILED', false));
         return false;
     }
     unset($_REQUEST['sender_name']);
     unset($_REQUEST['sender_mail']);
     unset($_REQUEST['recipient_mail']);
     unset($_REQUEST['recommend_message']);
     return true;
 }
Example #28
0
 /**
  * Process and store a product review
  *
  * @param array $d
  * @return boolean
  */
 function process_review(&$d)
 {
     global $db, $auth, $perm, $VM_LANG, $vmLogger, $mosConfig_offset;
     if (PSHOP_ALLOW_REVIEWS == "1" && !empty($auth['user_id'])) {
         $d["comment"] = trim($d["comment"]);
         if (strlen($d["comment"]) < VM_REVIEWS_MINIMUM_COMMENT_LENGTH) {
             $vmLogger->err(sprintf($VM_LANG->_('PHPSHOP_REVIEW_ERR_COMMENT1', false), VM_REVIEWS_MINIMUM_COMMENT_LENGTH));
             return true;
         }
         if (strlen($d["comment"]) > VM_REVIEWS_MAXIMUM_COMMENT_LENGTH) {
             $vmLogger->err(sprintf($VM_LANG->_('PHPSHOP_REVIEW_ERR_COMMENT2', false), VM_REVIEWS_MAXIMUM_COMMENT_LENGTH));
             return true;
         }
         if (!isset($d["user_rating"]) || intval($d["user_rating"]) < 0 || intval($d["user_rating"]) > 5) {
             $vmLogger->err($VM_LANG->_('PHPSHOP_REVIEW_ERR_RATE', false));
             return true;
         }
         $commented = false;
         $sql = "SELECT userid FROM #__{vm}_product_reviews WHERE product_id = '" . $d["product_id"] . "'";
         $db->query($sql);
         while ($db->next_record()) {
             $uid = $db->f("userid");
             if ($db->f("userid") == $auth['user_id']) {
                 $commented = true;
                 break;
             }
         }
         if (!$perm->check('admin,storeadmin')) {
             $userid = $auth['user_id'];
         } else {
             $userid = vmRequest::getInt('userid', $auth['user_id']);
         }
         if ($commented == false) {
             $comment = nl2br(htmlspecialchars(vmGet($d, 'comment')));
             $published = VM_REVIEWS_AUTOPUBLISH ? 'Y' : 'N';
             $time = time() + $mosConfig_offset * 60 * 60;
             $fields = array('product_id' => $d['product_id'], 'userid' => $userid, 'comment' => $comment, 'user_rating' => vmRequest::getInt('user_rating'), 'published' => $published, 'time' => $time);
             $db->buildQuery('INSERT', '#__{vm}_product_reviews', $fields);
             $db->query();
             $this->process_vote($d);
             $vmLogger->info($VM_LANG->_('PHPSHOP_REVIEW_THANKYOU', false));
         } else {
             $vmLogger->info($VM_LANG->_('PHPSHOP_REVIEW_ALREADYDONE', false));
         }
     }
     return true;
 }
$useStatusText = 'false';
$useCookies = 'false';
$closeSameLevel = 'false';
// if all folders should be open, we will ignore the closeSameLevel
$openAll = 'false';
if ($openAll == "true") {
    $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";
Example #30
0
 /**
  * This is used by lists to show a "Delete this item" button in each row
  *
  * @param string $id_fieldname The name of the identifying field [example: product_id]
  * @param mixed $id The unique ID identifying the item that is to be deleted
  * @param string $func The name of the function that is used to delete the item [e.g. productDelete]
  * @param string $keyword The recent keyword [deprecated]
  * @param int $limitstart The recent limitstart value [deprecated]
  * @param string $extra Additional URL parameters to be appended to the link
  * @return A link with the delete button in it
  */
 function deleteButton($id_fieldname, $id, $func, $keyword = "", $limitstart = 0, $extra = "")
 {
     global $page, $sess, $VM_LANG;
     $no_menu = vmRequest::getInt('no_menu');
     $href = $sess->url($_SERVER['PHP_SELF'] . "?page={$page}&func={$func}&{$id_fieldname}={$id}&keyword=" . urlencode($keyword) . "&limitstart={$limitstart}&no_menu={$no_menu}" . $extra);
     $code = "<a class=\"toolbar\" href=\"{$href}\" onclick=\"return confirm('" . $VM_LANG->_('PHPSHOP_DELETE_MSG') . "');\" onmouseout=\"MM_swapImgRestore();\"  onmouseover=\"MM_swapImage('delete{$id}','','" . IMAGEURL . "ps_image/delete_f2.gif',1);\">";
     $code .= "<img src=\"" . IMAGEURL . "ps_image/delete.gif\" alt=\"Delete this record\" name=\"delete{$id}\" align=\"middle\" border=\"0\" />";
     $code .= "</a>";
     return $code;
 }