Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Froogle Data Feeder

This is a discussion on Froogle Data Feeder within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Froogle data feeder module: "Make sure the file is being written properly. a. To run the feeder point your internet ...

      
  1. #1
    Member
    Join Date
    Sep 2004
    Posts
    68
    Rep Power
    0


    Default Froogle Data Feeder

    Froogle data feeder module:

    "Make sure the file is being written properly.
    a. To run the feeder point your internet browser to http://www.yourwebsite.com/catalog/admin/froogle.php"

    When I do this part of the instructions, this is what happens:

    Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 57
    Error when connecting itself to the data base

    can anyone tell me why I may be getting this message?

    thanks Annnnyone.....

  2. #2
    Member
    Join Date
    Sep 2004
    Posts
    68
    Rep Power
    0


    Default Re: Froogle Data Feeder

    Quote Originally Posted by lil-raskals
    Froogle data feeder module:

    "Make sure the file is being written properly.
    a. To run the feeder point your internet browser to http://www.yourwebsite.com/catalog/admin/froogle.php"

    When I do this part of the instructions, this is what happens:

    Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 57
    Error when connecting itself to the data base

    can anyone tell me why I may be getting this message?

    thanks Annnnyone.....

  3. #3
    Member
    Join Date
    Mar 2003
    Posts
    77
    Rep Power
    0


    Default RE: Re: Froogle Data Feeder

    Is the rest of your site working?

    This looks like mysql crashed.

    see this:

    http://dev.mysql.com/doc/mysql/en/ca...to-server.html

    --gabe

  4. #4
    Member
    Join Date
    Sep 2004
    Posts
    68
    Rep Power
    0


    Default RE: Re: Froogle Data Feeder

    Yes - my site is fine, just when I ran that script in the browser. The first time I ran the script per the instructions, the path was wrong, I had to add /catalog/ in path. I thought I crashed the site and the hosting control panel after that, I could not access my admin or the hosting control panel, and my site was doing weird things. the next morning every thing was fine. The second time (correct path) is when I get the error message.

    Thanks
    www.lil-raskals.com

  5. #5
    Member
    Join Date
    Mar 2003
    Posts
    77
    Rep Power
    0


    Default RE: Re: Froogle Data Feeder

    your problem could be any number of things (did you look at the link I pasted earlier?) FIRST, I would contact your host, tell them the problem... it really is their problem, secondly I think that mysql DID crash the first time, and when it came back up the socket file turned up in an odd place... what follows is a quick (and dirty) possible fix...

    What follows is a quote from here: http://drupal.org/node/7410

    I have the same problem. After a frustrating hop around the Drupal site fruitlessly trying to find a solution, I decided to fix it myself.

    I added a symbolic link to my actual mysql.sock file in the path where Drupal was trying to find it. It seems the default location is in /tmp. So I put a symbolic link at /tmp/mysql.sock that points to my actual mysql.sock file:

    lrwxrwxrwx 1 root root 25 Dec 27 10:42 mysql.sock -> /var/lib/mysql/mysql.sock

    To create a symbolic link, issue the following command:

    ln -s [your actual mysql.sock path and filename] /tmp/mysql.sock

    This should fix your problem.

    My first fix was to try to hack the Drupal database code but it was more involved than I liked and the changes would have had to be moved to any upgrades of the system. I wish/hope the Drupal guys will put in a feature to allow an alternate socket file to be specified for those unfortunate of us with "non-standard" installations.

  6. #6
    Member
    Join Date
    Sep 2004
    Posts
    68
    Rep Power
    0


    Default RE: Re: Froogle Data Feeder

    Hi, thanks for the advice, I did look at that link, that is surely well over my head. I will talk to my hosting company to see what can be done.
    Thanks for the help.
    Carla
    www.lil-raskals.com

  7. #7
    Member
    Join Date
    Sep 2004
    Posts
    68
    Rep Power
    0


    Default RE: Re: Froogle Data Feeder

    O.K. I talked to host company, they had me to change "localhost" to "mysql2.opentransfer.com" seems to be doing something now, but still not the right thing. When I test run: http://www.lil-raskals.com/catalog/admin/froogle.php --

    I get this:

    Warning: fopen(http://www.lil-raskals.com/catalog/f...askals_com.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 301

    Warning: fwrite(): supplied argument is not a valid stream resource in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 302

    Warning: fclose(): supplied argument is not a valid stream resource in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 303
    File completed: http://www.lil-raskals.com/catalog/f...askals_com.txt

    Warning: chmod(): No such file or directory in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 305

    Script timer: 0.144442 seconds.


    Below is the froogle.php file if someone can translate this to me. I am sure I must have missed something. the Hosting company said database is connecting and problem is not theirs to fix, they do not offer support for osc.

    Pleeeeze help.

  8. #8
    Member
    Join Date
    Sep 2004
    Posts
    68
    Rep Power
    0


    Default RE: Re: Froogle Data Feeder

    <?php
    // Start TIMER
    // -----------
    $stimer = explode( ' ', microtime() );
    $stimer = $stimer[1] + $stimer[0];
    // -----------


    $OutFile = "http://www.lil-raskals.com/catalog/feeds/carla_lil_raskals_com.txt"; //"CHANGEME-full-path-to-file-with-777-dir-and-file-permissions.fr-outfile.txt";
    $destination_file = "http://www.lil-raskals.com/catalog/feeds/carla_lil_raskals_com.txt"; //"CHANGEME-filename-to-upload-to-froogle.txt" ;
    $source_file = $OutFile;
    $imageURL = 'http://www.lil-raskals.com/catalog/images/';
    $productURL = 'http://www.lil-raskals.com/product_info.php?products_id=';
    $already_sent = array();

    $home = "mysql2.opentransfer.com" ;
    $user="******";
    $pass="******";
    $base="abuata_toys";

    $ftp_server = "hedwig.google.com" ;
    $ftp_user_name = "******";
    $ftp_user_pass = "*******";
    $ftp_directory = ""; // leave blank for froogle

    $taxRate = 0; //default = 0 (e.g. for 17.5% tax use "$taxRate = 17.5;")
    $taxCalc = ($taxRate/100) + 1; //Do not edit
    $convertCur = false; //default = false
    $curType = "USD"; // Converts Currency to any defined currency (eg. USD, EUR, GBP)
    if($convertCur)
    {
    $productURL = "http://www.lil-raskals.com/product_info.php?currency=" . $curType . "&products_id="; //where CURTYPE is your currency type (eg. USD, EUR, GBP)
    }

    //START Advance Optional Values

    //(0=False 1=True) (optional_sec must be enabled to use any options)
    $optional_sec = 0;
    $instock = 0;
    $shipping = 0;
    $lowestShipping = "4.95"; //this is not binary.
    $brand = 0;
    $upc = 0; //Not supported by default osC
    $manufacturer_id = 0; //Not supported by default osC
    $product_type = 0;
    $currency = 0;
    $default_currency = "USD"; //this is not binary.
    $feed_language = 0;
    $default_feed_language = "en"; //this is not binary.
    $ship_to = 0;
    $default_ship_to = "ALL"; //this is not binary, not supported by default osC for individual products.
    $ship_from = 0;
    $default_ship_from = "USD"; //this is not binary, not supported by default osC for individual products.

    //END of Advance Optional Values

    if (!($link=mysql_connect($home,$user,$pass)))
    {
    echo "Error when connecting itself to the data base";
    exit();
    }
    if (!mysql_select_db( $base , $link ))
    {
    echo "Error the data base does not exist";
    exit();
    }

    $sql = "
    SELECT concat( '" . $productURL . "' ,products.products_id) AS product_url,
    products_model AS prodModel, products_weight,
    manufacturers.manufacturers_name AS mfgName,
    manufacturers.manufacturers_id,
    products.products_id AS id,
    products_description.products_name AS name,
    products_description.products_description AS description,
    products.products_quantity AS quantity,
    products.products_status AS prodStatus,
    FORMAT( IFNULL(specials.specials_new_products_price, products.products_price) * " . $taxCalc . ",2) AS price,
    CONCAT( '" . $imageURL . "' ,products.products_image) AS image_url,
    products_to_categories.categories_id AS prodCatID,
    categories.parent_id AS catParentID,
    categories_description.categories_name AS catName
    FROM categories,
    categories_description,
    products,
    products_description,
    products_to_categories

    left join manufacturers on ( manufacturers.manufacturers_id = products.manufacturers_id )
    left join specials on ( specials.products_id = products.products_id AND ( ( (specials.expires_date > CURRENT_DATE) OR (specials.expires_date = 0) ) AND ( specials.status = 1 ) ) )

    WHERE products.products_id=products_description.products _id
    AND products.products_id=products_to_categories.produc ts_id
    AND products_to_categories.categories_id=categories.ca tegories_id
    AND categories.categories_id=categories_description.ca tegories_id
    ORDER BY
    products.products_id ASC
    ";


    $catInfo = "
    SELECT
    categories.categories_id AS curCatID,
    categories.parent_id AS parentCatID,
    categories_description.categories_name AS catName
    FROM
    categories,
    categories_description
    WHERE categories.categories_id = categories_description.categories_id
    ";

    function findCat($curID, $catTempPar, $catTempDes, $catIndex)
    {
    if( (isset($catTempPar[$curID])) && ($catTempPar[$curID] != 0) )
    {
    if(isset($catIndex[$catTempPar[$curID]]))
    {
    $temp=$catIndex[$catTempPar[$curID]];
    }
    else
    {
    $catIndex = findCat($catTempPar[$curID], $catTempPar, $catTempDes, $catIndex);
    $temp = $catIndex[$catTempPar[$curID]];
    }
    }
    if( (isset($catTempPar[$curID])) && (isset($catTempDes[$curID])) && ($catTempPar[$curID] == 0) )
    {
    $catIndex[$curID] = $catTempDes[$curID];
    }
    else
    {
    $catIndex[$curID] = $temp . " > " . $catTempDes[$curID];
    }
    return $catIndex;

    }

    $catIndex = array();
    $catTempDes = array();
    $catTempPar = array();
    $processCat = mysql_query( $catInfo )or die( $FunctionName . ": SQL error " . mysql_error() . "| catInfo = " . htmlentities($catInfo) );
    while ( $catRow = mysql_fetch_object( $processCat ) )
    {
    $catKey = $catRow->curCatID;
    $catName = $catRow->catName;
    $catParID = $catRow->parentCatID;
    if($catName != "")
    {
    $catTempDes[$catKey]=$catName;
    $catTempPar[$catKey]=$catParID;
    }
    }

    foreach($catTempDes as $curID=>$des) //don't need the $des
    {
    $catIndex = findCat($curID, $catTempPar, $catTempDes, $catIndex);
    }

    $_strip_search = array(
    "![\t ]+$|^[\t ]+!m", // remove leading/trailing space chars
    '%[\r\n]+%m'); // remove CRs and newlines
    $_strip_replace = array(
    '',
    '');
    $_cleaner_array = array(">" => "> ", "®" => "", "." => "", "™" => "", "" => "");

    if ( file_exists( $OutFile ) )
    unlink( $OutFile );

    $output = "product_url \t name \t description \t price \t image_url \t category \t offer_id";

    //create optional section
    if($optional_sec == 1)
    {
    if($instock == 1)
    $output .= "\t instock ";
    if($shipping == 1)
    $output .= "\t shipping ";
    if($brand == 1)
    $output .= "\t brand ";
    if($upc == 1)
    $output .= "\t upc ";
    if($manufacturer_id == 1)
    $output .= "\t manufacturer_id ";
    if($product_type == 1)
    $output .= "\t product_type ";
    if($currency == 1)
    $output .= "\t currency ";
    if($feed_language == 1)
    $output .= "\t language ";
    if($ship_to == 1)
    $output .= "\t ship_to ";
    if($ship_from == 1)
    $output .= "\t ship_from ";
    }
    $output .= "\n";


    $result=mysql_query( $sql )or die( $FunctionName . ": SQL error " . mysql_error() . "| sql = " . htmlentities($sql) );

    //Currency Information
    if($convertCur)
    {
    $sql3 = "
    SELECT
    currencies.value AS curUSD
    FROM
    currencies
    WHERE currencies.code = '$curType'
    ";

    $result3=mysql_query( $sql3 )or die( $FunctionName . ": SQL error " . mysql_error() . "| sql3 = " . htmlentities($sql3) );
    $row3 = mysql_fetch_object( $result3 );
    }

    $loop_counter = 0;

    while( $row = mysql_fetch_object( $result ) )
    {
    if (isset($already_sent[$row->id])) continue; // if we've sent this one, skip the rest of the while loop

    if( $row->prodStatus == 1 || ($optional_sec == 1 && $instock == 1) )
    {

    if($convertCur)
    {
    $row->price = ereg_replace("[^.0-9]", "", $row->price);
    $row->price = $row->price * $row3->curUSD;
    $row->price = number_format($row->price, 2, '.', ',');
    }

    $output .= $row->product_url . "\t" .
    preg_replace($_strip_search, $_strip_replace, strip_tags( strtr($row->name, $_cleaner_array) ) ) . "\t" .
    preg_replace($_strip_search, $_strip_replace, strip_tags( strtr($row->description, $_cleaner_array) ) ) . "\t" .
    $row->price . "\t" .
    $row->image_url . "\t" .
    $catIndex[$row->prodCatID] . "\t" .
    $row->id;

    //optional values section
    if($optional_sec == 1)
    {
    if($instock == 1)
    {
    if($row->prodStatus == 1)
    {
    $prodStatusOut = "Y";
    }
    else
    {
    $prodStatusOut = "N";
    }
    $output .= " \t " . $prodStatusOut;
    }
    if($shipping == 1)
    $output .= " \t " . $lowestShipping;
    if($brand == 1)
    $output .= " \t " . $row->mfgName;
    if($upc == 1)
    $output .= " \t " . "Not Supported";
    if($manufacturer_id == 1)
    $output .= " \t " . "Not Supported";
    if($product_type == 1)
    {
    $catNameTemp = strtolower($catName);
    if($catNameTemp == "books")
    $productTypeOut = "book";
    else if($catNameTemp == "music")
    $productTypeOut = "music";
    else if($catNameTemp == "videos")
    $productTypeOut = "video";
    else
    $productTypeOut = "other";

    $output .= " \t " . $productTypeOut;
    }
    if($currency == 1)
    $output .= " \t " . $default_currency;
    if($feed_language == 1)
    $output .= " \t " . $default_feed_language;
    if($ship_to == 1)
    $output .= " \t " . $default_ship_to;
    if($ship_from == 1)
    $output .= " \t " . $default_ship_from;
    }
    $output .= " \n";
    }
    $already_sent[$row->id] = 1;


    $loop_counter++;
    if ($loop_counter>750) {
    $fp = fopen( $OutFile , "a" );
    $fout = fwrite( $fp , $output );
    fclose( $fp );
    $loop_counter = 0;
    $output = "";
    }
    }

    $fp = fopen( $OutFile , "a" );
    $fout = fwrite( $fp , $output );
    fclose( $fp );
    echo "File completed: <a href=\"" . $OutFile . "\" target=\"_blank\">" . $destination_file . "</a><br>\n";
    chmod($OutFile, 0777);

    /*
    //Start FTP to Froogle

    function ftp_file( $ftpservername, $ftpusername, $ftppassword, $ftpsourcefile, $ftpdirectory, $ftpdestinationfile )
    {
    // set up basic connection
    $conn_id = ftp_connect($ftpservername);
    if ( $conn_id == false )
    {
    echo "FTP open connection failed to $ftpservername <BR>\n" ;
    return false;
    }

    // login with username and password
    $login_result = ftp_login($conn_id, $ftpusername, $ftppassword);

    // check connection
    if ((!$conn_id) || (!$login_result)) {
    echo "FTP connection has failed!<BR>\n";
    echo "Attempted to connect to " . $ftpservername . " for user " . $ftpusername . "<BR>\n";
    return false;
    } else {
    echo "Connected to " . $ftpservername . ", for user " . $ftpusername . "<BR>\n";
    }

    if ( strlen( $ftpdirectory ) > 0 )
    {
    if (ftp_chdir($conn_id, $ftpdirectory )) {
    echo "Current directory is now: " . ftp_pwd($conn_id) . "<BR>\n";
    } else {
    echo "Couldn't change directory on $ftpservername<BR>\n";
    return false;
    }
    }

    ftp_pasv ( $conn_id, true ) ;
    // upload the file
    $upload = ftp_put( $conn_id, $ftpdestinationfile, $ftpsourcefile, FTP_ASCII );

    // check upload status
    if (!$upload) {
    echo "$ftpservername: FTP upload has failed!<BR>\n";
    return false;
    } else {
    echo "Uploaded " . $ftpsourcefile . " to " . $ftpservername . " as " . $ftpdestinationfile . "<BR>\n";
    }

    // close the FTP stream
    ftp_close($conn_id);

    return true;
    }

    ftp_file( $ftp_server, $ftp_user_name, $ftp_user_pass, $source_file, $ftp_directory, $destination_file);

    //End FTP to Froogle
    */

    // End TIMER
    // ---------
    $etimer = explode( ' ', microtime() );
    $etimer = $etimer[1] + $etimer[0];
    echo '<p style="margin:auto; text-align:center">';
    printf( "Script timer: <b>%f</b> seconds.", ($etimer-$stimer) );
    echo '</p>';
    // ---------

    ?>

  9. #9
    Member
    Join Date
    Mar 2003
    Posts
    77
    Rep Power
    0


    Default RE: Re: Froogle Data Feeder

    "HTTP wrapper does not support writeable connections." means that your machine won't let you write to a url. Instead you should use the absolute path.

    These lines at the beginning of the file:

    $OutFile = "http://www.lil-raskals.com/catalog/feeds/carla_lil_raskals_com.txt";

    $destination_file = "http://www.lil-raskals.com/catalog/feeds/carla_lil_raskals_com.txt";

    probably need to become this:

    $OutFile = "/hsphere/local/home/abuata/lil-raskals.com/catalog/feeds/carla_lil_raskals_com.txt";

    $destination_file = "/hsphere/local/home/abuata/lil-raskals.com/feeds/carla_lil_raskals_com.txt";

    although... aren't these supposed to be different files? I have no idea, but you might want to check...


    --gabe

  10. #10
    Member
    Join Date
    Sep 2004
    Posts
    68
    Rep Power
    0


    Default RE: Re: Froogle Data Feeder

    KEWL...........
    That wrapper thing was it. Thanks so much!!!!!!!!!!!!!!!!!!!
    Not every one would just, like, know that, would they?

Page 1 of 2 12 LastLast

Similar Threads

  1. Froogle Exporter Access Denied message
    By rolotech in forum osCmax v2 Customization/Mods
    Replies: 0
    Last Post: 11-10-2006, 02:09 AM
  2. Froogle Product URL
    By cewncew in forum osCmax v1.7 Discussion
    Replies: 2
    Last Post: 02-04-2005, 01:57 PM
  3. How do I import data from previous version data base?
    By rondgray in forum osCmax v1.7 Discussion
    Replies: 1
    Last Post: 12-19-2004, 12:24 AM
  4. Froogle file mixes languages (Easypopulate 2.72)
    By kjedr in forum osCMax v1.7 Installation
    Replies: 0
    Last Post: 10-21-2004, 08:28 AM
  5. easypopulate froogle generation problem
    By BKnapik in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 01-27-2004, 08:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •