public function getAddressInfo($type = 'shop', $customer_id = 0) { if ($this->conf['cacheConfiguration']) { $CACHE_FRONT_END = 1; } else { $CACHE_FRONT_END = 0; } if ($CACHE_FRONT_END) { $this->cacheLifeTime = 2592000; $options = array('caching' => true, 'cacheDir' => $this->DOCUMENT_ROOT . 'uploads/tx_multishop/tmp/cache/', 'lifeTime' => $this->cacheLifeTime); $Cache_Lite = new Cache_Lite($options); $string = $this->cObj->data['uid'] . '_ADDRESS_' . $type . '_' . $customer_id . '_' . $this->conf['tt_address_record_id_store'] . '_' . $this->conf['fe_customer_pid']; } if (!$CACHE_FRONT_END or $CACHE_FRONT_END and !($data = $Cache_Lite->get($string))) { if ($type == 'shop') { $sql_tt_address = "select *, tta.uid as tt_uid, sc.cn_iso_nr from tt_address tta, static_countries sc where tta.deleted=0 and tta.hidden=0 and tta.uid='" . addslashes($this->conf['tt_address_record_id_store']) . "' and tta.country=sc.cn_short_en"; $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address); if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_tt_address) > 0) { $data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_tt_address); } else { if ($this->ADMIN_USER) { echo '<h1>Admin Error Message</h1>'; $sql_tt_address = "select * from tt_address where uid='" . addslashes($this->conf['tt_address_record_id_store']) . "'"; $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address); if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_tt_address) > 0) { // tt_address record has been found, but the country field does not contain a valid english country name echo 'System could fetch the store tt address record, but it contains an invalid country name (that is not found in static_countries table). Make sure you define the country field in tt address record in English. I.e. Netherlands, Germany, Austria etc.'; exit; } echo 'System could not fetch the store tt address record id. Maybe the value of tt_address_record_id_store is incorrect?<br />Query: ' . $sql_tt_address; $sql_tt_address = "select * from tt_address where deleted=0 and hidden=0 and tx_multishop_address_type='store' and tx_multishop_customer_id=0 and page_uid='" . $this->showCatalogFromPage . "' and pid='" . $this->conf['fe_customer_pid'] . "'"; $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address); if (!$GLOBALS['TYPO3_DB']->sql_num_rows($qry_tt_address) > 0) { $item = array(); $item['html'] = mslib_befe::RunMultishopUpdate(); $json = mslib_befe::array2json($item); } $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address); if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_tt_address) > 0) { $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address); $row_tt_address = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_tt_address); $recordId = $row_tt_address['uid']; echo '<br /><br />Add the following line to your TYPO3 template (constants field):<br />plugin.multishop.tt_address_record_id_store=' . $recordId; } exit; } else { // old fallback mode to bypass bugs $sql_tt_address = "select * from tt_address where deleted=0 and hidden=0 and tx_multishop_address_type='store' and tx_multishop_customer_id=0 and page_uid='" . $this->showCatalogFromPage . "' and pid='" . $this->conf['fe_customer_pid'] . "'"; $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address); $data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_tt_address); } } } elseif ($type == 'customer') { // Use wider query to prevent migration bugs $sql_tt_address = "select * from tt_address where deleted=0 and hidden=0 and tx_multishop_customer_id=" . $customer_id . ""; //$sql_tt_address="select * from tt_address where deleted=0 and hidden=0 and tx_multishop_customer_id=".$customer_id." and page_uid='".$this->showCatalogFromPage."' and pid='".$this->conf['fe_customer_pid']."'"; $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address); while ($row_tt_address = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_tt_address)) { if ($row_tt_address['tx_multishop_default'] == 1) { $data['default'] = $row_tt_address; } else { $data['delivery'][] = $row_tt_address; } } } if ($CACHE_FRONT_END) { $Cache_Lite->save(serialize($data)); } return $data; } else { return unserialize($data); } return false; }
} } else { $erno_str = '<div class="erno_message well text-danger"><ul>' . implode("\n", $erno) . '</ul></div>'; $return_data['status'] = 'NOTOK'; $return_data['reason'] = $erno_str; } echo json_encode($return_data); exit; } } exit; break; case 'update_multishop': if ($this->ADMIN_USER) { $item = array(); $item['html'] = mslib_befe::RunMultishopUpdate(); $json = mslib_befe::array2json($item); echo $json; } exit; break; case 'admin_panel_ajax_search': if ($this->ADMIN_USER) { require \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/ajax_pages/admin_panel_ajax_search.php'; } exit; break; case 'ajax_products_search': require \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/ajax_pages/ajax_products_search.php'; exit; break;
$query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_configuration', 'configuration_key=\'MULTISHOP_VERSION\'', $array); $res = $GLOBALS['TYPO3_DB']->sql_query($query); //TODO later we will execute the update method from here, instead of outside this if statement $this->runUpdate = 1; } } if ($this->runUpdate) { $runAutoUpdate = 1; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/meta_tags.php']['runAutoUpdatePreProc'])) { $params = array('runAutoUpdate' => &$runAutoUpdate); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/meta_tags.php']['runAutoUpdatePreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if ($runAutoUpdate) { mslib_befe::RunMultishopUpdate(); } } //mslib_befe::RunMultishopUpdate(); // temporary we compare the database for reach request, so the developer doesnt need to press manual button Compare database within the admin panel. //mslib_befe::RunMultishopUpdate(); // application top things that are only runned the first time when the plugin is initiated if ($this->get['categories_id'] or $this->get['products_id']) { if (strstr($this->ms['MODULES']['CRUMBAR_TYPE'], "/")) { require $this->DOCUMENT_ROOT . $this->ms['MODULES']['CRUMBAR_TYPE'] . '.php'; } elseif ($this->ms['MODULES']['CRUMBAR_TYPE']) { require \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/front_pages/includes/crumbar/' . $this->ms['MODULES']['CRUMBAR_TYPE'] . '.php'; } else { require \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/front_pages/includes/crumbar/default.php'; } if ($crum) {