#1 (permalink)  
Alt 05.05.2009, 23:05
Neuer Benutzer
 
Registriert seit: 12.01.2009
Beiträge: 21
Standard google base

Hi Leute,

habe beigefügte base-Dateien soweit in den Shop eingebaut, nur leider werden ein paar Variablen nicht mit in die zu erstellende Datei eingebaut.
Bspw. die id fehlt.

Was müsste noch hinzugefügt werden?

PHP-Code:
<?php
/* -----------------------------------------------------------------------------------------
   $Id: googlebase.php 1188 2007-05-31 14:24:34Z franz $

   XT-Commerce - community made shopping
   http://www.xt-commerce.com

   Copyright (c) 2003 XT-Commerce
   -----------------------------------------------------------------------------------------
   based on:
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(cod.php,v 1.28 2003/02/14); www.oscommerce.com
   (c) 2003     nextcommerce (invoice.php,v 1.6 2003/08/24); www.nextcommerce.org

   Released under the GNU General Public License
   ---------------------------------------------------------------------------------------*/
defined'_VALID_XTC' ) or die( 'Direct Access to this location is not allowed.' );

define('MODULE_GOOGLEBASE_TEXT_DESCRIPTION''Export - Google Base (XML RSS 2.0)');
define('MODULE_GOOGLEBASE_TEXT_TITLE''Google Base - XML');
define('MODULE_GOOGLEBASE_FILE_TITLE' '<hr noshade>Dateiname');
define('MODULE_GOOGLEBASE_FILE_DESC' 'Geben Sie einen Dateinamen ein, falls die Exportadatei am Server gespeichert werden soll.<br>(Verzeichnis export/)');
define('MODULE_GOOGLEBASE_STATUS_DESC','Modulstatus');
define('MODULE_GOOGLEBASE_STATUS_TITLE','Status');
define('MODULE_GOOGLEBASE_CURRENCY_TITLE','W&auml;hrung');
define('MODULE_GOOGLEBASE_CURRENCY_DESC','Welche W&auml;hrung soll exportiert werden?');
define('EXPORT_YES','Nur Herunterladen');
define('EXPORT_NO','Am Server Speichern');
define('CURRENCY','<hr noshade><b>W&auml;hrung:</b>');
define('CURRENCY_DESC','W&auml;hrung in der Exportdatei');
define('EXPORT','Bitte den Sicherungsprozess AUF KEINEN FALL unterbrechen. Dieser kann einige Minuten in Anspruch nehmen.');
define('EXPORT_TYPE','<hr noshade><b>Speicherart:</b>');
define('EXPORT_STATUS_TYPE','<hr noshade><b>Kundengruppe:</b>');
define('EXPORT_STATUS','Bitte w&auml;hlen Sie die Kundengruppe, die Basis f&uuml;r den Exportierten Preis bildet. (Falls Sie keine Kundengruppenpreise haben, w&auml;hlen Sie <i>Gast</i>):</b>');
define('CAMPAIGNS','<hr noshade><b>Kampagnen:</b>');
define('CAMPAIGNS_DESC','Mit Kampagne zur Nachverfolgung verbinden.');
define('DATE_FORMAT_EXPORT''%d.%m.%Y');  // this is used for strftime()

function entities2utf8 ($string) {
    return 
utf8_encode(alphaentities2html(numericentities2html($string)));
}

function 
alphaentities2html($text$quote_style ENT_COMPAT) {
   if (
function_exists('html_entity_decode')) {
       
$text html_entity_decode($text$quote_style'ISO-8859-1'); // NOTE: UTF-8 does not work!
   
}
   else { 
       
$trans_tbl get_html_translation_table(HTML_ENTITIES$quote_style);
       
$trans_tbl array_flip($trans_tbl);
       
$text strtr($text$trans_tbl);
   }
   
$text preg_replace('~&#x([0-9a-f]+);~ei''chr(hexdec("\\1"))'$text); 
   
$text preg_replace('~&#([0-9]+);~e''chr("\\1")'$text);
   return 
$text;
}

