compret Posted April 16, 2010 Share Posted April 16, 2010 <?php include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/init.php'); //define date for title: EDIT this to create the time-format you need $now_date = date('m-d-Y H:i'); //define title for .doc or .xls file: EDIT this if you want $title = "Data Katalog xxxxxx tanggal $now_date"; $file_type = "vnd.ms-excel"; $file_ending = "xls"; //header info for browser: determines file type ('.doc' or '.xls') header("Content-Type: application/$file_type"); header("Content-Disposition: attachment; filename=katalog.$file_ending"); header("Pragma: no-cache"); header("Expires: 0"); echo ("$title\n"); echo ("ID\tNama Barang\tVarian\tHarga\tBerat\tReference\tEAN13\tJumlah Stok\n"); $rq = Product::getProducts($cookie->id_lang, 0, 0, 'id_product', 'ASC', false, true); if (is_array($rq)) { foreach($rq AS $j => $product){ $sep = "\t"; /* Build attributes combinaisons */ $prod = new Product($product['id_product'], $full = false, $cookie->id_lang); $combinaisons = $prod->getAttributeCombinaisons($cookie->id_lang); $groups = array(); if (!$combinaisons){ $schema_insert = ""; $schema_insert .= $product['id_product'].$sep; $schema_insert .= $product['name'].$sep; $schema_insert .= $sep; $schema_insert .= ($currency->format == 1 ? $currency->sign.' ' : '').Product::getPriceStatic($product['id_product'], $usetax = true, $combinaison['id_product_attribute'], $decimals = 2, $divisor = NULL, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = true).($currency->format == 2 ? ' '.$currency->sign : '').$sep; $schema_insert .= $product['weight'].Configuration::get('PS_WEIGHT_UNIT').$sep; $schema_insert .= $sep; $schema_insert .= $sep; $schema_insert .= $product['quantity'].$sep; $schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert); print(trim($schema_insert)); print "\n"; } if (is_array($combinaisons)) { $combArray = array(); foreach ($combinaisons AS $k => $combinaison) { $combArray[$combinaison['id_product_attribute']]['wholesale_price'] = $combinaison['wholesale_price']; $combArray[$combinaison['id_product_attribute']]['price'] = Product::getPriceStatic($product['id_product'], $usetax = true, $combinaison['id_product_attribute'], $decimals = 2, $divisor = NULL, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = true);//$combinaison['price']; $combArray[$combinaison['id_product_attribute']]['weight'] = $combinaison['weight']; $combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference']; $combArray[$combinaison['id_product_attribute']]['supplier_reference'] = $combinaison['supplier_reference']; $combArray[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13']; $combArray[$combinaison['id_product_attribute']]['location'] = $combinaison['location']; $combArray[$combinaison['id_product_attribute']]['quantity'] = $combinaison['quantity']; $combArray[$combinaison['id_product_attribute']]['default_on'] = $combinaison['default_on']; $combArray[$combinaison['id_product_attribute']]['ecotax'] = $combinaison['ecotax']; $combArray[$combinaison['id_product_attribute']]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']); if ($combinaison['is_color_group']) $groups[$combinaison['id_attribute_group']] = $combinaison['group_name']; } } $irow = 0; if (isset($combArray)){ foreach ($combArray AS $id_product_attribute => $product_attribute) { $schema_insert = ""; $list = ''; $jsList = ''; foreach ($product_attribute['attributes'] AS $attribute) { $list .= addslashes(htmlspecialchars($attribute[0])).' - '.addslashes(htmlspecialchars($attribute[1])).', '; $jsList .= '\''.addslashes(htmlspecialchars($attribute[0])).' : '.addslashes(htmlspecialchars($attribute[1])).'\', \''.$attribute[2].'\', '; } $list = rtrim($list, ', '); $jsList = rtrim($jsList, ', '); $schema_insert .= $product['id_product'].$sep; $schema_insert .= $product['name'].$sep; $schema_insert .= stripslashes($list).$sep; $schema_insert .= ($currency->format == 1 ? $currency->sign.' ' : '').$product_attribute['price'].($currency->format == 2 ? ' '.$currency->sign : '').$sep; $schema_insert .= $product_attribute['weight'].Configuration::get('PS_WEIGHT_UNIT').$sep; $schema_insert .= $product_attribute['reference'].$sep; $schema_insert .= $product_attribute['ean13'].$sep; $schema_insert .= $product_attribute['quantity'].$sep; $schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert); print(trim($schema_insert)); print "\n"; } } } } Link to comment Share on other sites More sharing options...
compret Posted April 16, 2010 Author Share Posted April 16, 2010 Ada beberapa orang yg lebih nyaman liat2 katalog secara offline daripada ngeklik2 di prestashop kita, jadi sy buat script yg export catalog product prestashop ke file excel. Sementara ini gambar product gk bisa dimasukin ke file excelnya, sy baru mau buat export catalog product yg bisa muncul gambarnya tapi ke file PDF, yg sudah ada librarynya di prestashop, krn klo export gambar ke file excel keknya hrus nambah library di prestashopny.Save script php di atas di /public_html, kemudian buat link ke file tsbSelamat mencoba Link to comment Share on other sites More sharing options...
caparuni Posted April 16, 2010 Share Posted April 16, 2010 mantab... gan izin yah buat dipake dan di modif ) Link to comment Share on other sites More sharing options...
Ardian Yuli Setyanto Posted April 19, 2010 Share Posted April 19, 2010 sundul gan ! sip. Link to comment Share on other sites More sharing options...
xulap Posted April 26, 2010 Share Posted April 26, 2010 wah, keren gan. Makasih ya. Ini yang saya cari2. DItunggu versi pdfnya ya Link to comment Share on other sites More sharing options...
xulap Posted April 26, 2010 Share Posted April 26, 2010 Kalau stoknya tidak ingin ditampilkan, script mana yang mesti dihilangkan ya gan? Link to comment Share on other sites More sharing options...
SmartiesKiller Posted May 2, 2010 Share Posted May 2, 2010 hello,how to install your script ? must create a blank php file ??thx Link to comment Share on other sites More sharing options...
jolvil Posted May 2, 2010 Share Posted May 2, 2010 You just have to make a new .php file with this code, upload on your site and call it with yourshop.com/exportfile.php, a xls file will be generated.I have a problem with french caracters in xls file : Capacité - 16Go, Couleur - BleuAnother problemI have no reference for products with no combinaisons Link to comment Share on other sites More sharing options...
SmartiesKiller Posted May 8, 2010 Share Posted May 8, 2010 work like a charm but need utf8 version ;D for € sign and é characteres.thx for this great piece of code. Link to comment Share on other sites More sharing options...
dmsman2 Posted June 13, 2010 Share Posted June 13, 2010 Hi,this is almost the export function what I'm looking for a long time now!!!!BUT, I also need the utf8 version and e characteres. And I have problems with the content of the "Reference" column...Before the export the product reference is "02-0001" After the export the product reference is "01.02.01" ? why?What do I need to add to this code to get also the following values for each product?- the product-URL- the product-ImagePlease somebody help! This is a great export function and the best thing is - even product variants are included..Thanks a lotRgdsdmsman Link to comment Share on other sites More sharing options...
dmsman2 Posted July 5, 2010 Share Posted July 5, 2010 Is somebody working on the integration of:- the PRODUCT URL- the PRODUCT IMAGE - the PRODUCT Short Description- the PRODUCT Long DescriptionThis would be great then the export function is in my opinion complete...Thanks a lot Link to comment Share on other sites More sharing options...
callmac Posted July 26, 2010 Share Posted July 26, 2010 Pre tax wholesale price also please and Manufacturer: ta Link to comment Share on other sites More sharing options...
dhatomi Posted August 20, 2010 Share Posted August 20, 2010 wah mantap master Link to comment Share on other sites More sharing options...
mel- Posted September 20, 2010 Share Posted September 20, 2010 Hi,I wanted to add the friendly url. it is called url rewrited on the import page under tools but in the database it looks like the field is called link_rewritedI tried adding this line to the bottom section of the php but it didn't add the url to the xls file: $schema_insert .= $product['link_rewrite'].$sep; I put it right below this line: $schema_insert .= $product['name'].$sep; this LOOKED like the right place. the section up above involves products with attributes which I don't have/use.any help would be appreciated. thank you for this module. Link to comment Share on other sites More sharing options...
astragor Posted January 3, 2011 Share Posted January 3, 2011 Thanks, very good script... It's more efficient than many module i have tested.Just one thing missed me, the wholesale price ! Link to comment Share on other sites More sharing options...
mnir Posted January 25, 2011 Share Posted January 25, 2011 Agan Compret emang yahuuuud lah !!! Link to comment Share on other sites More sharing options...
x2fashion Posted December 21, 2011 Share Posted December 21, 2011 disave pake nama apa gan di public htmlnya ? Link to comment Share on other sites More sharing options...
Recommended Posts