die('Access denied.'); } if (!$this->imageWidth) { $this->imageWidth = '100'; } if ($show_default_header) { $content .= '<div class="main-heading"><h2>' . trim($current['categories_name']) . '</h2></div>'; } $content .= '<ul class="product_listing">'; $counter = 0; foreach ($products as $current_product) { $where = ''; if ($current_product['categories_id']) { // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($current_product['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $cat) { $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); $where .= '&'; } // get all cats to generate multilevel fake url eof } $link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $current_product['products_id'] . '&tx_multishop_pi1[page_section]=products_detail'); $catlink = mslib_fe::typolink($this->conf['products_listing_page_pid'], '&' . $where . '&tx_multishop_pi1[page_section]=products_listing'); $counter++;
} $return_data[$counter]['text'] = htmlentities(implode(" > ", $catsname) . ' > ' . $row['products_name']); $return_data[$counter]['id'] = $row['products_id']; $counter++; } } } else { $products = mslib_fe::getProductsPageSet($filter, 0, 100, array($prefix . 'products_name asc')); $counter = 0; foreach ($products['products'] as $product) { if ($product['products_name'] && !empty($product['products_name'])) { $catsname = array(); if ($product['categories_id']) { // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($product['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $cat) { $catsname[] = $cat['name']; } } // get all cats to generate multilevel fake url eof } $return_data[$counter]['text'] = htmlspecialchars(implode(" > ", $catsname) . ' > ' . $product['products_name']); $return_data[$counter]['id'] = $product['products_id']; $counter++; } } }
$where .= "categories_id[" . $level . "]=" . $cat['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); $where .= '&'; } // get all cats to generate multilevel fake url eof } $product_detail_link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $rs['products_id'] . '&tx_multishop_pi1[page_section]=products_detail'); // view product link eof $tmp_product_categories = mslib_fe::getProductToCategories($rs['products_id'], $rs['categories_id']); $product_categories = explode(',', $tmp_product_categories); $cat_crumbar = ''; foreach ($product_categories as $product_category) { $cat_crumbar .= '<ul class="msAdminCategoriesCrum list-inline">'; $cats = mslib_fe::Crumbar($product_category); $teller = 0; $total = count($cats); for ($i = $total - 1; $i >= 0; $i--) { $teller++; // get all cats to generate multilevel fake url eof if ($total == $teller) { $class = 'lastItem'; } else { $class = ''; } $cat_crumbar .= '<li class="' . $class . '"><a href="' . mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=edit_category&cid=' . $cats[$i]['id'] . '&action=edit_category') . '">' . $cats[$i]['name'] . '</a></li>'; } $cat_crumbar .= '</ul>'; } $status = '';
$cols = array(); if ($current['content']) { $content .= mslib_fe::htmlBox($current['categories_name'], $current['content'], 1); } else { $content .= '<div class="main-heading"><h1>' . $current['categories_name'] . '</h1></div>'; } $counter = 0; foreach ($categories as $category) { $html = ''; if ($category['categories_name']) { $counter++; if (mslib_fe::hasProducts($category['categories_id'])) { // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($category['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $item) { $where .= "categories_id[" . $level . "]=" . $item['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); $where .= '&'; } $where .= 'categories_id[' . $level . ']=' . $category['categories_id']; // get all cats to generate multilevel fake url eof if ($category['categories_external_url']) { $link = $category['categories_external_url']; } else {
function renderInterface($params, &$that) { mslib_fe::init($that); //hook to let other plugins further manipulate the method if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_mslib_admin_interface.php']['renderInterfacePreProc'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_mslib_admin_interface.php']['renderInterfacePreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } // for pagination $this->get = $that->get; $this->post = $that->post; if ($this->post) { if ($params['postErno']) { if (count($params['postErno'])) { $returnMarkup = ' <div style="display:none" id="msAdminPostMessage"> <table class="table table-striped table-bordered"> <thead> <tr> <th class="text-center">Status</th> <th>Message</th> </tr> </thead> <tbody> '; foreach ($params['postErno'] as $item) { switch ($item['status']) { case 'error': $item['status'] = '<span class="fa-stack text-danger"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-thumbs-down fa-stack-1x fa-inverse"></i></span>'; break; case 'info': $item['status'] = '<span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-thumbs-up fa-stack-1x fa-inverse"></i></span>'; break; } $returnMarkup .= '<tr><td class="text-center">' . $item['status'] . '</td><td>' . $item['message'] . '</td></tr>' . "\n"; } $returnMarkup .= '</tbody></table></div>'; $tableContent .= $returnMarkup; $GLOBALS['TSFE']->additionalHeaderData[] = '<script type="text/javascript" data-ignore="1"> jQuery(document).ready(function ($) { $.confirm({ title: \'\', content: $(\'#msAdminPostMessage\').html() }); }); </script> '; } } } $updateCookie = 0; if ($that->get['Search'] and $that->get['limit'] != $that->cookie['limit']) { $that->cookie['limit'] = $that->get['limit']; $updateCookie = 1; } if ($that->get['Search'] and $that->get['display_all_records'] != $that->cookie['display_all_records']) { $that->cookie['display_all_records'] = $that->get['display_all_records']; $updateCookie = 1; } if ($updateCookie) { $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_multishop_cookie', $that->cookie); $GLOBALS['TSFE']->storeSessionData(); } if ($that->cookie['display_all_records']) { $that->get['display_all_records'] = $that->cookie['display_all_records']; } else { $that->get['display_all_records'] = ''; } if ($that->cookie['limit']) { $that->get['limit'] = $that->cookie['limit']; } else { $that->get['limit'] = 50; } $that->ms['MODULES']['PAGESET_LIMIT'] = $that->get['limit']; if ($params['settings']['limit'] && is_numeric($params['settings']['limit'])) { $that->ms['MODULES']['PAGESET_LIMIT'] = $params['settings']['limit']; } if (is_numeric($that->get['p'])) { $p = $that->get['p']; } $that->searchKeywords = array(); if ($that->get['tx_multishop_pi1']['keyword']) { // using $_REQUEST cause TYPO3 converts "Command & Conquer" to "Conquer" (the & sign sucks ass) $that->get['tx_multishop_pi1']['keyword'] = trim($that->get['tx_multishop_pi1']['keyword']); $that->get['tx_multishop_pi1']['keyword'] = $GLOBALS['TSFE']->csConvObj->utf8_encode($that->get['tx_multishop_pi1']['keyword'], $GLOBALS['TSFE']->metaCharset); $that->get['tx_multishop_pi1']['keyword'] = $GLOBALS['TSFE']->csConvObj->entities_to_utf8($that->get['tx_multishop_pi1']['keyword'], true); $that->get['tx_multishop_pi1']['keyword'] = mslib_fe::RemoveXSS($that->get['tx_multishop_pi1']['keyword']); $that->searchKeywords[] = $that->get['tx_multishop_pi1']['keyword']; $that->searchMode = '%keyword%'; } $limit_search_result_selectbox = '<select name="limit" class="form-control">'; $limits = array(); $limits[] = '10'; $limits[] = '15'; $limits[] = '20'; $limits[] = '25'; $limits[] = '30'; $limits[] = '40'; $limits[] = '50'; $limits[] = '100'; $limits[] = '150'; $limits[] = '200'; $limits[] = '250'; $limits[] = '300'; $limits[] = '350'; $limits[] = '400'; $limits[] = '450'; $limits[] = '500'; $limits[] = '600'; $limits[] = '700'; $limits[] = '800'; $limits[] = '900'; $limits[] = '1000'; $limits[] = '1500'; $limits[] = '2000'; $limits[] = '2500'; $limits[] = '3000'; $limits[] = '3500'; foreach ($limits as $limit) { $limit_search_result_selectbox .= '<option value="' . $limit . '"' . ($limit == $that->get['limit'] ? ' selected="selected"' : '') . '>' . $limit . '</option>'; } $limit_search_result_selectbox .= '</select>'; $queryData = array(); $queryData['where'] = array(); if (count($that->searchKeywords)) { $keywordOr = array(); $that->searchMode = '%keyword%'; foreach ($that->searchKeywords as $searchKeyword) { if ($searchKeyword) { switch ($that->searchMode) { case 'keyword%': $that->sqlKeyword = addslashes($searchKeyword) . '%'; break; case '%keyword%': default: $that->sqlKeyword = '%' . addslashes($searchKeyword) . '%'; break; } if (is_array($params['query']['keywordSearchByColumns']) && count($params['query']['keywordSearchByColumns'])) { foreach ($params['query']['keywordSearchByColumns'] as $col) { $keywordOr[] = $col . " like '" . $that->sqlKeyword . "'"; } } } } if (is_array($keywordOr) && count($keywordOr)) { $queryData['where'][] = "(" . implode(" OR ", $keywordOr) . ")"; } } if ($params['query']['where']) { if (is_array($params['query']['where'])) { $queryData['where'] = array_merge(array_values($queryData['where']), array_values($params['query']['where'])); } else { $queryData['where'][] = $params['query']['where']; } } switch ($that->get['tx_multishop_pi1']['order_by']) { default: if (is_array($params['query']['defaultOrderByColumns']) && count($params['query']['defaultOrderByColumns'])) { $order_by = implode(',', $params['query']['defaultOrderByColumns']); } break; } switch ($that->get['tx_multishop_pi1']['order']) { case 'a': $order = 'asc'; $order_link = 'd'; break; case 'd': $order = 'desc'; $order_link = 'a'; break; default: if ($params['query']['defaultOrder'] == 'asc') { $order = 'asc'; $order_link = 'd'; } else { $order = 'desc'; $order_link = 'a'; } break; } $orderby[] = $order_by . ' ' . $order; if (is_array($params['query']['select'])) { $queryData['select'] = implode(',', $params['query']['select']); } else { $queryData['select'] = $params['query']['select']; } if (is_array($params['query']['from'])) { $queryData['from'] = implode(',', $params['query']['from']); } else { $queryData['from'] = $params['query']['from']; } if (is_array($params['query']['group_by'])) { $queryData['group_by'] = implode(',', $params['query']['group_by']); } elseif ($params['query']['group_by']) { $queryData['group_by'][] = $params['query']['group_by']; } if (is_array($params['query']['having'])) { $queryData['having'] = $params['query']['having']; } elseif ($params['query']['having']) { $queryData['having'][] = $params['query']['having']; } $queryData['order_by'] = $orderby; $queryData['limit'] = $that->ms['MODULES']['PAGESET_LIMIT']; if (is_numeric($that->get['p'])) { $p = $that->get['p']; } if ($p > 0) { $queryData['offset'] = $p * $that->ms['MODULES']['PAGESET_LIMIT']; } else { $p = 0; $queryData['offset'] = 0; } if ($params['msDebug']) { $this->msDebug = 1; } //$this->msDebug=1; //echo print_r($queryData); //die(); $pageset = mslib_fe::getRecordsPageSet($queryData); if ($this->msDebug) { echo $this->msDebugInfo; die; } if ($params['returnResultsSet']) { return $pageset; } //echo print_r($queryData); //die(); if (count($pageset['dataset'])) { $tr_type = 'even'; if (!$params['settings']['disableForm']) { $tableContent .= '<form method="post" action="' . $params['postForm']['actionUrl'] . '" enctype="multipart/form-data">'; } $tableContent .= '<div class="table-responsive">'; $tableContent .= '<table class="table table-striped table-bordered" id="msAdminTableInterface">'; $tableContent .= '<tr><thead>'; if ($params['settings']['enableRowBasedCheckboxSelection']) { $headerData = ''; $headerData .= ' <script type="text/javascript"> jQuery(document).ready(function($) { $(\'#check_all_1\').click(function(){ $(\'td > div.checkbox > input:checkbox\').prop(\'checked\', this.checked); }); }); </script>'; $GLOBALS['TSFE']->additionalHeaderData[] = $headerData; $headerData = ''; $tableContent .= ' <th class="cellCheckbox"> <div class="checkbox checkbox-success checkbox-inline"> <input type="checkbox" id="check_all_1"> <label for="check_all_1"></label> </div> </th>'; } foreach ($params['tableColumns'] as $col => $valArray) { $tdClass = array(); if ($valArray['align']) { $tdClass[] = 'text-' . $valArray['align']; } if ($valArray['nowrap']) { $tdClass[] = 'cellNoWrap'; } if ($valArray['class']) { $tdClass[] = $valArray['class']; } $tableContent .= '<th' . (count($tdClass) ? ' class="' . implode(' ', $tdClass) . '"' : '') . '>' . $valArray['title'] . '</th>'; } $tableContent .= '</thead></tr><tbody>'; $summarize = array(); $recordCounter = 0; foreach ($pageset['dataset'] as $rowKey => $row) { $recordCounter++; if (!$tr_type or $tr_type == 'even') { $tr_type = 'odd'; } else { $tr_type = 'even'; } $tableContent .= '<tr class="' . $tr_type . '">'; if ($params['settings']['enableRowBasedCheckboxSelection'] && $params['settings']['rowBasedCheckboxSelectionKey']) { $headerData = ''; $headerData .= ' <script type="text/javascript"> jQuery(document).ready(function($) { $(\'#check_all_1\').click(function(){ $(\'td > div.checkbox > input:checkbox\').prop(\'checked\', this.checked); }); }); </script>'; $GLOBALS['TSFE']->additionalHeaderData[] = $headerData; $headerData = ''; $tableContent .= '<td class="cellCheckbox"> <div class="checkbox checkbox-success checkbox-inline"> <input type="checkbox" name="tx_multishop_pi1[tableOverviewSelection][]" id="tableOverviewSelectionCheckbox_' . $row[$params['settings']['rowBasedCheckboxSelectionKey']] . '" value="' . htmlspecialchars($row[$params['settings']['rowBasedCheckboxSelectionKey']]) . '"> <label for="tableOverviewSelectionCheckbox_' . $row[$params['settings']['rowBasedCheckboxSelectionKey']] . '"></label> </div> </td>'; } foreach ($params['tableColumns'] as $col => $valArray) { $originalValue = $row[$col]; switch ($valArray['valueType']) { case 'number_format_2_decimals': $row[$col] = round(number_format($row[$col], 2, '.', ''), 2); $summarize[$col] += $row[$col]; break; case 'number_format_thousand_seperator': $row[$col] = round(number_format($row[$col], 2, '.', ''), 2); break; case 'recordCounter': $row[$col] = $recordCounter; break; case 'download_invoice': $row[$col] = '<a href="uploads/tx_multishopexactonline/' . $row[$col] . '" target="_blank">' . $row[$col] . '</a>'; break; case 'currency': $summarize[$col] += $row[$col]; $row[$col] = mslib_fe::amount2Cents($row[$col], 0); break; case 'domain_name': if ($row[$col]) { $row[$col] = '<a href="http://' . $row[$col] . '" target="_blank">' . $row[$col] . '</a>'; } break; case 'datetime': if ($row[$col]) { $row[$col] = strftime("%x %X", strtotime($row[$col])); } else { $row[$col] = ''; } break; case 'timestamp': if (is_numeric($row[$col]) && $row[$col] > 0) { $row[$col] = strftime("%x %X", $row[$col]); } else { $row[$col] = ''; } break; case 'timestamp_to_day_date_time': if (is_numeric($row[$col]) && $row[$col] > 0) { $row[$col] = strftime("%a. %x<br/>%X", $row[$col]); } else { $row[$col] = ''; } break; case 'timestamp_to_date': if (is_numeric($row[$col]) && $row[$col] > 0) { $row[$col] = strftime("%x", $row[$col]); } else { $row[$col] = ''; } break; case 'form': $content = '<form method="'; switch ($valArray['formAction']) { case 'post': $content .= 'POST'; break; case 'get': default: $content .= 'GET'; break; } $content .= '" action="' . $valArray['actionUrl'] . '" enctype="multipart/form-data">'; if ($valArray['content']) { $content .= $valArray['content']; } if (is_array($valArray['hiddenFields'])) { foreach ($valArray['hiddenFields'] as $hiddenFieldKey => $hiddenFieldVal) { foreach ($row as $tmpCol => $tmpVal) { $hiddenFieldVal = str_replace('###' . $tmpCol . '###', $row[$tmpCol], $hiddenFieldVal); } $content .= '<input name="' . $hiddenFieldKey . '" type="hidden" value="' . $hiddenFieldVal . '" />'; } } $content .= '</form>'; $row[$col] = $content; break; case 'content': foreach ($row as $tmpCol => $tmpVal) { $valArray['content'] = str_replace('###' . $tmpCol . '###', $row[$tmpCol], $valArray['content']); } $row[$col] = $valArray['content']; break; case 'products_detail_page_link': $where = ''; if ($row['categories_id']) { // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($row['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $cat) { $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); $where .= '&'; } // get all cats to generate multilevel fake url eof } $product_detail_link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $row['products_id'] . '&tx_multishop_pi1[page_section]=products_detail', 1); $row[$col] = '<a href="' . $product_detail_link . '" target="_blank">' . htmlspecialchars($row['products_name']) . '</a>'; break; case 'boolean': $status_html = ''; if (!$row[$col]) { $status_html .= '<span class="admin_status_red" alt="' . $this->pi_getLL('no') . '"></span>'; } else { $status_html .= '<span class="admin_status_green" alt="' . $this->pi_getLL('yes') . '"></span>'; } $row[$col] = $status_html; break; case 'booleanToggle': $status_html = ''; if (!$row[$col]) { $status_html .= '<span class="admin_status_red" alt="' . $this->pi_getLL('disable') . '"></span>'; if ($valArray['hrefEnable']) { foreach ($row as $tmpCol => $tmpVal) { $valArray['hrefEnable'] = str_replace('###' . $tmpCol . '###', $row[$tmpCol], $valArray['hrefEnable']); } $status_html .= '<a href="' . $valArray['hrefEnable'] . '"><span class="admin_status_green disabled" alt="' . $this->pi_getLL('enabled') . '"></span></a>'; } } else { if ($valArray['hrefDisable']) { foreach ($row as $tmpCol => $tmpVal) { $valArray['hrefDisable'] = str_replace('###' . $tmpCol . '###', $row[$tmpCol], $valArray['hrefDisable']); } $status_html .= '<a href="' . $valArray['hrefDisable'] . '"><span class="admin_status_red disabled" alt="' . $this->pi_getLL('disabled') . '"></span></a>'; } $status_html .= '<span class="admin_status_green" alt="' . $this->pi_getLL('enable') . '"></span>'; } $row[$col] = $status_html; break; } $adjustedValue = $row[$col]; if ($valArray['href']) { foreach ($row as $tmpCol => $tmpVal) { $valArray['href'] = str_replace('###' . $tmpCol . '###', $row[$tmpCol], $valArray['href']); } $adjustedValue = '<a ' . ($valArray['hrefNoFollow'] ? ' rel="nofollow"' : '') . ' href="' . $valArray['href'] . '"' . ($valArray['href_target'] ? ' target="' . $valArray['href_target'] . '""' : '') . '>' . $adjustedValue . '</a>'; } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_admin_interface.php']['tableColumnsPreProc'])) { $conf = array('col' => &$col, 'row' => &$row, 'originalValue' => &$originalValue, 'adjustedValue' => &$adjustedValue, 'params' => &$params, 'valArray' => &$valArray, 'summarize' => &$summarize); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_admin_interface.php']['tableColumnsPreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $conf, $that); } } $tdClass = array(); if ($valArray['align']) { $tdClass[] = 'text-' . $valArray['align']; } if ($valArray['nowrap']) { $tdClass[] = 'cellNoWrap'; } if ($valArray['class']) { $tdClass[] = $valArray['class']; } $tableContent .= '<td' . (count($tdClass) ? ' class="' . implode(' ', $tdClass) . '"' : '') . '>' . $adjustedValue . '</td>'; } $tableContent .= '</tr>'; if ($params['settings']['returnResultSetAsArray']) { $pageset['dataset'][$rowKey] = $row; } } $tableContent .= '</tbody>'; if (!$params['settings']['skipSummarize']) { // Summarize footer $tableContent .= '<tfoot><tr>'; if ($params['settings']['enableRowBasedCheckboxSelection']) { $tableContent .= '<th></th>'; } foreach ($params['tableColumns'] as $col => $valArray) { switch ($valArray['valueType']) { case 'currency': $row[$col] = mslib_fe::amount2Cents($summarize[$col], 0); break; case 'number_format_2_decimals': $row[$col] = round(number_format($summarize[$col], 2, ',', '.'), 2); break; default: $row[$col] = $valArray['title']; break; } $tdClass = array(); if ($valArray['align']) { $tdClass[] = 'text-' . $valArray['align']; } if ($valArray['nowrap']) { $tdClass[] = 'cellNoWrap'; } if ($valArray['class']) { $tdClass[] = $valArray['class']; } $tableContent .= '<th' . (count($tdClass) ? ' class="' . implode(' ', $tdClass) . '"' : '') . '>' . $row[$col] . '</th>'; // $tableContent.='<th'.($valArray['align'] ? ' class="text-'.$valArray['align'].'"' : '').($valArray['nowrap'] ? ' nowrap' : '').'>'.$row[$col].'</th>'; } $tableContent .= '</tr></tfoot>'; } $tableContent .= '</table>'; if ($params['settings']['enableActionSelectionForm'] && is_array($params['settings']['tableSelectionActions']) && count($params['settings']['tableSelectionActions'])) { $actions = $params['settings']['tableSelectionActions']; if (count($actions)) { // custom page hook that can be controlled by third-party plugin eof $action_selectbox .= '<select name="tx_multishop_pi1[action]" id="msAdminTableAction" class="form-control"><option value="">' . htmlspecialchars($this->pi_getLL('choose_action')) . '</option>'; foreach ($actions as $key => $value) { $action_selectbox .= '<option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>'; } $action_selectbox .= '</select>'; $tableContent .= $action_selectbox; } } if ($params['settings']['contentBelowTable']) { $tableContent .= $params['settings']['contentBelowTable']; } if ($params['settings']['enableActionSelectionForm'] && is_array($params['settings']['tableSelectionActions']) && count($params['settings']['tableSelectionActions'])) { $tableContent .= '<div class="form-group"> <input class="btn btn-success" type="submit" name="submit" value="' . htmlspecialchars($this->pi_getLL('submit_form')) . '" /> </div>'; } $tableContent .= ' </div> '; if (!$params['settings']['disableForm']) { $tableContent .= '</form>'; } // pagination $paginationMarkup = ''; if (!$params['settings']['skipPaginationMarkup'] and $pageset['total_rows'] > $that->ms['MODULES']['PAGESET_LIMIT']) { $total_pages = ceil($pageset['total_rows'] / $that->ms['MODULES']['PAGESET_LIMIT']); require \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/admin_pages/includes/admin_pagination.php'; $paginationMarkup = $tmp; $tableContent .= $tmp; $tmp = ''; } // pagination eof } $content = ''; $content .= '<div class="panel panel-default">'; $content .= '<div class="panel-heading">'; if ($params['interfaceTitle']) { $interfaceTitle = $params['interfaceTitle']; } else { $interfaceTitle = $params['title']; } $content .= '<h3>' . htmlspecialchars($interfaceTitle) . '</h3>'; if (is_array($params['settings']['headingButtons'])) { $content .= '<div class="form-inline">'; foreach ($params['settings']['headingButtons'] as $headingButton) { $content .= '<a href="' . $headingButton['href'] . '" class="' . $headingButton['btn_class'] . '"' . ($headingButton['attributes'] ? ' ' . $headingButton['attributes'] : '') . '><i class="' . $headingButton['fa_class'] . '"></i> ' . htmlspecialchars($headingButton['title']) . '</a> '; } $content .= '</div>'; } $content .= '</div>'; $content .= '<div class="panel-body">'; if (!$params['settings']['skipTabMarkup']) { $GLOBALS['TSFE']->additionalHeaderData['msAdminTabJs'] = '<script type="text/javascript"> jQuery(document).ready(function ($) { $(\'.nav-tabs a:first\').tab(\'show\'); }); </script> '; $content .= ' <div id="tab-container"> <ul class="nav nav-tabs" id="admin_orders" role="tablist"> <li role="presentation"><a href="#CmsListing" aria-controls="profile" role="tab" data-toggle="tab">' . htmlspecialchars($params['title']) . '</a></li> </ul> <div class="tab-content"> '; } $searchForm = ''; if ($params['settings']['enableKeywordSearch']) { $searchForm = ' <form id="form1" name="form1" method="get" action="index.php"> <div class="well"> <div class="row formfield-container-wrapper"> '; foreach ($params['searchForm']['hiddenFields'] as $key => $val) { $searchForm .= '<input name="' . $key . '" type="hidden" value="' . htmlspecialchars($val) . '" />' . "\n"; } $searchForm .= ' <div class="col-sm-8 formfield-wrapper"> <div class="form-inline"> <label class="control-label">' . $that->pi_getLL('keyword') . '</label> <input type="text" name="tx_multishop_pi1[keyword]" class="form-control" value="' . htmlspecialchars($that->get['tx_multishop_pi1']['keyword']) . '" /> <input type="submit" name="Search" class="btn btn-success" value="' . $that->pi_getLL('search') . '" /> </div> </div> <div class="col-sm-4 formfield-wrapper"> <div class="pull-right form-inline"> <label class="control-label">' . $that->pi_getLL('limit_number_of_records_to') . '</label> ' . $limit_search_result_selectbox . ' </div> </div> </div> </div> </form> '; //hook to let other plugins further manipulate the method if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_mslib_admin_interface.php']['setAdminInterfaceSearchFormPostProc'])) { $interfaceKey =& $this->interfaceKey; $params_searchform = array('interfaceKey' => &$interfaceKey, 'searchForm' => &$searchForm, 'adminInterfaceParams' => &$params); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_mslib_admin_interface.php']['setAdminInterfaceSearchFormPostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params_searchform, $this); } } } if (!$params['settings']['skipTabMarkup']) { $content .= ' <div role="tabpanel" id="CmsListing" class="tab-pane"> ' . $searchForm . ' ' . $tableContent . ' </div> </div> </div> '; } else { $content .= $searchForm . $tableContent; } if ($params['settings']['skipRecordCount'] || $params['settings']['skipRecordCountWhenZeroResults'] && !$pageset['total_rows']) { $skipRecordCount = 1; } if ($params['settings']['skipTotalCount'] || $params['settings']['skipTotalCountWhenZeroResults'] && !$params['summarizeData']['totalRecordsInTable']) { $skipTotalCount = 1; } if (!$skipRecordCount) { $content .= '<p class="text-center">' . $this->pi_getLL('found_records') . ': <strong>' . number_format($pageset['total_rows'], 0, '', '.') . '</strong></p>'; } if (!$skipTotalCount && isset($params['summarizeData']['totalRecordsInTable'])) { $content .= '<p class="text-center">' . $this->pi_getLL('total_records_in_database') . ': <strong>' . number_format($params['summarizeData']['totalRecordsInTable'], 0, '', '.') . '</strong></p>'; } if (!$params['settings']['skipFooterMarkup']) { $content .= '<hr><div class="clearfix"><a class="btn btn-success msAdminBackToCatalog" href="' . mslib_fe::typolink() . '"><span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-arrow-left fa-stack-1x"></i></span> ' . $that->pi_getLL('admin_close_and_go_back_to_catalog') . '</a></div>'; } $content .= '</div>'; $content .= '</div>'; if ($params['settings']['returnOnlyWhenRecordsFound'] && !$pageset['total_rows']) { //return; } else { if ($params['settings']['returnResultSetAsArray']) { $array = array(); $array['searchForm'] = $searchForm; $array['paginationMarkup'] = $paginationMarkup; $array['dataset'] = $pageset['dataset']; return $array; } else { return $content; } } }
public function convertProductToFlat($products_id, $table_name = 'tx_multishop_products_flat') { if (!is_numeric($products_id)) { return false; } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['convertProductToFlat'])) { $params = array('status' => $status, 'table' => $table, 'id' => $id, 'this' => &$this); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['convertProductToFlat'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } else { if ($table_name == 'tx_multishop_products_flat') { $qry = $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_multishop_products_flat', "products_id='" . $products_id . "'"); } // retrieving the products record $select = array(); $select[] = '*'; $select[] = 's.status as special_status'; $select[] = 'pd.language_id'; $select[] = 'p2c.sort_order as p2c_sort_order'; $select[] = 'p.staffel_price as staffel_price'; $select[] = 'o.code as order_unit_code'; $select[] = 'od.name as order_unit_name'; // old v2 code // $select[]='tr.tx_rate as tax_rate'; $select[] = 'IF(s.status, s.specials_new_products_price, p.products_price) as final_price'; $select[] = 'p2c.sort_order'; $from = array(); // old v2 code $from[] = 'tx_multishop_products p left join tx_multishop_specials s on p.products_id = s.products_id left join tx_multishop_manufacturers m on p.manufacturers_id=m.manufacturers_id left join tx_multishop_order_units o on p.order_unit_id=o.id left join tx_multishop_order_units_description od on o.id=od.order_unit_id and od.language_id=0 '; $from[] = 'tx_multishop_products_description pd'; $from[] = 'tx_multishop_products_to_categories p2c'; $from[] = 'tx_multishop_categories c'; $from[] = 'tx_multishop_categories_description cd'; $where = array(); $where[] = 'c.status=1'; $where[] = 'p.products_status=1'; $where[] = "p2c.products_id='" . $products_id . "'"; $where[] = 'p2c.is_deepest=1'; $where[] = 'p.products_id=pd.products_id'; $where[] = 'p.products_id=p2c.products_id'; $where[] = 'p2c.categories_id=c.categories_id'; $where[] = 'p2c.categories_id=cd.categories_id'; $where[] = 'pd.language_id=cd.language_id'; $orderby = array(); $orderby[] = 'pd.language_id'; $query_elements = array(); $query_elements['select'] =& $select; $query_elements['from'] =& $from; $query_elements['where'] =& $where; $query_elements['groupby'] =& $groupby; $query_elements['orderby'] =& $orderby; $query_elements['limit'] =& $limit; // custom hook that can be controlled by third-party plugin if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['convertProductToFlatPreFetchProductHook'])) { $params = array('products_id' => &$products_id, 'query_elements' => &$query_elements); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['convertProductToFlatPreFetchProductHook'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } // custom hook that can be controlled by third-party plugin eof $str = $GLOBALS['TYPO3_DB']->SELECTquery(is_array($select) ? implode(",", $select) : '', is_array($from) ? implode(",", $from) : '', is_array($where) ? implode(" AND ", $where) : '', is_array($groupby) ? implode(",", $groupby) : '', is_array($orderby) ? implode(",", $orderby) : '', is_array($limit) ? implode(",", $limit) : ''); if ($this->debug) { $logString = $str; \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($logString, 'multishop', 0); } $qry = $GLOBALS['TYPO3_DB']->sql_query($str); $rows = $GLOBALS['TYPO3_DB']->sql_num_rows($qry); if ($this->conf['debugEnabled'] == '1') { $logString = 'convertProductToFlat query: ' . $str . '.'; \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($logString, 'multishop', 0); } if (!$rows) { $logString = 'convertProductToFlat fetch query returned zero results. Query: ' . $str; \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($logString, 'multishop', 3); } if ($rows) { while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) { // retrieving the categories path $flat_product = array(); $flat_product['language_id'] = $row['language_id']; $flat_product['products_id'] = $products_id; $flat_product['products_condition'] = $row['products_condition']; $flat_product['products_name'] = $row['products_name']; $flat_product['products_model'] = $row['products_model']; $flat_product['products_description'] = $row['products_description']; $flat_product['products_shortdescription'] = $row['products_shortdescription']; //$flat_product['products_extra_description']=$row['products_extra_description']; $flat_product['products_quantity'] = $row['products_quantity']; $flat_product['products_price'] = $row['products_price']; $flat_product['products_viewed'] = $row['products_viewed']; $flat_product['staffel_price'] = $row['staffel_price']; $flat_product['delivery_time'] = $row['delivery_time']; $flat_product['order_unit_id'] = $row['order_unit_id']; $flat_product['order_unit_code'] = $row['order_unit_code']; $flat_product['order_unit_name'] = $row['order_unit_name']; if ($row['specials_new_products_price'] && $row['special_status'] > 0) { $flat_product['final_price'] = $row['specials_new_products_price']; $flat_product['sstatus'] = 1; } else { $flat_product['final_price'] = $row['products_price']; } // now we are going to define the price filter start value, so we can search very fast on it $array = explode(";", $this->ms['MODULES']['PRICE_FILTER_BOX_STEPPINGS']); if (is_array($array) && count($array)) { $total = count($array); $tel = 0; foreach ($array as $item) { $tel++; $cols = explode("-", $item); if ($flat_product['final_price'] <= $cols[1]) { $flat_product['price_filter'] = $cols[0]; break; } if ($tel == $total) { if ($flat_product['final_price'] > $cols[1]) { $flat_product['price_filter'] = $cols[1]; } } } } // now we are going to define the price filter start value, so we can search very fast on it eof $flat_product['products_multiplication'] = $row['products_multiplication']; $flat_product['minimum_quantity'] = $row['minimum_quantity']; $flat_product['maximum_quantity'] = $row['maximum_quantity']; $flat_product['products_date_available'] = $row['products_date_available']; $flat_product['products_last_modified'] = $row['products_last_modified']; $flat_product['tax_id'] = $row['tax_id']; $flat_product['categories_id'] = $row['categories_id']; $flat_product['categories_name'] = $row['categories_name']; $flat_product['manufacturers_id'] = $row['manufacturers_id']; $flat_product['manufacturers_name'] = $row['manufacturers_name']; $flat_product['products_negative_keywords'] = $row['products_negative_keywords']; $flat_product['products_meta_title'] = $row['products_meta_title']; $flat_product['products_meta_description'] = $row['products_meta_description']; $flat_product['products_meta_keywords'] = $row['products_meta_keywords']; $flat_product['products_url'] = $row['products_url']; $flat_product['vendor_code'] = $row['vendor_code']; $flat_product['sku_code'] = $row['sku_code']; $flat_product['ean_code'] = $row['ean_code']; $flat_product['language_id'] = $row['language_id']; if ($flat_product['categories_id']) { // get all cats to generate multilevel fake url $level = 0; if ($row['page_uid']) { $cats = mslib_fe::Crumbar($flat_product['categories_id'], '', array(), $row['page_uid']); } else { $cats = mslib_fe::Crumbar($flat_product['categories_id']); } if (is_array($cats) && count($cats)) { $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { $i = 0; foreach ($cats as $cat) { $flat_product['categories_id_' . $i] = $cat['id']; $flat_product['categories_name_' . $i] = $cat['name']; $i++; } } // get all cats to generate multilevel fake url eof } } for ($x = 0; $x < $this->ms['MODULES']['NUMBER_OF_PRODUCT_IMAGES']; $x++) { $i = $x; if ($i == 0) { $i = ''; } $flat_product['products_image' . $i] = $row['products_image' . $i]; } if ($flat_product['products_image']) { $flat_product['contains_image'] = 1; } else { $flat_product['contains_image'] = 0; } $flat_product['products_date_added'] = $row['products_date_added']; $flat_product['products_weight'] = $row['products_weight']; $flat_product['sort_order'] = $row['p2c_sort_order']; $flat_product['product_capital_price'] = $row['product_capital_price']; $flat_product['page_uid'] = $row['page_uid']; $flat_product['starttime'] = $row['starttime']; $flat_product['endtime'] = $row['endtime']; if ($this->ms['MODULES']['FLAT_DATABASE_EXTRA_ATTRIBUTE_OPTION_COLUMNS'] and is_array($this->ms['FLAT_DATABASE_ATTRIBUTE_OPTIONS']) && count($this->ms['FLAT_DATABASE_ATTRIBUTE_OPTIONS'])) { foreach ($this->ms['FLAT_DATABASE_ATTRIBUTE_OPTIONS'] as $option_id => $array) { if ($option_id) { $option_values = mslib_fe::getProductsOptionValues($option_id, $flat_product['products_id']); if ($option_values[0]['products_options_values_name']) { $flat_product[$array[0]] = $option_values[0]['products_options_values_name']; } } } } // custom hook that can be controlled by third-party plugin if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['convertProductToFlatPreInsert'])) { $params = array('products_id' => &$products_id, 'flat_product' => &$flat_product, 'row' => &$row, 'table_name' => &$table_name); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['convertProductToFlatPreInsert'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } // custom hook that can be controlled by third-party plugin eof $flat_product = mslib_befe::rmNullValuedKeys($flat_product); $query = $GLOBALS['TYPO3_DB']->INSERTquery($table_name, $flat_product); $res = $GLOBALS['TYPO3_DB']->sql_query($query); if (!$res) { $logString = 'Query failed! Query: ' . $query; \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($logString, 'multishop', 3); } if ($this->debug) { //error_log($query); $logString = $query; \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($logString, 'multishop', 0); } // custom hook that can be controlled by third-party plugin if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['convertProductToFlatProcInsert'])) { $params = array('products_id' => &$products_id, 'flat_product' => &$flat_product, 'row' => &$row, 'table_name' => &$table_name); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['convertProductToFlatProcInsert'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } // custom hook that can be controlled by third-party plugin eof } } return $flat_product['products_id']; } }
function subMenuArray($dataArray) { if (count($dataArray['subs'])) { $tel = 0; foreach ($dataArray['subs'] as $item) { $menuArr[$tel]['title'] = $item['categories_name']; $menuArr[$tel]['uid'] = '9999' . $item['categories_id']; $menuArr[$tel]['description'] = $item['meta_description']; $menuArr[$tel]['keywords'] = $item['meta_keywords']; $menuArr[$tel]['image'] = ''; if ($item['categories_image']) { $menuArr[$tel]['image'] = '<img src="uploads/tx_multishop/images/categories/normal' . mslib_befe::getImagePath($item['categories_image'], 'categories', 'normal') . '" alt="' . htmlspecialchars($item['categories_name']) . '">'; } // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($item['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $tmp) { $where .= "categories_id[" . $level . "]=" . $tmp['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); } $link = mslib_fe::typolink($this->conf['shop_pid'], $where . '&tx_multishop_pi1[page_section]=products_listing'); $menuArr[$tel]['_OVERRIDE_HREF'] = $link; $sub_content = $this->subMenuArray($item); if ($sub_content) { $menuArr[$tel]['_SUB_MENU'] = $sub_content; } $tel++; } } return $menuArr; }
$mslib_cart->init($this); $mslib_cart->updateCart(); $link = mslib_fe::typolink($this->shoppingcart_page_pid, '&tx_multishop_pi1[page_section]=shopping_cart', 1); if ($link) { header("Location: " . $this->FULL_HTTP_URL . $link); exit; } } } if ($this->get['categories_id']) { $categories_id = $this->get['categories_id']; } elseif ($product['categories_id']) { $categories_id = $product['categories_id']; } if ($categories_id) { $GLOBALS["TYPO3_CONF_VARS"]['tx_multishop_data']['user_crumbar'] = mslib_fe::Crumbar($categories_id); } } // application top things that are only runned the first time when the plugin is initiated eof $meta_tags = array(); if ($this->ADMIN_USER) { /* // bind shortkeys $meta_tags['1_jquery'].=' <script type="text/javascript"> jQuery(document).ready(function($) { '; if ($this->get['products_id']) { $meta_tags['1_jquery'].='msAdminShortcutFunc(\'product\');'."\n"; } elseif ($this->get['categories_id']) { $meta_tags['1_jquery'].='msAdminShortcutFunc(\'category\');'."\n";
function isItemInFeedsStockExcludeList($feed_id, $exclude_id, $exclude_type = 'products') { if ($exclude_type == 'categories') { $cats = mslib_fe::Crumbar($exclude_id); $cats = array_reverse($cats); if (count($cats) > 0) { $negate_value = false; foreach ($cats as $cat) { $sql_check = "select id, negate from tx_multishop_catalog_to_feeds_stocks where feed_id='" . addslashes($feed_id) . "' and exclude_id='" . addslashes($cat['id']) . "' and negate=1 and exclude_type='categories'"; $qry_check = $GLOBALS['TYPO3_DB']->sql_query($sql_check); if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_check)) { $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_check); if ($row['negate']) { $negate_value = true; } else { $negate_value = false; } } } return $negate_value; } } else { if ($exclude_type == 'products') { $negate_value = false; $sql_check = "select id, negate from tx_multishop_catalog_to_feeds_stocks where feed_id='" . addslashes($feed_id) . "' and exclude_id='" . addslashes($exclude_id) . "' and negate=1 and exclude_type='products'"; $qry_check = $GLOBALS['TYPO3_DB']->sql_query($sql_check); if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_check)) { $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_check); if ($row['negate']) { $negate_value = true; } else { $negate_value = false; } } return $negate_value; } } return false; }
$query = $GLOBALS['TYPO3_DB']->SELECTquery('B.categories_id,C.categories_name', 'tx_multishop_products p, tx_multishop_products_description A INNER JOIN tx_multishop_products_to_categories B ON A.products_id = B.products_id INNER JOIN tx_multishop_categories_description C ON B.categories_id = C.categories_id', implode(" AND ", $filter), 'C.categories_id', 'C.categories_name ASC', ''); // error_log($query); // error_log($query); $pid_regs = array(); $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 ($row['categories_name']) { $productFilter = $filter; $productFilter[] = '(B.categories_id = ' . $row['categories_id'] . ' and B.is_deepest=1 and A.products_id <> ' . $this->post['pid'] . ')'; $query2 = $GLOBALS['TYPO3_DB']->SELECTquery('A.products_id, A.products_name, B.categories_id,C.categories_name', 'tx_multishop_products p, tx_multishop_products_description A INNER JOIN tx_multishop_products_to_categories B ON A.products_id = B.products_id INNER JOIN tx_multishop_categories_description C ON B.categories_id = C.categories_id', implode(" AND ", $productFilter), 'p.products_id', 'A.products_name ASC', ''); //error_log($query2); $res2 = $GLOBALS['TYPO3_DB']->sql_query($query2); $cheking_check = 0; if ($GLOBALS['TYPO3_DB']->sql_num_rows($res2) > 0) { $crum = mslib_fe::Crumbar($row['categories_id']); $crum = array_reverse($crum); $cats = array(); foreach ($crum as $item) { $cats[] = $item['name']; } $json_data['related_product'][$row['categories_id']]['categories_name'] = implode(" / ", $cats); $json_data['related_product'][$row['categories_id']]['products'] = array(); $product_counter = 0; while (($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2)) != false) { if (!in_array($row2['products_id'], $pid_regs)) { $json_data['related_product'][$row['categories_id']]['products'][$product_counter]['id'] = $row2['products_id']; $json_data['related_product'][$row['categories_id']]['products'][$product_counter]['name'] = $row2['products_name']; if ($row2['products_model']) { $json_data['related_product'][$row['categories_id']]['products'][$product_counter]['name'] .= ' - ' . $row2['products_model']; }
$rs_sp = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_sp); if ($rs_sp['specials_new_products_price'] == 0 || empty($rs_sp['specials_new_products_price'])) { $rs_sp['specials_new_products_price'] = 0; } $GLOBALS['TYPO3_DB']->sql_free_result($qry_sp); $catpath_buffer = array(); $sql2 = "select categories_id from tx_multishop_products_to_categories where products_id = " . $rs[0]; $qry2 = $GLOBALS['TYPO3_DB']->sql_query($sql2); $multicats = array(); while ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry2)) { $multicats[] = $row2['categories_id']; } $multicats = array_unique($multicats); foreach ($multicats as $multicat) { $tmp_path = ''; $cats = mslib_fe::Crumbar($multicat); $cats = array_reverse($cats); $total_cats = count($cats); $pctr = 1; foreach ($cats as $path) { $tmp_path .= $path['name']; if ($pctr < $total_cats) { $tmp_path .= '||'; } $pctr++; } $catpath_buffer[] = $tmp_path; } if (count($catpath_buffer) > 1) { $rs[3] = implode(';', $catpath_buffer); } else {
$qry = $GLOBALS['TYPO3_DB']->sql_query($str); break; } } } $products = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) { $products[] = $row; } $content .= '<ul id="menu_product_listing_' . $category['categories_id'] . '">'; $counter = 0; foreach ($products as $item) { if ($item['categories_id']) { // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($item['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $cat) { $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); $where .= '&'; } // get all cats to generate multilevel fake url eof } $link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $item['products_id'] . '&tx_multishop_pi1[page_section]=products_detail'); $catlink = mslib_fe::typolink($this->conf['products_listing_page_pid'], '&' . $where . '&tx_multishop_pi1[page_section]=products_listing'); $counter++;
$products_options_name = $GLOBALS['TYPO3_DB']->sql_query($opt_sql); while ($products_options_name_values = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($products_options_name)) { $selected = 0; $products_options = $GLOBALS['TYPO3_DB']->sql_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from tx_multishop_products_attributes pa, tx_multishop_products_options_values pov where pa.products_id = '" . $product['products_id'] . "' and pa.page_uid='" . $this->showCatalogFromPage . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' order by pa.options_values_price,pov.products_options_values_id, pov.products_options_values_name"); while ($products_options_values = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($products_options)) { if ($products_options_values['options_values_price'] == 0 && $selected == 0) { $rel_rs['hidden_fields'] .= '<input type="hidden" name="relation_id[' . $i . '][' . $products_options_name_values['products_options_id'] . ']" value="' . $products_options_values['products_options_values_id'] . '" />'; $selected = 1; } } } } if ($rel_rs['categories_id']) { // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($rel_rs['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $cat) { $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); $where .= '&'; } // get all cats to generate multilevel fake url eof } $link = mslib_fe::typolink($this->conf['products_detail_page_pid'], $where . '&products_id=' . $rel_rs['products_id'] . '&tx_multishop_pi1[page_section]=products_detail'); // STOCK INDICATOR $product_qty = $rel_rs['products_quantity'];
$product_listing_form_content .= '<input type="hidden" name="p" value="' . $p . '">'; } if ($this->get['tx_multishop_pi1']['page_section'] == 'products_search') { $product_listing_form_content .= '<input type="hidden" name="page" value="' . $this->get['page'] . '">'; } } $product_listing_form_content .= '<script type="text/javascript"> jQuery(document).ready(function($) { $(".products_listing_filter").change(function(){ $("#sorting_products_listing").submit(); }); }); </script>'; // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($this->get['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $item) { $where .= "categories_id[" . $level . "]=" . $item['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); } // get all cats to generate multilevel fake url eof $form_action_url = mslib_fe::typolink($this->conf['products_listing_page_pid'], $where . '&tx_multishop_pi1[page_section]=products_listing'); $subpartArray['###PRODUCTS_LISTING_FILTER_FORM_URL###'] = ''; $subpartArray['###PRODUCTS_LISTING_FORM_CONTENT###'] = $product_listing_form_content; } else { $subpartArray['###PRODUCTS_LISTING_FILTER_FORM_URL###'] = '';
function convertCartToOrder($cart) { // var for total amount $tax_separation = array(); $total_price = 0; $order = array(); $address = $cart['user']; // check for NULL, convert to empty string - typo3 v6.x related bug if (is_array($address) && count($address)) { foreach ($address as $key => $val) { if ($val == null || $val == null) { $address[$key] = ''; } } } // if store country is different from customer country and user provided valid VAT id, change VAT rate to zero $this->ms['MODULES']['DISABLE_VAT_RATE'] = 0; if ($this->ms['MODULES']['DISABLE_VAT_FOR_FOREIGN_CUSTOMERS_WITH_COMPANY_VAT_ID'] and $address['tx_multishop_vat_id']) { if (strtolower($address['country']) != strtolower($this->tta_shop_info['country'])) { $this->ms['MODULES']['DISABLE_VAT_RATE'] = 1; } } /* * always use *_tax and *_total_tax_rate, unless need different calc for country/region * WARNING: *_country_* and *_region_* not always have value, depends on the tax ruleset * ----------------------------------------------------------------------------------------- */ $orders_tax['shipping_tax'] = (string) $address['shipping_tax']; $orders_tax['shipping_country_tax'] = (string) $address['shipping_country_tax']; $orders_tax['shipping_region_tax'] = (string) $address['shipping_region_tax']; $orders_tax['shipping_total_tax_rate'] = (string) $address['shipping_total_tax_rate']; $orders_tax['shipping_country_tax_rate'] = (string) $address['shipping_country_tax_rate']; $orders_tax['shipping_region_tax_rate'] = (string) $address['shipping_region_tax_rate']; if ($this->ms['MODULES']['DISABLE_VAT_RATE']) { $orders_tax['shipping_tax'] = 0; $orders_tax['shipping_country_tax'] = 0; $orders_tax['shipping_region_tax'] = 0; $orders_tax['shipping_total_tax_rate'] = 0; $orders_tax['shipping_country_tax_rate'] = 0; $orders_tax['shipping_region_tax_rate'] = 0; } // ---------------------------------------------------------------------------------------- $orders_tax['payment_tax'] = (string) $address['payment_tax']; $orders_tax['payment_country_tax'] = (string) $address['payment_country_tax']; $orders_tax['payment_region_tax'] = (string) $address['payment_region_tax']; $orders_tax['payment_total_tax_rate'] = (string) $address['payment_total_tax_rate']; $orders_tax['payment_country_tax_rate'] = (string) $address['payment_country_tax_rate']; $orders_tax['payment_region_tax_rate'] = (string) $address['payment_region_tax_rate']; if ($this->ms['MODULES']['DISABLE_VAT_RATE']) { $orders_tax['payment_tax'] = 0; $orders_tax['payment_country_tax'] = 0; $orders_tax['payment_region_tax'] = 0; $orders_tax['payment_total_tax_rate'] = 0; $orders_tax['payment_country_tax_rate'] = 0; $orders_tax['payment_region_tax_rate'] = 0; } // ---------------------------------------------------------------------------------------- $grand_total = array(); $grand_total['shipping_tax'] = $orders_tax['shipping_tax']; $grand_total['payment_tax'] = $orders_tax['payment_tax']; $tax_separation[$orders_tax['shipping_total_tax_rate'] * 100]['shipping_tax'] += $orders_tax['shipping_tax']; $tax_separation[$orders_tax['payment_total_tax_rate'] * 100]['payment_tax'] += $orders_tax['payment_tax']; if ($this->ms['MODULES']['DISABLE_VAT_RATE']) { $grand_total['shipping_tax'] = 0; $grand_total['payment_tax'] = 0; $tax_separation[$orders_tax['shipping_total_tax_rate'] * 100]['shipping_tax'] = 0; $tax_separation[$orders_tax['payment_total_tax_rate'] * 100]['payment_tax'] = 0; if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $address['shipping_method_costs'] = mslib_fe::taxDecimalCrop($address['shipping_method_costs'], 2, false); $address['payment_method_costs'] = mslib_fe::taxDecimalCrop($address['payment_method_costs'], 2, false); } } // add shipping & payment costs if ($address['shipping_method_costs']) { $grand_total['shipping_cost'] = $address['shipping_method_costs']; $total_price = $total_price + $address['shipping_method_costs']; $tax_separation[$orders_tax['shipping_total_tax_rate'] * 100]['shipping_costs'] = $address['shipping_method_costs']; } if ($address['payment_method_costs']) { $grand_total['payment_cost'] = $address['payment_method_costs']; $total_price = $total_price + $address['payment_method_costs']; $tax_separation[$orders_tax['payment_total_tax_rate'] * 100]['payment_costs'] = $address['payment_method_costs']; } $customer_id = ''; // first the account if ($GLOBALS['TSFE']->fe_user->user['uid']) { $customer_id = $GLOBALS['TSFE']->fe_user->user['uid']; } else { $tmp_user = mslib_fe::getUser($address['email'], 'email'); if ($tmp_user['uid']) { $customer_id = $tmp_user['uid']; } } //hook to let other plugins further manipulate the create table query if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_user.php']['convertCartToOrderGetCustomerIdPreProc'])) { $params = array('address' => &$address, 'cart' => &$cart, 'customer_id' => &$customer_id); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_user.php']['convertCartToOrderGetCustomerIdPreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if (!$customer_id) { // add new account $insertArray = array(); $insertArray['company'] = $address['company']; $insertArray['name'] = $address['first_name'] . ' ' . $address['middle_name'] . ' ' . $address['last_name']; $insertArray['name'] = preg_replace('/\\s+/', ' ', $insertArray['name']); $insertArray['first_name'] = $address['first_name']; $insertArray['middle_name'] = $address['middle_name']; $insertArray['last_name'] = $address['last_name']; $insertArray['username'] = $address['email']; $insertArray['email'] = $address['email']; if (!$address['street_name']) { // fallback for old custom checkouts $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['address']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $insertArray['street_name'] . ' ' . $insertArray['address_number'] . ($insertArray['address_ext'] ? '-' . $insertArray['address_ext'] : ''); $insertArray['address'] = preg_replace('/\\s+/', ' ', $insertArray['address']); } else { $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['street_name']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $address['address']; } $insertArray['zip'] = $address['zip']; $insertArray['telephone'] = $address['telephone']; $insertArray['city'] = $address['city']; $insertArray['country'] = $address['country']; $insertArray['tx_multishop_code'] = md5(uniqid('', true)); $insertArray['tstamp'] = time(); $insertArray['crdate'] = time(); if (isset($address['tx_multishop_newsletter']) && !empty($address['tx_multishop_newsletter'])) { $insertArray['tx_multishop_newsletter'] = $address['tx_multishop_newsletter']; } else { $insertArray['tx_multishop_newsletter'] = ''; } $insertArray['page_uid'] = $this->shop_pid; if (isset($address['password']) && !empty($address['password'])) { $insertArray['password'] = mslib_befe::getHashedPassword($address['password']); $insertArray['disable'] = 1; } else { $insertArray['password'] = mslib_befe::getHashedPassword(mslib_befe::generateRandomPassword(10)); } $insertArray['usergroup'] = $this->conf['fe_customer_usergroup']; $insertArray['pid'] = $this->conf['fe_customer_pid']; if (isset($this->cookie['HTTP_REFERER']) && !empty($this->cookie['HTTP_REFERER'])) { $insertArray['http_referer'] = $this->cookie['HTTP_REFERER']; } else { $insertArray['http_referer'] = ''; } $insertArray['ip_address'] = $this->server['REMOTE_ADDR']; if ($this->ms['MODULES']['CHECKOUT_DISPLAY_VAT_ID_INPUT'] && !empty($address['tx_multishop_vat_id'])) { $insertArray['tx_multishop_vat_id'] = $address['tx_multishop_vat_id']; } if ($this->ms['MODULES']['CHECKOUT_DISPLAY_COC_ID_INPUT'] && !empty($address['tx_multishop_coc_id'])) { $insertArray['tx_multishop_coc_id'] = $address['tx_multishop_coc_id']; } $insertArray['tx_multishop_quick_checkout'] = 1; if ($address['gender'] == 'm' or $address['gender'] == '0') { $insertArray['gender'] = '0'; } elseif ($address['gender'] == 'f' or $address['gender'] == '1') { $insertArray['gender'] = '1'; } $insertArray = mslib_befe::rmNullValuedKeys($insertArray); $query = $GLOBALS['TYPO3_DB']->INSERTquery('fe_users', $insertArray); $res = $GLOBALS['TYPO3_DB']->sql_query($query); if ($res) { $customer_id = $GLOBALS['TYPO3_DB']->sql_insert_id(); // ADD TT_ADDRESS RECORD $insertArray = array(); $insertArray['tstamp'] = time(); $insertArray['company'] = $address['company']; $insertArray['name'] = $address['first_name'] . ' ' . $address['middle_name'] . ' ' . $address['last_name']; $insertArray['name'] = preg_replace('/\\s+/', ' ', $insertArray['name']); $insertArray['first_name'] = $address['first_name']; $insertArray['middle_name'] = $address['middle_name']; $insertArray['last_name'] = $address['last_name']; $insertArray['email'] = $address['email']; if (!$address['street_name']) { // fallback for old custom checkouts $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['address']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $insertArray['street_name'] . ' ' . $insertArray['address_number'] . ($insertArray['address_ext'] ? '-' . $insertArray['address_ext'] : ''); $insertArray['address'] = preg_replace('/\\s+/', ' ', $insertArray['address']); } else { $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['street_name']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $address['address']; } $insertArray['zip'] = $address['zip']; $insertArray['phone'] = $address['telephone']; $insertArray['mobile'] = $address['mobile']; $insertArray['city'] = $address['city']; $insertArray['country'] = $address['country']; $insertArray['gender'] = $address['gender']; $insertArray['birthday'] = strtotime($address['birthday']); if ($address['gender'] == 'm') { $insertArray['title'] = 'Mr.'; } else { if ($address['gender'] == 'f') { $insertArray['title'] = 'Mrs.'; } } $insertArray['region'] = $address['state']; $insertArray['pid'] = $this->conf['fe_customer_pid']; $insertArray['page_uid'] = $this->shop_pid; $insertArray['tstamp'] = time(); $insertArray['tx_multishop_address_type'] = 'billing'; $insertArray['tx_multishop_default'] = 1; $insertArray['tx_multishop_customer_id'] = $customer_id; $insertArray = mslib_befe::rmNullValuedKeys($insertArray); $query = $GLOBALS['TYPO3_DB']->INSERTquery('tt_address', $insertArray); $res = $GLOBALS['TYPO3_DB']->sql_query($query); // send out the create account confirmation e-mail if (isset($address['password']) && !empty($address['password'])) { mslib_fe::sendCreateAccountConfirmationLetter($customer_id, $address['password']); } // insert delivery into tt_address if (!$address['different_delivery_address']) { $insertArray = array(); $insertArray['tstamp'] = time(); $insertArray['company'] = $address['company']; $insertArray['name'] = $address['first_name'] . ' ' . $address['middle_name'] . ' ' . $address['last_name']; $insertArray['name'] = preg_replace('/\\s+/', ' ', $insertArray['name']); $insertArray['first_name'] = $address['first_name']; $insertArray['middle_name'] = $address['middle_name']; $insertArray['last_name'] = $address['last_name']; $insertArray['email'] = $address['email']; if (!$address['street_name']) { // fallback for old custom checkouts $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['address']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $insertArray['street_name'] . ' ' . $insertArray['address_number'] . ($insertArray['address_ext'] ? '-' . $insertArray['address_ext'] : ''); $insertArray['address'] = preg_replace('/\\s+/', ' ', $insertArray['address']); } else { $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['street_name']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $address['address']; } $insertArray['zip'] = $address['zip']; $insertArray['phone'] = $address['telephone']; $insertArray['mobile'] = $address['mobile']; $insertArray['city'] = $address['city']; $insertArray['country'] = $address['country']; $insertArray['gender'] = $address['gender']; $insertArray['birthday'] = strtotime($address['birthday']); if ($address['gender'] == 'm') { $insertArray['title'] = 'Mr.'; } else { if ($address['gender'] == 'f') { $insertArray['title'] = 'Mrs.'; } } $insertArray['region'] = $address['state']; } else { $insertArray = array(); $insertArray['tx_multishop_customer_id'] = $customer_id; $insertArray['tstamp'] = time(); $insertArray['company'] = $address['delivery_company']; $insertArray['name'] = $address['delivery_first_name'] . ' ' . $address['delivery_middle_name'] . ' ' . $address['delivery_last_name']; $insertArray['name'] = preg_replace('/\\s+/', ' ', $insertArray['name']); $insertArray['first_name'] = $address['delivery_first_name']; $insertArray['middle_name'] = $address['delivery_middle_name']; $insertArray['last_name'] = $address['delivery_last_name']; $insertArray['email'] = $address['delivery_email']; if (!$address['delivery_street_name']) { // fallback for old custom checkouts $insertArray['building'] = $address['delivery_building']; $insertArray['street_name'] = $address['delivery_address']; $insertArray['address_number'] = $address['delivery_address_number']; $insertArray['address_ext'] = $address['delivery_address_ext']; $insertArray['address'] = $insertArray['street_name'] . ' ' . $insertArray['address_number'] . ($insertArray['address_ext'] ? '-' . $insertArray['address_ext'] : ''); $insertArray['address'] = preg_replace('/\\s+/', ' ', $insertArray['address']); } else { $insertArray['building'] = $address['delivery_building']; $insertArray['street_name'] = $address['delivery_street_name']; $insertArray['address_number'] = $address['delivery_address_number']; $insertArray['address_ext'] = $address['delivery_address_ext']; $insertArray['address'] = $address['delivery_address']; } $insertArray['zip'] = $address['delivery_zip']; $insertArray['phone'] = $address['delivery_telephone']; $insertArray['mobile'] = $address['delivery_mobile']; $insertArray['city'] = $address['delivery_city']; $insertArray['country'] = $address['delivery_country']; $insertArray['gender'] = $address['delivery_gender']; $insertArray['birthday'] = strtotime($address['delivery_birthday']); if ($address['delivery_gender'] == 'm') { $insertArray['title'] = 'Mr.'; } else { if ($address['delivery_gender'] == 'f') { $insertArray['title'] = 'Mrs.'; } } $insertArray['region'] = $address['delivery_state']; } $insertArray['pid'] = $this->conf['fe_customer_pid']; $insertArray['page_uid'] = $this->shop_pid; $insertArray['tstamp'] = time(); $insertArray['tx_multishop_customer_id'] = $customer_id; $insertArray['tx_multishop_address_type'] = 'delivery'; $insertArray['tx_multishop_default'] = 0; $insertArray = mslib_befe::rmNullValuedKeys($insertArray); $query = $GLOBALS['TYPO3_DB']->INSERTquery('tt_address', $insertArray); $res = $GLOBALS['TYPO3_DB']->sql_query($query); // ADD TT_ADDRESS RECORD EOF //hook to let other plugins further manipulate the create table query if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_user.php']['createUserPostProc'])) { $params = array('customer_id' => &$customer_id); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_user.php']['createUserPostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } } } else { // insert tt_address for existing customer if no record found if (!mslib_fe::getFeUserTTaddressDetails($customer_id, 'billing')) { // ADD TT_ADDRESS RECORD $insertArray = array(); $insertArray['tstamp'] = time(); $insertArray['company'] = $address['company']; $insertArray['name'] = $address['first_name'] . ' ' . $address['middle_name'] . ' ' . $address['last_name']; $insertArray['name'] = preg_replace('/\\s+/', ' ', $insertArray['name']); $insertArray['first_name'] = $address['first_name']; $insertArray['middle_name'] = $address['middle_name']; $insertArray['last_name'] = $address['last_name']; $insertArray['email'] = $address['email']; if (!$address['street_name']) { // fallback for old custom checkouts $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['address']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $insertArray['street_name'] . ' ' . $insertArray['address_number'] . ($insertArray['address_ext'] ? '-' . $insertArray['address_ext'] : ''); $insertArray['address'] = preg_replace('/\\s+/', ' ', $insertArray['address']); } else { $insertArray['building'] = $address['delivery_building']; $insertArray['street_name'] = $address['street_name']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $address['address']; } $insertArray['zip'] = $address['zip']; $insertArray['phone'] = $address['telephone']; $insertArray['mobile'] = $address['mobile']; $insertArray['city'] = $address['city']; $insertArray['country'] = $address['country']; $insertArray['gender'] = $address['gender']; $insertArray['birthday'] = strtotime($address['birthday']); if ($address['gender'] == 'm') { $insertArray['title'] = 'Mr.'; } else { if ($address['gender'] == 'f') { $insertArray['title'] = 'Mrs.'; } } $insertArray['region'] = $address['state']; $insertArray['pid'] = $this->conf['fe_customer_pid']; $insertArray['page_uid'] = $this->shop_pid; $insertArray['tstamp'] = time(); $insertArray['tx_multishop_address_type'] = 'billing'; $insertArray['tx_multishop_default'] = 1; $insertArray['tx_multishop_customer_id'] = $customer_id; $insertArray = mslib_befe::rmNullValuedKeys($insertArray); $query = $GLOBALS['TYPO3_DB']->INSERTquery('tt_address', $insertArray); $res = $GLOBALS['TYPO3_DB']->sql_query($query); } if (!mslib_fe::getFeUserTTaddressDetails($customer_id, 'delivery')) { // insert delivery into tt_address if (!$address['different_delivery_address']) { $insertArray = array(); $insertArray['tstamp'] = time(); $insertArray['company'] = $address['company']; $insertArray['name'] = $address['first_name'] . ' ' . $address['middle_name'] . ' ' . $address['last_name']; $insertArray['name'] = preg_replace('/\\s+/', ' ', $insertArray['name']); $insertArray['first_name'] = $address['first_name']; $insertArray['middle_name'] = $address['middle_name']; $insertArray['last_name'] = $address['last_name']; $insertArray['email'] = $address['email']; if (!$address['street_name']) { // fallback for old custom checkouts $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['address']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $insertArray['street_name'] . ' ' . $insertArray['address_number'] . ($insertArray['address_ext'] ? '-' . $insertArray['address_ext'] : ''); $insertArray['address'] = preg_replace('/\\s+/', ' ', $insertArray['address']); } else { $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['street_name']; $insertArray['address_number'] = $address['address_number']; $insertArray['address_ext'] = $address['address_ext']; $insertArray['address'] = $address['address']; } $insertArray['zip'] = $address['zip']; $insertArray['phone'] = $address['telephone']; $insertArray['mobile'] = $address['mobile']; $insertArray['city'] = $address['city']; $insertArray['country'] = $address['country']; $insertArray['gender'] = $address['gender']; $insertArray['birthday'] = strtotime($address['birthday']); if ($address['gender'] == 'm') { $insertArray['title'] = 'Mr.'; } else { if ($address['gender'] == 'f') { $insertArray['title'] = 'Mrs.'; } } $insertArray['region'] = $address['state']; } else { $insertArray = array(); $insertArray['tx_multishop_customer_id'] = $customer_id; $insertArray['tstamp'] = time(); $insertArray['company'] = $address['delivery_company']; $insertArray['name'] = $address['delivery_first_name'] . ' ' . $address['delivery_middle_name'] . ' ' . $address['delivery_last_name']; $insertArray['name'] = preg_replace('/\\s+/', ' ', $insertArray['name']); $insertArray['first_name'] = $address['delivery_first_name']; $insertArray['middle_name'] = $address['delivery_middle_name']; $insertArray['last_name'] = $address['delivery_last_name']; $insertArray['email'] = $address['delivery_email']; if (!$address['delivery_street_name']) { // fallback for old custom checkouts $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['delivery_address']; $insertArray['address_number'] = $address['delivery_address_number']; $insertArray['address_ext'] = $address['delivery_address_ext']; $insertArray['address'] = $insertArray['street_name'] . ' ' . $insertArray['address_number'] . ($insertArray['address_ext'] ? '-' . $insertArray['address_ext'] : ''); $insertArray['address'] = preg_replace('/\\s+/', ' ', $insertArray['address']); } else { $insertArray['building'] = $address['building']; $insertArray['street_name'] = $address['delivery_street_name']; $insertArray['address_number'] = $address['delivery_address_number']; $insertArray['address_ext'] = $address['delivery_address_ext']; $insertArray['address'] = $address['delivery_address']; } $insertArray['zip'] = $address['delivery_zip']; $insertArray['phone'] = $address['delivery_telephone']; $insertArray['mobile'] = $address['delivery_mobile']; $insertArray['city'] = $address['delivery_city']; $insertArray['country'] = $address['delivery_country']; $insertArray['gender'] = $address['delivery_gender']; $insertArray['birthday'] = strtotime($address['delivery_birthday']); if ($address['delivery_gender'] == 'm') { $insertArray['title'] = 'Mr.'; } else { if ($address['delivery_gender'] == 'f') { $insertArray['title'] = 'Mrs.'; } } $insertArray['region'] = $address['delivery_state']; } $insertArray['pid'] = $this->conf['fe_customer_pid']; $insertArray['page_uid'] = $this->shop_pid; $insertArray['tstamp'] = time(); $insertArray['tx_multishop_customer_id'] = $customer_id; $insertArray['tx_multishop_address_type'] = 'delivery'; $insertArray['tx_multishop_default'] = 0; $insertArray = mslib_befe::rmNullValuedKeys($insertArray); $query = $GLOBALS['TYPO3_DB']->INSERTquery('tt_address', $insertArray); $res = $GLOBALS['TYPO3_DB']->sql_query($query); } } if ($customer_id) { // now add the order $insertArray = array(); $insertArray['customer_id'] = $customer_id; $insertArray['page_uid'] = $this->shop_pid; if (isset($GLOBALS['TSFE']->fe_user->user['uid']) && !empty($GLOBALS['TSFE']->fe_user->user['uid'])) { $insertArray['cruser_id'] = $GLOBALS['TSFE']->fe_user->user['uid']; } else { $insertArray['cruser_id'] = ''; } $insertArray['customer_comments'] = $this->post['customer_comments']; $insertArray['billing_company'] = $address['company']; $insertArray['billing_first_name'] = $address['first_name']; $insertArray['billing_middle_name'] = $address['middle_name']; $insertArray['billing_last_name'] = $address['last_name']; $insertArray['billing_name'] = preg_replace('/ +/', ' ', $address['first_name'] . ' ' . $address['middle_name'] . ' ' . $address['last_name']); $insertArray['billing_email'] = $address['email']; $insertArray['billing_gender'] = $address['gender']; $insertArray['billing_birthday'] = strtotime($address['birthday']); if (!$address['street_name']) { // fallback for old custom checkouts $insertArray['billing_building'] = $address['building']; $insertArray['billing_street_name'] = $address['address']; $insertArray['billing_address_number'] = $address['address_number']; $insertArray['billing_address_ext'] = $address['address_ext']; $insertArray['billing_address'] = $insertArray['billing_street_name'] . ' ' . $insertArray['billing_address_number'] . ($insertArray['billing_address_ext'] ? '-' . $insertArray['billing_address_ext'] : ''); $insertArray['billing_address'] = preg_replace('/\\s+/', ' ', $insertArray['billing_address']); } else { $insertArray['billing_building'] = $address['building']; $insertArray['billing_street_name'] = $address['street_name']; $insertArray['billing_address_number'] = $address['address_number']; $insertArray['billing_address_ext'] = $address['address_ext']; $insertArray['billing_address'] = $address['address']; } /* $insertArray['billing_street_name'] = $address['street_name']; $insertArray['billing_address_number'] = $address['address_number']; $insertArray['billing_address_ext'] = $address['address_ext']; $insertArray['billing_address'] = $insertArray['billing_street_name'].' '.$insertArray['billing_address_number'].($insertArray['billing_address_ext']? '-'.$insertArray['billing_address_ext']:''); $insertArray['billing_address'] = preg_replace('/\s+/', ' ', $insertArray['billing_address']); */ $insertArray['billing_room'] = ''; $insertArray['billing_city'] = $address['city']; $insertArray['billing_zip'] = $address['zip']; $insertArray['billing_region'] = $address['state']; $insertArray['billing_country'] = $address['country']; $insertArray['billing_telephone'] = $address['telephone']; $insertArray['billing_mobile'] = $address['mobile']; $insertArray['billing_fax'] = ''; if ($this->ms['MODULES']['CHECKOUT_DISPLAY_VAT_ID_INPUT'] && !empty($address['tx_multishop_vat_id'])) { $insertArray['billing_vat_id'] = $address['tx_multishop_vat_id']; } if ($this->ms['MODULES']['CHECKOUT_DISPLAY_COC_ID_INPUT'] && !empty($address['tx_multishop_coc_id'])) { $insertArray['billing_coc_id'] = $address['tx_multishop_coc_id']; } if (!$address['different_delivery_address']) { $insertArray['delivery_email'] = $insertArray['billing_email']; $insertArray['delivery_company'] = $insertArray['billing_company']; $insertArray['delivery_first_name'] = $insertArray['billing_first_name']; $insertArray['delivery_middle_name'] = $insertArray['billing_middle_name']; $insertArray['delivery_last_name'] = $insertArray['billing_last_name']; $insertArray['delivery_telephone'] = $insertArray['billing_telephone']; $insertArray['delivery_mobile'] = $insertArray['billing_mobile']; $insertArray['delivery_gender'] = $insertArray['billing_gender']; $insertArray['delivery_building'] = $insertArray['billing_building']; $insertArray['delivery_street_name'] = $insertArray['billing_street_name']; $insertArray['delivery_address_number'] = $insertArray['billing_address_number']; $insertArray['delivery_address_ext'] = $insertArray['billing_address_ext']; $insertArray['delivery_address'] = $insertArray['billing_address']; $insertArray['delivery_zip'] = $insertArray['billing_zip']; $insertArray['delivery_city'] = $insertArray['billing_city']; $insertArray['delivery_country'] = $insertArray['billing_country']; $insertArray['delivery_telephone'] = $insertArray['billing_telephone']; $insertArray['delivery_region'] = $insertArray['billing_region']; $insertArray['delivery_name'] = $insertArray['billing_name']; $insertArray['delivery_birthday'] = $insertArray['billing_birthday']; } else { $insertArray['delivery_company'] = $address['delivery_company']; $insertArray['delivery_first_name'] = $address['delivery_first_name']; $insertArray['delivery_middle_name'] = $address['delivery_middle_name']; $insertArray['delivery_last_name'] = $address['delivery_last_name']; $insertArray['delivery_name'] = preg_replace('/ +/', ' ', $address['delivery_first_name'] . ' ' . $address['delivery_middle_name'] . ' ' . $address['delivery_last_name']); $insertArray['delivery_email'] = $address['delivery_email']; $insertArray['delivery_gender'] = $address['delivery_gender']; if (!$address['street_name']) { // fallback for old custom checkouts $insertArray['delivery_building'] = $address['delivery_building']; $insertArray['delivery_street_name'] = $address['delivery_address']; $insertArray['delivery_address_number'] = $address['delivery_address_number']; $insertArray['delivery_address_ext'] = $address['delivery_address_ext']; $insertArray['delivery_address'] = $insertArray['delivery_street_name'] . ' ' . $insertArray['delivery_address_number'] . ($insertArray['delivery_address_ext'] ? '-' . $insertArray['delivery_address_ext'] : ''); $insertArray['delivery_address'] = preg_replace('/\\s+/', ' ', $insertArray['delivery_address']); } else { $insertArray['delivery_building'] = $address['delivery_building']; $insertArray['delivery_street_name'] = $address['delivery_street_name']; $insertArray['delivery_address_number'] = $address['delivery_address_number']; $insertArray['delivery_address_ext'] = $address['delivery_address_ext']; $insertArray['delivery_address'] = $address['delivery_address']; } /* $insertArray['delivery_street_name'] = $address['delivery_street_name']; $insertArray['delivery_address_number'] = $address['delivery_address_number']; $insertArray['delivery_address_ext'] = $address['delivery_address_ext']; $insertArray['delivery_address'] = $insertArray['delivery_street_name'].' '.$insertArray['delivery_address_number'].($insertArray['delivery_address_ext']? '-'.$insertArray['delivery_address_ext']:''); $insertArray['delivery_address'] = preg_replace('/\s+/', ' ', $insertArray['delivery_address']); */ $insertArray['delivery_city'] = $address['delivery_city']; $insertArray['delivery_zip'] = $address['delivery_zip']; $insertArray['delivery_room'] = ''; $insertArray['delivery_region'] = $address['delivery_state']; $insertArray['delivery_country'] = $address['delivery_country']; $insertArray['delivery_telephone'] = $address['delivery_telephone']; $insertArray['delivery_mobile'] = $address['delivery_mobile']; $insertArray['delivery_fax'] = ''; $insertArray['delivery_vat_id'] = ''; $insertArray['delivery_birthday'] = strtotime($address['delivery_birthday']); } $insertArray['bill'] = 1; $insertArray['crdate'] = time(); $insertArray['shipping_method'] = $address['shipping_method']; $insertArray['shipping_method_label'] = $address['shipping_method_label']; $insertArray['payment_method'] = $address['payment_method']; $insertArray['payment_method_label'] = $address['payment_method_label']; $insertArray['shipping_method_costs'] = $address['shipping_method_costs']; $insertArray['payment_method_costs'] = $address['payment_method_costs']; $insertArray['hash'] = md5(uniqid('', true)); $insertArray['store_currency'] = $this->ms['MODULES']['CURRENCY_ARRAY']['cu_iso_3']; if (isset($this->ms['MODULES']['CUSTOMER_CURRENCY_ARRAY']['cu_iso_3']) && !empty($this->ms['MODULES']['CUSTOMER_CURRENCY_ARRAY']['cu_iso_3'])) { $insertArray['customer_currency'] = $this->ms['MODULES']['CUSTOMER_CURRENCY_ARRAY']['cu_iso_3']; } else { $insertArray['customer_currency'] = $this->ms['MODULES']['CURRENCY_ARRAY']['cu_iso_3']; } if (isset($this->cookie['currency_rate']) && !empty($this->cookie['currency_rate'])) { $insertArray['currency_rate'] = $this->cookie['currency_rate']; } else { $insertArray['currency_rate'] = 1; } $insertArray['language_id'] = $this->sys_language_uid; // get default orders status $status = mslib_fe::getDefaultOrdersStatus($this->sys_language_uid); $default_order_status_id = 0; if (is_array($status) && isset($status['id']) && $status['id'] > 0) { $default_order_status_id = $status['id']; } // set the order status based on payment method settings $payment_method = mslib_fe::loadPaymentMethod($address['payment_method']); $payment_method_vars = unserialize($payment_method['vars']); $payment_method_vars['default_order_status'] = (int) $payment_method_vars['default_order_status']; if (isset($payment_method_vars['default_order_status']) && is_numeric($payment_method_vars['default_order_status']) && $payment_method_vars['default_order_status'] > 0) { $default_order_status_id = $payment_method_vars['default_order_status']; } if ($default_order_status_id > 0) { $insertArray['status'] = $default_order_status_id; } else { $insertArray['status'] = ''; } if (isset($this->cookie['HTTP_REFERER']) && !empty($this->cookie['HTTP_REFERER'])) { $insertArray['http_referer'] = $this->cookie['HTTP_REFERER']; } else { $insertArray['http_referer'] = ''; } $insertArray['ip_address'] = $this->server['REMOTE_ADDR']; $insertArray['user_agent'] = $this->server['HTTP_USER_AGENT']; if (isset($address['expected_delivery_date'])) { $insertArray['expected_delivery_date'] = $address['expected_delivery_date']; } $user = mslib_fe::getUser($customer_id); $insertArray['payment_condition'] = ''; if (is_numeric($user['tx_multishop_payment_condition']) && $user['tx_multishop_payment_condition'] > 0) { $insertArray['payment_condition'] = $user['tx_multishop_payment_condition']; } //$insertArray['orders_tax_data'] = serialize($orders_tax); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderPreProc'])) { // hook $params = array('ms' => $this->ms, 'address' => &$address, 'insertArray' => &$insertArray); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderPreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } // hook oef } $insertArray = mslib_befe::rmNullValuedKeys($insertArray); $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_orders', $insertArray); $res = $GLOBALS['TYPO3_DB']->sql_query($query); // now add the order eof $orders_id = $GLOBALS['TYPO3_DB']->sql_insert_id(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderPostProc'])) { // hook $params = array('orders_id' => &$orders_id, 'insertArray' => &$insertArray, 'cart' => &$cart); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderPostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } // hook oef } if (!$orders_id) { $subject = $this->FULL_HTTP_URL . ' - Convert cart to order failed'; $body = 'Warning. Convert cart to order failed.<br/>Website: ' . $this->FULL_HTTP_URL . '<br/>Error: ' . $GLOBALS['TYPO3_DB']->sql_error() . '<br/>Query:<br/>' . $query; $mailuser = array(); $mailuser['name'] = $this->ms['MODULES']['STORE_NAME']; $mailuser['email'] = $this->ms['MODULES']['STORE_EMAIL']; if ($this->ms['MODULES']['DEVELOPER_EMAIL']) { $mailuser['email'] = $this->ms['MODULES']['DEVELOPER_EMAIL']; } if ($mailuser['email']) { mslib_fe::mailUser($mailuser, $subject, $body, $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME']); } } else { // now add the orders products if ($cart['user']['payment_method']) { $this->ms['payment_method'] = $cart['user']['payment_method']; } elseif ($cart['user']['shipping_method']) { $this->ms['shipping_method'] = $cart['user']['shipping_method']; } if (is_array($cart['products']) && count($cart['products'])) { foreach ($cart['products'] as $shopping_cart_item => $value) { if (is_numeric($value['products_id'])) { if ($this->ms['MODULES']['DISABLE_VAT_RATE']) { $value['tax_rate'] = 0; } $insertArray = array(); $insertArray['orders_id'] = $orders_id; $insertArray['products_id'] = $value['products_id']; $insertArray['categories_id'] = $value['categories_id']; // get all cats $cats = mslib_fe::Crumbar($value['categories_id']); $cats = array_reverse($cats); if (count($cats) > 0) { $i = 0; foreach ($cats as $cat) { $insertArray['categories_id_' . $i] = $cat['id']; $insertArray['categories_name_' . $i] = $cat['name']; $i++; } } // get all cats eof if (isset($value['manufacturers_id']) && !empty($value['manufacturers_id'])) { $insertArray['manufacturers_id'] = $value['manufacturers_id']; } else { $insertArray['manufacturers_id'] = ''; } if (isset($value['order_unit_id']) && !empty($value['order_unit_id'])) { $insertArray['order_unit_id'] = $value['order_unit_id']; } else { $insertArray['order_unit_id'] = ''; } if (isset($value['order_unit_name']) && !empty($value['order_unit_name'])) { $insertArray['order_unit_name'] = $value['order_unit_name']; } else { $insertArray['order_unit_name'] = ''; } if (isset($value['order_unit_code']) && !empty($value['order_unit_code'])) { $insertArray['order_unit_code'] = $value['order_unit_code']; } else { $insertArray['order_unit_code'] = ''; } $insertArray['qty'] = $value['qty']; $insertArray['products_tax'] = $value['tax_rate'] * 100; $insertArray['products_name'] = $value['products_name']; $insertArray['products_model'] = $value['products_model']; /* $insertArray['products_description']=$value['products_shortdescription']; if (is_array($value['attributes'])) { // loading the attributes //$insertArray['products_description'].="\n".strip_tags(mslib_fe::showAttributes($value['products_id'], '', $sessionData, 1)); $insertArray['products_description'].="\n".mslib_fe::showAttributes($value['products_id'], '', $sessionData, 1); // loading the attributes eof } */ $insertArray['products_price'] = $value['products_price']; $insertArray['final_price'] = $value['final_price']; $insertArray['product_capital_price'] = $value['product_capital_price']; $insertArray['type'] = 'P'; // P for Product, S for Subscription (returning-costs) $insertArray['ean_code'] = $value['ean_code']; $insertArray['sku_code'] = $value['sku_code']; $insertArray['vendor_code'] = $value['vendor_code']; $insertArray['products_tax_id'] = $value['tax_id']; // micro download if ($value['file_location'] || $value['file_remote_location']) { $insertArray['file_label'] = $value['file_label']; $insertArray['file_location'] = $value['file_location']; $insertArray['file_remote_location'] = $value['file_remote_location']; $insertArray['file_number_of_downloads'] = $value['file_number_of_downloads']; $insertArray['file_download_code'] = md5(uniqid(rand()) . uniqid(rand())); } // micro download eof /* * always use total_tax and total_tax_rate, unless need different calc for country/region * WARNING: country_* and region_* not always have value, depends on the tax ruleset * ----------------------------------------------------------------------------------------- */ $product_tax['country_tax_rate'] = (string) $value['country_tax_rate']; $product_tax['region_tax_rate'] = (string) $value['region_tax_rate']; $product_tax['total_tax_rate'] = (string) $value['tax_rate']; // ----------------------------------------------------------------------------------------- $product_tax['country_tax'] = (string) $value['country_tax']; $product_tax['region_tax'] = (string) $value['region_tax']; $product_tax['total_tax'] = (string) $value['tax']; $product_tax['total_attributes_tax'] = (string) $value['total_attributes_tax']; // ----------------------------------------------------------------------------------------- if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) { //$product_tax['total_tax']=mslib_fe::taxDecimalCrop($product_tax['total_tax'], 2, false); //$product_tax['total_attributes_tax']=mslib_fe::taxDecimalCrop($product_tax['total_attributes_tax'], 2, false); $product_tax['total_tax'] = round($product_tax['total_tax'], 2); $product_tax['total_attributes_tax'] = round($product_tax['total_attributes_tax'], 2); } if ($this->ms['MODULES']['DISABLE_VAT_RATE']) { $product_tax['country_tax_rate'] = 0; $product_tax['region_tax_rate'] = 0; $product_tax['total_tax_rate'] = 0; $product_tax['country_tax'] = 0; $product_tax['region_tax'] = 0; $product_tax['total_tax'] = 0; $product_tax['total_attributes_tax'] = 0; } // bugfixes bas $sub_total_excluding_vat['final_price'] = $sub_total['final_price'] + $value['final_price'] * $value['qty']; $sub_total['final_price'] = $sub_total['final_price'] + $value['final_price'] * $value['qty']; if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) { $sub_total['total_tax'] = $sub_total['total_tax'] + round($product_tax['total_tax'] * $value['qty'], 2); $sub_total['attributes_tax'] = $sub_total['attributes_tax'] + round($product_tax['total_attributes_tax'] * $value['qty'], 2); $total_order_tax['total_tax'] = $total_order_tax['total_tax'] + round($product_tax['total_tax'] * $value['qty'], 2); $total_order_tax['total_attributes_tax'] = $total_order_tax['total_attributes_tax'] + round($product_tax['total_attributes_tax'] * $value['qty'], 2); } else { $sub_total['total_tax'] = $sub_total['total_tax'] + $product_tax['total_tax'] * $value['qty']; $sub_total['attributes_tax'] = $sub_total['attributes_tax'] + $product_tax['total_attributes_tax'] * $value['qty']; $total_order_tax['total_tax'] = $total_order_tax['total_tax'] + $product_tax['total_tax'] * $value['qty']; $total_order_tax['total_attributes_tax'] = $total_order_tax['total_attributes_tax'] + $product_tax['total_attributes_tax'] * $value['qty']; } $insertArray['products_tax_data'] = serialize($product_tax); // separation of tax $tax_separation[$value['tax_rate'] * 100]['products_total_tax'] += $product_tax['total_tax'] * $value['qty'] + $product_tax['total_attributes_tax'] * $value['qty']; $tax_separation[$value['tax_rate'] * 100]['products_sub_total_excluding_vat'] += $value['final_price'] * $value['qty']; $tax_separation[$value['tax_rate'] * 100]['products_sub_total'] += ($value['final_price'] + $product_tax['total_tax'] + $product_tax['total_attributes_tax']) * $value['qty']; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrdersProductPreProc'])) { // hook $params = array('ms' => $this->ms, 'value' => $value, 'insertArray' => &$insertArray); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrdersProductPreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } // hook oef } // TYPO3 6.2 LTS NULL FIX $insertArray = mslib_befe::rmNullValuedKeys($insertArray); $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_orders_products', $insertArray); $res = $GLOBALS['TYPO3_DB']->sql_query($query); $orders_products_id = $GLOBALS['TYPO3_DB']->sql_insert_id(); if (!$orders_products_id) { error_log('ERROR:' . $GLOBALS['TYPO3_DB']->sql_error()); } // update orders_products sort_order $updateOrderProductsSortOrder = array(); $updateOrderProductsSortOrder['sort_order'] = $orders_products_id; $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_orders_products', 'orders_products_id=\'' . $orders_products_id . '\'', $updateOrderProductsSortOrder); $res = $GLOBALS['TYPO3_DB']->sql_query($query); if ($this->ms['MODULES']['SUBTRACT_STOCK']) { $continue_update_stock = true; // hook to manipulate the continuity of update stock if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_mslib_cart.php']['updateStockPreProc'])) { // hook $params = array('ms' => $this->ms, 'value' => $value, 'continue_update_stock' => &$continue_update_stock); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_mslib_cart.php']['updateStockPreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } // hook oef } // if ($continue_update_stock) { if ($this->ms['MODULES']['PRODUCT_ATTRIBUTES_STOCK']) { $sql_as_data = array(); $attributes_count = count($value['attributes']); foreach ($value['attributes'] as $attribute_key => $attribute_values) { $sql_as_data[] = '(pas.options_id = ' . $attribute_values['options_id'] . ' and pas.options_values_id = ' . $attribute_values['options_values_id'] . ')'; } $sql_as = "select pasg.group_id, pasg.attributes_stock from tx_multishop_products_attributes_stock_group pasg, tx_multishop_products_attributes_stock pas where pasg.products_id = " . $value['products_id'] . " and (" . implode(' or ', $sql_as_data) . ") and pasg.group_id = pas.group_id"; $res = $GLOBALS['TYPO3_DB']->sql_query($sql_as); $total_rows = $GLOBALS['TYPO3_DB']->sql_num_rows($res); $used_group = 0; if ($total_rows > 1) { $group_counter = array(); while ($rs_as = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $group_counter[$rs_as['group_id']] += 1; } foreach ($group_counter as $ref_group_id => $group_ctr_result) { if ($group_ctr_result == $attributes_count) { $used_group = $ref_group_id; break; } } } else { $rs_as = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $used_group = $rs_as['group_id']; } if ($used_group > 0) { $str = "update tx_multishop_products_attributes_stock_group set attributes_stock=(attributes_stock-" . $value['qty'] . ") where group_id='" . $used_group . "'"; $res = $GLOBALS['TYPO3_DB']->sql_query($str); } $str = "update tx_multishop_products set products_quantity=(products_quantity-" . $value['qty'] . ") where products_id='" . $value['products_id'] . "'"; $res = $GLOBALS['TYPO3_DB']->sql_query($str); $str = "select products_quantity, alert_quantity_threshold from tx_multishop_products where products_id='" . $value['products_id'] . "'"; $res = $GLOBALS['TYPO3_DB']->sql_query($str); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if ($row['products_quantity'] <= $row['alert_quantity_threshold']) { $page = mslib_fe::getCMScontent('email_alert_quantity_threshold_letter', $GLOBALS['TSFE']->sys_language_uid); if ($page[0]['content']) { // loading the email confirmation letter eof // replacing the variables with dynamic values $array1 = array(); $array2 = array(); $array1[] = '###ORDERED_QTY###'; $array2[] = $value['qty']; $array1[] = '###CURRENT_PRODUCT_QUANTITY###'; $array2[] = $row['products_id']; $array1[] = '###PRODUCT_ID###'; $array2[] = $row['products_quantity']; $array1[] = '###PRODUCT_NAME###'; $array2[] = $value['products_name']; $link_edit_prod = $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=edit_product&pid=' . $value['products_id'] . '&cid=' . $value['categories_id'] . '&action=edit_product'); $array1[] = '###DIRECT_EDIT_PRODUCT_LINK###'; $array2[] = '<a href="' . $link_edit_prod . '" target="_blank">' . htmlspecialchars($this->pi_getLL('admin_edit_product')) . '</a>'; // now mail a copy to the merchant $merchant = array(); $merchant['name'] = $this->ms['MODULES']['STORE_NAME']; $merchant['email'] = $this->ms['MODULES']['STORE_EMAIL']; $mailTo = array(); $mailTo[] = $merchant; //hook to let other plugins further manipulate the replacers if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['mailAlertQuantityThresholdPostProc'])) { $params = array('array1' => &$array1, 'array2' => &$array2, 'page' => &$page, 'mailTo' => &$mailTo); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['mailAlertQuantityThresholdPostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } //end of hook to let other plugins further manipulate the replacers if ($page[0]['content']) { $page[0]['content'] = str_replace($array1, $array2, $page[0]['content']); } if ($page[0]['name']) { $page[0]['name'] = str_replace($array1, $array2, $page[0]['name']); } foreach ($mailTo as $mailuser) { mslib_fe::mailUser($mailuser, $page[0]['name'], $page[0]['content'], $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME']); } } } if ($row['products_quantity'] < 1) { // stock is negative or zero. lets disable the product $str = "update tx_multishop_products set products_status=0 where products_id='" . $value['products_id'] . "'"; $res = $GLOBALS['TYPO3_DB']->sql_query($str); } } else { // now decrease the stocklevel $str = "update tx_multishop_products set products_quantity=(products_quantity-" . $value['qty'] . ") where products_id='" . $value['products_id'] . "'"; $res = $GLOBALS['TYPO3_DB']->sql_query($str); $str = "select products_quantity, alert_quantity_threshold from tx_multishop_products where products_id='" . $value['products_id'] . "'"; $res = $GLOBALS['TYPO3_DB']->sql_query($str); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if ($row['products_quantity'] <= $row['alert_quantity_threshold']) { $page = mslib_fe::getCMScontent('email_alert_quantity_threshold_letter', $GLOBALS['TSFE']->sys_language_uid); if ($page[0]['content']) { // loading the email confirmation letter eof // replacing the variables with dynamic values $array1 = array(); $array2 = array(); $array1[] = '###ORDERED_QTY###'; $array2[] = $value['qty']; $array1[] = '###CURRENT_PRODUCT_QUANTITY###'; $array2[] = $row['products_quantity']; $array1[] = '###PRODUCT_NAME###'; $array2[] = $value['products_name']; $link_edit_prod = $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=edit_product&pid=' . $value['products_id'] . '&cid=' . $value['categories_id'] . '&action=edit_product'); $array1[] = '###DIRECT_EDIT_PRODUCT_LINK###'; $array2[] = '<a href="' . $link_edit_prod . '" target="_blank">edit product stock</a>'; // now mail a copy to the merchant $merchant = array(); $merchant['name'] = $this->ms['MODULES']['STORE_NAME']; $merchant['email'] = $this->ms['MODULES']['STORE_EMAIL']; $mailTo = array(); $mailTo[] = $merchant; //hook to let other plugins further manipulate the replacers if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['mailAlertQuantityThresholdPostProc'])) { $params = array('array1' => &$array1, 'array2' => &$array2, 'page' => &$page, 'mailTo' => &$mailTo); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['mailAlertQuantityThresholdPostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } //end of hook to let other plugins further manipulate the replacers if ($page[0]['content']) { $page[0]['content'] = str_replace($array1, $array2, $page[0]['content']); } if ($page[0]['name']) { $page[0]['name'] = str_replace($array1, $array2, $page[0]['name']); } foreach ($mailTo as $mailuser) { mslib_fe::mailUser($mailuser, $page[0]['name'], $page[0]['content'], $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME']); } } } if ($row['products_quantity'] < 1) { if ($this->ms['MODULES']['DISABLE_PRODUCT_WHEN_NEGATIVE_STOCK']) { if (!$this->ms['MODULES']['ALLOW_ORDER_OUT_OF_STOCK_PRODUCT']) { // stock is negative or zero. lets turn off the product mslib_befe::disableProduct($value['products_id']); } } } // now decrease the stocklevel eof } } } if ($orders_products_id and is_array($value['attributes'])) { foreach ($value['attributes'] as $attribute_key => $attribute_values) { $str = "SELECT products_options_name,listtype from tx_multishop_products_options o where o.products_options_id='" . $attribute_key . "' "; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry); // print_r($row['listtype']); switch ($row['listtype']) { case 'checkbox': $items = $attribute_values; break; default: $items = array($attribute_values); break; } foreach ($items as $item) { $attributes_tax['country_tax'] = (string) $item['country_tax']; $attributes_tax['region_tax'] = (string) $item['region_tax']; $attributes_tax['tax'] = (string) $item['tax']; if ($this->ms['MODULES']['DISABLE_VAT_RATE']) { $attributes_tax['country_tax'] = 0; $attributes_tax['region_tax'] = 0; $attributes_tax['tax'] = 0; } $insertAttributes = array(); $insertAttributes['orders_id'] = $orders_id; $insertAttributes['orders_products_id'] = $orders_products_id; $insertAttributes['products_options'] = $item['products_options_name']; $insertAttributes['products_options_values'] = $item['products_options_values_name']; $insertAttributes['options_values_price'] = $item['options_values_price']; $insertAttributes['price_prefix'] = $item['price_prefix']; $insertAttributes['products_options_id'] = $item['options_id']; $insertAttributes['products_options_values_id'] = $item['options_values_id']; $sub_total_excluding_vat['attributes_price'] += $item['price_prefix'] . $item['options_values_price'] * $value['qty']; $sub_total['attributes_price'] += $item['price_prefix'] . $item['options_values_price'] * $value['qty']; $insertAttributes['attributes_tax_data'] = serialize($attributes_tax); $insertAttributes = mslib_befe::rmNullValuedKeys($insertAttributes); $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_orders_products_attributes', $insertAttributes); $res = $GLOBALS['TYPO3_DB']->sql_query($query); } } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrdersProductsPostProc'])) { // hook $params = array('ms' => $this->ms, 'orders_products_id' => $orders_products_id, 'insertArray' => $insertArray, 'insertAttributes' => $insertAttributes, 'cart' => $cart, 'cart_value' => $value); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrdersProductsPostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } // hook eof } } } } $updateArray = array(); $orders_tax['sub_total_excluding_vat'] = (string) array_sum($sub_total_excluding_vat); $orders_tax['sub_total'] = (string) array_sum($sub_total); if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) { $orders_tax['total_orders_tax'] = (string) round(array_sum($total_order_tax), 2); } else { $orders_tax['total_orders_tax'] = (string) array_sum($total_order_tax); } $orders_tax['total_orders_tax_including_discount'] = $orders_tax['total_orders_tax']; $grand_total['sub_total'] = array_sum($sub_total); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrdersTotalProc'])) { // hook $params = array('sub_total_excluding_vat' => &$sub_total_excluding_vat, 'sub_total' => &$sub_total, 'total_order_tax' => &$total_order_tax, 'orders_tax' => &$orders_tax, 'grand_total' => &$grand_total, 'cart' => $cart); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrdersTotalProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } // hook eof } if ($cart['discount_type']) { switch ($cart['discount_type']) { case 'percentage': if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) { $discount_amount = $orders_tax['sub_total_excluding_vat'] / 100 * $cart['discount']; } else { $discount_amount = $orders_tax['sub_total'] / 100 * $cart['discount']; } $discount_percentage = $cart['discount']; break; case 'price': $discount_amount = $cart['discount']; if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) { $discount_percentage = $discount_amount / $orders_tax['sub_total_excluding_vat'] * 100; } else { $discount_percentage = $discount_amount / $orders_tax['sub_total'] * 100; } break; } if ($discount_amount) { if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) { $grand_total['sub_total_excluding_vat'] = $grand_total['sub_total_excluding_vat'] - $discount_amount; if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $orders_tax['total_orders_tax_including_discount'] = round((1 - $discount_amount / $orders_tax['sub_total']) * $orders_tax['total_orders_tax_including_discount'], 2); } else { $orders_tax['total_orders_tax_including_discount'] = $orders_tax['total_orders_tax_including_discount'] / 100 * (100 - $discount_percentage); } } else { $grand_total['sub_total'] = $grand_total['sub_total'] - $discount_amount; if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $orders_tax['total_orders_tax_including_discount'] = round((1 - $discount_amount / $orders_tax['sub_total']) * $orders_tax['total_orders_tax_including_discount'], 2); } else { $orders_tax['total_orders_tax_including_discount'] = $orders_tax['total_orders_tax_including_discount'] / 100 * (100 - $discount_percentage); } } } $updateArray['discount'] = $discount_amount; } $orders_tax['total_orders_tax'] += $orders_tax['shipping_tax']; $orders_tax['total_orders_tax'] += $orders_tax['payment_tax']; $orders_tax['total_orders_tax_including_discount'] += $orders_tax['shipping_tax']; $orders_tax['total_orders_tax_including_discount'] += $orders_tax['payment_tax']; $orders_tax['tax_separation'] = $tax_separation; if ($this->ms['MODULES']['DISABLE_VAT_RATE']) { $orders_tax['total_orders_tax'] = 0; } $orders_tax['grand_total'] = (string) array_sum($grand_total); $updateArray['orders_tax_data'] = serialize($orders_tax); $updateArray['grand_total'] = $orders_tax['grand_total']; if (!empty($cart['coupon_code'])) { $updateArray['coupon_code'] = $cart['coupon_code']; $updateArray['coupon_discount_type'] = $cart['discount_type']; $updateArray['coupon_discount_value'] = $cart['discount']; } $updateArray['orders_last_modified'] = time(); $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_orders', 'orders_id=\'' . $orders_id . '\'', $updateArray); $res = $GLOBALS['TYPO3_DB']->sql_query($query); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderDiscountPreProc'])) { // hook $params = array('ms' => $this->ms, 'orders_id' => $orders_id, 'cart' => &$cart); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderDiscountPreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } // hook oef } if ($cart['discount']) { if ($cart['discount']) { if ($cart['coupon_code']) { $str = "update tx_multishop_coupons set times_used=(times_used+1) where code='" . addslashes($cart['coupon_code']) . "'"; $res = $GLOBALS['TYPO3_DB']->sql_query($str); $cart['coupon_code'] = ''; } $cart['discount'] = ''; $cart['discount_type'] = ''; } } mslib_befe::storeCustomerCartContent($cart, $customer_id, 1); // debug /* $order=mslib_fe::getOrder($orders_id); $ORDER_DETAILS=mslib_fe::printOrderDetailsTable($order,'email'); echo $ORDER_DETAILS; die(); */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderPostHook'])) { // hook $params = array('cart' => &$cart, 'orders_id' => &$orders_id); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderPostHook'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } // hook oef } $cart['products'] = array(); //unset($cart['user']); unset($cart['discount_type']); unset($cart['discount_amount']); //$GLOBALS['TSFE']->fe_user->setKey('ses', $this->cart_page_uid, $cart); //$GLOBALS['TSFE']->storeSessionData(); tx_mslib_cart::storeCart($cart); // unset the cart with original key $plain_cart_key = 'tx_multishop_cart'; if ($this->ms['MODULES']['CART_PAGE_UID']) { $plain_cart_key .= '_' . $this->ms['MODULES']['CART_PAGE_UID']; } $cart2 = $GLOBALS['TSFE']->fe_user->getKey('ses', $plain_cart_key); $cart2['products'] = array(); //unset($cart2['user']); unset($cart2['discount_type']); unset($cart2['discount_amount']); //TODO: plain cart key? //$GLOBALS['TSFE']->fe_user->setKey('ses', $plain_cart_key, $cart2); //$GLOBALS['TSFE']->storeSessionData(); tx_mslib_cart::storeCart($cart2); // custom error script for checkout if ($this->ms['MODULES']['ORDERS_CUSTOM_EXPORT_SCRIPT']) { if (strstr($this->ms['MODULES']['ORDERS_CUSTOM_EXPORT_SCRIPT'], "..")) { die('error in ORDERS_CUSTOM_EXPORT_SCRIPT value'); } else { require $this->DOCUMENT_ROOT . $this->ms['MODULES']['ORDERS_CUSTOM_EXPORT_SCRIPT'] . '.php'; } } require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.tx_mslib_order.php'; $mslib_order = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_mslib_order'); $mslib_order->init($this); $mslib_order->repairOrder($orders_id); // if grand total is zero we have to activate directly $order = mslib_fe::getOrder($orders_id); if ($order['orders_id'] and $order['grand_total'] < 0.001) { mslib_fe::updateOrderStatusToPaid($order['orders_id']); } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderLastPostHook'])) { // hook $params = array('orders_id' => &$orders_id); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['insertOrderLastPostHook'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } // hook oef } return $orders_id; } } }
$subpartArray['###VALUE_OLD_CATEGORY_ID###'] = $old_current_categories_id; //$product['categories_id']; $subpartArray['###INPUT_CATEGORY_TREE###'] = '<input type="hidden" name="categories_id" id="categories_id" class="categoriesIdSelect2BigDropWider" value="' . $current_categories_id . '" />'; $subpartArray['###INPUT_CATEGORY_TREE_DEFAULT_PATH###'] = ''; if ($this->get['action'] == 'edit_product' && $this->ms['MODULES']['ENABLE_DEFAULT_CRUMPATH'] > 0) { $product_path = mslib_befe::getRecord($this->get['pid'], 'tx_multishop_products_to_categories', 'products_id', array('is_deepest=1 and default_path=1')); $default_path = 0; if (is_array($product_path) && count($product_path)) { $default_path = $product_path['node_id']; } $p2c_cats = explode(',', $old_current_categories_id); $default_path_sb = '<select name="default_path_categories_id" id="default_path_categories_id" class="categoriesIdSelect2BigDropWider">'; $default_path_sb .= '<option value="">' . $this->pi_getLL('choose') . '</option>'; foreach ($p2c_cats as $p2c_cat) { if ($p2c_cat > 0) { $cats = mslib_fe::Crumbar($p2c_cat, '', array()); $cats = array_reverse($cats); $catpath = array(); foreach ($cats as $cat_idx => $cat) { $catpath[] = $cat['name']; } if ($default_path > 0 && $p2c_cat == $default_path) { $default_path_sb .= '<option value="' . $p2c_cat . '" selected="selected">' . implode(' > ', $catpath) . '</option>'; } else { $default_path_sb .= '<option value="' . $p2c_cat . '">' . implode(' > ', $catpath) . '</option>'; } } } $default_path_sb .= '</select>'; $subpartArray['###INPUT_CATEGORY_TREE_DEFAULT_PATH###'] = '<div class="form-group" id="msEditProductInputCategoryDefaultPath"> <label for="default_path_categories_id" class="col-md-2 control-label">' . $this->pi_getLL('category_default_path') . '</label>
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_sort_products.php']['adminSortProductsQuesryFilter'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } $query_p = $GLOBALS['TYPO3_DB']->SELECTquery('p.products_id, p.products_image, pd.products_name', 'tx_multishop_products_to_categories p2c, tx_multishop_products p, tx_multishop_products_description pd', implode(' and ', $filter), 'p.products_id', 'p2c.sort_order ' . $this->ms['MODULES']['PRODUCTS_LISTING_SORT_ORDER_OPTION'], ''); // $res_p = $GLOBALS['TYPO3_DB']->sql_query($query_p); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res_p)) { $products_list = array(); while ($row_p = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_p)) { $tmp_product = ''; // if ($categories_id) { // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($categories_id); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $cat) { $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); $where .= '&'; } // get all cats to generate multilevel fake url eof } $link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $row_p['products_id'] . '&tx_multishop_pi1[page_section]=products_detail'); // $imagePath = '<div class="no_image"></div>';