Пример #1
0
 public function update()
 {
     // update the record.
     $record = $this->snippet->update($this->params);
     // go back to where we came from.
     expHistory::back();
 }
 public function toggle_default()
 {
     global $db;
     $order_status = new order_status($this->params['id']);
     $db->setUniqueFlag($order_status, 'order_status', 'is_default');
     expHistory::back();
 }
Пример #3
0
 function addToCart($params)
 {
     global $order;
     expSession::set('params', $params);
     //get the configuration
     $cfg->mod = "ecomconfig";
     $cfg->src = "@globalstoresettings";
     $cfg->int = "";
     $config = new expConfig($cfg);
     $this->config = empty($catConfig->config) || @$catConfig->config['use_global'] == 1 ? $config->config : $catConfig->config;
     $min_amount = $this->config['minimum_gift_card_purchase'];
     $custom_message_product = $this->config['custom_message_product'];
     if (empty($params['product_id'])) {
         flash('error', gt("Please specify the style of the gift card you want to purchase."));
         expHistory::back();
     }
     if (empty($params['card_amount']) && empty($params['card_amount_txt'])) {
         flash('error', gt("You need to specify the card amount for the gift card."));
         expHistory::back();
     } else {
         // eDebug($params, true);
         $item = new orderitem($params);
         $sm = $order->getCurrentShippingMethod();
         $item->shippingmethods_id = $sm->id;
         if (isset($params['card_amount_txt'])) {
             $params['card_amount_txt'] = preg_replace("/[^0-9.]/", "", $params['card_amount_txt']);
         }
         if (!empty($params['card_amount_txt']) && $params['card_amount_txt'] > 0) {
             $item->products_price = preg_replace("/[^0-9.]/", "", $params['card_amount_txt']);
         } else {
             $item->products_price = preg_replace("/[^0-9.]/", "", $params['card_amount']);
         }
         if ($item->products_price < $min_amount) {
             flash('error', gt("The minimum amount of gift card is") . " " . $min_amount);
             expHistory::back();
         }
         $item->products_name = expCore::getCurrencySymbol() . $params['card_amount'] . ' ' . $this->title . " Style Gift Card";
         if (!empty($params['toname'])) {
             $ed['To'] = isset($params['toname']) ? $params['toname'] : '';
         }
         if (!empty($params['fromname'])) {
             $ed['From'] = isset($params['fromname']) ? $params['fromname'] : '';
         }
         if (!empty($params['msg'])) {
             $ed['Message'] = isset($params['msg']) ? $params['msg'] : '';
             $item->products_price += $custom_message_product;
             $item->products_name = $item->products_name . " (with message)";
         }
         $item->extra_data = serialize($ed);
         // we need to unset the orderitem's ID to force a new entry..other wise we will overwrite any
         // other giftcards in the cart already
         $item->id = null;
         $item->quantity = $this->getDefaultQuantity();
         $item->save();
         return true;
     }
 }
 public function downloadfile()
 {
     if (empty($this->params['fileid'])) {
         flash('error', gt('There was an error while trying to download your file.  No File Specified.'));
         expHistory::back();
     }
     $fd = new filedownload($this->params['fileid']);
     if (empty($fd->expFile['downloadable'][0]->id)) {
         flash('error', gt('There was an error while trying to download your file.  The file you were looking for could not be found.'));
         expHistory::back();
     }
     $fd->downloads += 1;
     $fd->save();
     // this will set the id to the id of the actual file..makes the download go right.
     $this->params['id'] = $fd->expFile['downloadable'][0]->id;
     parent::downloadfile();
 }
 /**
  * Method to save/update theme settings
  * This generic routine parses the passed params
  * and saves them to the theme's config.php file
  * It attempts to remove non-theme params such as analytics, etc..
  *
  * @param $params theme configuration parameters
  */
 function saveThemeConfig($params)
 {
     $theme = $params['theme'];
     unset($params['theme']);
     $sv = $params['sv'];
     if (strtolower($sv) == 'default') {
         $sv = '';
     }
     unset($params['sv']);
     unset($params['controller']);
     unset($params['action']);
     foreach ($params as $key => $value) {
         if (strpos($key, '_' == 1)) {
             unset($params[$key]);
         }
     }
     if ($params['sv'] != '') {
         expSettings::saveValues($params, BASE . "themes/" . $theme . "/config_" . $sv . ".php");
     } else {
         expSettings::saveValues($params, BASE . "themes/" . $theme . "/config.php");
     }
     expHistory::back();
 }