function 
numericentities2html($string){
    return 
preg_replace('/&#(\d+);/e''chr(str_replace(";","",str_replace("&#","","$0")))'$string);
}
// include needed functions
class googlebase {
    var 
$code$title$description$enabled;

    function 
googlebase() {
        global 
$order;

        
$this->code       'googlebase';
        
$this->language   'de';
        
$this->title MODULE_GOOGLEBASE_TEXT_TITLE;
        
$this->description MODULE_GOOGLEBASE_TEXT_DESCRIPTION;
        
$this->sort_order MODULE_GOOGLEBASE_SORT_ORDER;
        
$this->enabled = ((MODULE_GOOGLEBASE_STATUS == 'True') ? true false);
        
$this->CAT=array();
        
$this->PARENT=array();
    }

    function 
process($file) {
        @
xtc_set_time_limit(0);
        require(
DIR_FS_CATALOG.DIR_WS_CLASSES 'xtcPrice.php');

        
$xtPrice = new xtcPrice($_POST['currencies'],$_POST['status']);

        
$export_query =xtc_db_query("SELECT
                            p.products_id,
                            pd.products_name,
                            pd.products_description,
                            p.products_model,
                            p.products_image,
                            p.products_status,
                            p.products_date_available,
                            p.products_shippingtime,
                            p.products_discount_allowed,
                            pd.products_meta_keywords,
                            p.products_tax_class_id,
                            p.products_date_added,
                            m.manufacturers_name
                            FROM
                            " 
TABLE_PRODUCTS " p 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 = '"
.$_SESSION['languages_id']."' LEFT JOIN
                            " 
TABLE_SPECIALS " s
                            ON p.products_id = s.products_id
                            WHERE
                            p.products_status = 1 AND
                            p.products_price > 0
                            ORDER BY
                            p.products_date_added DESC,
                            pd.products_name"
);

        
$export_xml sprintf('<?xml version="1.0" encoding="UTF-8"?>%s' .
                        
'<rss version ="2.0" xmlns:g="http://base.google.com/ns/1.0">%s' .
                        
'<channel>%s' .
                        
'    <title>%s</title>%s' .
                        
'    <description>%s</description>%s' .
                        
'    <link>%s</link>%s',
                        
"\r\n\r\n",
                        
"\r\n\r\n",
                        
"\r\n",
                        
TITLE,
                        
"\r\n",
                        
TITLE,
                        
"\r\n",
                        
HTTP_SERVER,
                        
"\r\n\r\n"
                    
);

        while (
$products xtc_db_fetch_array($export_query)) {
            
$products_name str_replace("<br>"" "$products['products_name']);
            
$products_name str_replace("<br />"" "$products_name);
            
$products_name str_replace("&nbsp;"""$products_name);
            
$products_name str_replace("&ndash;""-"$products_name);
            
$products_name str_replace("&bdquo;"""$products_name);
            
$products_name str_replace("&ldquo;"""$products_name);
            
$products_name str_replace("&rsquo;"""$products_name);
            
$products_name str_replace("&hellip;""..."$products_name);
            
$products_name str_replace("&trade;"""$products_name);
            
$products_name strip_tags($products_name);
            
$products_name str_replace("\n"" "$products_name);
            
$products_name str_replace("\r"" "$products_name);
            
$products_name str_replace("\t"" "$products_name);
            
$products_name str_replace("\v"" "$products_name);
            
$products_name entities2utf8($products_name);

            
$products_description str_replace("<br>"" "$products['products_description']);
            
$products_description str_replace("<br />"" "$products_description);
            
$products_description str_replace("&nbsp;"""$products_description);
            
$products_description str_replace("&ndash;""-"$products_description);
            
$products_description str_replace("&bdquo;"""$products_description);
            
$products_description str_replace("&ldquo;"""$products_description);
            
$products_description str_replace("&rsquo;"""$products_description);
            
$products_description str_replace("&hellip;""..."$products_description);
            
$products_description str_replace("&trade;"""$products_description);
            
$products_description strip_tags($products_description);
            
$products_description str_replace("\n"" "$products_description);
            
$products_description str_replace("\r"" "$products_description);
            
$products_description str_replace("\t"" "$products_description);
            
$products_description str_replace("\v"" "$products_description);
            
$products_description entities2utf8($products_description);

            
$products_price $xtPrice->xtcGetPrice($products['products_id'], $format=false1$products['products_tax_class_id'], '');

// get product categorie
$categorie_query=xtc_db_query("SELECT
categories_id
FROM "
.TABLE_PRODUCTS_TO_CATEGORIES."
WHERE products_id='"
.$products['products_id']."'");
while (
$categorie_data=xtc_db_fetch_array ($categorie_query)) {
$categories=$categorie_data['categories_id'];
}

            
//create content
            
$export_xml .= sprintf ('<item>%s' .
                                    
'<title>%s</title>%s' .
                                    
'<description>%s</description>%s' .
                                    
'<link>%s</link>%s' .
                                    
'<g:bild_url>%s</g:bild_url>%s' .
                                    
'<g:preis>%s</g:preis>%s' .
                                    
'<g:hersteller>%s</g:hersteller>%s' .
                                    
'<g:produktart>%s</g:produktart>%s' .
                                    
'</item>%s',
                                    
"\r\n",
                                    
$products_name"\r\n",
                                    
substr($products_description065536), "\r\n",
                                    
$link"\r\n",
                                    
$image"\r\n",
                                    
number_format($products_price,2,'.',''), "\r\n",
                                    
utf8_encode($products['manufacturers_name']), "\r\n",
                                    
utf8_encode(substr($cat,0,strlen($cat)-3)), "\r\n",
                                    
"\r\n\r\n"
                                
);
        }

        
$export_xml .= "</channel>\r\n</rss>";
        
$export_xml str_replace("&""<![CDATA[&]]>"$export_xml);

        
// create File
        
$fp fopen(DIR_FS_DOCUMENT_ROOT.'export/' $file"w+");
        
fputs($fp$export_xml);
        
fclose($fp);

        if (
$_POST['export'] == yes) {
            
// send File to Browser
            
$extension substr($file, -3);
            
$fp fopen(DIR_FS_DOCUMENT_ROOT.'export/' $file,"rb");
            
$buffer fread($fpfilesize(DIR_FS_DOCUMENT_ROOT.'export/' $file));
                
fclose($fp);
            
header('Content-type: application/x-octet-stream');
            
header('Content-disposition: attachment; filename=' $file);
            echo 
$buffer;
            exit;
        }
    }

