public function duplicateProduct($id_product, $target_categories_id)
 {
     if (!is_numeric($id_product)) {
         return false;
     }
     if (!is_numeric($target_categories_id)) {
         return false;
     }
     $str = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_products', 'products_id=\'' . $id_product . '\'', '', '', '');
     $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry) == 0) {
         return false;
     } else {
         //insert into tx_multishop_products
         $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
         $product_arr_new = array();
         if (is_array($row) && count($row)) {
             foreach ($row as $key_p => $val_p) {
                 if ($key_p != 'products_id') {
                     if ($key_p == 'products_image' or $key_p == 'products_image1' or $key_p == 'products_image2' or $key_p == 'products_image3' or $key_p == 'products_image4') {
                         if (!empty($val_p)) {
                             $str = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_products_description', 'products_id=\'' . $id_product . '\' and language_id=\'' . $this->sys_language_uid . '\'', '', '', '');
                             $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
                             $row_desc = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
                             $file = mslib_befe::getImagePath($val_p, 'products', 'original');
                             //echo $file;
                             $imgtype = mslib_befe::exif_imagetype($file);
                             if ($imgtype) {
                                 // valid image
                                 $ext = image_type_to_extension($imgtype, false);
                                 if ($ext) {
                                     $i = 0;
                                     $filename = mslib_fe::rewritenamein($row_desc['products_name']) . '.' . $ext;
                                     //echo $filename;
                                     $folder = mslib_befe::getImagePrefixFolder($filename);
                                     $array = explode(".", $filename);
                                     if (!is_dir($this->DOCUMENT_ROOT . $this->ms['image_paths']['products']['original'] . '/' . $folder)) {
                                         \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir($this->DOCUMENT_ROOT . $this->ms['image_paths']['products']['original'] . '/' . $folder);
                                     }
                                     $folder .= '/';
                                     $target = $this->DOCUMENT_ROOT . $this->ms['image_paths']['products']['original'] . '/' . $folder . $filename;
                                     //echo $target;
                                     if (file_exists($target)) {
                                         do {
                                             $filename = mslib_fe::rewritenamein($row_desc['products_name']) . ($i > 0 ? '-' . $i : '') . '.' . $ext;
                                             $folder_name = mslib_befe::getImagePrefixFolder($filename);
                                             $array = explode(".", $filename);
                                             $folder = $folder_name;
                                             if (!is_dir($this->DOCUMENT_ROOT . $this->ms['image_paths']['products']['original'] . '/' . $folder)) {
                                                 \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir($this->DOCUMENT_ROOT . $this->ms['image_paths']['products']['original'] . '/' . $folder);
                                             }
                                             $folder .= '/';
                                             $target = $this->DOCUMENT_ROOT . $this->ms['image_paths']['products']['original'] . '/' . $folder . $filename;
                                             $i++;
                                             //echo $target . "<br/>";
                                         } while (file_exists($target));
                                     }
                                     if (copy($file, $target)) {
                                         $target_origineel = $target;
                                         $update_product_images = mslib_befe::resizeProductImage($target_origineel, $filename, $this->DOCUMENT_ROOT . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey));
                                     }
                                 }
                             }
                             $product_arr_new[$key_p] = $update_product_images;
                         } else {
                             $product_arr_new[$key_p] = $val_p;
                         }
                     } else {
                         $product_arr_new[$key_p] = $val_p;
                     }
                 }
             }
         }
         $product_arr_new['sort_order'] = time();
         $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_products', $product_arr_new);
         $res = $GLOBALS['TYPO3_DB']->sql_query($query);
         $id_product_new = $GLOBALS['TYPO3_DB']->sql_insert_id();
         unset($product_arr_new);
         if ($id_product_new) {
             // insert tx_multishop_products_description
             $str = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_products_description', 'products_id=\'' . $id_product . '\'', '', '', '');
             $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
                 $product_arr_new = $row;
                 $product_arr_new['products_id'] = $id_product_new;
                 if (strpos($product_arr_new['products_name'], '(copy') === false) {
                     $product_arr_new['products_name'] .= ' (copy ' . $id_product_new . ')';
                 } else {
                     if (strpos($product_arr_new['products_name'], '(copy ' . $id_product . ')') !== false) {
                         $product_arr_new['products_name'] = str_replace('(copy ' . $id_product . ')', ' (copy ' . $id_product_new . ')', $product_arr_new['products_name']);
                     } else {
                         $product_arr_new['products_name'] = str_replace('(copy)', ' (copy ' . $id_product_new . ')', $product_arr_new['products_name']);
                     }
                 }
                 $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_products_description', $product_arr_new);
                 $res = $GLOBALS['TYPO3_DB']->sql_query($query);
             }
             // insert tx_multishop_products_attributes
             $str = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_products_attributes', 'products_id=\'' . $id_product . '\' and page_uid=\'' . $this->showCatalogFromPage . '\'', '', '', '');
             $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
             if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry) > 0) {
                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
                     $product_arr_new = $row;
                     $product_arr_new['products_id'] = $id_product_new;
                     $product_arr_new['page_uid'] = $this->showCatalogFromPage;
                     unset($product_arr_new['products_attributes_id']);
                     //primary key
                     $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_products_attributes', $product_arr_new);
                     $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                 }
             }
             // insert tx_multishop_specials
             $str = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_specials', 'products_id=\'' . $id_product . '\'', '', '', '');
             $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
             if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry) > 0) {
                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
                     $product_arr_new = $row;
                     $product_arr_new['products_id'] = $id_product_new;
                     unset($product_arr_new['specials_id']);
                     //primary key
                     $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_specials', $product_arr_new);
                     $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                 }
             }
             // insert tx_multishop_products_to_relative_products
             $str = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_products_to_relative_products', 'products_id=\'' . $id_product . '\' or relative_product_id = \'' . $id_product . '\'', '', '', '');
             $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
             if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry) > 0) {
                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
                     $product_arr_new = $row;
                     if ($product_arr_new['products_id'] == $id_product) {
                         $product_arr_new['products_id'] = $id_product_new;
                     } else {
                         $product_arr_new['relative_product_id'] = $id_product_new;
                     }
                     unset($product_arr_new['products_to_relative_product_id']);
                     //primary key
                     $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_products_to_relative_products', $product_arr_new);
                     $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                 }
             }
             // insert into tx_multishop_products_to_categories
             $insertArray = array('products_id' => $id_product_new, 'categories_id' => $target_categories_id, 'sort_order' => time(), 'page_uid' => $this->showCatalogFromPage);
             //$query=$GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_products_to_categories', $insertArray);
             //$res=$GLOBALS['TYPO3_DB']->sql_query($query);
             // create categories tree linking
             $res = tx_mslib_catalog::linkCategoriesTreeToProduct($id_product_new, $target_categories_id, $insertArray);
             if ($res) {
                 if ($this->ms['MODULES']['FLAT_DATABASE']) {
                     mslib_befe::convertProductToFlat($id_product);
                 }
             } else {
                 return false;
             }
         }
     }
 }
     // custom hook that can be controlled by third-party plugin eof
 }
 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_edit_product.php']['saveProductPostHook'])) {
     $params = array('prodid' => $prodid);
     foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_edit_product.php']['saveProductPostHook'] as $funcRef) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
     }
 }
 // set default Crumpath
 mslib_befe::setProductDefaultCrumpath($prodid);
 // lets notify plugin that we have update action in product
 tx_mslib_catalog::productsUpdateNotifierForPlugin($this->post, $prodid);
 // custom hook that can be controlled by third-party plugin eof
 if ($this->ms['MODULES']['FLAT_DATABASE']) {
     // if the flat database module is enabled we have to sync the changes to the flat table
     mslib_befe::convertProductToFlat($prodid);
 }
 if (isset($this->post['SaveClose']) || isset($this->post['save_as_new'])) {
     if (strpos($this->post['tx_multishop_pi1']['referrer'], 'action=edit_product') === false && strpos($this->post['tx_multishop_pi1']['referrer'], 'action=add_product') === false && $this->post['tx_multishop_pi1']['referrer']) {
         header("Location: " . $this->post['tx_multishop_pi1']['referrer']);
         exit;
     } else {
         header("Location: " . $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=admin_products_search_and_edit', 1));
         exit;
     }
 } else {
     if (isset($this->post['Submit'])) {
         $redirect_cid = $this->get['cid'];
         if (!$redirect_cid) {
             $product_data = mslib_fe::getProduct($prodid, '', '', 1);
             $redirect_cid = $product_data['categories_id'];
     $updateArray['page_uid'] = $this->showCatalogFromPage;
     $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_categories', $updateArray);
     $res = $GLOBALS['TYPO3_DB']->sql_query($query);
     $catid = $GLOBALS['TYPO3_DB']->sql_insert_id();
 } else {
     if ($_REQUEST['action'] == 'edit_category') {
         $updateArray['last_modified'] = time();
         $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_categories', 'categories_id=\'' . $this->post['cid'] . '\'', $updateArray);
         $res = $GLOBALS['TYPO3_DB']->sql_query($query);
         $catid = $this->post['cid'];
         if ($this->ms['MODULES']['FLAT_DATABASE']) {
             $products = mslib_fe::getProducts('', $catid);
             if (is_array($products)) {
                 foreach ($products as $product) {
                     // if the flat database module is enabled we have to sync the changes to the flat table
                     mslib_befe::convertProductToFlat($product['products_id']);
                 }
             }
         }
         if (count($shopPids) && $this->ms['MODULES']['ENABLE_CATEGORIES_TO_CATEGORIES']) {
             // clean up the link
             $query = $GLOBALS['TYPO3_DB']->DELETEquery('tx_multishop_categories_to_categories', 'categories_id=\'' . $catid . '\' and page_uid=\'' . $this->showCatalogFromPage . '\'');
             $res = $GLOBALS['TYPO3_DB']->sql_query($query);
             // link to other categories
             $catIds = array();
             $reflector_cattree = array();
             if (!empty($this->post['link_categories_id'])) {
                 if (strpos($this->post['link_categories_id'], ',') !== false) {
                     $tmp_link_categories_id = explode(',', $this->post['link_categories_id']);
                     $catIds[$this->showCatalogFromPage] = $tmp_link_categories_id;
                     foreach ($tmp_categories_id as $tmp_catid) {
                        $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                    }
                }
                // insert into tx_multishop_products_to_categories
                $insertArray = array('products_id' => $id_product_new, 'categories_id' => $id_category, 'page_uid' => $this->showCatalogFromPage, 'sort_order' => time());
                //$query=$GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_products_to_categories', $insertArray);
                //$res=$GLOBALS['TYPO3_DB']->sql_query($query);
                // create categories tree linking
                $res = tx_mslib_catalog::linkCategoriesTreeToProduct($id_product_new, $id_category, $insertArray);
                // custom page hook that can be controlled by third-party plugin
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/copy_duplicate_product.php']['copyDuplicateProductPostHook'])) {
                    $params = array('old_products_id' => &$id_product, 'products_id' => &$id_product_new);
                    foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/copy_duplicate_product.php']['copyDuplicateProductPostHook'] as $funcRef) {
                        \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                    }
                }
                // custom page hook that can be controlled by third-party plugin eof
                if ($res) {
                    echo "<p>Product succesfully duplicated</p>";
                    if ($this->ms['MODULES']['FLAT_DATABASE']) {
                        // if the flat database module is enabled we have to sync the changes to the flat table
                        mslib_befe::convertProductToFlat($id_product_new);
                    }
                } else {
                    echo "<p>Product not duplicated</p>";
                }
            }
        }
    }
}
exit;
Exemple #5
0
                     $updateArray['type'] = 'shipping';
                     $updateArray['negate'] = !$item[$s] ? 1 : 0;
                     $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_products_method_mappings', $updateArray);
                     $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                 }
             }
         }
     }
 }
 // update flat database
 if ($this->ms['MODULES']['FLAT_DATABASE'] or $this->ms['MODULES']['GLOBAL_MODULES']['FLAT_DATABASE']) {
     if (isset($item['products_status']) and $item['products_status'] == '0' and is_numeric($products_id)) {
         $query = $GLOBALS['TYPO3_DB']->DELETEquery('tx_multishop_products_flat', 'products_id=' . $products_id);
         $res = $GLOBALS['TYPO3_DB']->sql_query($query);
     } else {
         mslib_befe::convertProductToFlat($products_id, 'tx_multishop_products_flat');
     }
 }
 // lets notify plugin that we have update action in product
 tx_mslib_catalog::productsUpdateNotifierForPlugin($item);
 // update flat database eof
 if ($item['added_products_id']) {
     // custom hook that can be controlled by third-party plugin
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_import.php']['insertProductPostHook'])) {
         $params = array('products_id' => $item['added_products_id'], 'item' => &$item, 'prefix_source_name' => $this->post['prefix_source_name']);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_import.php']['insertProductPostHook'] as $funcRef) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
         }
     }
     // custom hook that can be controlled by third-party plugin eof
     // set default Crumpath
        if ($x2 == 0) {
            $x2 = '';
        }
        $filename = $row['products_image' . $x2];
        if ($filename) {
            $folder = mslib_befe::getImagePrefixFolder($filename);
            if (!file_exists($this->DOCUMENT_ROOT . $this->ms['image_paths']['products']['original'] . '/' . $folder . '/' . $filename)) {
                // file no longer available. lets update the database
                $updateArray['products_image' . $x2] = '';
                if (!$x2) {
                    // first image
                    $updateArray['contains_image'] = '0';
                }
            }
        }
    }
    if (count($updateArray)) {
        $unmapped_images++;
        $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_products', 'products_id=' . $row['products_id'], $updateArray);
        $res = $GLOBALS['TYPO3_DB']->sql_query($query);
        // update flat database
        if ($this->ms['MODULES']['GLOBAL_MODULES']['FLAT_DATABASE']) {
            mslib_befe::convertProductToFlat($row['products_id'], 'tx_multishop_products_flat');
        }
    }
}
if ($unmapped_images) {
    $content .= '<strong>' . $unmapped_images . '</strong> ' . $this->pi_getLL('admin_label_missing_related_images_has_been_adjust_to_the_database') . '.<br />';
} else {
    $content .= $this->pi_getLL('admin_label_everything_is_fine');
}
 public function getProduct($products_id, $categories_id = '', $extra_fields = '', $include_disabled_products = 0, $skipFlatDatabase = 0, $ignoreStartEndTime = 0)
 {
     if (!is_numeric($products_id)) {
         return false;
     }
     if (!empty($categories_id)) {
         $categories_id = (int) $categories_id;
     }
     if ($skipFlatDatabase || (!$this->ms['MODULES']['FLAT_DATABASE'] || $include_disabled_products)) {
         $select = array();
         $select[] = '*';
         $select[] = 'p.staffel_price as staffel_price';
         $select[] = 's.specials_new_products_price';
         $select[] = 's.start_date as special_start_date';
         $select[] = 's.expires_date as special_expired_date';
         $select[] = 's.status as special_status';
         $select[] = 'IF(s.status, s.specials_new_products_price, p.products_price) as final_price';
         $select[] = 'oud.name as order_unit_name';
         if ($extra_fields) {
             $select[] = $extra_fields;
         }
         $from = array();
         $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_description oud on p.order_unit_id=oud.order_unit_id and oud.language_id=' . $this->sys_language_uid;
         $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();
         if (!$include_disabled_products) {
             $where[] = 'p.products_status=1';
         }
         $where[] = 'p.products_id=\'' . $products_id . '\'';
         $where[] = 'pd.language_id=\'' . $this->sys_language_uid . '\'';
         $where[] = 'cd.language_id=pd.language_id';
         $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';
         if ($categories_id) {
             $where[] = 'p2c.categories_id=\'' . $categories_id . '\'';
         }
         $where[] = 'p2c.is_deepest=1';
     } else {
         $select = array();
         $select[] = '*';
         $from = array();
         $from[] = 'tx_multishop_products_flat';
         $where = array();
         $where[] = 'products_id=\'' . $products_id . '\'';
         $where[] = 'language_id=\'' . $this->sys_language_uid . '\'';
     }
     $query_elements = array();
     $query_elements['select'] =& $select;
     $query_elements['from'] =& $from;
     $query_elements['where'] =& $where;
     $params = array('query_elements' => &$query_elements, 'skipFlatDatabase' => &$skipFlatDatabase, 'include_disabled_products' => &$include_disabled_products);
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getProductPreProc'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getProductPreProc'] as $funcRef) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
         }
     }
     $str = $GLOBALS['TYPO3_DB']->SELECTquery(is_array($query_elements['select']) ? implode(",", $query_elements['select']) : '', is_array($query_elements['from']) ? implode(",", $query_elements['from']) : '', is_array($query_elements['where']) ? implode(" and ", $query_elements['where']) : '', is_array($query_elements['group_by']) ? implode(",", $query_elements['group_by']) : '', is_array($query_elements['order_by']) ? implode(",", $query_elements['order_by']) : '', is_array($query_elements['limit']) ? implode(",", $query_elements['limit']) : '');
     $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
     $product = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
     $current_tstamp = time();
     if ($product['specials_new_products_price'] > 0) {
         $disable_special_price = false;
         if ($product['special_start_date'] > 0) {
             if ($product['special_start_date'] > $current_tstamp) {
                 $product['specials_new_products_price'] = 0;
                 $product['final_price'] = $product['products_price'];
                 $disable_special_price = true;
             }
         }
         if ($product['special_expired_date'] > 0) {
             if ($product['special_expired_date'] <= $current_tstamp) {
                 $product['specials_new_products_price'] = 0;
                 $product['final_price'] = $product['products_price'];
                 $disable_special_price = true;
             }
         }
         $check_special_status = '0';
         $set_special_status = '1';
         if ($disable_special_price) {
             $check_special_status = '1';
             $set_special_status = '0';
         }
         $str = $GLOBALS['TYPO3_DB']->SELECTquery('status', 'tx_multishop_specials', 'products_id=\'' . $products_id . '\' and status=\'' . $check_special_status . '\'', '', '', '');
         $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry) > 0) {
             $updateArray = array();
             $updateArray['status'] = $set_special_status;
             $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_specials', 'products_id=\'' . $products_id . '\'', $updateArray);
             $GLOBALS['TYPO3_DB']->sql_query($query);
             if ($this->ms['MODULES']['FLAT_DATABASE']) {
                 // update the flat table
                 mslib_befe::convertProductToFlat($products_id);
             }
         }
     }
     if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
         // when shop is running excluding vat then change prices to 2 decimals to prevent bugs
         if ($product['final_price']) {
             $product['final_price'] = round($product['final_price'], 2);
         }
         if ($product['products_price']) {
             $product['products_price'] = round($product['products_price'], 2);
         }
         if ($product['specials_price']) {
             $product['specials_price'] = round($product['specials_price'], 2);
         }
     }
     if ($product['products_id']) {
         $disable_product = false;
         $current_tstamp = time();
         // check every cat status
         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);
             $product_crumbar_tree = array();
             if (count($cats) > 0) {
                 foreach ($cats as $cat) {
                     if ($cat['status'] == 0) {
                         $disable_product = true;
                     }
                     $product_crumbar_tree[$level]['id'] = $cat['id'];
                     $product_crumbar_tree[$level]['name'] = $cat['name'];
                     $product_crumbar_tree[$level]['url'] = $cat['url'];
                     $level++;
                 }
             }
             // get all cats to generate multilevel fake url eof
             if (count($product_crumbar_tree)) {
                 $product['categories_crumbar'] = $product_crumbar_tree;
             }
         }
         if (!$ignoreStartEndTime) {
             if ($product['starttime'] > 0) {
                 if ($product['starttime'] > $current_tstamp) {
                     $disable_product = true;
                 }
             }
             if ($product['endtime'] > 0) {
                 if ($product['endtime'] <= $current_tstamp) {
                     $disable_product = true;
                 }
             }
         }
         if ($disable_product && !$include_disabled_products) {
             return false;
         }
         // hook
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getProductArray'])) {
             $params = array('product' => &$product, 'products_id' => $products_id, 'categories_id' => $categories_id, 'extra_fields' => $extra_fields, 'include_disabled_products' => $include_disabled_products, 'skipFlatDatabase' => $skipFlatDatabase);
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getProductArray'] as $funcRef) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
             }
         }
         // hook eof
         if ($this->conf['disableFeFromCalculatingVatPrices'] != '1') {
             $tax_ruleset = self::getTaxRuleSet($product['tax_id'], 0);
             $product['tax_rate'] = $tax_ruleset['total_tax_rate'] / 100;
             $product['region_tax_rate'] = $tax_ruleset['state_tax_rate'] / 100;
             $product['country_tax_rate'] = $tax_ruleset['country_tax_rate'] / 100;
         }
         return $product;
     }
 }