function affiliate_insert($sql_data_array, $affiliate_parent = 0)
{
    // LOCK TABLES
    smn_db_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");
    if ($affiliate_parent > 0) {
        $affiliate_root_query = smn_db_query("select affiliate_root, affiliate_rgt, affiliate_lft�from  " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_parent . "' ");
        // Check if we have a parent affiliate
        if ($affiliate_root_array = smn_db_fetch_array($affiliate_root_query)) {
            smn_db_query("update " . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft + 2 WHERE affiliate_root  =  '" . $affiliate_root_array['affiliate_root'] . "' and  affiliate_lft > " . $affiliate_root_array['affiliate_rgt'] . "  AND affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " ");
            smn_db_query("update " . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt + 2 WHERE affiliate_root  =  '" . $affiliate_root_array['affiliate_root'] . "' and  affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . "  ");
            $sql_data_array['affiliate_root'] = $affiliate_root_array['affiliate_root'];
            $sql_data_array['affiliate_lft'] = $affiliate_root_array['affiliate_rgt'];
            $sql_data_array['affiliate_rgt'] = $affiliate_root_array['affiliate_rgt'] + 1;
            smn_db_perform(TABLE_AFFILIATE, $sql_data_array);
            $affiliate_id = smn_db_insert_id();
        }
        // no parent -> new root
    } else {
        $sql_data_array['affiliate_lft'] = '1';
        $sql_data_array['affiliate_rgt'] = '2';
        smn_db_perform(TABLE_AFFILIATE, $sql_data_array);
        $affiliate_id = smn_db_insert_id();
        smn_db_query("update " . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' ");
    }
    // UNLOCK TABLES
    smn_db_query("UNLOCK TABLES");
    return $affiliate_id;
}
예제 #2
0
 function create($customers_id = 0)
 {
     //if customer is 0, then is a new account...(needs to be added in for editing)
     //add data for table customers which hold most of the primary customers info
     $sql_data_array = array('customers_firstname' => $this->firstname, 'customers_lastname' => $this->lastname, 'customers_email_address' => $this->email_address, 'customers_telephone' => $this->telephone, 'customers_fax' => $this->fax, 'customers_newsletter' => $this->newsletter, 'customers_gender' => $this->gender, 'customers_dob' => $this->dob);
     if ($customers_id == 0) {
         $sql_data_array['customers_password'] = $this->password;
         smn_db_perform(TABLE_CUSTOMERS, $sql_data_array);
         $this->customer_id = smn_db_insert_id();
         //primary KEY for customer
     } else {
         smn_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', 'customers_id=' . (int) $customers_id);
         $this->customer_id = (int) $customers_id;
     }
     //start building array for adress book entries using the default address given on sign up
     $sql_data_array = array('customers_id' => $this->customer_id, 'entry_firstname' => $this->firstname, 'entry_lastname' => $this->lastname, 'entry_company' => $this->company, 'entry_street_address' => $this->street_address, 'entry_postcode' => $this->postcode, 'entry_city' => $this->city, 'entry_country_id' => $this->country_id, 'entry_gender' => $this->gender, 'entry_zone_id' => $this->zone_id, 'entry_state' => $this->state);
     if ($customers_id == 0) {
         smn_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
         $this->address_id = smn_db_insert_id();
         smn_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int) $this->address_id . "' where customers_id = '" . (int) $this->customer_id . "'");
         smn_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $this->customer_id . "', '0', now())");
     } else {
         smn_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', 'customers_id=' . (int) $customers_id);
         smn_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int) $customer_id . "'");
     }
     if (SESSION_RECREATE == 'True') {
         smn_session_recreate();
     }
     return $this->customer_id;
 }