    function 
buildCAT($catID) {
        if (isset(
$this->CAT[$catID])) {
            return  
$this->CAT[$catID];
        } else {
            
$cat=array();
            
$tmpID=$catID;

            while (
$this->getParent($catID)!=|| $catID!=0) {
                
$cat_select=xtc_db_query("SELECT categories_name FROM ".TABLE_CATEGORIES_DESCRIPTION." WHERE categories_id='".$catID."' and language_id='".$_SESSION['languages_id']."'");
                
$cat_data=xtc_db_fetch_array($cat_select);
                
$catID=$this->getParent($catID);
                
$cat[]=$cat_data['categories_name'];
            }

            
$catStr='';
            for (
$i=count($cat);$i>0;$i--) {
                
$catStr.=$cat[$i-1].' > ';
            }

            
$this->CAT[$tmpID]=$catStr;
            return 
$this->CAT[$tmpID];
        }
    }

    function 
getParent($catID) {
        if (isset(
$this->PARENT[$catID])) {
            return 
$this->PARENT[$catID];
        } else {
            
$parent_query=xtc_db_query("SELECT parent_id FROM ".TABLE_CATEGORIES." WHERE categories_id='".$catID."'");
            
$parent_data=xtc_db_fetch_array($parent_query);
            
$this->PARENT[$catID]=$parent_data['parent_id'];
            return  
$parent_data['parent_id'];
        }
    }

