meca11 Posted September 4, 2014 Share Posted September 4, 2014 Arkadaşlar merhaba, Prestashop'un veritabanında ürün resimlerinin url'lerinin export etmek istesem hangi tablodan yararlanacağım ? Link to comment Share on other sites More sharing options...
Şahin YILDIZ Posted September 4, 2014 Share Posted September 4, 2014 (edited) prestashop'ta direk url yoktur...bir kod dizinini izlemeniz gerekiyor... Örnek : http://lwww.siteadi.com".__PS_BASE_URI__."img/p/".$image[0]['id_product']."-".$image[0]['id_image']."-large.jpg aşağıdaki kod işinizi görür....xml.php olarak kayıt edin ana dizinde çalıştırın...size fikir verecektir... <?php include(dirname(__FILE__).'/config/config.inc.php'); require_once(dirname(__FILE__).'/init.php'); // Get data $number = (intval(Tools::getValue('n')) ? intval(Tools::getValue('n')) : 10000); $orderByValues = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position'); $orderWayValues = array(0 => 'ASC', 1 => 'DESC'); $orderBy = Tools::strtolower(Tools::getValue('orderby', $orderByValues[intval(Configuration::get('PS_PRODUCTS_ORDER_BY'))])); $orderWay = Tools::strtoupper(Tools::getValue('orderway', $orderWayValues[intval(Configuration::get('PS_PRODUCTS_ORDER_WAY'))])); if (!in_array($orderBy, $orderByValues)) $orderBy = $orderByValues[0]; if (!in_array($orderWay, $orderWayValues)) $orderWay = $orderWayValues[0]; //$id_category = (intval(Tools::getValue('id_category')) ? intval(Tools::getValue('id_category')) : 1); $currency = new Currency(intval($cookie->id_currency)); $affiliate = (Tools::getValue('ac') ? '?ac='.Tools::getValue('ac') : ''); $categTree = Category::getRootCategory()->recurseLiteCategTree(0); function constructTreeNode($node){ $ret = ';'; $ret .= $node['id'].'|'.$node['name'].';'; if(!empty($node['children'])) { $ret .= ';'; foreach ($node['children'] AS $child) $ret .= constructTreeNode($child); $ret .= ';'; } return $ret; } foreach ($categTree['children'] AS $child) $ulTree .= constructTreeNode($child); $tab_cat=explode(';',$ulTree); foreach ($tab_cat as $id2cat){ $tab_id2cat=explode('|',$id2cat); if (!empty($tab_id2cat)) $tab_cat_final[$tab_id2cat[0]]=$tab_id2cat[1]; } header("Content-Type:text/xml; charset=utf-8"); echo '<?xml version="1.0" encoding="UTF-8"?>'."\n"; ?> <katalog> <?php foreach ($tab_cat_final as $id_category=>$name_category){ $products = Product::getProducts(intval($cookie->id_lang), 0, ($number > 10000 ? 10000 : $number), $orderBy, $orderWay, $id_category, true); foreach ($products AS $product){ $image = Image::getImages(intval($cookie->id_lang), $product['id_product']); //$prix=Product::getPriceStatic($product['id_product']); $prix=Product::getPriceStatic($product['id_product'],true,NULL,6,NULL,FALSE,FALSE,1,FALSE); //$prix_promo= Product::getPriceStatic($product['id_product'],true,NULL,6,NULL,FALSE,TRUE,1,FALSE); //getPriceStatic($id_product, $usetax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = false) echo "<urun>\n"; echo "<durum>".($product['active']>0)."</durum>\n"; echo "<urun_id>".$product['id_product']."</urun_id>\n"; echo "<urun_adi>".$product['name']."</urun_adi>\n"; echo "<opis><![CDATA[".$product['description_short']."]]></opis>\n"; echo "<urun_fiyati>".$prix."</urun_fiyati>\n"; echo "<stok_adeti>".$product['quantity']."</stok_adeti>\n"; echo "<kategori>".$name_category."</kategori>\n"; echo "<link>".htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Tools::getValue('id_category'))).$affiliate."</link>\n"; echo "<resim>http://localhost".__PS_BASE_URI__."img/p/".$image[0]['id_product']."-".$image[0]['id_image']."-large.jpg</resim>\n"; echo "</urun>\n"; } } ?> </katalog> Edited September 4, 2014 by Şahin YILDIZ (see edit history) Link to comment Share on other sites More sharing options...
meca11 Posted September 4, 2014 Author Share Posted September 4, 2014 Aslında amacım belirli ürünleri xml export almak genel olarak ürünler detaylar vs çıkarttım ama resim olayı sıkıntı çıkarttı. Buradan bakacağım teşekkür ederim. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now