Пример #6
0
 public function update_memberships()
 {
     global $user, $db;
     //$memb = $db->selectObject('groupmembership','member_id='.$user->id.' AND group_id='.$this->params['id'].' AND is_admin=1');
     $group = $db->selectObject('group', 'id=' . intval($this->params['id']));
     $db->delete('groupmembership', 'group_id=' . $group->id);
     $memb = null;
     $memb->group_id = $group->id;
     if ($this->params['memdata'] != "") {
         foreach ($this->params['memdata'] as $u => $str) {
             $memb->member_id = $u;
             $memb->is_admin = $str['is_admin'];
             $db->insertObject($memb, 'groupmembership');
         }
     }
     expPermissions::triggerRefresh();
     expHistory::back();
 }
Пример #7
0
 /**
  * Delete the Tweet
  */
 public function delete_retweet()
 {
     if (!empty($this->config['consumer_key']) && !empty($this->params['id'])) {
         // create instance
         $twitter = new Twitter($this->config['consumer_key'], $this->config['consumer_secret']);
         // set tokens
         $twitter->setOAuthToken($this->config['oauth_token']);
         $twitter->setOAuthTokenSecret($this->config['oauth_token_secret']);
         $twitter->statusesDestroy($this->params['id']);
     }
     expHistory::back();
 }
Пример #8
0
 public function deleteSpeed()
 {
     global $db;
     if (empty($this->params['id'])) {
         return false;
     }
     $db->delete('shippingspeeds', ' id =' . $this->params['id']);
     expHistory::back();
 }
Пример #9
0
 /**
  * Switches current help version temporarily
  */
 public function switch_version()
 {
     global $db;
     // unset the current version.
     expSession::un_set('help-version');
     // set the requested version.
     $version = $db->selectValue('help_version', 'version', 'id="' . $this->params['version'] . '"');
     expSession::set('help-version', $version);
     flash('message', gt('Now displaying Help version') . ' ' . $version);
     expHistory::back();
 }
Пример #10
0
 /**
  * download a file attached to item
  */
 function downloadfile()
 {
     global $db;
     if (!isset($this->config['allowdownloads']) || $this->config['allowdownloads'] == true) {
         //if ($db->selectObject('content_expFiles', 'content_type="'.$this->baseclassname.'" AND expfiles_id='.$this->params['id']) != null) {
         expFile::download($this->params['id']);
         //}
     } else {
         flash('error', gt('Downloads have not been enabled for this file'));
         expHistory::back();
     }
 }
Пример #11
0
<?php

##################################################
#
# Copyright (c) 2004-2011 OIC Group, Inc.
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
expHistory::back();
Пример #12
0
 function delete_model_alias()
 {
     global $db;
     if (empty($this->params['id'])) {
         return false;
     }
     $db->delete('model_aliases', 'id =' . $this->params['id']);
     expHistory::back();
 }
Пример #13
0
 public static function clearSmartyCache()
 {
     self::removeSmartyCache();
     flash('message', gt("Smarty Cache has been cleared"));
     expHistory::back();
 }
Пример #14
0
 public function subscription_update()
 {
     global $db;
     // make sure we have what we need.
     if (empty($this->params['email'])) {
         expQueue::flashAndFlow('error', 'You must supply an email address to sign up for email alerts.');
     }
     if (empty($this->params['key'])) {
         expQueue::flashAndFlow('error', 'The security key for account was not supplied.');
     }
     if (empty($this->params['id'])) {
         expQueue::flashAndFlow('error', 'The subscriber id for account was not supplied.');
     }
     // find the subscriber and validate the security key
     $subscriber = new subscribers($this->params['id']);
     if ($subscriber->hash != $this->params['key']) {
         expQueue::flashAndFlow('error', 'The security key you supplied does not match the one we have on file.');
     }
     // delete any old subscriptions and add the user to new subscriptions
     $db->delete('expeAlerts_subscribers', 'subscribers_id=' . $subscriber->id);
     foreach ($this->params['ealerts'] as $ea_id) {
         $obj = null;
         $obj->subscribers_id = $subscriber->id;
         $obj->expeAlerts_id = $ea_id;
         $db->insertObject($obj, 'expeAlerts_subscribers');
     }
     $count = count($this->params['ealerts']);
     if ($count > 0) {
         flash('message', gt("Your subscriptions have been updated.  You are now subscriber to") . " " . $count . ' ' . gt('E-Alerts.'));
     } else {
         flash('error', gt("You have been unsubscribed from all E-Alerts."));
     }
     expHistory::back();
 }
