public function RunMultishopUpdate($multishop_page_uid = '') { $settings = array(); // attribute fixer $str = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_products_options', 'language_id=\'0\'', '', 'sort_order', ''); $qry = $GLOBALS['TYPO3_DB']->sql_query($str); $rows = $GLOBALS['TYPO3_DB']->sql_num_rows($qry); if ($rows) { while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) { // now load the related values $str2 = $GLOBALS['TYPO3_DB']->SELECTquery('povp.products_options_id,povp.products_options_values_id', 'tx_multishop_products_options_values_to_products_options povp, tx_multishop_products_options_values pov', 'povp.products_options_id=\'' . $row['products_options_id'] . '\' and povp.products_options_values_id=pov.products_options_values_id and pov.language_id=\'0\' and povp.sort_order=0', '', '', ''); $qry2 = $GLOBALS['TYPO3_DB']->sql_query($str2); $rows2 = $GLOBALS['TYPO3_DB']->sql_num_rows($qry2); if ($rows2 > 1) { $fix_attribute_values = 1; break; } } } if ($fix_attribute_values) { // attribute fixer $str = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_products_options', 'language_id=\'0\'', '', 'sort_order', ''); $qry = $GLOBALS['TYPO3_DB']->sql_query($str); $rows = $GLOBALS['TYPO3_DB']->sql_num_rows($qry); if ($rows) { while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) { // now load the related values $str2 = $GLOBALS['TYPO3_DB']->SELECTquery('povp.products_options_id,povp.products_options_values_id', 'tx_multishop_products_options_values_to_products_options povp, tx_multishop_products_options_values pov', 'povp.products_options_id=\'' . $row['products_options_id'] . '\' and povp.products_options_values_id=pov.products_options_values_id and pov.language_id=\'0\'', '', 'povp.sort_order', ''); $qry2 = $GLOBALS['TYPO3_DB']->sql_query($str2); $counter = 0; while (($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry2)) != false) { $where = "products_options_id='" . $row2['products_options_id'] . "' and products_options_values_id = " . $row2['products_options_values_id']; $updateArray = array('sort_order' => $counter); $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_products_options_values_to_products_options', $where, $updateArray); $res = $GLOBALS['TYPO3_DB']->sql_query($query); $counter++; } } } // end attribute fixer } $query = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_configuration_values', 'page_uid="' . $multishop_page_uid . '"', '', '', ''); $res = $GLOBALS['TYPO3_DB']->sql_query($query); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) { while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) != false) { if (isset($row['configuration_value']) and $row['configuration_value'] != '') { $settings['LOCAL_MODULES'][$row['configuration_key']] = $row['configuration_value']; } } } // load local front-end module config eof // load global front-end module config $query = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_configuration', '', '', '', ''); $res = $GLOBALS['TYPO3_DB']->sql_query($query); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) { while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) != false) { if (isset($row['configuration_value'])) { $settings['GLOBAL_MODULES'][$row['configuration_key']] = $row['configuration_value']; } } } // load global front-end module config eof // merge global with local front-end module config if (is_array($settings['GLOBAL_MODULES']) && count($settings['GLOBAL_MODULES'])) { foreach ($settings['GLOBAL_MODULES'] as $key => $value) { if (isset($settings['LOCAL_MODULES'][$key])) { $settings[$key] = $settings['LOCAL_MODULES'][$key]; } else { $settings[$key] = $value; } } } // merge global with local front-end module config eof if ($settings['COUNTRY_ISO_NR']) { $country = mslib_fe::getCountryByIso($settings['COUNTRY_ISO_NR']); $settings['CURRENCY_ARRAY'] = mslib_befe::loadCurrency($country['cn_currency_iso_nr']); switch ($settings['COUNTRY_ISO_NR']) { case '528': case '276': $settings['CURRENCY'] = '€'; break; default: $settings['CURRENCY'] = $settings['CURRENCY_ARRAY']['cu_symbol_left']; break; } } // check database $messages = array(); $skip = 0; $settings['update_database'] = 1; if ($settings['update_database']) { set_time_limit(86400); ignore_user_abort(true); require \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/front_pages/includes/compare_database.php'; } // check database eof // delete duplicates eof // load default vars for upgrade purposes eof if (!count($messages)) { $content = $this->pi_getLL('admin_label_nothing_updated_already_using_latest_version'); } else { $content = addslashes(str_replace("\n", "", implode("<br />", $messages))); } return $content; }
// load enabled countries to array $str2 = "SELECT * from static_countries sc, tx_multishop_countries_to_zones c2z, tx_multishop_shipping_countries c where c.page_uid='" . $this->showCatalogFromPage . "' and sc.cn_iso_nr=c.cn_iso_nr and c2z.cn_iso_nr=sc.cn_iso_nr group by c.cn_iso_nr order by sc.cn_short_en"; //$str2="SELECT * from static_countries c, tx_multishop_countries_to_zones c2z where c2z.cn_iso_nr=c.cn_iso_nr order by c.cn_short_en"; $qry2 = $GLOBALS['TYPO3_DB']->sql_query($str2); $enabled_countries = array(); while (($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry2)) != false) { $countries_name = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $row2['cn_short_en']); $row2['locale_countries_name'] = $countries_name; $enabled_countries[$countries_name] = $row2; } ksort($enabled_countries); // load enabled countries to array eof if (count($enabled_countries) == 1) { $deliver_to_sb .= '<input name="deliver_to_country" type="hidden" value="' . mslib_befe::strtolower($enabled_countries[0]['cn_short_en']) . '" />'; } else { $default_country = mslib_fe::getCountryByIso($this->tta_shop_info['cn_iso_nr']); foreach ($enabled_countries as $country) { $tmpcontent_con .= '<option value="' . mslib_befe::strtolower($country['cn_short_en']) . '" ' . (mslib_befe::strtolower($default_country['cn_short_en']) == mslib_befe::strtolower($country['cn_short_en']) ? 'selected' : '') . '>' . htmlspecialchars($country['locale_countries_name']) . '</option>'; } if ($tmpcontent_con) { $deliver_to_sb .= ' <select name="deliver_to_country" id="deliver_to_country" class="country" title="' . $this->pi_getLL('country_is_required') . '"> ' . $tmpcontent_con . ' </select> '; } } // country eof $subpartArray['###SHIPPING_COST_COUNTRY_SELECTION###'] = ' <div class="shoppingcart_shipping_cost_wrapper"> <div class="shipping_deliver_to"><label for="deliver_to_country">' . $this->pi_getLL('deliver_in') . '<label>' . $deliver_to_sb . '</div>
/** * @return the $configurationArray */ public function generateConfigurationArray() { if ($this->staticConfiguration == true) { static $settings; if (is_array($settings)) { // the settings are already loaded before so lets return them. $this->configurationArray = $settings; return ''; } // first check if we already loaded the configuration before } $settings = array(); $query = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_configuration_values', 'page_uid="' . $this->shopPid . '"', '', '', ''); $res = $GLOBALS['TYPO3_DB']->sql_query($query); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) { while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if (isset($row['configuration_value']) and $row['configuration_value'] != '') { $settings['LOCAL_MODULES'][$row['configuration_key']] = $row['configuration_value']; } } } // load local front-end module config eof // load global front-end module config $query = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_configuration', '', '', '', ''); $res = $GLOBALS['TYPO3_DB']->sql_query($query); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) { while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if (isset($row['configuration_value'])) { $settings['GLOBAL_MODULES'][$row['configuration_key']] = $row['configuration_value']; } } } // load global front-end module config eof // merge global with local front-end module config foreach ($settings['GLOBAL_MODULES'] as $key => $value) { if (isset($settings['LOCAL_MODULES'][$key])) { $settings[$key] = $settings['LOCAL_MODULES'][$key]; } else { $settings[$key] = $value; } } // merge global with local front-end module config eof if ($settings['COUNTRY_ISO_NR']) { $country = mslib_fe::getCountryByIso($settings['COUNTRY_ISO_NR']); $settings['CURRENCY_ARRAY'] = mslib_befe::loadCurrency($country['cn_currency_iso_nr']); // if default currency is not set then define it to the store country currency if (!$settings['DEFAULT_CURRENCY']) { $settings['DEFAULT_CURRENCY'] = $settings['CURRENCY_ARRAY']['cu_iso_3']; } switch ($settings['COUNTRY_ISO_NR']) { case '528': case '276': $settings['CURRENCY'] = '€'; break; default: $settings['CURRENCY'] = $settings['CURRENCY_ARRAY']['cu_symbol_left']; break; } } if (!$this->cookie['selected_currency']) { $this->cookie['selected_currency'] = $settings['DEFAULT_CURRENCY']; } if ($this->cookie['selected_currency']) { // load customer selected currency $settings['CUSTOMER_CURRENCY_ARRAY'] = mslib_befe::loadCurrency($this->cookie['selected_currency'], 'cu_iso_3'); $settings['CUSTOMER_CURRENCY'] = $settings['CUSTOMER_CURRENCY_ARRAY']['cu_symbol_left']; } //hook to let other plugins further manipulate the settings if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['loadConfiguration'])) { $params = array('settings' => &$settings, 'this' => &$this); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['loadConfiguration'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } $this->configurationArray = $settings; }
if ($this->ms['MODULES']['CHECKOUT_ENABLE_STATE']) { $state_block .= '<div class="account-field col-sm-12" id="input-state"> <label class="account-state" for="state">' . ucfirst($this->pi_getLL('state')) . '*</label> <input type="text" name="state" id="state" class="state" value="' . htmlspecialchars($user['state']) . '" > </div>'; } $markerArray['###STATE_BLOCK###'] = $state_block; // // load countries $country_block = ''; $delivery_country_block = ''; if (count($enabled_countries) == 1) { $country_block .= '<input name="country" type="hidden" value="' . mslib_befe::strtolower($enabled_countries[0]['cn_short_en']) . '" />'; $delivery_country_block .= '<input name="delivery_country" type="hidden" value="' . mslib_befe::strtolower($enabled_countries[0]['cn_short_en']) . '" />'; } else { $default_country = mslib_fe::getCountryByIso($this->ms['MODULES']['COUNTRY_ISO_NR']); if (!$user['country']) { $user['country'] = $default_country['cn_short_en']; } if (!$user['delivery_country']) { $user['delivery_country'] = $default_country['cn_short_en']; } foreach ($enabled_countries as $country) { $tmpcontent_con .= '<option value="' . mslib_befe::strtolower($country['cn_short_en']) . '" ' . (mslib_befe::strtolower($user['country']) == mslib_befe::strtolower($country['cn_short_en']) ? 'selected' : '') . '>' . htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $country['cn_short_en'])) . '</option>'; $tmpcontent_con_delivery .= '<option value="' . mslib_befe::strtolower($country['cn_short_en']) . '" ' . (mslib_befe::strtolower($user['delivery_country']) == mslib_befe::strtolower($country['cn_short_en']) ? 'selected' : '') . '>' . htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $country['cn_short_en'])) . '</option>'; } if ($tmpcontent_con) { $country_block .= ' <div class="account-field col-sm-' . ($this->conf['multistep_checkout_address_tmpl_path'] ? '12' : '8') . '" id="input-country"> <label for="country" id="account-country">' . ucfirst($this->pi_getLL('country')) . '*</label> <select name="country" id="country" class="country" required="required" data-h5-errorid="invalid-country" title="' . $this->pi_getLL('country_is_required') . '">
function createStoreTTAddress() { $str = "select uid from tt_address where tx_multishop_address_type='store' and pid='" . $this->conf['fe_customer_pid'] . "' and tx_multishop_customer_id='0' and tx_multishop_default='0'"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); if (!$GLOBALS['TYPO3_DB']->sql_num_rows($qry)) { $default_iso_nr = 276; // germany if (!empty($this->ms['MODULES']['COUNTRY_ISO_NR']) && $this->ms['MODULES']['COUNTRY_ISO_NR'] > 0) { $default_iso_nr = $this->ms['MODULES']['COUNTRY_ISO_NR']; } $default_country = mslib_fe::getCountryByIso($default_iso_nr); $array = array(); $array['pid'] = $this->conf['fe_customer_pid']; $array['name'] = 'Store'; $array['country'] = $default_country['cn_short_en']; $array['tx_multishop_customer_id'] = 0; $array['tx_multishop_default'] = 0; $array['tx_multishop_address_type'] = 'store'; $array['page_uid'] = $this->showCatalogFromPage; $array['tstamp'] = time(); $query2 = $GLOBALS['TYPO3_DB']->INSERTquery('tt_address', $array); $res2 = $GLOBALS['TYPO3_DB']->sql_query($query2); $store_tt_address_id = $GLOBALS['TYPO3_DB']->sql_insert_id(); } else { $tt_rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry); $str = "UPDATE `tt_address` SET page_uid='" . $this->showCatalogFromPage . "' where uid='" . $tt_rec['uid'] . "'"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); $store_tt_address_id = $tt_rec['uid']; } return $store_tt_address_id; }