public function procShopToolExportProducts(){ $shopModel = $this->model; $productRepository = $shopModel->getProductRepository(); $categoryRepository = $shopModel->getCategoryRepository(); $attributeRepository = $shopModel->getAttributeRepository(); $args = new stdClass(); $args->module_srl = $this->module_info->module_srl; $products = $productRepository->getAllProducts($args); $categories = $categoryRepository->getCategoriesTree($args->module_srl)->toFlatStructure(); $attributes = $attributeRepository->getAttributesList($args->module_srl)->attributes; FileHandler::makeDir('./files/attach/shop/export-import/'); if(count($products)) $productRepository->addProductsToExportFolder($products); if(count($categories)) $categoryRepository->addCategoriesToExportFolder($categories); if(count($attributes)) $attributeRepository->addAttributesToExportFolder($attributes); if(!count($products) && !count($categories) && !count($attributes)){ $this->setMessage("No data to export"); $returnUrl = getNotEncodedUrl('', 'act', 'dispShopToolManageProducts'); $this->setRedirectUrl($returnUrl); return; } $shopModel->includeZipHandler(); ZipHandler::zip('./files/attach/shop/export-import/','./files/attach/shop/export.zip'); header("Content-type: application/zip"); header("Content-Disposition: attachment; filename=export.zip"); header("Pragma: no-cache"); header("Expires: 0"); readfile('./files/attach/shop/export.zip'); FileHandler::removeFile('./files/attach/shop/export.zip'); FileHandler::removeDir('./files/attach/shop/export-import/'); exit; }