예제 #3
0
 function create_store($use_store_id = 0)
 {
     $this->store_id = $use_store_id;
     $sql_store_array = array('customer_id' => $this->get_customers_id(), 'store_status' => DISPLAY_STORE_IMMEDIATELY == 'true' ? 1 : 0, 'date_added' => date('Ymd'), 'store_type' => $this->store_type);
     if ($this->store_id == 0) {
         smn_db_perform(TABLE_STORE_MAIN, $sql_store_array);
         $this->store_id = smn_db_insert_id();
         return $this->store_id;
     } else {
         smn_db_perform(TABLE_STORE_MAIN, $sql_store_array, 'update', 'store_id=' . $this->store_id);
         return $this->store_id;
     }
 }
         $value_name = smn_db_prepare_input($value_name_array[$languages[$i]['id']]);
         smn_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (store_id, products_options_values_id, language_id, products_options_values_name) values ('" . (int) $store_id . "', '" . (int) $value_id . "', '" . (int) $languages[$i]['id'] . "', '" . smn_db_input($value_name) . "')");
     }
     smn_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (store_id, products_options_id, products_options_values_id) values ('" . (int) $store_id . "', '" . (int) $option_id . "', '" . (int) $value_id . "')");
     smn_redirect(smn_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
     break;
 case 'add_product_attributes':
     $products_id = smn_db_prepare_input($_POST['products_id']);
     $options_id = smn_db_prepare_input($_POST['options_id']);
     $values_id = smn_db_prepare_input($_POST['values_id']);
     $value_price = smn_db_prepare_input($_POST['value_price']);
     $price_prefix = smn_db_prepare_input($_POST['price_prefix']);
     $sort_order = smn_db_prepare_input($_POST['sort_order']);
     smn_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values ('" . (int) $store_id . "', null, '" . (int) $products_id . "', '" . (int) $options_id . "', '" . (int) $values_id . "', '" . (double) smn_db_input($value_price) . "', '" . smn_db_input($price_prefix) . "', '" . (int) $sort_order . "')");
     if (DOWNLOAD_ENABLED == 'true') {
         $products_attributes_id = smn_db_insert_id();
         $products_attributes_filename = smn_db_prepare_input($_POST['products_attributes_filename']);
         $products_attributes_maxdays = smn_db_prepare_input($_POST['products_attributes_maxdays']);
         $products_attributes_maxcount = smn_db_prepare_input($_POST['products_attributes_maxcount']);
         if (smn_not_null($products_attributes_filename)) {
             smn_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " values ('" . (int) $store_id . "', " . (int) $products_attributes_id . ", '" . smn_db_input($products_attributes_filename) . "', '" . smn_db_input($products_attributes_maxdays) . "', '" . smn_db_input($products_attributes_maxcount) . "')");
         }
     }
     smn_redirect(smn_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
     break;
 case 'update_option_name':
     $option_name_array = $_POST['option_name'];
     $option_id = smn_db_prepare_input($_POST['option_id']);
     for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
         $option_name = smn_db_prepare_input($option_name_array[$languages[$i]['id']]);
         smn_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . smn_db_input($option_name) . "' where products_options_id = '" . (int) $option_id . "' and language_id = '" . (int) $languages[$i]['id'] . "' and store_id = '" . $store_id . "'");
     $categories_id = smn_db_prepare_input($_POST['categories_id']);
     if ($_POST['copy_as'] == 'link') {
       if ($categories_id != $current_category_id) {
         $check_query = smn_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "' and store_id = '" . $store_id . "'");
         $check = smn_db_fetch_array($check_query);
         if ($check['total'] < '1') {
           smn_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (store_id, products_id, categories_id) values ('" . (int)$store_id . "', '" . (int)$products_id . "', '" . (int)$categories_id . "')");
         }
       } else {
         $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
       }
     } elseif ($_POST['copy_as'] == 'duplicate') {
       $product_query = smn_db_query("select store_id, products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
       $product = smn_db_fetch_array($product_query);
       smn_db_query("insert into " . TABLE_PRODUCTS . " (store_id, products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . (int)$store_id . "', '" . smn_db_input($product['products_quantity']) . "', '" . smn_db_input($product['products_model']) . "', '" . smn_db_input($product['products_image']) . "', '" . smn_db_input($product['products_price']) . "',  now(), '" . smn_db_input($product['products_date_available']) . "', '" . smn_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
       $dup_products_id = smn_db_insert_id();
       $description_query = smn_db_query("select language_id, products_name, products_description, products_head_title_tag, products_head_desc_tag, products_head_keywords_tag, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");
       while ($description = smn_db_fetch_array($description_query)) {
         smn_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_head_title_tag, products_head_desc_tag, products_head_keywords_tag, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . smn_db_input($description['products_name']) . "', '" . smn_db_input($description['products_description']) . "', '" . smn_db_input($description['products_head_title_tag']) . "', '" . smn_db_input($description['products_head_desc_tag']) . "', '" . smn_db_input($description['products_head_keywords_tag']) . "', '" . smn_db_input($description['products_url']) . "', '0')");
       }    
       smn_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (store_id, products_id, categories_id) values ('" . (int)$store_id . "', '" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
       $products_id = $dup_products_id;
     }
     if (USE_CACHE == 'true') {
       smn_reset_cache_block('categories');
       smn_reset_cache_block('also_purchased');
     }
   }
   smn_redirect(html_entity_decode(smn_href_link(FILENAME_STORE_PRODUCT_CATEGORIES, 'cPath=' . $categories_id . '&ID='.$store_id.'&pID=' . $products_id)));
   break;
 case 'new_product_preview':
         $affiliate_billing_query = smn_db_query($sql);
         $affiliate_billing = smn_db_fetch_array($affiliate_billing_query);
         // Get affiliate Informations
         $sql = "\n        SELECT a.*, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id \n          from " . TABLE_AFFILIATE . " a \n          left join " . TABLE_ZONES . " z on (a.affiliate_zone_id  = z.zone_id) \n          left join " . TABLE_COUNTRIES . " c on (a.affiliate_country_id = c.countries_id)\n          WHERE affiliate_id = '" . $affiliate_payment['affiliate_id'] . "' \n        ";
         $affiliate_query = smn_db_query($sql);
         $affiliate = smn_db_fetch_array($affiliate_query);
         // Get need tax informations for the affiliate
         $affiliate_tax_rate = smn_get_affiliate_tax_rate(AFFILIATE_TAX_ID, $affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id']);
         $affiliate_tax = smn_round($affiliate_billing['affiliate_payment'] * $affiliate_tax_rate / 100, 2);
         // Netto-Provision
         $affiliate_payment_total = $affiliate_billing['affiliate_payment'] + $affiliate_tax;
         // Bill the order
         $affiliate['affiliate_state'] = smn_get_zone_code($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']);
         $sql_data_array = array('affiliate_id' => $affiliate_payment['affiliate_id'], 'affiliate_payment' => $affiliate_billing['affiliate_payment'], 'affiliate_payment_tax' => $affiliate_tax, 'affiliate_payment_total' => $affiliate_payment_total, 'affiliate_payment_date' => 'now()', 'affiliate_payment_status' => '0', 'affiliate_firstname' => $affiliate['affiliate_firstname'], 'affiliate_lastname' => $affiliate['affiliate_lastname'], 'affiliate_street_address' => $affiliate['affiliate_street_address'], 'affiliate_suburb' => $affiliate['affiliate_suburb'], 'affiliate_city' => $affiliate['affiliate_city'], 'affiliate_country' => $affiliate['countries_name'], 'affiliate_postcode' => $affiliate['affiliate_postcode'], 'affiliate_company' => $affiliate['affiliate_company'], 'affiliate_state' => $affiliate['affiliate_state'], 'affiliate_address_format_id' => $affiliate['address_format_id']);
         smn_db_perform(TABLE_AFFILIATE_PAYMENT, $sql_data_array);
         $insert_id = smn_db_insert_id();
         // Set the Sales to Final State
         smn_db_query("update " . TABLE_AFFILIATE_SALES . " set affiliate_payment_id = '" . $insert_id . "', affiliate_billing_status = 1, affiliate_payment_date = now() where affiliate_id = '" . $affiliate_payment['affiliate_id'] . "' and affiliate_billing_status = 99");
         // Notify Affiliate
         if (AFFILIATE_NOTIFY_AFTER_BILLING == 'true') {
             $check_status_query = smn_db_query("select af.affiliate_email_address, ap.affiliate_lastname, ap.affiliate_firstname, ap.affiliate_payment_status, ap.affiliate_payment_date, ap.affiliate_payment_date from " . TABLE_AFFILIATE_PAYMENT . " ap, " . TABLE_AFFILIATE . " af where affiliate_payment_id  = '" . $insert_id . "' and af.affiliate_id = ap.affiliate_id ");
             $check_status = smn_db_fetch_array($check_status_query);
             $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_AFFILIATE_PAYMENT_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . smn_catalog_href_link(FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO, 'payment_id=' . $insert_id, 'NONSSL') . "\n" . EMAIL_TEXT_PAYMENT_BILLED . ' ' . smn_date_long($check_status['affiliate_payment_date']) . "\n\n" . EMAIL_TEXT_NEW_PAYMENT;
             smn_mail($check_status['affiliate_firstname'] . ' ' . $check_status['affiliate_lastname'], $check_status['affiliate_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, AFFILIATE_EMAIL_ADDRESS);
         }
     }
     $messageStack->add_session(SUCCESS_BILLING, 'success');
     smn_redirect(smn_href_link(FILENAME_AFFILIATE_PAYMENT, smn_get_all_get_params(array('action')) . 'action=edit'));
     break;
 case 'update_payment':
     $pID = smn_db_prepare_input($_GET['pID']);
예제 #7
0
 define('EMAIL_CONTACT', 'For help with any of our online services, please email the store-owner: ' . $store->get_store_owner_email_address() . '.' . "\n\n");
 define('EMAIL_WARNING', '<b>Note:</b> This email address was given to us by one of our customers. If you did not signup to be a member, please send a email to ' . $store->get_store_owner_email_address() . '.' . "\n");
 if (ACCOUNT_GENDER == 'true') {
     if ($gender == 'm') {
         $email_text = sprintf(EMAIL_GREET_MR, $lastname);
     } else {
         $email_text = sprintf(EMAIL_GREET_MS, $lastname);
     }
 } else {
     $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
 }
 $email_text .= EMAIL_WELCOME . EMAIL_CONTACT . EMAIL_WARNING;
 if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
     $coupon_code = create_coupon_code();
     $insert_query = smn_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
     $insert_id = smn_db_insert_id($insert_query);
     $insert_query = smn_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $email_address . "', now() )");
     $email_text .= sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . "\n\n" . sprintf(EMAIL_GV_REDEEM, $coupon_code) . "\n\n" . EMAIL_GV_LINK . smn_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . "\n\n";
 }
 if (NEW_SIGNUP_DISCOUNT_COUPON != '') {
     $coupon_code = NEW_SIGNUP_DISCOUNT_COUPON;
     $coupon_query = smn_db_query("select * from " . TABLE_COUPONS . " where coupon_code = '" . $coupon_code . "'");
     $coupon = smn_db_fetch_array($coupon_query);
     $coupon_id = $coupon['coupon_id'];
     $coupon_desc_query = smn_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . (int) $languages_id . "'");
     $coupon_desc = smn_db_fetch_array($coupon_desc_query);
     $insert_query = smn_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id . "', '0', 'Admin', '" . $email_address . "', now() )");
     $email_text .= EMAIL_COUPON_INCENTIVE_HEADER . "\n" . sprintf("%s", $coupon_desc['coupon_description']) . "\n\n" . sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "\n\n" . "\n\n";
 }
 smn_mail($name, $email_address, EMAIL_SUBJECT, $email_text, $store->get_store_owner(), $store->get_store_owner_email_address());
 smn_redirect(smn_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'NONSSL'));
             $sql_data_array['entry_company'] = $company;
         }
         if (ACCOUNT_STATE == 'true') {
             if ($zone_id > 0) {
                 $sql_data_array['entry_zone_id'] = $zone_id;
                 $sql_data_array['entry_state'] = '';
             } else {
                 $sql_data_array['entry_zone_id'] = '0';
                 $sql_data_array['entry_state'] = $state;
             }
         }
         if (!smn_session_is_registered('sendto')) {
             smn_session_register('sendto');
         }
         smn_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
         $sendto = smn_db_insert_id();
         if (smn_session_is_registered('shipping')) {
             smn_session_unregister('shipping');
         }
         /*Unregister the session shipping_store,By Cimi*/
         if (smn_session_is_registered('shipping_store')) {
             smn_session_unregister('shipping_store');
         }
         smn_redirect(smn_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'NONSSL'));
     }
     // process the selected shipping destination
 } elseif (isset($_POST['address'])) {
     $reset_shipping = false;
     if (smn_session_is_registered('sendto')) {
         if ($sendto != $_POST['address']) {
             if (smn_session_is_registered('shipping')) {
         } else {
             $stock_left = $stock_values['products_quantity'];
         }
         smn_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . smn_get_prid($order->products[$i]['id']) . "'");
         if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
             smn_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . smn_get_prid($order->products[$i]['id']) . "'");
         }
     }
 }
 // Update products_ordered (for bestsellers list)
 smn_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . smn_get_prid($order->products[$i]['id']) . "'");
 if ($order->products[$i]['products_store_id'] == $store_list[$k]) {
     $sql_data_array = array('orders_id' => $insert_id, 'products_id' => smn_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']);
     smn_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
 }
 $order_products_id = smn_db_insert_id();
 $order_total_modules->update_credit_account($i);
 $member_product = explode('_', $order->products[$i]['model']);
 if ($member_product[0] == 'mem' && $store_id == 1) {
     $start_day = getdate();
     $day = $start_day['mday'];
     $month = $start_day['mon'];
     $year = $start_day['year'];
     $product_end_date = strftime('%Y', mktime(0, 0, 0, $month + (int) $member_product[1], $day, $year)) . '-' . strftime('%m', mktime(0, 0, 0, $month + (int) $member_product[1], $day, $year)) . '-' . strftime('%d', mktime(0, 0, 0, $month + (int) $member_product[1], $day, $year));
     $sql_data_array = array('orders_id' => $insert_id, 'store_id' => $insert_id, 'products_id' => smn_get_prid($order->products[$i]['id']), 'customer_id' => $customer_id, 'products_end_date' => $product_end_date);
     $update_query = smn_db_query("select store_id from " . TABLE_MEMBER_ORDERS . " where customer_id = '" . (int) $customer_id . "'");
     if (smn_db_num_rows($update_query)) {
         smn_db_perform(TABLE_MEMBER_ORDERS, $sql_data_array, 'update', "customer_id = '" . (int) $customer_id . "'");
     } else {
         smn_db_perform(TABLE_MEMBER_ORDERS, $sql_data_array);
     }
예제 #10
0
         $sql_data_array = array('admin_files_name' => smn_db_prepare_input($_GET['fileName']), 'admin_tabs_to_files' => smn_db_prepare_input($_GET['masterFileID']), 'admin_files_is_tab' => '1', 'admin_files_to_boxes' => smn_db_prepare_input($_GET['boxID']));
     } else {
         $sql_data_array = array('admin_files_name' => smn_db_prepare_input($_GET['fileName']), 'admin_files_to_boxes' => smn_db_prepare_input($_GET['boxID']));
     }
     smn_db_perform(TABLE_ADMIN_FILES, $sql_data_array);
     $masterFileID = smn_db_insert_id();
     $tabDir = str_replace('.php', '', $_GET['fileName']);
     $directory = DIR_FS_TEMPLATES . 'content/tabs/' . $tabDir . '/';
     $tabs = array();
     if (is_dir($directory)) {
         $dir = dir($directory);
         while (($file = $dir->read()) !== false) {
             if ($file != '.' && $file != '..' && is_file($directory . $file)) {
                 $sql_data_array = array('admin_files_name' => smn_db_prepare_input($file), 'admin_files_is_tab' => '1', 'admin_tabs_to_files' => $masterFileID, 'admin_files_to_boxes' => smn_db_prepare_input($_GET['boxID']));
                 smn_db_perform(TABLE_ADMIN_FILES, $sql_data_array);
                 $fileID = smn_db_insert_id();
                 $tabs[] = '["' . $fileID . '", "' . $file . '"]';
             }
         }
     }
     echo '{
           success: true,
           file_id: "' . $masterFileID . '",
           tabs: [' . implode(',', $tabs) . ']
       }';
 } else {
     $admin_files_name = smn_db_prepare_input($_GET['fileName']);
     $admin_boxes_id = smn_db_prepare_input($_GET['boxID']);
     $Qcheck = smn_db_query('select admin_files_id from ' . TABLE_ADMIN_FILES . ' where admin_files_is_boxes = "0" and admin_files_to_boxes = "' . $admin_boxes_id . '" and admin_files_name = "' . $admin_files_name . '"');
     if (smn_db_num_rows($Qcheck)) {
         $check = smn_db_fetch_array($Qcheck);
예제 #11
0
function insert_data($data)
{
    $prefix = $data['store_id'];
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Expected Sort Order', 'EXPECTED_PRODUCTS_SORT', 'desc', 'This is the sort order used in the expected products box.', '1', '8', 'smn_cfg_select_option(array(\\'asc\\', \\'desc\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Expected Sort Field', 'EXPECTED_PRODUCTS_FIELD', 'date_expected', 'The column to sort by in the expected products box.', '1', '9', 'smn_cfg_select_option(array(\\'products_name\\', \\'date_expected\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Switch To Default Language Currency', 'USE_DEFAULT_LANGUAGE_CURRENCY', 'false', 'Automatically switch to the language\\'s currency when it is changed', '1', '10', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Use Search-Engine Safe URLs (still in development)', 'SEARCH_ENGINE_FRIENDLY_URLS', 'false', 'Use search-engine safe urls for all site links', '1', '12', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Display Cart After Adding Product', 'DISPLAY_CART', 'true', 'Display the shopping cart after adding a product (or return back to their origin)', '1', '14', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Allow Guest To Tell A Friend', 'ALLOW_GUEST_TO_TELL_A_FRIEND', 'false', 'Allow guests to tell a friend about a product', '1', '15', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Default Search Operator', 'ADVANCED_SEARCH_DEFAULT_OPERATOR', 'and', 'Default search operators', '1', '17', 'smn_cfg_select_option(array(\\'and\\', \\'or\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Store Address and Phone', 'STORE_NAME_ADDRESS', '" . $data['store_name'] . "\n" . $data['street_address'] . "\n" . $data['city'] . "\n" . $data['postal_code'] . "\n', 'This is the Store Name, Address and Phone used on printable documents and displayed online', '1', '18', 'smn_cfg_textarea(', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Send Extra Order Emails To', 'SEND_EXTRA_ORDER_EMAILS_TO', '', 'Send extra order emails to the following email addresses, in this format: Name 1 &lt;email@address1&gt;, Name 2 &lt;email@address2&gt;', '1', '19', '', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Credit Card Owner Name', 'CC_OWNER_MIN_LENGTH', '3', 'Minimum length of credit card owner name', '2', '12', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Credit Card Number', 'CC_NUMBER_MIN_LENGTH', '10', 'Minimum length of credit card number', '2', '13', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Review Text', 'REVIEW_TEXT_MIN_LENGTH', '50', 'Minimum length of review text', '2', '14', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Best Sellers', 'MIN_DISPLAY_BESTSELLERS', '1', 'Minimum number of best sellers to display', '2', '15', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Also Purchased', 'MIN_DISPLAY_ALSO_PURCHASED', '1', 'Minimum number of products to display in the \\'This Customer Also Purchased\\' box', '2', '16', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Search Results', 'MAX_DISPLAY_SEARCH_RESULTS', '20', 'Amount of products to list', '3', '2', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Page Links', 'MAX_DISPLAY_PAGE_LINKS', '5', 'Number of \\'number\\' links use for page-sets', '3', '3', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Special Products', 'MAX_DISPLAY_SPECIAL_PRODUCTS', '9', 'Maximum number of products on special to display', '3', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'New Products Module', 'MAX_DISPLAY_NEW_PRODUCTS', '9', 'Maximum number of new products to display in a category', '3', '5', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Products Expected', 'MAX_DISPLAY_UPCOMING_PRODUCTS', '10', 'Maximum number of products expected to display', '3', '6', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Manufacturers List', 'MAX_DISPLAY_MANUFACTURERS_IN_A_LIST', '0', 'Used in manufacturers box; when the number of manufacturers exceeds this number, a drop-down list will be displayed instead of the default list', '3', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Manufacturers Select Size', 'MAX_MANUFACTURERS_LIST', '1', 'Used in manufacturers box; when this value is \\'1\\' the classic drop-down list will be used for the manufacturers box. Otherwise, a list-box with the specified number of rows will be displayed.', '3', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Length of Manufacturers Name', 'MAX_DISPLAY_MANUFACTURER_NAME_LEN', '15', 'Used in manufacturers box; maximum length of manufacturers name to display', '3', '8', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Store List', 'MAX_DISPLAY_STORES_IN_A_LIST', '0', 'Used in store box; when the number of stores exceeds this number, a drop-down list will be displayed instead of the default list', '3', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Store Select Size', 'MAX_STORE_LIST', '1', 'Used in store box; when this value is \\'1\\' the classic drop-down list will be used for the storess box. Otherwise, a list-box with the specified number of rows will be displayed.', '3', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'New Reviews', 'MAX_DISPLAY_NEW_REVIEWS', '6', 'Maximum number of new reviews to display', '3', '9', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Selection of Random Reviews', 'MAX_RANDOM_SELECT_REVIEWS', '10', 'How many records to select from to choose one random product review', '3', '10', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Selection of Random New Products', 'MAX_RANDOM_SELECT_NEW', '10', 'How many records to select from to choose one random new product to display', '3', '11', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Selection of Products on Special', 'MAX_RANDOM_SELECT_SPECIALS', '10', 'How many records to select from to choose one random product special to display', '3', '12', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Categories To List Per Row', 'MAX_DISPLAY_CATEGORIES_PER_ROW', '3', 'How many categories to list per row', '3', '13', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'New Products Listing', 'MAX_DISPLAY_PRODUCTS_NEW', '10', 'Maximum number of new products to display in new products page', '3', '14', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Best Sellers', 'MAX_DISPLAY_BESTSELLERS', '10', 'Maximum number of best sellers to display', '3', '15', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Also Purchased', 'MAX_DISPLAY_ALSO_PURCHASED', '6', 'Maximum number of products to display in the \\'This Customer Also Purchased\\' box', '3', '16', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Customer Order History Box', 'MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX', '6', 'Maximum number of products to display in the customer order history box', '3', '17', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Order History', 'MAX_DISPLAY_ORDER_HISTORY', '10', 'Maximum number of orders to display in the order history page', '3', '18', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Small Image Width', 'SMALL_IMAGE_WIDTH', '100', 'The pixel width of small images', '4', '1', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Small Image Height', 'SMALL_IMAGE_HEIGHT', '80', 'The pixel height of small images', '4', '2', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Heading Image Width', 'HEADING_IMAGE_WIDTH', '57', 'The pixel width of heading images', '4', '3', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Heading Image Height', 'HEADING_IMAGE_HEIGHT', '40', 'The pixel height of heading images', '4', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Subcategory Image Width', 'SUBCATEGORY_IMAGE_WIDTH', '100', 'The pixel width of subcategory images', '4', '5', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Subcategory Image Height', 'SUBCATEGORY_IMAGE_HEIGHT', '57', 'The pixel height of subcategory images', '4', '6', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Calculate Image Size', 'CONFIG_CALCULATE_IMAGE_SIZE', 'true', 'Calculate the size of images?', '4', '7', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Image Required', 'IMAGE_REQUIRED', 'true', 'Enable to display broken images. Good for development.', '4', '8', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration  VALUES (" . $prefix . ", '', 'Installed Modules', 'MODULE_PAYMENT_INSTALLED', '', 'List of payment module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: cc.php;cod.php;paypal.php)', 6, 0, now(), now(), NULL, NULL);");
    smn_db_query("INSERT INTO configuration  VALUES (" . $prefix . ", '', 'Installed Modules', 'MODULE_ORDER_TOTAL_INSTALLED', '', 'List of order_total module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: ot_subtotal.php;ot_tax.php;ot_shipping.php;ot_total.php)', 6, 0, now(), now(), NULL, NULL);");
    smn_db_query("INSERT INTO configuration  VALUES (" . $prefix . ", '', 'Installed Modules', 'MODULE_SHIPPING_INSTALLED', '', 'List of shipping module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: ups.php;flat.php;item.php)', 6, 0, now(), now(), NULL, NULL);");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Default Template', 'TEMPLATE_ID', '1', 'Default Template Layout used for store vendor', '6', '0', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Default Currency', 'DEFAULT_CURRENCY', 'USD', 'Default Currency', '6', '0', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Default Language', 'DEFAULT_LANGUAGE', 'en', 'Default Language', '6', '0', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Default Order Status For New Orders', 'DEFAULT_ORDERS_STATUS_ID', '1', 'When a new order is created, this order status will be assigned to it.', '6', '0', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Enter the Maximum Package Weight you will ship', 'SHIPPING_MAX_WEIGHT', '50', 'Carriers have a max weight limit for a single package. This is a common one for all.', '7', '3', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Package Tare weight.', 'SHIPPING_BOX_WEIGHT', '3', 'What is the weight of typical packaging of small to medium packages?', '7', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Larger packages - percentage increase.', 'SHIPPING_BOX_PADDING', '10', 'For 10% enter 10', '7', '5', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Handling Fee', 'SHIPPING_HANDLING', '5.00', 'Enter the handling fee you may charge.', '7', '6', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Image', 'PRODUCT_LIST_IMAGE', '0', 'Do you want to display the Product Image?', '8', '1', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Manufaturer Name','PRODUCT_LIST_MANUFACTURER', '0', 'Do you want to display the Product Manufacturer Name?', '8', '2', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Model', 'PRODUCT_LIST_MODEL', '0', 'Do you want to display the Product Model?', '8', '3', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Name', 'PRODUCT_LIST_NAME', '1', 'Do you want to display the Product Name?', '8', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Price', 'PRODUCT_LIST_PRICE', '2', 'Do you want to display the Product Price', '8', '5', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Quantity', 'PRODUCT_LIST_QUANTITY', '0', 'Do you want to display the Product Quantity?', '8', '6', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Weight', 'PRODUCT_LIST_WEIGHT', '0', 'Do you want to display the Product Weight?', '8', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Buy Now column', 'PRODUCT_LIST_BUY_NOW', '0', 'Do you want to display the Buy Now column?', '8', '8', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Category/Manufacturer Filter (0=disable; 1=enable)', 'PRODUCT_LIST_FILTER', '1', 'Do you want to display the Category/Manufacturer Filter?', '8', '9', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both)', 'PREV_NEXT_BAR_LOCATION', '2', 'Sets the location of the Prev/Next Navigation Bar (1-top, 2-bottom, 3-both)', '8', '10', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Check stock level', 'STOCK_CHECK', 'true', 'Check to see if sufficent stock is available', '9', '1', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Subtract stock', 'STOCK_LIMITED', 'true', 'Subtract product in stock by product orders', '9', '2', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Allow Checkout', 'STOCK_ALLOW_CHECKOUT', 'true', 'Allow customer to checkout even if there is insufficient stock', '9', '3', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Mark product out of stock', 'STOCK_MARK_PRODUCT_OUT_OF_STOCK', '***', 'Display something on screen so customer can see which product has insufficient stock', '9', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Stock Re-order level', 'STOCK_REORDER_LEVEL', '5', 'Define when stock needs to be re-ordered', '9', '5', now());");
    smn_db_query("INSERT INTO tax_class (store_id, tax_class_id, tax_class_title, tax_class_description, last_modified, date_added) VALUES (" . $prefix . ", '', 'Taxable Goods', 'The following types of products are included non-food, services, etc', now(), now());");
    $tax_class_id = smn_db_insert_id();
    smn_db_query("INSERT INTO geo_zones (store_id, geo_zone_id, geo_zone_name, geo_zone_description, date_added)�VALUES (" . $prefix . ", '','Florida','Florida local sales tax zone',now());");
    $geo_zone_id = smn_db_insert_id();
    smn_db_query("INSERT INTO tax_rates (store_id, tax_rates_id, tax_zone_id, tax_class_id, tax_priority, tax_rate, tax_description, last_modified, date_added ) VALUES (" . $prefix . ", '',  " . $geo_zone_id . ", " . $tax_class_id . ", 1, 7.0, 'FL TAX 7.0%', now(), now());");
    $tax_rate_id = smn_db_insert_id();
    smn_db_query("INSERT INTO zones_to_geo_zones (store_id, association_id, zone_country_id, zone_id, geo_zone_id, date_added)�VALUES (" . $prefix . ", '', 223, 18, " . $geo_zone_id . ", now());");
    if ($db_error) {
        return $db_error;
    } else {
        return $store_data_inserted = 'true';
    }
}
예제 #12
0
 case 'deleteRate':
     $tax_rates_id = smn_db_prepare_input($_GET['rate_id']);
     smn_db_query("delete from " . TABLE_TAX_RATES . " where tax_rates_id = '" . (int) $tax_rates_id . "' and store_id = '" . $store_id . "'");
     echo '{ success:true }';
     exit;
     break;
 case 'saveSubZone':
     $geo_zone_id = smn_db_prepare_input($_POST['geo_zone_id']);
     $zone_country_id = smn_db_prepare_input($_POST['zone_country_id']);
     $zone_id = smn_db_prepare_input($_POST['zone_id']);
     if ($_POST['hidden_action'] == 'edit' && $_POST['association_id'] > 0) {
         smn_db_query("update " . TABLE_ZONES_TO_GEO_ZONES . " set geo_zone_id = '" . (int) $geo_zone_id . "', zone_country_id = '" . (int) $zone_country_id . "', zone_id = " . (smn_not_null($zone_id) ? "'" . (int) $zone_id . "'" : 'null') . ", last_modified = now() where association_id = '" . (int) $_POST['association_id'] . "' and store_id = '" . $store_id . "'");
         $association_id = $_POST['association_id'];
     } else {
         smn_db_query("insert into " . TABLE_ZONES_TO_GEO_ZONES . " (store_id, zone_country_id, zone_id, geo_zone_id, date_added) values ('" . (int) $store_id . "', '" . (int) $zone_country_id . "', '" . (int) $zone_id . "', '" . (int) $geo_zone_id . "', now())");
         $association_id = smn_db_insert_id();
     }
     $Qzone = smn_db_query('select * from ' . TABLE_ZONES_TO_GEO_ZONES . ' where association_id = "' . $association_id . '"');
     $zone = smn_db_fetch_array($Qzone);
     echo '{
          success: true,
          db: {
            association_id  : "' . $zone['association_id'] . '",
            zone_country_id  : "' . $zone['zone_country_id'] . '",
            zone_id  : "' . $zone['zone_id'] . '",
            geo_zone_id  : "' . $zone['geo_zone_id'] . '",
            last_modified  : "' . $zone['last_modified'] . '",
            date_added  : "' . $zone['date_added'] . '"
          }
      }';
     exit;
예제 #13
0
 function saveHelpPage()
 {
     if (isset($_POST['customHelp'])) {
         $helpContent = $_POST['customHelpContent']['catalog'];
         $customString = smn_db_prepare_input($_POST['customHelp']);
         $Qcheck = smn_db_query('select help_id from ' . TABLE_HELP . ' where help_custom = "' . $customString . '"');
         if (smn_db_num_rows($Qcheck)) {
             $check = smn_db_fetch_array($Qcheck);
             smn_db_query('update ' . TABLE_HELP_CONTENT . ' set help_content = "' . $fullPageHelp . '" where help_id = "' . $check['help_id'] . '"');
         } else {
             smn_db_query('insert into ' . TABLE_HELP . ' (help_file, help_file_tab, help_custom) values ("false", "false", "' . $customString . '")');
             $helpID = smn_db_insert_id();
             smn_db_query('insert into ' . TABLE_HELP_CONTENT . ' (help_id, help_content, language_id) values ("' . $helpID . '", "' . $helpContent . '", "1")');
         }
     } else {
         $pageName = $_POST['helpFile'];
         $fullPageHelp = smn_db_prepare_input($_POST['fullPageHelp']['catalog']);
         $tabs = $_POST['tab'];
         $Qcheck = smn_db_query('select * from ' . TABLE_HELP . ' where help_file = "' . $pageName . '"');
         if (smn_db_num_rows($Qcheck)) {
             $check = smn_db_fetch_array($Qcheck);
             smn_db_query('update ' . TABLE_HELP_CONTENT . ' set help_content = "' . $fullPageHelp . '" where help_id = "' . $check['help_id'] . '"');
         } else {
             smn_db_query('insert into ' . TABLE_HELP . ' (help_file, help_file_tab, help_custom) values ("' . $pageName . '", "false", "false")');
             $fullHelpID = smn_db_insert_id();
             smn_db_query('insert into ' . TABLE_HELP_CONTENT . ' (help_id, help_content, language_id) values ("' . $fullHelpID . '", "' . $fullPageHelp . '", "1")');
         }
         if (!empty($tabs)) {
             foreach ($tabs as $tabFile => $helpContent) {
                 $Qcheck = smn_db_query('select * from ' . TABLE_HELP . ' where help_file = "' . $pageName . '" and help_file_tab = "' . $tabFile . '"');
                 if (smn_db_num_rows($Qcheck)) {
                     $check = smn_db_fetch_array($Qcheck);
                     smn_db_query('update ' . TABLE_HELP_CONTENT . ' set help_content = "' . $helpContent . '" where help_id = "' . $check['help_id'] . '"');
                 } else {
                     smn_db_query('insert into ' . TABLE_HELP . ' (help_file, help_file_tab, help_custom) values ("' . $pageName . '", "' . $tabFile . '", "false")');
                     $tabHelpID = smn_db_insert_id();
                     smn_db_query('insert into ' . TABLE_HELP_CONTENT . ' (help_id, help_content, language_id) values ("' . $tabHelpID . '", "' . $helpContent . '", "1")');
                 }
             }
         }
     }
     $this->setJsonResponse('{
           success: true
       }');
 }
예제 #14
0
     if (empty($banners_image_local) || $_POST['delete_current_image'] == '1') {
         $banners_image = new upload('banners_image');
         $banners_image->set_destination(DIR_FS_CATALOG . 'images/' . $banners_image_target);
         if ($banners_image->parse() == false || $banners_image->save() == false) {
             $banner_error = true;
         }
     }
 }
 if ($banner_error == false) {
     $db_image_location = smn_not_null($banners_image_local) && $_POST['delete_current_image'] != 1 ? $banners_image_local : $banners_image_target . $banners_image->filename;
     $sql_data_array = array('banners_title' => $banners_title, 'banners_url' => $banners_url, 'banners_image' => $db_image_location, 'banners_group' => $banners_group, 'categories_id' => $categories_id, 'banners_html_text' => $banners_html_text);
     if ($action == 'insert') {
         $insert_sql_data = array('date_added' => 'now()', 'status' => '1');
         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
         smn_db_perform(TABLE_BANNERS, $sql_data_array);
         $banners_id = smn_db_insert_id();
         $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
     } elseif ($action == 'update') {
         smn_db_perform(TABLE_BANNERS, $sql_data_array, 'update', "banners_id = '" . (int) $banners_id . "'");
         $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
     }
     if (smn_not_null($expires_date)) {
         list($day, $month, $year) = explode('/', $expires_date);
         $expires_date = $year . (strlen($month) == 1 ? '0' . $month : $month) . (strlen($day) == 1 ? '0' . $day : $day);
         smn_db_query("update " . TABLE_BANNERS . " set expires_date = '" . smn_db_input($expires_date) . "', expires_impressions = null where banners_id = '" . (int) $banners_id . "'");
     } elseif (smn_not_null($expires_impressions)) {
         smn_db_query("update " . TABLE_BANNERS . " set expires_impressions = '" . smn_db_input($expires_impressions) . "', expires_date = null where banners_id = '" . (int) $banners_id . "'");
     }
     if (smn_not_null($date_scheduled)) {
         list($day, $month, $year) = explode('/', $date_scheduled);
         $date_scheduled = $year . (strlen($month) == 1 ? '0' . $month : $month) . (strlen($day) == 1 ? '0' . $day : $day);
     if (empty($title)) {
         $messageStack->add(ERROR_NEWSLETTER_TITLE, 'error');
         $affiliate_newsletter_error = true;
     }
     if (empty($module)) {
         $messageStack->add(ERROR_NEWSLETTER_MODULE, 'error');
         $affiliate_newsletter_error = true;
     }
     if ($affiliate_newsletter_error == false) {
         $sql_data_array = array('title' => $title, 'content' => $content, 'module' => $affiliate_newsletter_module);
         if ($action == 'insert') {
             $sql_data_array['date_added'] = 'now()';
             $sql_data_array['status'] = '0';
             $sql_data_array['locked'] = '0';
             smn_db_perform(TABLE_AFFILIATE_NEWSLETTERS, $sql_data_array);
             $affiliate_newsletter_id = smn_db_insert_id();
         } elseif ($action == 'update') {
             smn_db_perform(TABLE_AFFILIATE_NEWSLETTERS, $sql_data_array, 'update', "affiliate_newsletters_id = '" . (int) $affiliate_newsletter_id . "'");
         }
         smn_redirect(smn_href_link(FILENAME_AFFILIATE_NEWSLETTERS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'nID=' . $affiliate_newsletter_id));
     } else {
         $action = 'new';
     }
     break;
 case 'deleteconfirm':
     $affiliate_newsletter_id = smn_db_prepare_input($_GET['nID']);
     smn_db_query("delete from " . TABLE_AFFILIATE_NEWSLETTERS . " where affiliate_newsletters_id = '" . (int) $affiliate_newsletter_id . "'");
     smn_redirect(smn_href_link(FILENAME_AFFILIATE_NEWSLETTERS, 'page=' . $_GET['page']));
     break;
 case 'delete':
 case 'new':
예제 #16
0
function insert_data($data)
{
    global $languages_id;
    $prefix = $data['store_id'];
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Expected Sort Order', 'EXPECTED_PRODUCTS_SORT', 'desc', 'This is the sort order used in the expected products box.', '1', '8', 'smn_cfg_select_option(array(\\'asc\\', \\'desc\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Expected Sort Field', 'EXPECTED_PRODUCTS_FIELD', 'date_expected', 'The column to sort by in the expected products box.', '1', '9', 'smn_cfg_select_option(array(\\'products_name\\', \\'date_expected\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Switch To Default Language Currency', 'USE_DEFAULT_LANGUAGE_CURRENCY', 'false', 'Automatically switch to the language\\'s currency when it is changed', '1', '10', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Use Search-Engine Safe URLs (still in development)', 'SEARCH_ENGINE_FRIENDLY_URLS', 'false', 'Use search-engine safe urls for all site links', '1', '12', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Display Cart After Adding Product', 'DISPLAY_CART', 'true', 'Display the shopping cart after adding a product (or return back to their origin)', '1', '14', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Allow Guest To Tell A Friend', 'ALLOW_GUEST_TO_TELL_A_FRIEND', 'false', 'Allow guests to tell a friend about a product', '1', '15', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Default Search Operator', 'ADVANCED_SEARCH_DEFAULT_OPERATOR', 'and', 'Default search operators', '1', '17', 'smn_cfg_select_option(array(\\'and\\', \\'or\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Store Address and Phone', 'STORE_NAME_ADDRESS', '" . $data['store_name'] . "\n" . $data['street_address'] . "\n" . $data['city'] . "\n" . $data['postal_code'] . "\n', 'This is the Store Name, Address and Phone used on printable documents and displayed online', '1', '18', 'smn_cfg_textarea(', now());");
    /*Added the query to insert commission percentage,By Cimi*/
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Commission Percentage', 'COMMISSION_PERCENTAGE', '3', 'This is the percentage of the sales sales amount the mall retains as commission', '1', '12', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Send Extra Order Emails To', 'SEND_EXTRA_ORDER_EMAILS_TO', '', 'Send extra order emails to the following email addresses, in this format: Name 1 &lt;email@address1&gt;, Name 2 &lt;email@address2&gt;', '1', '19', '', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Credit Card Owner Name', 'CC_OWNER_MIN_LENGTH', '3', 'Minimum length of credit card owner name', '2', '12', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Credit Card Number', 'CC_NUMBER_MIN_LENGTH', '10', 'Minimum length of credit card number', '2', '13', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Review Text', 'REVIEW_TEXT_MIN_LENGTH', '50', 'Minimum length of review text', '2', '14', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Best Sellers', 'MIN_DISPLAY_BESTSELLERS', '1', 'Minimum number of best sellers to display', '2', '15', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Also Purchased', 'MIN_DISPLAY_ALSO_PURCHASED', '1', 'Minimum number of products to display in the \\'This Customer Also Purchased\\' box', '2', '16', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Search Results', 'MAX_DISPLAY_SEARCH_RESULTS', '20', 'Amount of products to list', '3', '2', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Page Links', 'MAX_DISPLAY_PAGE_LINKS', '5', 'Number of \\'number\\' links use for page-sets', '3', '3', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Special Products', 'MAX_DISPLAY_SPECIAL_PRODUCTS', '9', 'Maximum number of products on special to display', '3', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'New Products Module', 'MAX_DISPLAY_NEW_PRODUCTS', '9', 'Maximum number of new products to display in a category', '3', '5', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Products Expected', 'MAX_DISPLAY_UPCOMING_PRODUCTS', '10', 'Maximum number of products expected to display', '3', '6', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Manufacturers List', 'MAX_DISPLAY_MANUFACTURERS_IN_A_LIST', '0', 'Used in manufacturers box; when the number of manufacturers exceeds this number, a drop-down list will be displayed instead of the default list', '3', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Manufacturers Select Size', 'MAX_MANUFACTURERS_LIST', '1', 'Used in manufacturers box; when this value is \\'1\\' the classic drop-down list will be used for the manufacturers box. Otherwise, a list-box with the specified number of rows will be displayed.', '3', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Length of Manufacturers Name', 'MAX_DISPLAY_MANUFACTURER_NAME_LEN', '15', 'Used in manufacturers box; maximum length of manufacturers name to display', '3', '8', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Store List', 'MAX_DISPLAY_STORES_IN_A_LIST', '0', 'Used in store box; when the number of stores exceeds this number, a drop-down list will be displayed instead of the default list', '3', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Store Select Size', 'MAX_STORE_LIST', '1', 'Used in store box; when this value is \\'1\\' the classic drop-down list will be used for the storess box. Otherwise, a list-box with the specified number of rows will be displayed.', '3', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'New Reviews', 'MAX_DISPLAY_NEW_REVIEWS', '6', 'Maximum number of new reviews to display', '3', '9', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Selection of Random Reviews', 'MAX_RANDOM_SELECT_REVIEWS', '10', 'How many records to select from to choose one random product review', '3', '10', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Selection of Random New Products', 'MAX_RANDOM_SELECT_NEW', '10', 'How many records to select from to choose one random new product to display', '3', '11', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Selection of Products on Special', 'MAX_RANDOM_SELECT_SPECIALS', '10', 'How many records to select from to choose one random product special to display', '3', '12', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Categories To List Per Row', 'MAX_DISPLAY_CATEGORIES_PER_ROW', '3', 'How many categories to list per row', '3', '13', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'New Products Listing', 'MAX_DISPLAY_PRODUCTS_NEW', '10', 'Maximum number of new products to display in new products page', '3', '14', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Best Sellers', 'MAX_DISPLAY_BESTSELLERS', '10', 'Maximum number of best sellers to display', '3', '15', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Also Purchased', 'MAX_DISPLAY_ALSO_PURCHASED', '6', 'Maximum number of products to display in the \\'This Customer Also Purchased\\' box', '3', '16', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Customer Order History Box', 'MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX', '6', 'Maximum number of products to display in the customer order history box', '3', '17', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Order History', 'MAX_DISPLAY_ORDER_HISTORY', '10', 'Maximum number of orders to display in the order history page', '3', '18', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Small Image Width', 'SMALL_IMAGE_WIDTH', '100', 'The pixel width of small images', '4', '1', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Small Image Height', 'SMALL_IMAGE_HEIGHT', '80', 'The pixel height of small images', '4', '2', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Heading Image Width', 'HEADING_IMAGE_WIDTH', '57', 'The pixel width of heading images', '4', '3', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Heading Image Height', 'HEADING_IMAGE_HEIGHT', '40', 'The pixel height of heading images', '4', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Subcategory Image Width', 'SUBCATEGORY_IMAGE_WIDTH', '100', 'The pixel width of subcategory images', '4', '5', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Subcategory Image Height', 'SUBCATEGORY_IMAGE_HEIGHT', '57', 'The pixel height of subcategory images', '4', '6', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Calculate Image Size', 'CONFIG_CALCULATE_IMAGE_SIZE', 'true', 'Calculate the size of images?', '4', '7', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Image Required', 'IMAGE_REQUIRED', 'true', 'Enable to display broken images. Good for development.', '4', '8', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Installed Modules', 'MODULE_PAYMENT_INSTALLED', 'paypal.php', 'List of payment module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: cc.php;cod.php;paypal.php)', 6, 0, now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Installed Modules', 'MODULE_ORDER_TOTAL_INSTALLED', 'ot_subtotal.php;ot_total.php', 'List of order_total module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: ot_subtotal.php;ot_tax.php;ot_shipping.php;ot_total.php)', 6, 0, now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Installed Modules', 'MODULE_SHIPPING_INSTALLED', '', 'List of shipping module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: ups.php;flat.php;item.php)', 6, 0, now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Default Template', 'TEMPLATE_ID', '1', 'Default Template Layout used for store vendor', '6', '0', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Default Currency', 'DEFAULT_CURRENCY', 'USD', 'Default Currency', '6', '0', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Default Language', 'DEFAULT_LANGUAGE', 'en', 'Default Language', '6', '0', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Default Order Status For New Orders', 'DEFAULT_ORDERS_STATUS_ID', '1', 'When a new order is created, this order status will be assigned to it.', '6', '0', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Enter the Maximum Package Weight you will ship', 'SHIPPING_MAX_WEIGHT', '50', 'Carriers have a max weight limit for a single package. This is a common one for all.', '7', '3', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Package Tare weight.', 'SHIPPING_BOX_WEIGHT', '3', 'What is the weight of typical packaging of small to medium packages?', '7', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Larger packages - percentage increase.', 'SHIPPING_BOX_PADDING', '10', 'For 10% enter 10', '7', '5', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Handling Fee', 'SHIPPING_HANDLING', '5.00', 'Enter the handling fee you may charge.', '7', '6', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Image', 'PRODUCT_LIST_IMAGE', '0', 'Do you want to display the Product Image?', '8', '1', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Manufaturer Name','PRODUCT_LIST_MANUFACTURER', '0', 'Do you want to display the Product Manufacturer Name?', '8', '2', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Model', 'PRODUCT_LIST_MODEL', '0', 'Do you want to display the Product Model?', '8', '3', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Name', 'PRODUCT_LIST_NAME', '1', 'Do you want to display the Product Name?', '8', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Price', 'PRODUCT_LIST_PRICE', '2', 'Do you want to display the Product Price', '8', '5', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Quantity', 'PRODUCT_LIST_QUANTITY', '0', 'Do you want to display the Product Quantity?', '8', '6', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Product Weight', 'PRODUCT_LIST_WEIGHT', '0', 'Do you want to display the Product Weight?', '8', '7', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Buy Now column', 'PRODUCT_LIST_BUY_NOW', '0', 'Do you want to display the Buy Now column?', '8', '8', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Display Category/Manufacturer Filter (0=disable; 1=enable)', 'PRODUCT_LIST_FILTER', '1', 'Do you want to display the Category/Manufacturer Filter?', '8', '9', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both)', 'PREV_NEXT_BAR_LOCATION', '2', 'Sets the location of the Prev/Next Navigation Bar (1-top, 2-bottom, 3-both)', '8', '10', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Check stock level', 'STOCK_CHECK', 'true', 'Check to see if sufficent stock is available', '9', '1', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Subtract stock', 'STOCK_LIMITED', 'true', 'Subtract product in stock by product orders', '9', '2', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES (" . $prefix . ", 'Allow Checkout', 'STOCK_ALLOW_CHECKOUT', 'true', 'Allow customer to checkout even if there is insufficient stock', '9', '3', 'smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Mark product out of stock', 'STOCK_MARK_PRODUCT_OUT_OF_STOCK', '***', 'Display something on screen so customer can see which product has insufficient stock', '9', '4', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES (" . $prefix . ", 'Stock Re-order level', 'STOCK_REORDER_LEVEL', '5', 'Define when stock needs to be re-ordered', '9', '5', now());");
    smn_db_query("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (" . $prefix . ", 'To offer a discount coupon', 'NEW_SIGNUP_DISCOUNT_COUPON', '', 'To offer a discount coupon to a new customer, enter the code of the coupon.<br><br>Leave empty if you do not want to offer discount coupon.<BR>', 1, 32, NULL, now(), NULL, NULL);");
    /*smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs?  This is a global setting and will turn them off completely.', 901, 0, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Add cPath to product URLs?', 'SEO_ADD_CPATH_TO_PRODUCT_URLS', 'false', 'This setting will append the cPath to the end of product URLs (i.e. - some-product-p-1.html?cPath=xx).', 901, 1, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Add category parent to begining of URLs?', 'SEO_ADD_CAT_PARENT', 'true', 'This setting will add the category parent name to the beginning of the category URLs (i.e. - parent-category-c-1.html).', 901, 101, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Filter Short Words', 'SEO_URLS_FILTER_SHORT_WORDS', '3', 'This setting will filter words less than or equal to the value from the URL.', 901, 2, NULL, now(), NULL, NULL);");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Output W3C valid URLs (parameter string)?', 'SEO_URLS_USE_W3C_VALID', 'true', 'This setting will output W3C valid URLs.', 901, 3, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enable SEO cache to save queries?', 'USE_SEO_CACHE_GLOBAL', 'true', 'This is a global setting and will turn off caching completely.', 901, 4, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enable product cache?', 'USE_SEO_CACHE_PRODUCTS', 'true', 'This will turn off caching for the products.', 901, 5, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enable categories cache?', 'USE_SEO_CACHE_CATEGORIES', 'true', 'This will turn off caching for the categories.', 901, 6, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enable manufacturers cache?', 'USE_SEO_CACHE_MANUFACTURERS', 'true', 'This will turn off caching for the manufacturers.', 901, 7, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enable articles cache?', 'USE_SEO_CACHE_ARTICLES', 'true', 'This will turn off caching for the articles.', 901, 8, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enable topics cache?', 'USE_SEO_CACHE_TOPICS', 'true', 'This will turn off caching for the article topics.', 901, 9, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enable information cache?', 'USE_SEO_CACHE_INFO_PAGES', 'true', 'This will turn off caching for the information pages.', 901, 10, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enable automatic redirects?', 'USE_SEO_REDIRECT', 'true', 'This will activate the automatic redirect code and send 301 headers for old to new URLs.', 901, 101, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Choose URL Rewrite Type', 'SEO_REWRITE_TYPE', 'Rewrite', 'Choose which SEO URL format to use.', 901, 11, NULL, now(), NULL, 'smn_cfg_select_option(array(''Rewrite''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Enter special character conversions', 'SEO_CHAR_CONVERT_SET', '', 'This setting will convert characters.<br><br>The format <b>MUST</b> be in the form: <b>char=>conv,char2=>conv2</b>', 901, 12, NULL, now(), NULL, NULL);");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Remove all non-alphanumeric characters?', 'SEO_REMOVE_ALL_SPEC_CHARS', 'false', 'This will remove all non-letters and non-numbers.  This should be handy to remove all special characters with 1 setting.', 901, 13, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    smn_db_query ("INSERT INTO configuration (store_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (".$prefix.", 'Reset SEO URLs Cache', 'SEO_URLS_CACHE_RESET', 'false', 'This will reset the cache data for SEO', 901, 14, NULL, now(), NULL, 'smn_cfg_select_option(array(''true'', ''false''),');");
    */
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $prefix . "', 'Enable PayPal Module', 'MODULE_PAYMENT_PAYPAL_STATUS', 'True', 'Do you want to accept PayPal payments?', '6', '3', 'smn_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())");
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $prefix . "', 'PayPal E-Mail Address', 'MODULE_PAYMENT_PAYPAL_ID', '*****@*****.**', 'The e-mail address to use for the PayPal service', '6', '4', now())");
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $prefix . "', 'PayPal Transaction Currency', 'MODULE_PAYMENT_PAYPAL_CURRENCY', 'Selected Currency', 'The currency to use for credit card transactions', '6', '6', 'smn_cfg_select_option(array(\\'Selected Currency\\',\\'Only USD\\',\\'Only CAD\\',\\'Only EUR\\',\\'Only GBP\\',\\'Only JPY\\'), ', now())");
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $prefix . "', 'PayPal Sort order of display.', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('" . $prefix . "', 'PayPal Payment Zone', 'MODULE_PAYMENT_PAYPAL_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'smn_get_zone_class_title', 'smn_cfg_pull_down_zone_classes(', now())");
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . $prefix . "', 'PayPal Set Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'smn_cfg_pull_down_order_statuses(', 'smn_get_order_status_name', now())");
    if ($prefix == 1) {
        smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $prefix . "', 'For Single Checkout?', 'MODULE_PAYMENT_PAYPAL_SINGLE_CHECKOUT', 'False', 'Use this payment for single checkout?', '6', '2', 'smn_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())");
    }
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $prefix . "', 'Display Sub-Total', 'MODULE_ORDER_TOTAL_SUBTOTAL_STATUS', 'true', 'Do you want to display the order sub-total cost?', '6', '1','smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now())");
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $prefix . "', 'Sort Order', 'MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER', '1', 'Sort order of display.', '6', '2', now())");
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $prefix . "', 'Display Total', 'MODULE_ORDER_TOTAL_TOTAL_STATUS', 'true', 'Do you want to display the total order value?', '6', '1','smn_cfg_select_option(array(\\'true\\', \\'false\\'), ', now())");
    smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id, configuration_title,  configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $prefix . "', 'Sort Order', 'MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER', '4', 'Sort order of display.', '6', '2', now())");
    smn_db_query("INSERT INTO web_site_content (store_id, page_name, text_key, language_id, text_content, date_modified) VALUES (" . $prefix . ", 'ot_total', 'MODULE_ORDER_TOTAL_TOTAL_TITLE', " . (int) $languages_id . ", 'Total', now());");
    smn_db_query("INSERT INTO web_site_content (store_id, page_name, text_key, language_id, text_content, date_modified) VALUES (" . $prefix . ", 'ot_total', 'MODULE_ORDER_TOTAL_TOTAL_DESCRIPTION', " . (int) $languages_id . ", 'Order Total', now());");
    smn_db_query("INSERT INTO web_site_content (store_id, page_name, text_key, language_id, text_content, date_modified) VALUES (" . $prefix . ", 'ot_subtotal', 'MODULE_ORDER_TOTAL_SUBTOTAL_TITLE', " . (int) $languages_id . ", 'Sub-Total', now());");
    smn_db_query("INSERT INTO web_site_content (store_id, page_name, text_key, language_id, text_content, date_modified) VALUES (" . $prefix . ", 'ot_subtotal', 'MODULE_ORDER_TOTAL_SUBTOTAL_DESCRIPTION', " . (int) $languages_id . ", 'Order Sub-Total', now());");
    smn_db_query("INSERT INTO web_site_content (store_id, page_name, text_key, language_id, text_content, date_modified) VALUES (" . $prefix . ", 'paypal', 'MODULE_PAYMENT_PAYPAL_TEXT_TITLE', " . (int) $languages_id . ", 'PayPal', now());");
    smn_db_query("INSERT INTO web_site_content (store_id, page_name, text_key, language_id, text_content, date_modified) VALUES (" . $prefix . ", 'paypal', 'MODULE_PAYMENT_PAYPAL_TEXT_DESCRIPTION', " . (int) $languages_id . ", 'PayPal', now());");
    smn_db_query("INSERT INTO tax_class (store_id, tax_class_title, tax_class_description, last_modified, date_added) VALUES (" . $prefix . ", 'Taxable Goods', 'The following types of products are included non-food, services, etc', now(), now());");
    $tax_class_id = smn_db_insert_id();
    smn_db_query("INSERT INTO geo_zones (store_id, geo_zone_name, geo_zone_description, date_added)�VALUES (" . $prefix . ", 'Florida','Florida local sales tax zone',now());");
    $geo_zone_id = smn_db_insert_id();
    smn_db_query("INSERT INTO tax_rates (store_id, tax_zone_id, tax_class_id, tax_priority, tax_rate, tax_description, last_modified, date_added ) VALUES (" . $prefix . ", " . $geo_zone_id . ", " . $tax_class_id . ", 1, 7.0, 'FL TAX 7.0%', now(), now());");
    $tax_rate_id = smn_db_insert_id();
    smn_db_query("INSERT INTO zones_to_geo_zones (store_id, zone_country_id, zone_id, geo_zone_id, date_added)�VALUES (" . $prefix . ", 223, 18, " . $geo_zone_id . ", now());");
    if ($db_error) {
        return $db_error;
    } else {
        return $store_data_inserted = 'true';
    }
}
예제 #17
0
 function before_process()
 {
     global $_POST, $language;
     require DIR_WS_LANGUAGES . $language . "/modules/payment/surepay.php";
     require DIR_WS_CLASSES . "sausurepay.php";
     #  Creditcard test AUTH:
     #     cc number: 4012000033330026   any future exp date
     #     $11 = AUTH     $21 = "REF"   $31 = "DCL"   any other may give "ERR"
     #     This test request uses total $1 shipping, and 1x$5 + 1x$5 goods,
     #     total $11. Just change the item quantities to try the other status.
     #  I have also found some bugs and weakneses in Surepays processing, here is a
     #  couple of them:
     #
     #   - Do not add % as character data, best off staying away from it totally.
     #     This can cause surepays servlets to crash and gives a 500 server error.
     #
     #   - Do not convert < > & ' " to the correct XML entities, surepays parser or
     #     data collector rejects any characterdata like &lt; and so on.
     #
     #   - Phone numbers in address are limited length (stay 11 digits or less), they
     #     claim to be "US domestic oriented" (?)
     #
     #   - What is the correct way to handle ref? Should the script handle and check
     #     avs and cvv2status responses to something automatically? If someone has
     #     a guideline to this would be appreciated.. (sausurepay@sauen.com)
     ## Syntax:
     ##  vobject_identifier: sausp (
     ##     boolean: live?
     ##    ,string: merchant id
     ##    ,string: password
     ##   [,array: extra pp.request parameters ]
     ##  )
     // --- Create the SurePay request object. ---
     // --- This is where you can change some of the settings. ---
     $amount = $_POST['surepay_total'];
     $shipping_cost = $_POST['surepay_shipping_cost'];
     if ($this->test_mode == true) {
         // --- Fill in the info for the fake auth requests. ---
         $shipping_cost = '0.00USD';
         $amount = '11.00USD';
         // Use this amount if you want to test: card okay.
         $amount = '31.00USD';
         // Use this amount if you want to test: card referred to voice center.
         $amount = '44.00USD';
         // Use this amount if you want to test: card declined.
         // -- Random valid generator.
         if (rand() % 2 == 1) {
             $amount = '11.00USD';
         }
     }
     // -- Figure out whether to use xml.test.surepay.com (test) or xml.surepay.com (live).
     $live = !$this->test_mode;
     $ssp = new sausp($live, $this->login, $this->password);
     if ($ssp->err) {
         die($ssp->err);
     }
     // --- Generate SurePay order id. ---
     // --   Note that this is not the same as the order_id in OS Commerce, which does
     // --   not exist until after a payment is approved.
     smn_db_perform(TABLE_SUREPAY_TRANSACTIONS, array(message => ''));
     $order_number = smn_db_insert_id();
     // --- Add miscellanous auth request info. ---
     // --   ecommercecode specifies the level of encryption( default is 07 - NONSSL, )
     // --   05 - secure w/ cardholder & merchant cert,
     // --   06 - secure w/ merchant cert
     // --   07 - NONSSL
     // --   08 - no security
     $auth = $ssp->add_auth(array('ordernumber' => $order_number, 'ecommerce' => 'true', 'ecommercecode' => '07', 'ipaddress' => $REMOTE_ADDR, 'shippingcost' => $shipping_cost, 'shippingcost2' => "0.00USD", 'taxamount' => $_POST['surepay_tax'], 'referringurl' => $HTTP_REFERER, 'browsertype' => $HTTP_USER_AGENT));
     if ($ssp->err) {
         die($ssp->err);
     }
     // --- Add the shipping address using the order info. ---
     $ssp->add_shipping_address($auth, array('fullname' => $_POST['surepay_delivery_fullname'], 'address1' => $_POST['surepay_delivery_address'], 'address2' => '', 'city' => $_POST['surepay_delivery_city'], 'state' => $_POST['surepay_delivery_state'], 'zip' => $_POST['surepay_delivery_postcode'], 'country' => $_POST['surepay_delivery_country'], 'phone' => $_POST['surepay_phone'], 'email' => $_POST['surepay_email']));
     if ($ssp->err) {
         die($ssp->err);
     }
     // --- Add the credit card info. ---
     ## Syntax:
     ##  object_identifier: add_creditcard (
     ##      object_identifier: parent object
     ##     ,string: card number
     ##     ,string: expiration (mm/yy)
     ##     ,int: cvv2 code from card
     ##    [,int: cvv2status (security mode) (0|1|9) default is 1 (In Use), 0 = off, 9 = no code available ]
     ##    [,array: billing address]
     ##  )
     $creditcard = $ssp->add_creditcard($auth, $this->cc_number, $this->cc_expires_month . "/" . $this->cc_expires_year, $this->cc_cvv2);
     // --- Add the billing address for the order. ---
     $ssp->add_billing_address($creditcard, array('fullname' => $_POST['surepay_fullname'], 'address1' => $_POST['surepay_address'], 'address2' => '', 'city' => $_POST['surepay_city'], 'state' => $_POST['surepay_state'], 'zip' => $_POST['surepay_postcode'], 'country' => $_POST['surepay_country'], 'phone' => $_POST['surepay_phone'], 'email' => $_POST['surepay_email']));
     if ($ssp->err) {
         die($ssp->err);
     }
     // --- Add total as lineitem ---
     // -- We only add one lineitem with the total right now.  If you wanted to, you could
     // --  rewrite this to use multiple lineitems to more accurately reflect the items
     // --  in the current order.
     ## Syntax:
     ##  object_identifier: add_lineitem (
     ##      object_identifier: parent object (The AUTH object)
     ##     ,int: quantity,
     ##     ,string: sku,
     ##     ,string: description,
     ##     ,string: unit cost (currency) [d..d]d.ccUSD
     ##     ,real: taxrate in decimal notation (0.08 = 8%)
     ##    [,array: options ]
     ##  )
     $item = $ssp->add_lineitem($auth, '1', 'ORDER_TOTAL', 'Order total for this order.', $amount, $_POST['surepay_tax_rate']);
     if ($ssp->err) {
         die($ssp->err);
     }
     // --- Generate the XML request for SurePay. ---
     $ssp->prepare_request();
     if ($ssp->err) {
         die($ssp->err);
     }
     // TODO: remove.  debug info
     if ($surepay_debug_mode) {
         echo "server: " . $ssp->serverurl;
         echo "</PRE><h2>The request xml we send:</H2><PRE>" . htmlentities($ssp->xml_request, ENT_QUOTES) . "\n<hr>";
     }
     // --- Send the request to SurePay. ---
     $ssp->submit_request();
     if ($ssp->err) {
         die($ssp->err);
     }
     // TODO: remove  debug info
     if ($surepay_debug_mode) {
         echo "</PRE><h2>The response xml we got back:</H2><PRE>" . htmlentities($ssp->xml_response, ENT_QUOTES) . "\n<hr>";
         die("\n<br>end");
     }
     $responsecount = $ssp->parse_response();
     if ($ssp->err) {
         die($ssp->err);
     }
     if (!$responsecount) {
         die("Invalid response count.\n");
     }
     // --- Check through the AUTH responses. ---
     $auths = $ssp->auths();
     if ($ssp->err) {
         die($ssp->err);
     }
     while (list($key, $ssp_order) = each($auths)) {
         // -- Store the transaction record in the SurePay table. ---
         $sql_data_array = array('auth_code' => $ssp->auth_authcode($ssp_order), 'transaction_id' => $ssp->auth_trans_id($ssp_order), 'message' => $ssp->auth_text($ssp_order));
         smn_db_perform(TABLE_SUREPAY_TRANSACTIONS, $sql_data_array, 'update', 'request_id = ' . $ssp_order);
         if ($ssp->auth_status($ssp_order) != 'AUTH') {
             // -- Redirect to error page.
             $err_msg = $ssp->auth_text($ssp_order);
             smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . stripslashes(MODULE_PAYMENT_SUREPAY_TEXT_ERROR_DECLINED), 'NONSSL', true, false));
         }
         if ($ssp->err) {
             die($ssp->err);
         }
     }
 }
