function storeManufacturer(&$pParamHash) { $sql_data_array = array('manufacturers_name' => zen_db_prepare_input($pParamHash['manufacturers_name'])); $sql_data_array['manufacturers_image'] = !empty($pParamHash['manufacturers_image']) ? $pParamHash['manufacturers_image'] : NULL; if (!empty($pParamHash['manufacturers_id']) && $this->manufacturerExists($pParamHash['manufacturers_id'])) { $sql_data_array['last_modified'] = $gBitDb->NOW(); $manufacturers_id = zen_db_prepare_input($pParamHash['manufacturers_id']); $gBitDb->associateInsert(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "'"); } else { if (!empty($pParamHash['manufacturers_id'])) { $sql_data_array['manufacturers_id'] = $pParamHash['manufacturers_id']; } $sql_data_array['date_added'] = $gBitDb->NOW(); $gBitDb->associateInsert(TABLE_MANUFACTURERS, $sql_data_array); if (!empty($pParamHash['manufacturers_id'])) { $sql_data_array['manufacturers_id'] = $pParamHash['manufacturers_id']; } } $languages = zen_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $manufacturers_url_array = $pParamHash['manufacturers_url']; $language_id = $languages[$i]['id']; $sql_data_array = array('manufacturers_url' => zen_db_prepare_input($manufacturers_url_array[$language_id])); if ($action == 'insert') { $insert_sql_data = array('manufacturers_id' => $manufacturers_id, 'languages_id' => $language_id); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); $gBitDb->associateInsert(TABLE_MANUFACTURERS_INFO, $sql_data_array); } elseif ($action == 'save') { $gBitDb->associateInsert(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "' and languages_id = '" . (int) $language_id . "'"); } } }
function zen_set_column_with_language($INSERT_SQL, $values) { global $db; $languages = zen_get_languages(); foreach ($languages as $val) { $name = preg_replace('/LANGUAGE_NAME/', $val['name'], $values['name']); $name = preg_replace('/LANGUAGE_ID/', 'language_id=' . $val['id'], $name); $insert_sql = sprintf($INSERT_SQL, $values['column_id'], $values['type_id'], $name, $values['validate'], $values['dbtable'], $values['dbcolumn']); $db->Execute($insert_sql); $values['column_id'] = $values['column_id'] + 1; } }
$record_company_array[] = array('id' => $record_company->fields['record_company_id'], 'text' => $record_company->fields['record_company_name']); $record_company->MoveNext(); } $music_genre_array = array(array('id' => '', 'text' => TEXT_NONE)); $music_genre = $db->Execute("select music_genre_id, music_genre_name\r\n from " . TABLE_MUSIC_GENRE . " order by music_genre_name"); while (!$music_genre->EOF) { $music_genre_array[] = array('id' => $music_genre->fields['music_genre_id'], 'text' => $music_genre->fields['music_genre_name']); $music_genre->MoveNext(); } $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE)); $tax_class = $db->Execute("select tax_class_id, tax_class_title\r\n from " . TABLE_TAX_CLASS . " order by tax_class_title"); while (!$tax_class->EOF) { $tax_class_array[] = array('id' => $tax_class->fields['tax_class_id'], 'text' => $tax_class->fields['tax_class_title']); $tax_class->MoveNext(); } $languages = zen_get_languages(); if (!isset($pInfo->products_status)) { $pInfo->products_status = '1'; } switch ($pInfo->products_status) { case '0': $in_status = false; $out_status = true; break; case '1': default: $in_status = true; $out_status = false; break; } // set to out of stock if categories_status is off and new product or existing products_status is off
function get_params_for_languages_dropdown() { // Show Languages Dropdown for convenience only if main filename and directory exists if (basename($_SERVER['PHP_SELF']) != FILENAME_DEFINE_LANGUAGE . '.php' and basename($_SERVER['PHP_SELF']) != FILENAME_PRODUCTS_OPTIONS_NAME . '.php' and empty($action)) { $languages = zen_get_languages(); if (sizeof($languages) > 1) { $languages_array = array(); $languages_selected = $_GET['language']; $missing_languages = ''; for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $test_directory = DIR_WS_LANGUAGES . $languages[$i]['directory']; $test_file = DIR_WS_LANGUAGES . $languages[$i]['directory'] . '.php'; if (file_exists($test_file) and file_exists($test_directory)) { $count++; $languages_array[] = array('id' => $languages[$i]['code'], 'text' => $languages[$i]['name']); if ($languages[$i]['id'] == $_SESSION['languages_id']) { $languages_selected = $languages[$i]['code']; } } else { $missing_languages .= ' ' . ucfirst($languages[$i]['directory']) . ' ' . $languages[$i]['name']; } } // if languages in table do not match valid languages show error message if ($count != sizeof($languages)) { $messageStack->add('MISSING LANGUAGE FILES OR DIRECTORIES ...' . $missing_languages, 'caution'); } $hide_languages = false; } else { $hide_languages = true; } // more than one language } else { $hide_languages = true; } // hide when other language dropdown is used $return = array('hide_languages' => $hide_languages, 'languages' => $languages, 'languages_array' => $languages_array, 'languages_selected' => $languages_selected); return $return; }
<?php /** * @package admin * @copyright Copyright 2009-2014 Zen Cart Development Team * @copyright Portions Copyright 2010 Kuroi Web Design * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: Original: ckeditor.php 277 2010-05-22 14:09:32Z kuroi $ */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } $var = zen_get_languages(); $jsLanguageLookupArray = "var lang = new Array;\n"; foreach ($var as $key) { $jsLanguageLookupArray .= " lang[" . $key['id'] . "] = '" . $key['code'] . "';\n"; } ?> <script type="text/javascript" src="//www.google.com/jsapi"></script> <script type="text/javascript">if (typeof jQuery == 'undefined') google.load("jquery", "1");</script> <script type="text/javascript" src="../<?php echo DIR_WS_EDITORS; ?> ckeditor/ckeditor.js"></script> <script type="text/javascript"><!-- $(document).ready(function() { <?php echo $jsLanguageLookupArray; ?> $('textarea').each(function() { if ($(this).attr('class') == 'editorHook' || ($(this).attr('name') != 'message' && $(this).attr('class') != 'noEditor'))
function choose_audience() { global $_GET, $db; $products_array = array(); $products = $db->Execute("select pd.products_id, pd.products_name\r\n from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\r\n where pd.language_id = '" . $_SESSION['languages_id'] . "'\r\n and pd.products_id = p.products_id\r\n and p.products_status = '1'\r\n order by pd.products_name"); while (!$products->EOF) { $products_array[] = array('id' => $products->fields['products_id'], 'text' => $products->fields['products_name']); $products->MoveNext(); } $choose_audience_string = '<script language="javascript"><!-- function mover(move) { if (move == \'remove\') { for (x=0; x<(document.notifications.products.length); x++) { if (document.notifications.products.options[x].selected) { with(document.notifications.elements[\'chosen[]\']) { options[options.length] = new Option(document.notifications.products.options[x].text,document.notifications.products.options[x].value); } document.notifications.products.options[x] = null; x = -1; } } } if (move == \'add\') { for (x=0; x<(document.notifications.elements[\'chosen[]\'].length); x++) { if (document.notifications.elements[\'chosen[]\'].options[x].selected) { with(document.notifications.products) { options[options.length] = new Option(document.notifications.elements[\'chosen[]\'].options[x].text,document.notifications.elements[\'chosen[]\'].options[x].value); } document.notifications.elements[\'chosen[]\'].options[x] = null; x = -1; } } } return true; } function selectAll(FormName, SelectBox) { temp = "document." + FormName + ".elements[\'" + SelectBox + "\']"; Source = eval(temp); for (x=0; x<(Source.length); x++) { Source.options[x].selected = "true"; } if (x<1) { alert(\'' . JS_PLEASE_SELECT_PRODUCTS . '\'); return false; } else { return true; } } //--></script>'; $languages = zen_get_languages(); $global_button = ''; $languages_id_options = array(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $global_button .= '<script language="javascript"><!--' . "\n" . 'document.write(\'<input type="button" value="' . BUTTON_GLOBAL . ' (' . $languages[$i]['name'] . ') ' . '" style="width: 12em;" onclick="document.location=\\\'' . zen_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm&global=true' . '&languages_id=' . $languages[$i]['id']) . '\\\'">\');' . "\n" . '//--></script><noscript><a href="' . zen_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm&global=true' . '&languages_id=' . $languages[$i]['id']) . '">[ ' . BUTTON_GLOBAL . ' (' . $languages[$i]['name'] . ') ' . ' ]</a></noscript><br />'; $languages_id_options[] = array('id' => $languages[$i]['id'], 'text' => $languages[$i]['name']); } $cancel_button = '<script language="javascript"><!--' . "\n" . 'document.write(\'<input type="button" value="' . BUTTON_CANCEL . '" style="width: 12em;" onclick="document.location=\\\'' . zen_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID']) . '\\\'">\');' . "\n" . '//--></script><noscript><a href="' . zen_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID']) . '">[ ' . BUTTON_CANCEL . ' ]</a></noscript>'; $choose_audience_string .= '<form name="notifications" action="' . zen_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm') . '" method="post" onSubmit="return selectAll(\'notifications\', \'chosen[]\')"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n" . ' <tr>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_PRODUCTS . '</b><br />' . zen_draw_pull_down_menu('products', $products_array, '', 'size="20" style="width: 20em;" multiple') . '</td>' . "\n" . ' <td align="center" class="main"> <br />' . $global_button . '<br /><br /><input type="button" value="' . BUTTON_SELECT . '" style="width: 12em;" onClick="mover(\'remove\');"><br /><br /><input type="button" value="' . BUTTON_UNSELECT . '" style="width: 12em;" onClick="mover(\'add\');"><br /><br /><br /><b>' . TEXT_CUSTOMERS_LANGUAGE . '</b>' . zen_draw_pull_down_menu('languages_id', $languages_id_options, $_SESSION['languages_id']) . '<br /><br /><input type="submit" value="' . BUTTON_SUBMIT . '" style="width: 12em;"><br /><br />' . $cancel_button . '</td>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_SELECTED_PRODUCTS . '</b><br />' . zen_draw_pull_down_menu('chosen[]', array(), '', 'size="20" style="width: 20em;" multiple') . '</td>' . "\n" . ' </tr>' . "\n" . '</table></form>'; return $choose_audience_string; }
/** * Adds a new order state with the given name for both german and english language sets * Therefore the state name should be english * @param String $stateName */ function addOrderState($stateName) { global $db; $check_query = $db->Execute("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = '{$stateName}' limit 1"); if ($check_query->RecordCount() < 1) { $status_query = $db->Execute("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS); $status_id = $status_query->fields['status_id'] + 1; } else { $status_id = $check_query->fields['orders_status_id']; } $languages = zen_get_languages(); foreach ($languages as $lang) { $db->Execute("REPLACE INTO " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', '" . $stateName . "')"); } }
function get_audiences_list_with_language($query_category = 'email', $display_count = "") { // used to display drop-down list of available audiences in emailing modules: // ie: mail, gv_main, coupon_admin... and eventually newsletters too. // gets info from query_builder table include_once DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . 'audience.php'; //$current_page global $db; $languages = zen_get_languages(); $count_array = array(); $count = 0; if ($display_count == "") { $display_count = AUDIENCE_SELECT_DISPLAY_COUNTS; } // get list of queries in database table, based on category supplied $queries_list = $db->Execute("select query_name, query_string from " . TABLE_QUERY_BUILDER . " " . "where query_category like '%" . $query_category . "%'"); $audience_list = array(); if ($queries_list->RecordCount() > 1) { // if more than one query record found $audience_list[] = array('id' => '', 'text' => TEXT_SELECT_AN_OPTION); //provide a "not-selected" value } reset($queries_list); while (!$queries_list->EOF) { for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $query_string = $queries_list->fields['query_string']; // if requested, show recordcounts at end of descriptions of each entry // This could slow things down considerably, so use sparingly !!!! if ($display_count == 'true' || $display_count == true) { // if it's literal 'true' or logical true $languages_query_string = "customers_languages_id = '" . $languages[$i]['id'] . "'"; if ($languages[$i]['code'] == DEFAULT_LANGUAGE) { $languages_query_string = "(" . $languages_query_string . " or customers_languages_id = '0')"; } if (preg_match('/TABLE_CUSTOMERS/', $query_string)) { $query_string = preg_replace('/where/i', 'where ' . $languages_query_string . ' and', $query_string); } if (preg_match('/TABLE_CUSTOMERS c/', $query_string)) { $query_string = preg_replace('/customers_languages_id/', 'c.customers_languages_id', $query_string); } $count_array = $db->Execute(parsed_query_string($query_string)); $count = $count_array->RecordCount(); } // generate an array consisting of 2 columns which are identical. Key and Text are same. // Thus, when the array is used in a Select Box, the key is the same as the displayed description // The key can then be used to get the actual select SQL statement using the get...addresses_query function, below. if (!preg_match('/TABLE_CUSTOMERS/', $query_string)) { $audience_list[] = array('id' => $queries_list->fields['query_name'], 'text' => $queries_list->fields['query_name'] . ' (' . $count . ')'); break; } else { $audience_list[] = array('id' => $queries_list->fields['query_name'] . ',languages_id:' . $languages[$i]['id'], 'text' => $queries_list->fields['query_name'] . ' (' . $languages[$i]['name'] . ') (' . $count . ')'); } } $queries_list->MoveNext(); } //if this is called by an emailing module which offers individual customers as an option, add all customers email addresses as well. if ($query_category == 'email') { $customers_values = $db->Execute("select c.customers_email_address, c.customers_firstname, c.customers_lastname, c.customers_languages_id, l.name as languages_name " . "from " . TABLE_CUSTOMERS . " c left join " . TABLE_LANGUAGES . " l on c.customers_languages_id = l.languages_id WHERE c.customers_email_format != 'NONE' " . "order by c.customers_lastname, c.customers_firstname, c.customers_email_address"); while (!$customers_values->EOF) { $audience_list[] = array('id' => $customers_values->fields['customers_email_address'], 'text' => $customers_values->fields['customers_firstname'] . ' ' . $customers_values->fields['customers_lastname'] . ' (' . $customers_values->fields['customers_email_address'] . ') ' . $customers_values->fields['languages_name']); $customers_values->MoveNext(); } } // send back the array for display in the SELECT drop-down menu return $audience_list; }
function getParams() { global $db; if (!defined('MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_TRANSACTION_ORDER_STATUS_ID')) { $check_query = $db->Execute("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Pay.nl [PAID]' limit 1"); if ($check_query->RecordCount() < 1) { $status_query = $db->Execute("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS); $status = $status_query->fields; $status_id = $status['status_id'] + 1; $languages = zen_get_languages(); foreach ($languages as $lang) { $db->Execute("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Pay.nl [PAID]')"); } $flags_query = $db->Execute("describe " . TABLE_ORDERS_STATUS . " public_flag"); if ($flags_query->RecordCount() == 1) { $db->Execute("update " . TABLE_ORDERS_STATUS . " set public_flag = 0 and downloads_flag = 0 where orders_status_id = '" . $status_id . "'"); } } else { $check = $status_query->fields; $status_id = $check['orders_status_id']; } } else { $status_id = constant('MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_TRANSACTION_ORDER_STATUS_ID'); } $params = array('MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_STATUS' => array('title' => 'Enable Pay.nl Server Integration Method', 'desc' => 'Do you want to accept Pay.nl Server Integration Method payments?', 'value' => 'True', 'set_func' => 'zen_cfg_select_option(array(\'True\', \'False\'), '), 'MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_SERVICE_ID' => array('title' => 'Service ID', 'desc' => 'The Service ID used for the pay.nl service'), 'MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_API_TOKEN' => array('title' => 'API Token ', 'desc' => 'The API Token used for the pay.nl service'), 'MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_ORDER_STATUS_ID' => array('title' => 'Set Pending Status', 'desc' => 'Set the status of pending orders made with this payment module to this value', 'value' => '0', 'use_func' => 'zen_get_order_status_name', 'set_func' => 'zen_cfg_pull_down_order_statuses('), 'MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_TRANSACTION_ORDER_STATUS_ID' => array('title' => 'Paid Order Status', 'desc' => 'Include paid transaction information in this order status level', 'value' => $status_id, 'use_func' => 'zen_get_order_status_name', 'set_func' => 'zen_cfg_pull_down_order_statuses('), 'MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_ZONE' => array('title' => 'Payment Zone', 'desc' => 'If a zone is selected, only enable this payment method for that zone.', 'value' => '0', 'set_func' => 'zen_cfg_pull_down_zone_classes(', 'use_func' => 'zen_get_zone_class_title'), 'MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_DEBUG_EMAIL' => array('title' => 'Debug E-Mail Address', 'desc' => 'All parameters of an invalid transaction will be sent to this email address.'), 'MODULE_PAYMENT_PAYNL_' . $this->payment_method_description . '_SORT_ORDER' => array('title' => 'Sort order of display.', 'desc' => 'Sort order of display. Lowest is displayed first.', 'value' => '0')); return $params; }
function install() { global $db; $language = $_SESSION['language']; require_once DIR_FS_CATALOG . 'includes/languages/' . $language . '/modules/payment/googlecheckout.php'; $shipping_list = 'array(\'not\')'; $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Google Checkout Module Version', 'MODULE_PAYMENT_GOOGLECHECKOUT_VERSION', '" . GOOGLECHECKOUT_FILES_VERSION . "', 'Version of the installed Module', '6', '0', 'zen_cfg_select_option(array(\\'" . GOOGLECHECKOUT_FILES_VERSION . "\\'), ', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable GoogleCheckout Module', 'MODULE_PAYMENT_GOOGLECHECKOUT_STATUS', 'True', 'Accepts payments through Google Checkout on your site', '6', '3', 'zen_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())"); // Merchant id/key $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Select Mode of Operation', 'MODULE_PAYMENT_GOOGLECHECKOUT_MODE', 'https://sandbox.google.com/checkout/', 'Select either the Developer\\'s Sandbox or live Production environment<br />Note that different Id/Key pair will be used depending on the environment selected', '6', '3', 'zen_cfg_select_option(array(\\'https://sandbox.google.com/checkout/\\', \\'https://checkout.google.com/\\'),',now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Production Merchant ID', 'MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTID', '', 'Your merchant ID is listed on the \"Integration\" page under the \"Settings\" tab', '6', '1', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Production Merchant Key', 'MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTKEY', '', 'Your merchant key is also listed on the \"Integration\" page under the \"Settings\" tab', '6', '2', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sandbox Merchant ID', 'MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTID_SNDBOX', '', 'Your merchant ID is listed on the \"Integration\" page under the \"Settings\" tab', '6', '1', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sandbox Merchant Key', 'MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTKEY_SNDBOX', '', 'Your merchant key is also listed on the \"Integration\" page under the \"Settings\" tab', '6', '2', now())"); // CGI $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('.htaccess Basic Authentication Mode', 'MODULE_PAYMENT_GOOGLECHECKOUT_CGI', 'False', 'Your site Site in installed with PHP over CGI? <br /> This configuration will <b>disable</b> PHP Basic Authentication that is NOT compatible with CGI used in the responsehandler.php to validate Google Checkout messages.<br />If setted True you MUST configure your .htaccess files <a href=\"htaccess.php\" target=\"_OUT\">here</a>.', '6', '4', 'zen_cfg_select_option(array(\\'False\\', \\'True\\'),',now())"); // Virtual Goods $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Disable Google Checkout for Virtual Goods?', 'MODULE_PAYMENT_GOOGLECHECKOUT_VIRTUAL_GOODS', 'False', 'If this configuration is enabled and there is any virtual good in the cart the Google Checkout button will be shown disabled.', '6', '4', 'zen_cfg_select_option(array(\\'True\\', \\'False\\'),',now())"); // $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('MultiSocket Shipping Quotes Retrieval', 'MODULE_PAYMENT_GOOGLECHECKOUT_MULTISOCKET', 'False', 'This configuration will enable a multisocket feature to parallelize Shipping Providers quotes. This should reduce the time this call take and avoid GC Merchant Calculation TimeOut. <a href=\"multisock.html\" target=\"_OUT\">More Info</a>.(Alfa Feature)', '6', '4', 'zen_cfg_select_option(array(\'True\', \'False\'),',now())"); // Shipping configs $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow US PO BOX shipping?', 'MODULE_PAYMENT_GOOGLECHECKOUT_USPOBOX', 'True', 'Allow sending items to US PO Boxes?', '6', '4', 'zen_cfg_select_option(array(\\'True\\', \\'False\\'),',now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Select Merchant Calculation Mode of Operation', 'MODULE_PAYMENT_GOOGLECHECKOUT_MC_MODE', 'https', 'Merchant calculation URL for Sandbox environment. (Checkout production environemnt always requires HTTPS.)', '6', '4', 'zen_cfg_select_option(array(\\'http\\', \\'https\\'),',now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Default Values for Real Time Shipping Rates', 'MODULE_PAYMENT_GOOGLECHECKOUT_SHIPPING', '', 'Default values for real time rates in case the webservice call fails.<br />Set <b>Default Value</b> to <b>0</b> to disable the method <br/><a href=\"../googlecheckout/shipping_generator/\">Shipping Generator</a>', '6', '0',\"zen_cfg_select_shipping({$shipping_list}, \",now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('GoogleCheckout Carrier Calculated Shipping', 'MODULE_PAYMENT_GOOGLECHECKOUT_CARRIER_CALCULATED_ENABLED', 'True', 'Do you want to use GC Carrier calculated shipping? This feature can be mixed with Flat Rate Shipping, but not Merchant Calculated.', '6', '4', 'zen_cfg_select_option(array(\\'True\\',\\'False\\'),',now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Carrier Calculater Shipping Configuration', 'MODULE_PAYMENT_GOOGLECHECKOUT_CARRIER_CALCULATED', '', 'Set Default Values, Fix and Variable charge<br />Set <b>Def. Value</b> to <b>0</b> to disable the method', '6', '5',\"zen_cfg_select_CCshipping(\",now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Rounding Policy Mode', 'MODULE_PAYMENT_GOOGLECHECKOUT_TAXMODE', 'HALF_EVEN', 'This configuration specifies the methodology that will be used to round values to two decimal places. <a href=\"http://code.google.com/apis/checkout/developer/Google_Checkout_Rounding_Policy.html\">More info</a>', '6', '4', 'zen_cfg_select_option(array(\\'UP\\',\\'DOWN\\',\\'CEILING\\',\\'HALF_UP\\',\\'HALF_DOWN\\', \\'HALF_EVEN\\'),',now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Rounding Policy Rule', 'MODULE_PAYMENT_GOOGLECHECKOUT_TAXRULE', 'PER_LINE', 'This configuration specifies when rounding rules should be applied to monetary values while Google Checkout is computing an order total.', '6', '4', 'zen_cfg_select_option(array(\\'PER_LINE\\',\\'TOTAL\\'),',now())"); // Cart expiration $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Cart Expiration Time (Minutes)', 'MODULE_PAYMENT_GOOGLECHECKOUT_EXPIRATION', 'NONE', 'Set the time in minutes after which the cart will expire. NONE for no-expiration', '6', '1', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Also send notifications with Zencart', 'MODULE_PAYMENT_GOOGLECHECKOUT_USE_CART_MESSAGING', 'False', 'Do you also want to send notifications to buyers using Zencart\\'s mailing system?', '6', '4', 'zen_cfg_select_option(array(\\'True\\',\\'False\\'),',now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Google Analytics Id', 'MODULE_PAYMENT_GOOGLECHECKOUT_ANALYTICS', 'NONE', 'Do you want to integrate the module with Google Analytics? Add your GA Id (UA-XXXXXX-X), NONE to disable. <br/> More info <a href=\\'http://code.google.com/apis/checkout/developer/checkout_analytics_integration.html\\'>here</a>', '6', '1', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('3rd Party Tracking', 'MODULE_PAYMENT_GOOGLECHECKOUT_3RD_PARTY_TRACKING', 'NONE', 'Do you want to integrate the module 3rd party tracking? Add the tracker URL, NONE to disable. <br/> More info <a href=\\'http://code.google.com/apis/checkout/developer/checkout_pixel_tracking.html\\'>here</a>', '6', '1', now())"); // Restricted products $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Google Checkout restricted product categories', 'MODULE_PAYMENT_GOOGLECHECKOUT_RESTRICTED_CATEGORIES', '', 'Specify the ids separated by commas \\',\\' of the product categories for which the GC button should be disabled.<br />Check <a href=\"http://checkout.google.com/support/sell/bin/answer.py?answer=46174&topic=8681\">Google Policy</a>', '6', '8', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Continue shopping URL.', 'MODULE_PAYMENT_GOOGLECHECKOUT_CONTINUE_URL', 'checkout_success', 'Specify the page customers will be directed to if they choose to continue shopping after checkout.', '6', '8', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_GOOGLECHECKOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); $db->Execute("create table if not exists " . $this->table_name . " (customers_id int(11), buyer_id bigint(20) )"); $db->Execute("create table if not exists " . $this->table_order . " (orders_id int(11), google_order_number bigint(20), order_amount decimal(15,4) )"); // Add GC custom order states /* * New * Processing * Shipped * Refunded * Shipped and refunded * Canceled */ $languages = zen_get_languages(); foreach ($this->gc_order_states as $orders_status_id => $orders_status_name) { for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id']; $order_status_id = $db->Execute("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . (int) $orders_status_id . "' and language_id = '" . (int) $language_id . "'"); $sql_data_array = array('orders_status_name' => zen_db_prepare_input($orders_status_name), 'orders_status_id' => $orders_status_id, 'language_id' => $language_id); if ($order_status_id->RecordCount() == 0) { zen_db_perform(TABLE_ORDERS_STATUS, $sql_data_array); } else { zen_db_perform(TABLE_ORDERS_STATUS, $sql_data_array, 'update', "orders_status_id = '" . (int) $orders_status_id . "' and language_id = '" . (int) $language_id . "'"); } } } }
function store(&$pParamHash) { if ($this->verify($pParamHash)) { $this->StartTrans(); $languages = zen_get_languages(); if (empty($pParamHash['coupon_id'])) { $pParamHash['coupon_store']['date_created'] = $this->mDb->NOW(); $this->mDb->associateInsert(TABLE_COUPONS, $pParamHash['coupon_store']); $this->mCouponId = zen_db_insert_id(TABLE_COUPONS, 'coupon_id'); $pParamHash['coupon_store']['coupon_id'] = $this->mCouponId; for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $languageId = $languages[$i]['id']; $pParamHash['voucher_lang_store'][$languageId]['coupon_id'] = $pParamHash['coupon_store']['coupon_id']; $pParamHash['voucher_lang_store'][$languageId]['language_id'] = $languageId; $this->mDb->associateInsert(TABLE_COUPONS_DESCRIPTION, $pParamHash['voucher_lang_store'][$languageId]); } } else { $this->mDb->associateUpdate(TABLE_COUPONS, $pParamHash['coupon_store'], array('coupon_id' => $pParamHash['coupon_id'])); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $languageId = $languages[$i]['id']; $this->mDb->query("UPDATE " . TABLE_COUPONS_DESCRIPTION . " SET `coupon_name`=?, `coupon_description`=? WHERE `coupon_id`=? AND `language_id`=?", array($pParamHash['voucher_lang_store'][$languageId]['coupon_name'], $pParamHash['voucher_lang_store'][$languageId]['coupon_description'], $pParamHash['coupon_id'], $languageId)); } } $this->CompleteTrans(); $this->load(); } return empty($this->mFeedback['error']); }
function _change_image_icon($html) { $languages = zen_get_languages(); for ($i = 0; $i < count($languages); $i++) { $image_src = '"' . DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'] . '"'; $startpos = 0; for (;;) { $pos = strpos($html, $image_src, $startpos); if ($pos === FALSE) { break; } $html = substr_replace($html, '"images/pixel_trans.gif" width="24" height="14"', $pos, strlen($image_src)); $startpos = $pos + strlen($image_src); } } return $html; }
if (empty($_POST['coupon_start_date'])) { $coupon_start_date = explode("-", date('Y-m-d')); } else { $coupon_start_date = explode("-", $_POST['coupon_start_date']); } if (empty($_POST['coupon_expire_date'])) { $coupon_expire_date = explode("-", date('Y-m-d')); $coupon_expire_date[0] = $coupon_expire_date[0] + 1; } else { $coupon_expire_date = explode("-", $_POST['coupon_expire_date']); } $gBitSmarty->assign('coupon_start_date', $coupon_start_date); $gBitSmarty->assign('coupon_expire_date', $coupon_expire_date); $gBitSmarty->assign('startDateSelect', zen_draw_date_selector('coupon_start_date', mktime(0, 0, 0, $coupon_start_date[1], (int) $coupon_start_date[2], $coupon_start_date[0]))); $gBitSmarty->assign('finishDateSelect', zen_draw_date_selector('coupon_expire_date', mktime(0, 0, 0, $coupon_expire_date[1], (int) $coupon_expire_date[2], $coupon_expire_date[0]))); $gBitSmarty->assign('languages', zen_get_languages()); if ($gCoupon->isValid()) { $title = tra('Edit Coupon') . ' : ' . $gCoupon->getField('coupon_code'); } else { $title = tra('Create Coupon'); } $mid = 'bitpackage:bitcommerce/admin_coupon_edit.tpl'; break; default: $couponList = CommerceVoucher::getList($_REQUEST); $_REQUEST['listInfo']['page_records'] = count($couponList); $gBitSmarty->assign_by_ref('couponList', $couponList); $title = HEADING_TITLE; $mid = 'bitpackage:bitcommerce/admin_coupon_list.tpl'; } if (isset($_REQUEST['listInfo'])) {
function store(&$pParamHash) { // we have already done all the permission checking needed for this user to upload an image $pParamHash['no_perm_check'] = TRUE; $this->StartTrans(); if (CommerceProduct::verify($pParamHash) && LibertyMime::store($pParamHash)) { if (isset($pParamHash['pID'])) { $this->mProductsId = zen_db_prepare_input($pParamHash['pID']); } if ($this->isValid()) { $action = 'update_product'; $this->mDb->associateUpdate(TABLE_PRODUCTS, $pParamHash['product_store'], array('products_id' => $this->mProductsId)); } else { $pParamHash['product_store']['content_id'] = $pParamHash['content_id']; $action = 'insert_product'; $this->mDb->associateInsert(TABLE_PRODUCTS, $pParamHash['product_store']); $this->mProductsId = zen_db_insert_id(TABLE_PRODUCTS, 'products_id'); $this->mDb->query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " ( `products_id`, `categories_id` ) values (?,?)", array($this->mProductsId, $pParamHash['product_store']['master_categories_id'])); } $languages = zen_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id']; $bindVars = array(); if (!empty($pParamHash['products_name'][$language_id])) { $bindVars['products_name'] = substr(zen_db_prepare_input($pParamHash['products_name'][$language_id]), 0, 64); } if (!empty($pParamHash['products_description'][$language_id])) { $bindVars['products_description'] = zen_db_prepare_input($pParamHash['products_description'][$language_id]); } if (!empty($pParamHash['products_url'][$language_id])) { $bindVars['products_url'] = substr(zen_db_prepare_input($pParamHash['products_url'][$language_id]), 0, 255); } if ($action == 'insert_product') { $bindVars['products_id'] = $this->mProductsId; $bindVars['language_id'] = $language_id; $this->mDb->associateInsert(TABLE_PRODUCTS_DESCRIPTION, $bindVars); } elseif ($action == 'update_product') { if (!empty($bindVars)) { $query = "UPDATE " . TABLE_PRODUCTS_DESCRIPTION . " SET `" . implode(array_keys($bindVars), '`=?, `') . '`=?' . " WHERE `products_id` =? AND `language_id`=?"; $bindVars['products_id'] = $this->mProductsId; $bindVars['language_id'] = $language_id; $this->mDb->query($query, $bindVars); } } } // add meta tags for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id']; $bindVars = array(); if (!empty($pParamHash['metatags_title'][$language_id])) { $bindVars['metatags_title'] = zen_db_prepare_input($pParamHash['metatags_title'][$language_id]); } if (!empty($pParamHash['metatags_keywords'][$language_id])) { $bindVars['metatags_keywords'] = zen_db_prepare_input($pParamHash['metatags_keywords'][$language_id]); } if (!empty($pParamHash['metatags_description'][$language_id])) { $bindVars['metatags_description'] = zen_db_prepare_input($pParamHash['metatags_description'][$language_id]); } $this->mDb->query("DELETE FROM " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " WHERE `products_id`=?", array($this->mProductsId)); if (!empty($bindVars)) { if (!empty($bindVars)) { $bindVars['products_id'] = $this->mProductsId; $bindVars['language_id'] = $language_id; $this->mDb->associateInsert(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $bindVars); } } $this->storeProductImage($pParamHash); } } $this->CompleteTrans(); $this->load(); return count($this->mErrors) == 0; }