    function 
display() {
        
$customers_statuses_array xtc_get_customers_statuses();

        
// build Currency Select
        
$curr='';
        
$currencies=xtc_db_query("SELECT code FROM ".TABLE_CURRENCIES);
        while (
$currencies_data=xtc_db_fetch_array($currencies)) {
            
$curr.=xtc_draw_radio_field('currencies'$currencies_data['code'],true).$currencies_data['code'].'<br>';
        }

        
$campaign_array = array(array('id' => '''text' => TEXT_NONE));
        
$campaign_query xtc_db_query("select campaigns_name, campaigns_refID from ".TABLE_CAMPAIGNS." order by campaigns_id");
        while (
$campaign xtc_db_fetch_array($campaign_query)) {
            
$campaign_array[] = array ('id' => 'refID='.$campaign['campaigns_refID'], 'text' => $campaign['campaigns_name'],);
        }

        return array(
'text' =>  EXPORT_STATUS_TYPE.'<br>'.
                        
EXPORT_STATUS.'<br>'.
                        
xtc_draw_pull_down_menu('status',$customers_statuses_array'1').'<br>'.
                        
CURRENCY.'<br>'.
                        
CURRENCY_DESC.'<br>'.
                        
$curr.
                        
CAMPAIGNS.'<br>'.
                        
CAMPAIGNS_DESC.'<br>'.
                        
xtc_draw_pull_down_menu('campaign',$campaign_array).'<br>'.
                        
EXPORT_TYPE.'<br>'.
                        
EXPORT.'<br>'.
                        
xtc_draw_radio_field('export''no',false).EXPORT_NO.'<br>'.
                        
xtc_draw_radio_field('export''yes',true).EXPORT_YES.'<br>'.
                        
'<br>' xtc_button(BUTTON_EXPORT) .
                        
xtc_button_link(BUTTON_CANCELxtc_href_link(FILENAME_MODULE_EXPORT'set=' $_GET['set'] . '&module=googlebase')));
    }

    function 
check() {
        if (!isset(
$this->_check)) {
            
$check_query xtc_db_query("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_GOOGLEBASE_STATUS'");
            
$this->_check xtc_db_num_rows($check_query);
        }
        return 
$this->_check;
    }

    function 
install() {
        
xtc_db_query("insert into " TABLE_CONFIGURATION " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GOOGLEBASE_FILE', 'googlebase.xml',  '6', '1', '', now())");
        
xtc_db_query("insert into " TABLE_CONFIGURATION " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GOOGLEBASE_STATUS', 'True',  '6', '1', 'xtc_cfg_select_option(array(\'True\', \'False\'), ', now())");
    }

    function 
remove() {
        
xtc_db_query("delete from " TABLE_CONFIGURATION " where configuration_key in ('" implode("', '"$this->keys()) . "')");
    }

    function 
keys() {
        return array(
'MODULE_GOOGLEBASE_STATUS','MODULE_GOOGLEBASE_FILE');
    }
}
?>
Angehängte Dateien
Dateityp: zip googlebase.zip (3,9 KB, 22x aufgerufen)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #2 (permalink)  
Alt 12.05.2009, 14:50
Neuer Benutzer
 
Registriert seit: 19.12.2007
Beiträge: 15
Standard

ich habe das gleiche problem gibt es hier schon eine lösung
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
base, google

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Hiiilfe ich finde meine produkte bei Google Base nicht Gimmshop Modul Entwicklung 3 06.11.2008 12:53
Hiiilfe artikel ercheinen bei Google Base nicht.. Gimmshop Installation und Konfiguration 0 21.10.2008 17:29


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:17 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand