php - Magento, Help with SQL Query to get full product URL's -
so, looking interact database outside of magento. upon reviewing tables in database, catalog_product_flat_1 seems store majority of information looking retrieve gets me final step.
i trying understand relations within magento db , full product url's newly created table.
the purpose of seo/ppc initiative having nice list of every product sku, name, brand, description , url directly product make work breeze.
i have working fine aside full product url.
i have been doing amount of reading , appears more people using sql injections within normal magento methods, looking database outside of site.
any appreciated.
running raw sql commands against magento database time-consuming, not upgrade-proof and, in cases, dangerous. use models made available in magento codebase perform queries.
you achieve sku, name, brand, description , url done with:
<?php require_once 'app/mage.php'; varien_profiler::enable(); mage::setisdevelopermode(true); ini_set('display_errors', 1); umask(0); mage::app(); $fhandle = fopen("dump.csv", "w"); $products = mage::getmodel('catalog/product')->getcollection() ->addattributetoselect('*'); foreach ($products $product) { $data = array( $product->getsku(), $product->getname(), $product->getbrand(), // or whatever attribute name is.. $product->getdescription(), $product->geturlpath() ); fputcsv($fhandle, $data); } fclose($fhandle);
i don't follow use of "sql injections". attacks, not ways of programming.
Comments
Post a Comment