예제 #18
0
     break;
 case 'insert_affiliate_news':
     //insert a new news article.
     if ($_POST['headline']) {
         /*Changed the insert query to add the news details to affiliate_news_content table by Cimi */
         /* $sql_data_array = array('headline'   => smn_db_prepare_input($_POST['headline']),
                                           'content'    => smn_db_prepare_input($_POST['content']),
                                           'date_added' => 'now()', //uses the inbuilt mysql function 'now'
                                           'status'     => '1' );
         
                   smn_db_perform(TABLE_AFFILIATE_NEWS, $sql_data_array);
                   $news_id = smn_db_insert_id();*/
         //not actually used ATM -- just there in case          $sql_data_array = array('date_added' => 'now()', //uses the inbuilt mysql function 'now'
         $sql_data_array = array('date_added' => 'now()', 'news_status' => '1');
         smn_db_perform(TABLE_AFFILIATE_NEWS, $sql_data_array);
         $news_id = smn_db_insert_id();
         //not actually used ATM -- just there in case
         $sql_data_array = array('affiliate_news_id' => $news_id, 'affiliate_news_languages_id' => $languages_id, 'affiliate_news_headlines' => $_POST['headline'], 'affiliate_news_contents' => $_POST['content']);
         smn_db_perform(TABLE_AFFILIATE_NEWS_CONTENTS, $sql_data_array);
     }
     smn_redirect(smn_href_link(FILENAME_AFFILIATE_NEWS));
     break;
 case 'update_affiliate_news':
     //user wants to modify a news article.
     if ($_GET['affiliate_news_id']) {
         /*Changed the update query to update the news details to affiliate_news_content table by Cimi */
         /* $sql_data_array = array('headline' => smn_db_prepare_input($_POST['headline']),
                                    'content'  => smn_db_prepare_input($_POST['content']) );
                                    
            smn_db_perform(TABLE_AFFILIATE_NEWS, $sql_data_array, 'update', "news_id = '" . smn_db_prepare_input($_GET['affiliate_news_id']) . "'");*/
         $sql_data_array = array('affiliate_news_headlines' => smn_db_prepare_input($_POST['headline']), 'affiliate_news_contents' => smn_db_prepare_input($_POST['content']));
     if (empty($affiliate_html_text)) {
         if ($affiliate_banners_image && $affiliate_banners_image != 'none' && is_uploaded_file($affiliate_banners_image)) {
             $image_location = DIR_FS_CATALOG_IMAGES . $affiliate_banners_image_target . $affiliate_banners_image_name;
             copy($affiliate_banners_image, $image_location);
         }
         $db_image_location = !empty($affiliate_banners_image_local) ? $affiliate_banners_image_local : $affiliate_banners_image_target . $affiliate_banners_image_name;
     }
     if (!$affiliate_products_id) {
         $affiliate_products_id = "0";
     }
     $sql_data_array = array('affiliate_banners_title' => $affiliate_banners_title, 'affiliate_products_id' => $affiliate_products_id, 'affiliate_banners_image' => $db_image_location, 'affiliate_banners_group' => $affiliate_banners_group);
     if ($_GET['action'] == 'insert') {
         $insert_sql_data = array('affiliate_date_added' => 'now()', 'affiliate_status' => '1');
         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
         smn_db_perform(TABLE_AFFILIATE_BANNERS, $sql_data_array);
         $affiliate_banners_id = smn_db_insert_id();
         // Banner ID 1 is generic Product Banner
         if ($affiliate_banners_id == 1) {
             smn_db_query("update " . TABLE_AFFILIATE_BANNERS . " set affiliate_banners_id = affiliate_banners_id + 1");
         }
         $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
     } elseif ($_GET['action'] == 'update') {
         $insert_sql_data = array('affiliate_date_status_change' => 'now()');
         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
         smn_db_perform(TABLE_AFFILIATE_BANNERS, $sql_data_array, 'update', 'affiliate_banners_id = \'' . $affiliate_banners_id . '\'');
         $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
     }
     smn_redirect(smn_href_link(FILENAME_AFFILIATE_BANNER_MANAGER, 'selected_box=affiliate&page=' . $_GET['page'] . '&abID=' . $affiliate_banners_id));
 } else {
     $_GET['action'] = 'new';
 }