Пример #15
0
 public static function flashAndFlow($name, $msg)
 {
     flash($name, $msg);
     expHistory::back();
 }
Пример #16
0
 /**
  * main login method
  */
 public static function login()
 {
     user::login($_POST['username'], $_POST['password']);
     if (!isset($_SESSION[SYS_SESSION_KEY]['user'])) {
         flash('error', gt('Invalid Username / Password'));
         if (expSession::is_set('redirecturl_error')) {
             $url = expSession::get('redirecturl_error');
             expSession::un_set('redirecturl_error');
             header("Location: " . $url);
         } else {
             expHistory::back();
         }
     } else {
         global $user;
         if (!empty($_POST['username'])) {
             flash('message', gt('Welcome back') . ' ' . $_POST['username']);
         }
         foreach ($user->groups as $g) {
             if (!empty($g->redirect)) {
                 $url = URL_FULL . $g->redirect;
                 break;
             }
         }
         if (isset($url)) {
             header("Location: " . $url);
         } else {
             expHistory::back();
         }
     }
 }
Пример #17
0
 public function activate_address()
 {
     global $db, $user;
     $object->id = $this->params['id'];
     //FIXME $object not set
     $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id);
     flash("message", gt("Successfully updated address."));
     expHistory::back();
 }
Пример #18
0
 function delete_zone()
 {
     global $db;
     if (empty($this->params['id'])) {
         return false;
     }
     $db->delete('tax_zone', 'id =' . $this->params['id']);
     expHistory::back();
 }
Пример #19
0
 public function saveconfig()
 {
     $calc = new billingcalculator($this->params['id']);
     $conf = serialize($calc->calculator->parseConfig($this->params));
     $calc->update(array('config' => $conf));
     expHistory::back();
 }
 function delete_vendor()
 {
     global $db;
     if (!empty($this->params['id'])) {
         $db->delete('vendor', 'id =' . $this->params['id']);
     }
     expHistory::back();
 }
Пример #21
0
 public function clearCart()
 {
     global $order;
     $sessAr = expSession::get('verify_shopper');
     if (isset($sessAr)) {
         order::setCartCookie($order);
         $orig_path = $sessAr['orig_path'];
         expSession::un_set('verify_shopper');
         redirect_to($orig_path);
     } else {
         expHistory::back();
     }
 }
Пример #22
0
 function reset_stats()
 {
     global $db;
     // reset the counters
     $db->sql('UPDATE ' . DB_TABLE_PREFIX . '_banner SET impressions=0 WHERE 1');
     $db->sql('UPDATE ' . DB_TABLE_PREFIX . '_banner SET clicks=0 WHERE 1');
     // let the user know we did stuff.
     flash('message', gt("Banner statistics reset."));
     expHistory::back();
 }
Пример #23
0
 function update_upcharge()
 {
     $this->loc->src = "@globalstoresettings";
     $config = new expConfig($this->loc);
     $this->config = $config->config;
     //This will make sure that only the country or region that given a rate value will be saved in the db
     $upcharge = array();
     foreach ($this->params['upcharge'] as $key => $item) {
         if (!empty($item)) {
             $upcharge[$key] = $item;
         }
     }
     $this->config['upcharge'] = $upcharge;
     $config->update(array('config' => $this->config));
     flash('message', gt('Configuration updated'));
     expHistory::back();
 }
