Pagina 1 di 1

Contribution per Trovaprezzi

Inviato: 15/11/2008, 14:38
da wiko85
Salve, avrei bisogno della contrib per trova prezzi
ho provato su oscommerce.com ma niente...
http://www.google.it/search?hl=it&q=sit ... ogle&meta=

Re: Contribution per Trovaprezzi

Inviato: 15/11/2008, 16:17
da vampire
ti serve il file per "stampare" i prodotti per l'iscrizione del sito al trovaprezzi? se ti serve quello te lo da la trovaprezzi stessa

Re: Contribution per Trovaprezzi

Inviato: 15/11/2008, 16:18
da marzioscaglione
Prova questa

Codice: Seleziona tutto

<?php

include('includes/application_top.php');

require(DIR_WS_INCLUDES . 'database_tables.php');

function get_special_price($product_id) {
   $special_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status");
   $special = tep_db_fetch_array($special_query);
   return $special['specials_new_products_price'];
  }



//INSERIRE QUI IL NOME DEL FILE DA GENERARE
$nomefile = '/trovaprezzi.txt';

// INSERIRE QUI IL NOME DEL SITO! IMPORTANTE: SENZA SLASH FINALE!
$site_url = "http://www.mcdigit.it";

// INSERIRE QUI L'ID DELLA LINGUA CHE SI VUOLE USARE
$language_id = "4";

$var=fopen(DIR_FS_CATALOG . $nomefile,'w');

$products_query_raw = "select p.products_id, pd.products_name, p.products_model, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_quantity, cd.categories_name, m.manufacturers_name, c.parent_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id=p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id=c.categories_id left join " .	TABLE_CATEGORIES_DESCRIPTION . " cd on c.categories_id=cd.categories_id left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' and cd.language_id = '" . $languages_id . "' order by cd.categories_name, c.parent_id, c.sort_order, c.categories_id, pd.products_name";

$products_query = tep_db_query($products_query_raw);


      while ($products = tep_db_fetch_array($products_query)) {

		
            $descrizionehtml=$products["products_description"];
	
		$descrizionehtml=strip_tags($descrizionehtml); 	
		$descrizionehtml=substr($descrizionehtml,0,255);


		// $document contiene un documento HTML.
		// In questo esempio la funzione rimuove i tag HTML,
		// le sezioni javascript e gli spazi bianchi.
		// Inoltre si convertirà le entità HTML nella loro
		// rappresentazione testuale.
		$search = array ("'<script[^>]*?>.*?</script>'si",  // Rimozione del javascript
                 "'<[\/\!]*?[^<>]*?>'si",          // Rimozione dei tag HTML
                 "'([\r\n])[\s]+'",                // Rimozione degli spazi bianchi
		     "'([\r])+'",                // Rimozione degli spazi bianchi
		     "'([\n])+'",                // Rimozione degli spazi bianchi
                 "'&(quot|#34);'i",                // Sostituzione delle entità HTML
                 "'&(amp|#38);'i",
                 "'&(lt|#60);'i",
                 "'&(gt|#62);'i",
                 "'&(nbsp|#160);'i",
                 "'&(iexcl|#161);'i",
                 "'&(cent|#162);'i",
                 "'&(pound|#163);'i",
                 "'&(copy|#169);'i",
                 "'&#(\d+);'e");                    // Valuta come codice PHP

		$replace = array ("",
                 "",
                 "",
		     "",
		     "",
                 "",
                 "",
                 "",
                 "",
                 "",
                 chr(161),
                 chr(162),
                 chr(163),
                 chr(169),
                 "chr(\\1)");

		$description = preg_replace($search, $replace, $descrizionehtml);

            $prezzo=$products['products_price'];
            if ($newprice = get_special_price($products['products_id'])) {
            $prezzo=$products['specials_new_products_price'];
            }
                
            $calcolo_tasse_query = tep_db_query("select tax_rate from " . TABLE_TAX_RATES . " where tax_class_id = '".(int)$products["products_tax_class_id"]."'");
            $calcolo_tasse = tep_db_fetch_array($calcolo_tasse_query);
            $valore_tassa = ($prezzo/100)* ($calcolo_tasse['tax_rate']);
            $prezzo= $prezzo + $valore_tassa;
            if ($products['products_quantity'] > 0){ 
                $disponibile= 'disponibile';
            } else {
                $disponibile= 'In arrivo';
            }
		$categoria=$products["categories_name"];
		 If ($categoria!="ALIMENTATORI" && $categoria!="CPU" && $categoria!="SOCKET 775" && $categoria!="AGP" ){	// Qui è possibile inserire una categoria da non esportare!

			//Recupera la categoria madre 
			$result1 = tep_db_query("SELECT categories_name, categories_id from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '".(int)$products['parent_id']."' and language_id = '".(int)$language_id."'" );
				$products1= tep_db_fetch_array($result1);
                  if ($products1['categories_id']== 0) {
                    $stringa_categorie = $categoria;
                    } else {
                    $stringa_categorie = $products1['categories_name'] . ';' . $categoria;
                   }
			
			$filestring=$products['products_id'].'|'.$products['products_model']. '|' .$products['products_name']. '|' .$site_url.'/images/'. $products['products_image']. '|' .$site_url.'/product_info.php?products_id='.$products['products_id']. '|' .$stringa_categorie.'|'.$prezzo.'|'.$description. '|' .$disponibile .'|'.$products['manufacturers_name']. '<endrecord>'. "\r\n";

			fwrite($var, $filestring);
                  echo $filestring;

	 	}
		
}

fclose($var);

?>

Re: Contribution per Trovaprezzi

Inviato: 05/12/2008, 21:52
da lellowindhover
Salve io ho installato la contrib. di trovaprezzi ma pultroppo se vado a vedere il file http://www.rumshop.it/trovaprezzi10.php mi calcola l' iva al 10% al posto che al 20% :( avete qualche idea?

Re: Contribution per Trovaprezzi

Inviato: 06/12/2008, 20:58
da wiko85
tra le tasse ne hai qualcuna al 10%?

Re: Contribution per Trovaprezzi

Inviato: 12/07/2012, 17:35
da TurziMichel
Ciao sapete dirmi se è compatibile anche con Prezzolandia ?