예제 #20
0
require 'includes/application_top.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (smn_not_null($action)) {
    switch ($action) {
        case 'insert':
        case 'save':
            if (isset($_GET['mID'])) {
                $manufacturers_id = smn_db_prepare_input($_GET['mID']);
            }
            $manufacturers_name = smn_db_prepare_input($_POST['manufacturers_name']);
            $sql_data_array = array('manufacturers_name' => $manufacturers_name);
            if ($action == 'insert') {
                $insert_sql_data = array('date_added' => 'now()');
                $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
                smn_db_perform(TABLE_MANUFACTURERS, $sql_data_array);
                $manufacturers_id = smn_db_insert_id();
            } elseif ($action == 'save') {
                $update_sql_data = array('last_modified' => 'now()');
                $sql_data_array = array_merge($sql_data_array, $update_sql_data);
                smn_db_perform(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "'");
            }
            if ($manufacturers_image = new upload('manufacturers_image', DIR_FS_CATALOG_IMAGES)) {
                smn_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $manufacturers_image->filename . "' where manufacturers_id = '" . (int) $manufacturers_id . "'");
            }
            $languages = smn_get_languages();
            for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
                $manufacturers_url_array = $_POST['manufacturers_url'];
                $language_id = $languages[$i]['id'];
                $sql_data_array = array('manufacturers_url' => smn_db_prepare_input($manufacturers_url_array[$language_id]));
                if ($action == 'insert') {
                    $insert_sql_data = array('manufacturers_id' => $manufacturers_id, 'languages_id' => $language_id);
예제 #21
0
            break;
        case 'deleteconfirm_sub':
            $sID = smn_db_prepare_input($_GET['sID']);
            smn_db_query("delete from " . TABLE_ZONES_TO_GEO_ZONES . " where association_id = '" . (int) $sID . "' and store_id = '" . $store_id . "'");
            smn_redirect(smn_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage']));
            break;
    }
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (smn_not_null($action)) {
    switch ($action) {
        case 'insert_zone':
            $geo_zone_name = smn_db_prepare_input($_POST['geo_zone_name']);
            $geo_zone_description = smn_db_prepare_input($_POST['geo_zone_description']);
            smn_db_query("insert into " . TABLE_GEO_ZONES . " (store_id, geo_zone_name, geo_zone_description, date_added) values ('" . smn_db_input($store_id) . "', '" . smn_db_input($geo_zone_name) . "', '" . smn_db_input($geo_zone_description) . "', now())");
            $new_zone_id = smn_db_insert_id();
            smn_redirect(smn_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $new_zone_id));
            break;
        case 'save_zone':
            $zID = smn_db_prepare_input($_GET['zID']);
            $geo_zone_name = smn_db_prepare_input($_POST['geo_zone_name']);
            $geo_zone_description = smn_db_prepare_input($_POST['geo_zone_description']);
            smn_db_query("update " . TABLE_GEO_ZONES . " set geo_zone_name = '" . smn_db_input($geo_zone_name) . "', geo_zone_description = '" . smn_db_input($geo_zone_description) . "', last_modified = now() where geo_zone_id = '" . (int) $zID . "' and store_id = '" . $store_id . "'");
            smn_redirect(smn_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID']));
            break;
        case 'deleteconfirm_zone':
            $zID = smn_db_prepare_input($_GET['zID']);
            smn_db_query("delete from " . TABLE_GEO_ZONES . " where geo_zone_id = '" . (int) $zID . "' and store_id = '" . $store_id . "'");
            smn_db_query("delete from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int) $zID . "' and store_id = '" . $store_id . "'");
            smn_redirect(smn_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage']));
            break;
             $sql_data_array['entry_company'] = $company;
         }
         if (ACCOUNT_STATE == 'true') {
             if ($zone_id > 0) {
                 $sql_data_array['entry_zone_id'] = $zone_id;
                 $sql_data_array['entry_state'] = '';
             } else {
                 $sql_data_array['entry_zone_id'] = '0';
                 $sql_data_array['entry_state'] = $state;
             }
         }
         if (!smn_session_is_registered('billto')) {
             smn_session_register('billto');
         }
         smn_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
         $billto = smn_db_insert_id();
         if (smn_session_is_registered('payment')) {
             smn_session_unregister('payment');
         }
         smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL'));
     }
     // process the selected billing destination
 } elseif (isset($_POST['address'])) {
     $reset_payment = false;
     if (smn_session_is_registered('billto')) {
         if ($billto != $_POST['address']) {
             if (smn_session_is_registered('payment')) {
                 $reset_payment = true;
             }
         }
     } else {
예제 #23
0
         $messageStack->add(ERROR_NEWSLETTER_TITLE, 'error');
         $newsletter_error = true;
     }
     if (empty($module)) {
         $messageStack->add(ERROR_NEWSLETTER_MODULE, 'error');
         $newsletter_error = true;
     }
     if ($newsletter_error == false) {
         $sql_data_array = array('title' => $title, 'content' => $content, 'module' => $newsletter_module);
         if ($action == 'insert') {
             $sql_data_array['date_added'] = 'now()';
             $sql_data_array['status'] = '0';
             $sql_data_array['locked'] = '0';
             $sql_data_array['store_id'] = $store_id;
             smn_db_perform(TABLE_NEWSLETTERS, $sql_data_array);
             $newsletter_id = smn_db_insert_id();
         } elseif ($action == 'update') {
             smn_db_perform(TABLE_NEWSLETTERS, $sql_data_array, 'update', "newsletters_id = '" . (int) $newsletter_id . "'");
         }
         smn_redirect(smn_href_link(FILENAME_NEWSLETTERS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'nID=' . $newsletter_id));
     } else {
         $action = 'new';
     }
     break;
 case 'deleteconfirm':
     $newsletter_id = smn_db_prepare_input($HTTP_GET_VARS['nID']);
     smn_db_query("delete from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int) $newsletter_id . "'");
     smn_redirect(smn_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page']));
     break;
 case 'delete':
 case 'new':
예제 #24
0
function copy_to_confirm()
{
    if (isset($_POST['list_store_id']) && isset($_POST['store_categories_id'])) {
        $list_store_id = smn_db_prepare_input($_POST['list_store_id']);
        $store_categories_id = smn_db_prepare_input($_POST['store_categories_id']);
        if ($_POST['copy_as'] == 'link') {
            if ($store_categories_id != $current_store_category_id) {
                $check_query = smn_db_query("select count(*) as total from " . TABLE_STORE_TO_CATEGORIES . " where store_id = '" . (int) $list_store_id . "' and store_categories_id = '" . (int) $store_categories_id . "'");
                $check = smn_db_fetch_array($check_query);
                if ($check['total'] < '1') {
                    smn_db_query("insert into " . TABLE_STORE_TO_CATEGORIES . " (store_id, store_categories_id) values ('" . (int) $list_store_id . "', '" . (int) $store_categories_id . "')");
                }
            } else {
                $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
            }
        } elseif ($_POST['copy_as'] == 'duplicate') {
            $store_query = smn_db_query("select store_image, store_status  from " . TABLE_STORE_MAIN . " where store_id = '" . (int) $list_store_id . "'");
            $store_arr = smn_db_fetch_array($store_query);
            smn_db_query("insert into " . TABLE_STORE_MAIN . " (store_image, date_added, store_status) values ('" . smn_db_input($store_arr['store_image']) . "', now(), '0')");
            $dup_store_id = smn_db_insert_id();
            $description_query = smn_db_query("select language_id, store_name, store_description from " . TABLE_STORE_DESCRIPTION . " where store_id = '" . (int) $list_store_id . "'");
            while ($description = smn_db_fetch_array($description_query)) {
                smn_db_query("insert into " . TABLE_STORE_DESCRIPTION . " (store_id, language_id, store_name, store_description, store_viewed) values ('" . (int) $dup_store_id . "', '" . (int) $description['language_id'] . "', '" . smn_db_input($description['store_name']) . "', '" . smn_db_input($description['store_description']) . "', '0')");
            }
            smn_db_query("insert into " . TABLE_STORE_TO_CATEGORIES . " (store_id, store_categories_id) values ('" . (int) $dup_store_id . "', '" . (int) $store_categories_id . "')");
            $list_store_id = $dup_store_id;
        }
        if (USE_CACHE == 'true') {
            smn_reset_cache_block('store_categories');
            smn_reset_cache_block('also_purchased');
        }
    }
    smn_redirect(smn_href_link(FILENAME_MANAGEMENT, 'sPath=' . $store_categories_id . '&sID=' . $list_store_id));
}
             // systemsmanager end
             $customer_zone_id = $zone_id > 0 ? (int) $zone_id : '0';
             $customer_default_address_id = (int) $_GET['edit'];
             $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_default_address_id' => (int) $_GET['edit']);
             if (ACCOUNT_GENDER == 'true') {
                 $sql_data_array['customers_gender'] = $gender;
             }
             smn_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int) $customer_id . "'");
         }
         $messageStack->add_session('addressbook', SUCCESS_ADDRESS_BOOK_ENTRY_UPDATED, 'success');
     }
 } else {
     if (tep_count_customer_address_book_entries() < MAX_ADDRESS_BOOK_ENTRIES) {
         $sql_data_array['customers_id'] = (int) $customer_id;
         smn_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
         $new_address_book_id = smn_db_insert_id();
         // reregister session variables
         if (isset($_POST['primary']) && $_POST['primary'] == 'on') {
             $customer_first_name = $firstname;
             // systemsmanager begin - Dec 1, 2005 security patch
             //          $customer_country_id = $country_id;
             $customer_country_id = $country;
             // systemsmanager end
             $customer_zone_id = $zone_id > 0 ? (int) $zone_id : '0';
             if (isset($_POST['primary']) && $_POST['primary'] == 'on') {
                 $customer_default_address_id = $new_address_book_id;
             }
             $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname);
             if (ACCOUNT_GENDER == 'true') {
                 $sql_data_array['customers_gender'] = $gender;
             }
예제 #26
0
 }
 if ($_POST['products_id']) {
     $affiliate_products_id = $_POST['products_id'];
 }
 if ($_GET['affiliate_banner_id']) {
     $affiliate_banner_id = $_GET['affiliate_banner_id'];
 }
 if ($_POST['affiliate_banner_id']) {
     $affiliate_banner_id = $_POST['affiliate_banner_id'];
 }
 if (!$link_to) {
     $link_to = "0";
 }
 $sql_data_array = array('affiliate_id' => $affiliate_ref, 'affiliate_clientdate' => $affiliate_clientdate, 'affiliate_clientbrowser' => $affiliate_clientbrowser, 'affiliate_clientip' => $affiliate_clientip, 'affiliate_clientreferer' => $affiliate_clientreferer, 'affiliate_products_id' => $affiliate_products_id, 'affiliate_banner_id' => $affiliate_banner_id);
 smn_db_perform(TABLE_AFFILIATE_CLICKTHROUGHS, $sql_data_array);
 $affiliate_clickthroughs_id = smn_db_insert_id();
 // Banner has been clicked, update stats:
 if ($affiliate_banner_id && $affiliate_ref) {
     $today = date('Y-m-d');
     $sql = "select * from " . TABLE_AFFILIATE_BANNERS_HISTORY . " where affiliate_banners_id = '" . $affiliate_banner_id . "' and  affiliate_banners_affiliate_id = '" . $affiliate_ref . "' and affiliate_banners_history_date = '" . $today . "'";
     $banner_stats_query = smn_db_query($sql);
     // Banner has been shown today
     if (smn_db_fetch_array($banner_stats_query)) {
         smn_db_query("update " . TABLE_AFFILIATE_BANNERS_HISTORY . " set affiliate_banners_clicks = affiliate_banners_clicks + 1 where affiliate_banners_id = '" . $affiliate_banner_id . "' and affiliate_banners_affiliate_id = '" . $affiliate_ref . "' and affiliate_banners_history_date = '" . $today . "'");
         // Initial entry if banner has not been shown
     } else {
         $sql_data_array = array('affiliate_banners_id' => $affiliate_banner_id, 'affiliate_banners_products_id' => $affiliate_products_id, 'affiliate_banners_affiliate_id' => $affiliate_ref, 'affiliate_banners_clicks' => '1', 'affiliate_banners_history_date' => $today);
         smn_db_perform(TABLE_AFFILIATE_BANNERS_HISTORY, $sql_data_array);
     }
 }
 // Set Cookie if the customer comes back and orders it counts
예제 #27
0
            } elseif ($_GET['gID'] != 'edit_group') {
                $check_groups_name_query = smn_db_query("select admin_groups_name as group_name_new from " . TABLE_ADMIN_GROUPS . " where admin_groups_name like '%" . $name_replace . "%'");
                $check_duplicate = smn_db_num_rows($check_groups_name_query);
                if ($check_duplicate > 0) {
                    smn_redirect(smn_href_link(FILENAME_ADMIN_MEMBERS, 'gID=' . $_GET['gID'] . '&gName=used&action=new_group'));
                } else {
                    $sql_product_data_array = array('products_quantity' => '1000', 'products_model' => 'mem_6_', 'products_price' => smn_db_prepare_input($_POST['admin_groups_cost']), 'products_date_available' => date('Y-m-d'), 'store_id' => 1, 'products_weight' => '0', 'products_status' => '1', 'products_tax_class_id' => '', 'products_date_added' => 'now()', 'products_image' => '', 'manufacturers_id' => '');
                    smn_db_perform(TABLE_PRODUCTS, $sql_product_data_array);
                    $products_id = smn_db_insert_id();
                    smn_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int) $products_id . "', '1')");
                    $languages = smn_get_languages();
                    for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
                        $language_id = $languages[$i]['id'];
                        $sql_data_array = array('products_id' => $products_id, 'products_name' => smn_db_prepare_input($admin_groups_name), 'language_id' => $language_id, 'products_url' => HTTP_CATALOG_SERVER);
                        smn_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
                    }
                    $sql_data_array = array('admin_groups_name' => $admin_groups_name, 'admin_groups_store_type' => smn_db_prepare_input($_POST['admin_groups_store_types']), 'admin_groups_products_id' => $products_id, 'admin_sales_cost' => smn_db_prepare_input($_POST['admin_sales_cost']), 'admin_groups_max_products' => smn_db_prepare_input($_POST['admin_groups_max_products']));
                    smn_db_perform(TABLE_ADMIN_GROUPS, $sql_data_array);
                    $admin_groups_id = smn_db_insert_id();
                    $set_groups_id = smn_db_prepare_input($_POST['set_groups_id']);
                    $add_group_id = $set_groups_id . ',\'' . $admin_groups_id . '\'';
                    smn_db_query("alter table " . TABLE_ADMIN_FILES . " change admin_groups_id admin_groups_id set( " . $add_group_id . ") NOT NULL DEFAULT '1' ");
                    smn_redirect(smn_href_link(FILENAME_ADMIN_MEMBERS, 'gID=' . $admin_groups_id));
                }
            }
            break;
    }
}
$content_page = basename($_SERVER['PHP_SELF']);
require 'templates/default/layout.php';
require DIR_WS_INCLUDES . 'application_bottom.php';
예제 #28
0
 case 'save':
     if (isset($_GET['cID'])) {
         $currency_id = smn_db_prepare_input($_GET['cID']);
     }
     $title = smn_db_prepare_input($_POST['title']);
     $code = smn_db_prepare_input($_POST['code']);
     $symbol_left = smn_db_prepare_input($_POST['symbol_left']);
     $symbol_right = smn_db_prepare_input($_POST['symbol_right']);
     $decimal_point = smn_db_prepare_input($_POST['decimal_point']);
     $thousands_point = smn_db_prepare_input($_POST['thousands_point']);
     $decimal_places = smn_db_prepare_input($_POST['decimal_places']);
     $value = smn_db_prepare_input($_POST['value']);
     $sql_data_array = array('title' => $title, 'code' => $code, 'symbol_left' => $symbol_left, 'symbol_right' => $symbol_right, 'decimal_point' => $decimal_point, 'thousands_point' => $thousands_point, 'decimal_places' => $decimal_places, 'value' => $value);
     if ($action == 'insert') {
         smn_db_perform(TABLE_CURRENCIES, $sql_data_array);
         $currency_id = smn_db_insert_id();
     } elseif ($action == 'save') {
         smn_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update', "currencies_id = '" . (int) $currency_id . "'");
     }
     if (isset($_POST['default']) && $_POST['default'] == 'on') {
         smn_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . smn_db_input($code) . "' where configuration_key = 'DEFAULT_CURRENCY'");
     }
     smn_redirect(smn_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $currency_id));
     break;
 case 'deleteconfirm':
     $currencies_id = smn_db_prepare_input($_GET['cID']);
     $currency_query = smn_db_query("select currencies_id from " . TABLE_CURRENCIES . " where code = '" . DEFAULT_CURRENCY . "'");
     $currency = smn_db_fetch_array($currency_query);
     if ($currency['currencies_id'] == $currencies_id) {
         smn_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '' where configuration_key = 'DEFAULT_CURRENCY'");
     }