Пример #24
0
 /**
  * copy selected users/groups over from old site
  * @global db the exponent database object
  * @return void
  */
 public function migrate_users()
 {
     global $db;
     if (isset($this->params['wipe_groups'])) {
         $db->delete('group');
         $db->delete('groupmembership');
     }
     if (isset($this->params['wipe_users'])) {
         $db->delete('user', 'id > 1');
     }
     $old_db = $this->connect();
     //		print_r("<pre>");
     //		print_r($old_db->selectAndJoinObjects('', '', 'group', 'groupmembership','id', 'group_id', 'name = "Editors"', ''));
     $gsuccessful = 0;
     $gfailed = 0;
     if (!empty($this->params['groups'])) {
         foreach ($this->params['groups'] as $groupid) {
             $group = $old_db->selectObject('group', 'id=' . $groupid);
             $ret = $db->insertObject($group, 'group');
             if (empty($ret)) {
                 $gfailed += 1;
             } else {
                 $gsuccessful += 1;
             }
         }
     }
     if (!empty($this->params['rep_groups'])) {
         foreach ($this->params['rep_groups'] as $groupid) {
             $db->delete('group', 'id=' . $groupid);
             $group = $old_db->selectObject('group', 'id=' . $groupid);
             $ret = $db->insertObject($group, 'group');
             if (empty($ret)) {
                 $gfailed += 1;
             } else {
                 $gsuccessful += 1;
             }
         }
     }
     $successful = 0;
     $failed = 0;
     if (!empty($this->params['users'])) {
         foreach ($this->params['users'] as $userid) {
             $user = $old_db->selectObject('user', 'id=' . $userid);
             $ret = $db->insertObject($user, 'user');
             if (empty($ret)) {
                 $failed += 1;
             } else {
                 $successful += 1;
             }
         }
     }
     if (!empty($this->params['rep_users'])) {
         foreach ($this->params['rep_users'] as $userid) {
             $db->delete('user', 'id=' . $userid);
             $user = $old_db->selectObject('user', 'id=' . $userid);
             $ret = $db->insertObject($user, 'user');
             if (empty($ret)) {
                 $failed += 1;
             } else {
                 $successful += 1;
             }
         }
     }
     $users = null;
     $groups = null;
     if (!empty($this->params['groups']) && !empty($this->params['rep_groups'])) {
         $groups = array_merge($this->params['groups'], $this->params['rep_groups']);
     } elseif (!empty($this->params['groups'])) {
         $groups = $this->params['groups'];
     } elseif (!empty($this->params['rep_groups'])) {
         $groups = $this->params['rep_groups'];
     }
     if (!empty($this->params['users']) && !empty($this->params['rep_users'])) {
         $users = array_merge($this->params['users'], $this->params['rep_users']);
     } elseif (!empty($this->params['users'])) {
         $users = $this->params['users'];
     } elseif (!empty($this->params['rep_users'])) {
         $users = $this->params['rep_users'];
     }
     if (!empty($groups) && !empty($users)) {
         foreach ($groups as $groupid) {
             $groupmembers = $old_db->selectObjects('groupmembership', 'group_id=' . $groupid);
             foreach ($groupmembers as $userid) {
                 if (in_array($userid->member_id, $users)) {
                     $db->insertObject($userid, 'groupmembership');
                 }
             }
         }
     }
     flash('message', $successful . ' ' . gt('users and') . ' ' . $gsuccessful . ' ' . gt('groups were imported from') . ' ' . $this->config['database']);
     if ($failed > 0 || $gfailed > 0) {
         $msg = '';
         if ($failed > 0) {
             $msg = $failed . ' users ';
         }
         if ($gfailed > 0) {
             if ($msg != '') {
                 $msg .= ' and ';
             }
             $msg .= $gfailed . ' groups ';
         }
         flash('error', $msg . ' ' . gt('could not be imported from') . ' ' . $this->config['database'] . ' ' . gt('This is usually because a user with the username or group with that name already exists in the database you importing to.'));
     }
     expSession::clearCurrentUserSessionCache();
     expHistory::back();
 }
 function manage_ranks()
 {
     global $db;
     $rank = 1;
     $category = new storeCategory($this->params['id']);
     foreach ($this->params['rerank'] as $key => $id) {
         $sql = "SELECT DISTINCT sc.* FROM exponent_product_storeCategories sc JOIN exponent_product p ON p.id = sc.product_id WHERE p.id=" . $id . " AND sc.storecategories_id IN (SELECT id FROM exponent_storeCategories WHERE rgt BETWEEN " . $category->lft . " AND " . $category->rgt . ") ORDER BY rank ASC";
         $prod = $db->selectObjectBySQL($sql);
         $prod->rank = $rank;
         $db->updateObject($prod, "product_storeCategories", "storecategories_id=" . $prod->storecategories_id . " AND product_id=" . $id);
         $rank += 1;
     }
     expHistory::back();
 }
Пример #26
0
 public function update_answer()
 {
     if (empty($this->params['id'])) {
         flash('error', gt('No ID was specified for the question to be answered'));
         expHistory::back();
     }
     $faq = new faq($this->params['id']);
     $mail = new expMail();
     $mail->quickSend(array('html_message' => $this->params['body'], 'to' => trim($faq->submitter_email), 'from' => array(empty($this->config['answer_from_address']) ? SMTP_FROMADDRESS : $this->config['answer_from_address'] => empty($this->config['answer_from_name']) ? null : $this->config['answer_from_name']), 'subject' => $this->params['subject']));
     flash('message', gt('Your email was sent to') . ' ' . $faq->submitter_name . ' ' . gt('at') . ' ' . $faq->submitter_email);
     expHistory::back();
 }
Пример #27
0
 /**
  * prompts the user to download a file
  *
  * @static
  * @access public
  *
  * @uses function download()    Built-in PHP method
  *
  * @PHPUnit Not Defined|Implement|Completed
  *
  * @param string $file       Full path to file to download
  * @return void
  * @throws void
  *
  */
 public static function download($file)
 {
     // we are expecting an int val as a file ID or the whole file object.
     // If all we get is the ID then we'll instantiate a new file object.
     // If that object doesn't have it's id property set or the file doesn't
     // actually exist then we can assume its not a valid file object and
     // return false.
     if (!is_object($file)) {
         $file = new expFile($file);
     }
     //if (empty($file->id) || !file_exists($file->path)) return false;
     if (!file_exists($file->path)) {
         flash('error', gt('The file is unavailable for Download'));
         expHistory::back();
         return false;
     }
     // NO buffering from here on out or things break unexpectedly. - RAM
     ob_end_clean();
     // This code was lifted from phpMyAdmin, but this is Open Source, right?
     // 'application/octet-stream' is the registered IANA type but
     // MSIE and Opera seems to prefer 'application/octetstream'
     // It seems that other headers I've added make IE prefer octet-stream again. - RAM
     $mimetype = EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA' ? 'application/octet-stream;' : $file->mimetype;
     header('Content-Type: ' . $mimetype);
     header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     //header("Content-length: ".filesize($file->path));  // for some reason the webserver cant run stat on the files and this breaks.
     header('Content-Transfer-Encoding: binary');
     header('Content-Encoding:');
     header('Content-Disposition: attachment; filename="' . $file->filename . '";');
     // IE need specific headers
     if (EXPONENT_USER_BROWSER == 'IE') {
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
         header('Vary: User-Agent');
     } else {
         header('Pragma: no-cache');
     }
     //Read the file out directly
     readfile($file->path);
     exit;
 }
Пример #28
0
 public function delete()
 {
     global $db;
     /* The global constants can be overriden by passing appropriate params */
     //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
     $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
     $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
     $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
     $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
     if (empty($this->params['id'])) {
         flash('error', gt('Missing id for the comment you would like to delete'));
         expHistory::back();
     }
     // delete the comment
     $comment = new expComment($this->params['id']);
     $rows = $comment->delete();
     // delete the assocication too
     $db->delete($comment->attachable_table, 'expcomments_id=' . $this->params['id']);
     // send the user back where they came from.
     expHistory::back();
 }
Пример #29
0
 public function empty_cart()
 {
     global $order;
     foreach ($order->orderitem as $orderItem) {
         $orderItem->delete();
     }
     flash('message', gt('Your shopping cart is now empty.'));
     expHistory::back();
 }
Пример #30
0
 function addToCart($params, $orderid = null)
 {
     // eDebug($params,true);
     if ($orderid == null) {
         global $order;
     } else {
         $order = new order($orderid);
     }
     //eDebug($this);
     //eDebug($params,true);
     $params['qty'] = isset($params['qty']) ? $params['qty'] : 1;
     if (!isset($params['product_type'])) {
         $params['product_type'] = 'product';
     }
     $params['error'] = '';
     if (empty($params['children'])) {
         //$oiObj = new orderitem();
         //$oi = $oiObj->find('all','product_id='.$this->id);
         $qCheck = 0;
         //$this->quantity;
         //if (!empty($oi))
         //{
         foreach ($order->orderitem as $orderItem) {
             //eDebug($orderItem->quantity);
             if ($orderItem->product_id == $this->id) {
                 $qCheck += $orderItem->quantity;
             }
         }
         //}
         $qty = $params['qty'];
         if ($this->quantity - $qCheck < $qty) {
             if ($this->availability_type == 2) {
                 flash('error', $this->title . ' ' . gt('only has') . ' ' . $this->quantity . ' ' . gt('on hand. You can not add more than that to your cart.'));
                 //return false;
                 expHistory::back();
             }
         }
         //check minimum quantity
         if ($qty + $qCheck < $this->minimum_order_quantity) {
             flash('message', $this->title . ' ' . gt('has a minimum order quantity of') . ' ' . $this->minimum_order_quantity . '. ' . gt('The quantity has been adjusted accordingly.'));
             $params['qty'] += $this->minimum_order_quantity - ($qty + $qCheck);
             $qty = $params['qty'];
         }
     } else {
         foreach ($params['children'] as $idKey => $childQty) {
             $cprod = new childProduct($idKey);
             //$oiObj = new orderitem();
             //$oi = $oiObj->find('all','product_id='.$idKey);
             $qCheck = 0;
             //$cprod->quantity;
             //if (!empty($oi))
             //{
             foreach ($order->orderitem as $orderItem) {
                 //eDebug($orderItem->quantity);
                 if ($orderItem->product_id == $idKey) {
                     $qCheck += $orderItem->quantity;
                 }
             }
             //}
             /*eDebug("Qty:".$childQty);
               eDebug("Product Quantity:".$cprod->quantity);
               eDebug("Qcheck:".$qCheck,true);*/
             if ($cprod->quantity - $qCheck < $childQty) {
                 if ($cprod->availability_type == 2) {
                     flash('error', $this->title . ' - ' . $cprod->model . ' ' . gt('only has') . ' ' . $cprod->quantity . ' ' . gt('on hand. You can not add more than that to your cart.'));
                     //return false;
                     expHistory::back();
                 }
             }
             //check minimum quantity
             if ($childQty + $qCheck < $cprod->minimum_order_quantity) {
                 flash('message', $cprod->title . ' ' . gt('has a minimum order quantity of') . ' ' . $cprod->minimum_order_quantity . '. ' . gt('The quantity has been adjusted accordingly.'));
                 $params['children'][$idKey] += $cprod->minimum_order_quantity - ($childQty + $qCheck);
                 //$qty = $params['qty'];
             }
         }
     }
     foreach ($this->optiongroup as $og) {
         if ($og->required) {
             $err = true;
             if (!empty($params['options'][$og->id])) {
                 foreach ($params['options'][$og->id] as $opt) {
                     //eDebug($opt,true);
                     //make sure at least one is not empty to cover both single and mult selects
                     if (!empty($opt)) {
                         $err = false;
                     }
                 }
             }
             if ($err) {
                 $params['error'] .= 'You must select an option from the ' . $og->title . ' options below before you can add it to your cart. <br/>';
             }
         }
         //eDebug($og->title . ":" .$og->required);
     }
     $user_input_info = array();
     //check user input fields
     //$this->user_input_fields = expUnserialize($this->user_input_fields);
     //eDebug($this,true);
     foreach ($this->user_input_fields as $uifkey => $uif) {
         if ($uif['is_required'] || !$uif['is_required'] && strlen($params['user_input_fields'][$uifkey]) > 0) {
             if (strlen($params['user_input_fields'][$uifkey]) < $uif['min_length']) {
                 //flash('error', 'test');
                 //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type));
                 $params['error'] .= $uif['name'] . ' field has a minimum requirement of ' . $uif['min_length'] . ' characters.<br/>';
             } else {
                 if (strlen($params['user_input_fields'][$uifkey]) > $uif['max_length'] && $uif['max_length'] > 0) {
                     //flash('error', );
                     //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type));
                     $params['error'] .= $uif['name'] . ' field has a maximum requirement of ' . $uif['max_length'] . ' characters.<br/>';
                 }
             }
         }
         $user_input_info[] = array($uif['name'] => $params['user_input_fields'][$uifkey]);
     }
     if ($orderid == null) {
         if ($params['error'] != '') {
             $this->displayForm('addToCart', $params);
             return false;
         }
     } else {
         if ($params['error'] != '') {
             $this->displayForm('addToOrder', $params);
             return false;
         }
     }
     if (empty($params['children'])) {
         $this->createOrderItem($this, $params, $user_input_info, $orderid);
     } else {
         foreach ($params['children'] as $ckey => $cqty) {
             $params['qty'] = 1;
             for ($qty = 1; $qty <= $cqty; $qty++) {
                 $child = new $params['product_type']($ckey);
                 //$params['prod-quantity'][$ckey];
                 $this->createOrderItem($child, $params, $user_input_info, $orderid);
                 /*foreach($this->childProduct as $child)
                   {
                       if ($child->id == $ckey) $this->createOrderItem($child, $params, $user_input_info);
                       break;   
                   }*/
             }
         }
         //die();
     }
     return true;
 }