예제 #29
0
         $new_page_array[] = array('id' => $new_page['page_name'], 'text' => $page_name);
     }
     $pInfo = new objectInfo($new_page_array);
     break;
 case 'newsave':
     if ($_POST['use_current_catagory'] != '') {
         $page_name = smn_db_prepare_input($_POST['use_current_catagory']);
         $store_page_title = str_replace(' ', '_', $page_name);
     } elseif ($_POST['new_catagory'] != '') {
         $page_name = smn_db_prepare_input($_POST['new_catagory']);
         $store_page_title = str_replace(' ', '_', $page_name);
     }
     if ($_GET['type'] != 'site_text') {
         $sql_index_page_data_array = array('page_id' => '', 'page_name' => $store_page_title, 'store_id' => $store_id, 'page_type' => $_GET['type']);
         smn_db_perform(TABLE_DYNAMIC_PAGE_INDEX, $sql_index_page_data_array, 'insert');
         $page_id = smn_db_insert_id();
         $languages = smn_get_languages();
         for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
             $language_id = $languages[$i]['id'];
             if ($_POST['new_catagory'] != '') {
                 $sql_navbar_data_array = array('page_name' => $store_page_title, 'language_id' => $language_id, 'store_id' => $store_id, 'text_key' => 'NAVBAR_TITLE', 'text_content' => smn_db_prepare_input($_POST['page_navbar'][$language_id]), 'date_modified' => 'now()');
                 $sql_heading_data_array = array('page_name' => $store_page_title, 'language_id' => $language_id, 'store_id' => $store_id, 'text_key' => 'HEADING_TITLE', 'text_content' => smn_db_prepare_input($_POST['page_header'][$language_id]), 'date_modified' => 'now()');
                 $sql_header_data_array = array('page_name' => $store_page_title, 'language_id' => $language_id, 'store_id' => $store_id, 'text_key' => 'HEADER_TITLE', 'text_content' => smn_db_prepare_input($_POST['page_heading'][$language_id]), 'date_modified' => 'now()');
                 smn_db_perform(TABLE_WEB_SITE_CONTENT, $sql_navbar_data_array, 'insert');
                 smn_db_perform(TABLE_WEB_SITE_CONTENT, $sql_heading_data_array, 'insert');
                 smn_db_perform(TABLE_WEB_SITE_CONTENT, $sql_header_data_array, 'insert');
             }
             $sql_page_data_array = array('page_id' => $page_id, 'language_id' => $language_id, 'store_id' => $store_id, 'page_title' => smn_db_prepare_input($_POST['page_title'][$language_id]), 'text_content' => '', 'date_modified' => 'now()');
             smn_db_perform($db_table, $sql_page_data_array, 'insert');
         }
     } elseif ($_GET['type'] == 'site_text') {
예제 #30
0
 function confirmation()
 {
     global $cartID, $cart_PayPal_IPN_ID, $customer_id, $languages_id, $order, $order_total_modules, $store_id, $cart;
     $insert_order = true;
     if ($insert_order == true) {
         $order_totals = array();
         if (is_array($order_total_modules->modules)) {
             reset($order_total_modules->modules);
             while (list(, $value) = each($order_total_modules->modules)) {
                 $class = substr($value, 0, strrpos($value, '.'));
                 if ($GLOBALS[$class]->enabled) {
                     for ($i = 0, $n = sizeof($GLOBALS[$class]->output); $i < $n; $i++) {
                         if (smn_not_null($GLOBALS[$class]->output[$i]['title']) && smn_not_null($GLOBALS[$class]->output[$i]['text'])) {
                             $order_totals[] = array('code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->output[$i]['title'], 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => $GLOBALS[$class]->sort_order);
                         }
                     }
                 }
             }
         }
         if (ALLOW_STORE_PAYMENT == 'true') {
             $sql_data_array = array('store_id' => $store_id, 'customers_id' => $customer_id, 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'customers_company' => $order->customer['company'], 'customers_street_address' => $order->customer['street_address'], 'customers_city' => $order->customer['city'], 'customers_postcode' => $order->customer['postcode'], 'customers_state' => $order->customer['state'], 'customers_country' => $order->customer['country']['title'], 'customers_telephone' => $order->customer['telephone'], 'customers_email_address' => $order->customer['email_address'], 'customers_address_format_id' => $order->customer['format_id'], 'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 'delivery_company' => $order->delivery['company'], 'delivery_street_address' => $order->delivery['street_address'], 'delivery_city' => $order->delivery['city'], 'delivery_postcode' => $order->delivery['postcode'], 'delivery_state' => $order->delivery['state'], 'delivery_country' => $order->delivery['country']['title'], 'delivery_address_format_id' => $order->delivery['format_id'], 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'billing_company' => $order->billing['company'], 'billing_street_address' => $order->billing['street_address'], 'billing_city' => $order->billing['city'], 'billing_postcode' => $order->billing['postcode'], 'billing_state' => $order->billing['state'], 'billing_country' => $order->billing['country']['title'], 'billing_address_format_id' => $order->billing['format_id'], 'payment_method' => $order->info['payment_method'], 'cc_type' => $order->info['cc_type'], 'cc_owner' => $order->info['cc_owner'], 'cc_number' => $order->info['cc_number'], 'cc_expires' => $order->info['cc_expires'], 'date_purchased' => 'now()', 'orders_status' => $order->info['order_status'], 'currency' => $order->info['currency'], 'currency_value' => $order->info['currency_value']);
             //+1.4
             if ($update_order) {
                 smn_db_perform(TABLE_ORDERS, $sql_data_array, 'update', 'orders_id = "' . (int) $order_id . '"');
                 $insert_id = (int) $order_id;
             } else {
                 //-1.4
                 smn_db_perform(TABLE_ORDERS, $sql_data_array);
                 $insert_id = smn_db_insert_id();
             }
             //1.4
             $orders_invoice_id = $insert_id;
             for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
                 $sql_data_array = array('orders_id' => $insert_id, 'title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'class' => $order_totals[$i]['code'], 'sort_order' => $order_totals[$i]['sort_order']);
                 smn_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
             }
             //+1.4
             $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => $order->info['comments']);
             smn_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
             //-1.4
             for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
                 if ($order->products[$i]['products_store_id'] == $store_id) {
                     $sql_data_array = array('orders_id' => $insert_id, 'products_id' => smn_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']);
                     smn_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
                     $order_products_id = smn_db_insert_id();
                     $attributes_exist = '0';
                     if (isset($order->products[$i]['attributes'])) {
                         $attributes_exist = '1';
                         for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                             if (DOWNLOAD_ENABLED == 'true') {
                                 $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n\t\t\t\t\t\t\t\t\t\t\t   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n\t\t\t\t\t\t\t\t\t\t\t   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n\t\t\t\t\t\t\t\t\t\t\t   on pa.products_attributes_id=pad.products_attributes_id\n\t\t\t\t\t\t\t\t\t\t\t   where pa.products_id = '" . $order->products[$i]['id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t   and pa.options_id = popt.products_options_id\n\t\t\t\t\t\t\t\t\t\t\t   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t   and pa.options_values_id = poval.products_options_values_id\n\t\t\t\t\t\t\t\t\t\t\t   and popt.language_id = '" . $languages_id . "'\n\t\t\t\t\t\t\t\t\t\t\t   and poval.language_id = '" . $languages_id . "'";
                                 $attributes = smn_db_query($attributes_query);
                             } else {
                                 $attributes = smn_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
                             }
                             $attributes_values = smn_db_fetch_array($attributes);
                             $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']);
                             smn_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
                             if (DOWNLOAD_ENABLED == 'true' && isset($attributes_values['products_attributes_filename']) && smn_not_null($attributes_values['products_attributes_filename'])) {
                                 $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount']);
                                 smn_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
                             }
                         }
                     }
                 }
             }
         } else {
             $store_list = $cart->get_store_list();
             $orders_invoice_id = '';
             for ($k = 0; $k < sizeof($store_list); $k++) {
                 $sql_data_array = array('store_id' => $store_list[$k], 'customers_id' => $customer_id, 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'customers_company' => $order->customer['company'], 'customers_street_address' => $order->customer['street_address'], 'customers_city' => $order->customer['city'], 'customers_postcode' => $order->customer['postcode'], 'customers_state' => $order->customer['state'], 'customers_country' => $order->customer['country']['title'], 'customers_telephone' => $order->customer['telephone'], 'customers_email_address' => $order->customer['email_address'], 'customers_address_format_id' => $order->customer['format_id'], 'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 'delivery_company' => $order->delivery['company'], 'delivery_street_address' => $order->delivery['street_address'], 'delivery_city' => $order->delivery['city'], 'delivery_postcode' => $order->delivery['postcode'], 'delivery_state' => $order->delivery['state'], 'delivery_country' => $order->delivery['country']['title'], 'delivery_address_format_id' => $order->delivery['format_id'], 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'billing_company' => $order->billing['company'], 'billing_street_address' => $order->billing['street_address'], 'billing_city' => $order->billing['city'], 'billing_postcode' => $order->billing['postcode'], 'billing_state' => $order->billing['state'], 'billing_country' => $order->billing['country']['title'], 'billing_address_format_id' => $order->billing['format_id'], 'payment_method' => $order->info['payment_method'], 'cc_type' => $order->info['cc_type'], 'cc_owner' => $order->info['cc_owner'], 'cc_number' => $order->info['cc_number'], 'cc_expires' => $order->info['cc_expires'], 'date_purchased' => 'now()', 'orders_status' => $order->info['order_status'], 'currency' => $order->info['currency'], 'currency_value' => $order->info['currency_value']);
                 //+1.4
                 if ($update_order) {
                     smn_db_perform(TABLE_ORDERS, $sql_data_array, 'update', 'orders_id = "' . (int) $order_id . '"');
                     $insert_id = (int) $order_id;
                 } else {
                     //-1.4
                     smn_db_perform(TABLE_ORDERS, $sql_data_array);
                     $insert_id = smn_db_insert_id();
                 }
                 //1.4
                 for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
                     $sql_data_array = array('orders_id' => $insert_id, 'title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'class' => $order_totals[$i]['code'], 'sort_order' => $order_totals[$i]['sort_order']);
                     smn_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
                 }
                 //+1.4
                 $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => $order->info['comments']);
                 smn_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
                 //-1.4
                 for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
                     if ($order->products[$i]['products_store_id'] == $store_list[$k]) {
                         $sql_data_array = array('orders_id' => $insert_id, 'products_id' => smn_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']);
                         smn_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
                         $order_products_id = smn_db_insert_id();
                         $attributes_exist = '0';
                         if (isset($order->products[$i]['attributes'])) {
                             $attributes_exist = '1';
                             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                                 if (DOWNLOAD_ENABLED == 'true') {
                                     $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n\t\t\t\t\t\t\t\t\t\t\t   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n\t\t\t\t\t\t\t\t\t\t\t   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n\t\t\t\t\t\t\t\t\t\t\t   on pa.products_attributes_id=pad.products_attributes_id\n\t\t\t\t\t\t\t\t\t\t\t   where pa.products_id = '" . $order->products[$i]['id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t   and pa.options_id = popt.products_options_id\n\t\t\t\t\t\t\t\t\t\t\t   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t   and pa.options_values_id = poval.products_options_values_id\n\t\t\t\t\t\t\t\t\t\t\t   and popt.language_id = '" . $languages_id . "'\n\t\t\t\t\t\t\t\t\t\t\t   and poval.language_id = '" . $languages_id . "'";
                                     $attributes = smn_db_query($attributes_query);
                                 } else {
                                     $attributes = smn_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
                                 }
                                 $attributes_values = smn_db_fetch_array($attributes);
                                 $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']);
                                 smn_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
                                 if (DOWNLOAD_ENABLED == 'true' && isset($attributes_values['products_attributes_filename']) && smn_not_null($attributes_values['products_attributes_filename'])) {
                                     $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount']);
                                     smn_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
                                 }
                             }
                         }
                     }
                 }
                 $sql_data_array = array('orders_invoice_id' => $orders_invoice_id, 'orders_id' => $insert_id);
                 smn_db_perform(TABLE_ORDERS_INVOICE, $sql_data_array);
                 $orders_invoice_id = smn_db_insert_id();
             }
         }
         smn_session_register('cart_PayPal_IPN_ID');
         // Terra register globals fix
         $_SESSION['cart_PayPal_IPN_ID'] = $cartID . '-' . $orders_invoice_id;
     }
     return false;
 }