Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

anvip

Pioneers
  • Posts

    25
  • Joined

  • Last visited

Posts posted by anvip

  1. I found and tested this code for Google, it works. But I do not know how to implement it in Seo Assistant ...

     

    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Checking keyword position with PHP</title>
    <style type="text/css">
       body{font-family:Verdana, Geneva, sans-serif; color:#666;}
       #center{width:350px;margin:5px auto 0 auto;}
       form { float:left; width:380px; }
       input, label { width:70%; clear:left; float:left; margin-top:5px; }
    input{color:#999;}
       input[type="submit"] { width:30%; clear:left; float:left; margin-top:20px; color:#666; }
    
       .small{ font-size:0.7em; color:#999999}
    h3{font-size:1.4em;}
       #kwdz{ width:400px; position:relative; top:5px;}
    #domainz{width:400px; margin-top:10px;}
    #result{margin-top:20px;}
       </style>
    </head>
    
    <body>
    <div id="center">
    
    
    <form action="pr.php" method="post">
       <div id="domainz">
           <label>Domain:</label>
           <input name="domain" value="www.google.com" onclick="this.value=''" />
       </div>
       <div id="kwdz">
           <label>Keywords:</label>
           <input name="keywords" value="Seo Assistant" onclick="this.value=''" />
       </div>
       <input type="submit" name="check" value="Get position" />
    </form>
    
    
    <br style="clear:both" />
    <?php
    
    $i = 1; $hit = 0;
    
    if($_POST) {
    
    // Clean the post data and make usable
    $domain = filter_var($_POST['domain'], FILTER_SANITIZE_STRING);
    $keywords = filter_var($_POST['keywords'], FILTER_SANITIZE_STRING);
    // Remove begining http and trailing /
    $domain = substr($domain, 0, 7) == 'http://' ? substr($domain, 7) : $domain;
    $domain = substr($domain, -1) == '/' ? substr_replace($domain, '', -1) : $domain;
    // Replace spaces with +
    $keywords = strstr($keywords, ' ') ? str_replace(' ', '+', $keywords) : $keywords;
    
    // Grab the Google page using the chosen keywords
    $html = new DOMDocument();
    @$html->loadHtmlFile('http://www.google.com/search?q='.$keywords.'&num=100');
    $xpath = new DOMXPath($html);
    // Store the domains to nodes
    $nodes = $xpath->query('//div[1]/cite');
    
    // Loop through the nodes to look for our domain
    $hit = 2;
    foreach ($nodes as $n){
    echo '<div style="font-size:0.7em">'.$n->nodeValue.'<br /></div>'; // Show all links
    if (strstr($n->nodeValue, $domain)) {
    $message = 'Position '.$i.'<br />'; $hit = 1;
    }
    else { ++$i; }
    }
    }
    ?>
    
       <div id="result">
           <?php // Echo the result
           if ($hit == 1) { echo '<h2>'.$message.'</h2>'; }
           else if ($hit >= 2) { echo '<h2>Not found!</h2>'; }
           ?>
       </div>
    
    </div>
    
    </body>
    </html>
    

  2. Hmm, I don't have any ideas as to why that may be. I maintain a number of sites that use this contribution and none of them have such a problem, even my own. I canonly guess that it is due to how your server supplies the dates.

    Hmm, My opinion is that with this query in includes/modules/daily_specials_banner.php

    $ds_query = tep_db_query("select * from " . TABLE_DAILY_SPECIALS . " where date_start <= current_date() and date_stop >= current_date() and ( language_id = 99 or language_id = '" . (int)$languages_id . "') order by rand() limit 1");
    

    script will also show the campaign ended on a current date because of "and date_stop >= current_date()". Corect will be "and date_stop > current_date()". Or am I wrong?

  3. Hmm, I don't have any ideas as to why that may be. I maintain a number of sites that use this contribution and none of them have such a problem, even my own. I canonly guess that it is due to how your server supplies the dates.

    Strangely, the module works very similar to Specials, there is no problem with dates ...

  4. Bug: Start Date and Stop Date

     

    Example:

    Start Date: 2011-03-31

    Stop Date: 2011-04-01

    Campaign continues to show up to 2011-04-02, basically 24 hours more. I tried multiple dates.

    I insert the code to check dates, dates are correct.

    <?php echo 'From: ' .tep_date_long($ds['date_start']) ?>
    <?php echo ' To: ' .tep_date_long($ds['date_stop']) ?>
    

  5. Resolved

    This is a working code ->modules/daily_specials_cart.php ... (no matter what language you are using)

     

    <?php
    /*
     $Id: daily specials, v 1.1 2009/09/01 by Jack_mcs
     Created by Jack_mcs from http://www.oscommerce-solution.com
    
     osCommerce, Open Source E-Commerce Solutions
     http://www.oscommerce.com
    
     Copyright (c) 2003 osCommerce
     Portions Copyright 2009 oscommerce-solution.com
    
     Released under the GNU General Public License
    */
     include_once(DIR_WS_FUNCTIONS.FILENAME_DAILY_SPECIALS);
     $dsClear = true;
    
     if (DAILY_SPECIALS_ENABLE == 'true')
     {
        $ds_query = tep_db_query("select unique_id, special_name, page_type, page_text, popup_text, alt_text, image, categories, pages, products_list, condition1, condition2, condition3, coupon_amount, date_start, date_stop, recur_days, recur_mode, test_mode, use_css, language_id from " . TABLE_DAILY_SPECIALS . " where date_start <= current_date() and date_stop >= current_date() and ( language_id = 99 or language_id = '" . (int)$languages_id . "')");
    
        if (tep_db_num_rows($ds_query) > 0)
        {
           $amt = 0;
           while ($ds = tep_db_fetch_array($ds_query))
           {
              if (OKToContinue($ds['test_mode'], $customer_id)) //not in test mode or in test mode and shop owner logged in
              {
                 $comparison = CheckConditions($ds, $cart, $amt);
    // echo 'result '.$ds['condition1'] ;
                 switch ($ds['condition1'])
              {
    
    
                    case 'Cart Total' :
                       if ($comparison) 
                       {
                           $easy_discount->set('DS_CTTL',$ds['special_name'], $amt);
                           $dsClear = false;
                       } else {
                           $easy_discount->clear('DS_CTTL'.$ds['special_name']);
                       }
                       break;
    
                    case 'Cart Quantity' :
                       if ($comparison) 
                       {
                           $easy_discount->set('DS_CQTY'.$ds['special_name'],$ds['special_name'],$amt);
                           $dsClear = false;
                       } else {
                           $easy_discount->clear('DS_CQTY'.$ds['special_name']);
                       }
                       break;
    
                    default:  //just displaying a banner //echo 'ERROR: No definition found -> '. $ds['condition1'];  
    
                 }            
              }
           }
        }
     }  
    
     if ($dsClear)
     {
         if ($easy_discount->count() > 0) 
         {
             $easy_discount->clear('DS_CTTL', true);
             $easy_discount->clear('DS_CQTY', true);
         }
     }
    ?>  
    

  6. I came to the following conclusions.

    Something is wrong with cases in file modules/daily_specials_cart.php ...

    If I copy

    if ($comparison) 
    {
    $easy_discount->set('DS_CQTY'.$ds['special_name'],$ds['special_name'],$amt);
    $dsClear = false;
    } else {
    $easy_discount->clear('DS_CQTY'.$ds['special_name']);
    }
    

    under default: discounts appear ...

  7. What happens if you change it to cart total? Remove the product? Have you tried any other settings? Does the included example work once you change the stop date?

     

    I tried all possible settings ... Included example also does not show discounts, only banner.

  8. No idea what this is about without details. What are the conditions of the sale you have setup? What oscommerce version do you have? Are you seeing the banner?

     

    1. Condition 1 (Cart Quantity), Condition 2 (Greater Than), Condition 3 (1), Coupon Amount 55%, Products (4420)

    2. oscommerce 2.2

    3. Yes, banner is visible.

    4. I tried also with other conitions, without success.

    5. After all of that, the problem is that my shop side cannot see the definitons ...

  9. I also have problem that the discount is not visible.

     

    Here is the output:

    cmp 1

    def - no condition -> Cart Quantity

     

    Must be something in includes/functions/daily_specials.php ... I checked all 100 times but I do not see a solution. Any new idea?

  10. The line numbers for the hackers file is one off due to the <?php line. If you go to the next line, it is probably the list of hacker codes the script is checking for.

     

    The code reads in the files directly from the server. It can't find one if it isn't there. Are you sure you are looking in the correct images directory?

     

    About: WARNING: Your images directory contains .php files but it should not.

    Also found a php file in images directory, but after checking, I have no such file there ...

     

    Well, the glob page says

    Returns an array containing the matched files/directories, an empty array if no file matched or FALSE on error.

    Note: On some systems it is impossible to distinguish between empty match and an error.

     

    file: sitemonitor_admin.php

    if (count(glob(DIR_FS_CATALOG . DIR_WS_IMAGES . '*.php'))) {
    $messageStack->add(ERROR_IMAGES_HAS_PHP, 'error');
    }
    

    If it's returning false, count() would count that as one value.

     

    Here is my solution

    file: sitemonitor_admin.php

    Replace

    if (count(glob(DIR_FS_CATALOG . DIR_WS_IMAGES . '*.php'))) {
    $messageStack->add(ERROR_IMAGES_HAS_PHP, 'error');
    }
    

     

    with

     

    $phpdata = glob(DIR_FS_CATALOG . DIR_WS_IMAGES . '*.php');
    if(empty($phpdata))
    $phpdata = 0;
    else 
    { 
    $messageStack->add(ERROR_IMAGES_HAS_PHP, 'error');
    }
    

  11. Looks like you have perhaps modified the code wrongly in classes/shopping_cart.php

    ... You were righ about that.

     

     

    Are you sure that the sub total amount in shopping cart is showing the correct amount with auction product in it?

    <?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?>

    Because for me, the amount is standard product price + auction final price. When in the shopping cart is non of the product in the auction, the amount is correct.

  12. Checked. All correct.

     

    It is something with this part:

    if( $products[$i]['auctions_price'] != 'false' ){
    
    	 $display_price = '<b>' . $currencies->display_price($products[$i]['auctions_price'], tep_get_tax_rate($products[$i]['tax_class_id']), '1') . '</b>';
      } else {
    	$display_price = '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>';

     

    If I change the code in the

     

    if( $products[$i]['auctions_price'] != '' ){

     

    The price for auction product is shown = standard product price - auction final price.

    In checkout confirmation total amount is corect.

  13. During testing I noticed one more error. I do not know if the error occurs only in my case or anyone else has a problem.

    The erro occor in shopping_cart.php. After I implement code :

     

    // BOF AUCTIONS
      if( isset($cart->contents[ $products[$i]['id']]['auction_id']) && $cart->contents[ $products[$i]['id']]['auction_id'] > '0' ){
      $info_box_contents[$cur_row][] = array('align' => 'center',
    										 'params' => 'class="productListing-data" valign="top"',
    										 'text' => 'Predmet dražbe');
      } else {
      $info_box_contents[$cur_row][] = array('align' => 'center',
    										 'params' => 'class="productListing-data" valign="top"',
    										 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));
      }
      if( $products[$i]['auctions_price'] != 'false' ){
    	$display_price = '<b>' . $currencies->display_price($products[$i]['auctions_price'], tep_get_tax_rate($products[$i]['tax_class_id']), '1') . '</b>';
      } else {
    	$display_price = '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>';
      }
      // EOF AUCTIONS
      $info_box_contents[$cur_row][] = array('align' => 'right',
    										 'params' => 'class="productListing-data" valign="top"',
    										 // BOF AUCTIONS
    										 'text' => $display_price);
    						   // EOF AUCTIONS

     

     

    Price for product is always 0 and the total amount is always ful price for product.

  14. ... same thing

     

    I check things and found that the function

     

      function productInfoPriceArray($auctionkey, $products_id, $products_tax_class_id){
    global $currencies;
    
    $databid = tep_db_query("
    SELECT MAX(bid_price) AS max_bid_price
    FROM " . TABLE_AUCTIONS_BIDS . " ab, " . TABLE_AUCTIONS . " ap
    WHERE ab.auctions_id = ap.auctions_id
    AND ab.auctions_id = '" . (int)$this->auctions['auctions'][$auctionkey]->auctions_id . "'") or die(mysql_error());
    $highbid = tep_db_fetch_array( $databid );
    tep_db_free_result($databid);
      if ($highbid['max_bid_price'] > $this->auctions['auctions'][$auctionkey]->auctions_starting_price){
    	$this->auctions_price_array['osc']  = '<span style="color: orange; font-size: 10pt; font-weight: bold;">' . MY_AUCTIONS_MAX_BID . ':</span> ' . $currencies->display_price($highbid['max_bid_price'], tep_get_tax_rate($products_tax_class_id));
    	$this->auctions_price_array['raw'] = $highbid['max_bid_price'];
    	$this->auctions_price_array['text'] = MY_AUCTIONS_MAX_BID . ':';  
      } else {
    	$this->auctions_price_array['osc']  = $currencies->display_price($this->auctions['auctions'][$auctionkey]->auctions_starting_price, tep_get_tax_rate($products_tax_class_id));
    	$this->auctions_price_array['raw'] = $this->auctions['auctions'][$auctionkey]->auctions_starting_price;
    	$this->auctions_price_array['text'] = false;
      }
     }

     

    does not work in my case.

  15. javascript is not working for you on that page .. you should get a pop up stopping you from bidding.

     

    However .. it has highlighted an issue .. with javascript off I can replicate this .. the code should reject the bid without javascript so I'll fix this.

     

    Rob

     

    I think javascript is working, because I get a pop up stopping me from overbid myself.

     

    My opinion is that problem is something in relation to this part of the code:

     

    $this->auctions_price_array['raw'] ... but i do not know what.

     

    BR

    Andrej

  16. I have a problem with Auction price & Bid Price.

     

    1) Auction price: 0,00€ (has always shown 0,00)

    2) bid price

    For example.

    Starting Price = 5

    Overbid Amount = 2, so Bidding increments must be at least 2 (that means Bid Price will be 5 + 2, or is wrong?)

    In my case custumer can always Bid Price same to Bidding increments minimum.

    Which means that he can offer a price which does not depend on the previous offer.

  17. Hello,

    Anvip, as you suggested I replaced pdf_catalog_info2 with the code you supplied but still could not generate the pdf file from the store (customer) side.

    What may be the problem? Any other suggestions?

    In advance thank you.

     

    I need link to your store ...

  18. Same problem here:

     

    I get this message:

    Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 11246 is not allowed to access /tmp owned by uid 0 in /customers/agerholm.com/agerholm.com/httpd.www/shp/includes/functions/sessions.php on line 148

     

    When I use the fix by spyrotsk on the customer page.

     

    I can create catalog under admin.

    I can see the main catalog under "customer"

    But I cannot create categori catalog under "customer"

     

    spyrotsk - had a fix preventing database php5 problems on customer front - but then I get the error i has decsrobed.

     

    HELP::::

     

    If you have problems with create catalog under customer, please replace pdf_catalogue_info2.php with this code:

     

    <?php

    /******************************************************************************/

    /* PDF Catalogs v.2.0.1 for osCommerce v.2.2 MS2 */

    /* */

    /* by Infobroker ([email protected]), April 2006 */

    /* by Antonios THROUVALAS ([email protected]), April 2004 */

    /* by Mitch O`Brian (mitchobrian.de), juli2004 2004 */

    /* by Nicolas Hilly ([email protected]), August 2004 */

    /* by Christophe Buchi ([email protected]), September 2004 */

    /* by Ryan Kononoff ([email protected]), October 2004 */

    /* */

    /* Based on PDF Catalogs v.1.4 by [email protected] */

    /* */

    /* Uses FPDF (http://www.fpdf.org), Version 1.52, by Olivier PLATHEY */

    /* modified by Infobroker */

    /* */

    /* Credit goes also to: */

    /* - Yamasoft (http://www.yamasoft.com/php-gif.zip) for their GIF class, */

    /* - Jerome FENAL ([email protected]) for introducing GIF Support */

    /* in the FPDF Class, */

    /* - The osC forums members (www.oscommerce.com/forums)! */

    /* */

    /* Please donate to the osCommerce Core Team! */

    /* */

    /* Freeware, You may use, modify and redistribute this software as you wish! */

    /******************************************************************************/

    //Anzeigen des Download Links und verstecken der Fehlermeldungen mit weißer Schrift!!! ;)

    //Fehler: foreach und Session //Nicht störend bei den Funktionen!

     

    define('FPDF_FONTPATH','font/');

    require('pdf_config.php');

    require('pdf_fpdf.php');

    require('includes/application_top.php');

    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PDF_KATALOG);

     

    if ($no_of_files == 'one_file') {

    echo "<style type=\"text/css\">"

    .".mini {font-size: 1pt;};"

    ."</style>"

    ."<link rel=\"stylesheet\" type=\"text/css\" href=\"templates/Original/stylesheet.css\">";

    echo '<center>==> <a href="'.$file_PDF.' all selected.pdf" target="_blank"><font size="2" face="verdana"><b>Prenos kataloga</b></font></a> <==</center>';

    echo '<font color="#FFFFFF" class="mini">';

    }

    else {

    $KATEGORIE_SELECTED = explode("|", $KAT_SELECTED_ARRAY);

    echo "<style type=\"text/css\">"

    .".mini {font-size: 1pt;};"

    ."</style>"

    ."<link rel=\"stylesheet\" type=\"text/css\" href=\"templates/Original/stylesheet.css\">";

    for ($i=0; $i<$ANZAHL_KATEGORIEN; $i++) {

    $categories_name_query = tep_db_query('select categories_name from ' . TABLE_CATEGORIES_DESCRIPTION . ' where categories_id = "' . $KATEGORIE_SELECTED[$i] . '"');

    $categories_name = tep_db_fetch_array($categories_name_query);

    echo '<center>==> <a href="'.$file_PDF.' '.$categories_name['categories_name'].'.pdf" target="_blank"><font size="2" face="verdana"><b>Prenos kataloga</b></font></a> <==</center>';

    }

    echo '<font color="#FFFFFF" class="mini">'; }

    //Neuerung ab Version 1.6

    if (isset($PDF_ACTION)){

     

    //Exportieren der Daten aus dem "Array" zurück in das wirkliche Array!!!

    $KATEGORIE_SELECTED = explode("|", $KAT_SELECTED_ARRAY);

     

     

     

    // Count how many products exist in a category

    // TABLES: products, products_to_categories, categories

    function tep_products_in_category_count($categories_id, $include_deactivated = false) {

    $products_count = 0;

     

    if ($include_deactivated) {

    $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$categories_id . "'");

    } else {

    $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$categories_id . "'");

    }

     

    $products = tep_db_fetch_array($products_query);

     

    $products_count += $products['total'];

     

    $childs_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$categories_id . "'");

    if (tep_db_num_rows($childs_query)) {

    while ($childs = tep_db_fetch_array($childs_query)) {

    $products_count += tep_products_in_category_count($childs['categories_id'], $include_deactivated);

    }

    }

     

    return $products_count;

    }

     

     

    $products_index_array;

     

    class PDF extends FPDF

    {

    //Colonne courante

    var $col=0;

    //Ordonnée du début des colonnes

    var $y0;

    var $categories_string_spe = '';

    var $categories_string = '';

    var $categories_id = '';

    var $levels = '';

    var $parent_category_name;

    var $ifw = 0; //internal width margin for the products (image and text) description

    var $text_fw = 0; //text width for the products (text) description

    var $ifh = 0; //internal height margin for the products description

    var $products_index_array;

    var $products_index_list='';

     

    function Header()

    {

    //Background Color

    $background_color_table=explode(",",BACKGROUND_COLOR);

    $this->SetFillColor($background_color_table[0], $background_color_table[1], $background_color_table[2]);

    $this->ifw = $this->fw * 0.95; // A4 portrait = 200

    $this->ifh = $this->fh * 0.87; // A4 portrait = 260

    $this->Rect(0,0,$this->fw,$this->fh,F); // Draw background

     

    //Logo: If LOGO_IMAGE defined, show image with logo, else show text

    if (PDF_LOGO) {

    $this->Image(DIR_FS_CATALOG.DIR_WS_IMAGES.PDF_LOGO,10,8,0,29);

    } else {

    $this->SetFont('Arial','B',18);

    $this->SetLineWidth(0);

    $w=$this->GetStringWidth(PDF_TITLE)+6;

    //$this->SetX((210-$w)/2);

    $this->SetFillColor(100,100,100);

    $this->Cell($w,9,PDF_TITLE,0,0,'C');

    }

    //Année en cour

    $aujourdhui = getdate();

    $annee = strftime(PDF_DATE_FORMAT);

     

    $this->SetFont('Arial','B',12);

    $this->Cell(0,9,$annee." ",0,1,'R');

    if (PDF_LOGO) {

    $this->Ln(20);

    } else {

    $this->Ln(2);

    }

    $x=$this->GetX();

    $y=$this->GetY();

    $this->Line($x,$y,$this->ifw,$y);

    $this->Ln(3);

    //Schutz der Ordinate

    $this->y0=$this->GetY();

    }

     

    function Footer()

    {

    //Pied de page

    $this->SetY(-15);

    $x=$this->GetX();

    $y=$this->GetY();

    $this->SetLineWidth(0.2);

    $this->Line($x,$y,$this->ifw,$y);

    $this->SetFont('Arial','I',8);

    $this->Cell(0,10,PDF_TXT_PAGE.$this->PageNo().'/{nb} ',0,0,'R');

    }

     

    function CheckPageBreak($h)

    {

    //Wenn die Höhe h débordement, manuellen Seitensprung verursacht //$x=$this->SetX(56);

    if($this->GetY()+$h>$this->PageBreakTrigger) $this->AddPage($this->CurOrientation);

    }

     

    function NbLines($w,$txt)

    {

    //Rechnen Sie die Anzahl der Linien, daß MultiCell von Breite w besetzt

    $cw=&$this->CurrentFont['cw'];

    if($w==0)

    $w=$this->w-$this->rMargin-$this->x;

    $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;

    $s=str_replace("\r",'',$txt);

    $nb=strlen($s);

    if($nb>0 and $s[$nb-1]=="\n")

    $nb--;

    $sep=-1;

    $i=0;

    $j=0;

    $l=0;

    $nl=1;

    while($i<$nb)

    {

    $c=$s[$i];

    if($c=="\n")

    {

    $i++;

    $sep=-1;

    $j=$i;

    $l=0;

    $nl++;

    continue;

    }

    if($c==' ')

    $sep=$i;

    $l+=$cw[$c];

    if($l>$wmax)

    {

    if($sep==-1)

    {

    if($i==$j)

    $i++;

    }

    else

    $i=$sep+1;

    $sep=-1;

    $j=$i;

    $l=0;

    $nl++;

    }

    else

    $i++;

    }

    return $nl;

    }

     

    function LineString($x,$y,$txt,$cellheight)

    {

    //calculate the width of the string

    $stringwidth=$this->GetStringWidth($txt);

    //calculate the width of an alpha/numerical char

    $numberswidth=$this->GetStringWidth('1');

    $xpos=($x+$numberswidth);

    $ypos=($y+($cellheight/2));

    $this->Line($xpos,$ypos,($xpos+$stringwidth),$ypos);

    }

     

    function ShowImage(&$width,&$height,$link,$path)

    {

    $width=min($width,MAX_IMAGE_WIDTH);

    $height=min($height,MAX_IMAGE_HEIGHT);

     

    if(RESIZE_IMAGES) {

    $destination =DIR_FS_CATALOG."catalogues/";

    if(substr(strtolower($path), (strlen($path)-4),4)==".jpg" || substr(strtolower($path), (strlen($path)-5),5)==".jpeg") {

    $src=imagecreatefromjpeg($path);

    } else if (substr(strtolower($path), (strlen($path)-4),4)==".png") {

    $src=imagecreatefrompng($path);

    } else {

    echo "Only PNG and JPEG";

    exit();

    }

     

    $array=explode("/", $path);

    $last=sizeof($array);

    $size = getimagesize($path);

    if($size[0] > $size[1]) {

    $im=imagecreate($width/PDF_TO_MM_FACTOR, $height/PDF_TO_MM_FACTOR);

    imagecopyresized($im, $src, 0, 0, 0, 0,$width/PDF_TO_MM_FACTOR, $height/PDF_TO_MM_FACTOR, $size[0], $size[1]);

    } else {

    $im=imagecreate($height/PDF_TO_MM_FACTOR,$width/PDF_TO_MM_FACTOR);

    imagecopyresized($im, $src, 0, 0, 0, 0, $height/PDF_TO_MM_FACTOR, $width/PDF_TO_MM_FACTOR, $size[0], $size[1]);

    }

    if(!imagejpeg($im, $destination.$array[$last-1])) {

    exit();

    }

     

    $path=$destination.$array[$last-1];

    $this->SetLineWidth(1);

    $this->Cell($width+3,$height,"",1,0);

    $this->SetLineWidth(0.2);

    $this->Image($path,($this->GetX()-$width), $this->GetY(), $width, $height,'',$link);

    $this->SetFont('Arial','',8);

    unlink($path);

    } else {

    $this->SetLineWidth(1);

    // NH $this->Cell($width,$height,"",1,0);

    $this->Cell($width+3,$height,"",SIZE_BORDER_IMAGE,0);

    $this->SetLineWidth(0.2);

    //NH $this->Image($path,($this->GetX()-$width), $this->GetY(), $width, $height,'',$link);

    $this->Image($path,($this->GetX()-$width), $this->GetY(),$width ,'' ,'',$link);

    $this->SetFont('Arial','',8);

    }

    }

     

     

    //Ordnen des Baumes (Niveau ist das Niveau der unter- Kategorie)

    function Order($cid, $level, $foo, $cpath)

    {

    if ($cid != 0) {

    if($level>1) {

    $nbspaces=7;

    $dessinrep="|___ ";

    //ich drehe die Zeichnung um

    $revstring = strrev($dessinrep);

    //ich ihn füge nbspace für jedes Niveau von unter- repertoire hinzu

    $revstring .= str_repeat(" ",$nbspaces*($level-2));

    //je réinverse la chaine

    $this->categories_string_spe .= strrev($revstring);

    }

    $this->levels .=$level." ";

    $this->categories_id .= $cid." ";

    $this->categories_string .= $foo[$cid]['name'];

    $this->categories_string_spe .= $foo[$cid]['name'];

     

    if (SHOW_COUNTS) {

    $products_in_category = tep_products_in_category_count($cid,'false');

    if ($products_in_category > 0) {

    $this->categories_string_spe .= ' (' . $products_in_category . ')';

    }

    }

    $this->categories_string .= "\n";

    $this->categories_string_spe .= "\n";

    }

    //Parcourir l'arbre des categories (lecture de la table de hachage comme en Perl)

    if (sizeof($foo) > 0 ) {

    foreach ($foo as $key => $value) {

    if ($foo[$key]['parent'] == $cid) {

    $this->Order($key, $level+1, $foo, $cid);

    }

    }

    }

    }

     

    function ParentsName($current_category_level,$i,&$categorieslevelsarray, &$categoriesnamearray)

    {

     

    $k=$i;

    while($k>0) {

    if($categorieslevelsarray[$k] == ($current_category_level-1)) {

    $this->parent_category_name=$categoriesnamearray[$k];

    break;

    }

    $k--;

    }

    }

     

    function CalculatedSpace($y1,$y2,$imageheight)

    {

    //Wenn die Kommentare sind - wichtig, daß das Bild beim Anschlagraum

    if(($h2=$y2-$y1) < $imageheight) {

    $this->Ln(($imageheight-$h2)+3);

    } else {

    $this->Ln(3);

    }

    }

     

    function PrepareIndex($name,$manufacturer,$category)

    {

    $this->products_index_array[] = array (

    'name' => substr($name,0,55),

    'manufacturer' => substr($manufacturer,0,20),

    'category' => substr($category,0,18),

    'page' => $this->PageNo());

    }

     

    function DrawIndex()

    {

    //5 = Höhe der Zellen

    $h= 5 * sizeof($this->products_index_array) ."<br>";

    if($h< $this->ifh) {

    $this->CheckPageBreak($h);

    }

    $this->AddPage();

    $this->Ln(5);

    // echo "<br>HHHH sizeof= " . sizeof($this->products_index_array);

     

    if (!function_exists(CompareIndex)) {

    function CompareIndex($a, $B)

    {

    // return strcmp($a['name'], $b['name']);

    return strncasecmp($a['name'],$b['name'],8); // seulement les 8 premiers caracteres

    }

    }

    usort($this->products_index_array, CompareIndex);

     

    $this->SetFont('Courier','B',11);

    $this->Cell(1,11,"",0,0);

    $this->MultiCell($this->ifw,11,PDF_INDEX_HEADER,0,'C');

    $this->SetFont('Courier','',11);

    if (strlen(INDEX_SEPARATOR) < 1) {

    $index_separator=" ";

    } else {

    $index_separator=INDEX_SEPARATOR;

    }

    foreach ($this->products_index_array as $key => $value) {

    if (strlen($value['manufacturer']) > 0) {

    $ligne_index = str_pad($value['name']." - ". $value['manufacturer'],53,$index_separator,STR_PAD_RIGHT);

    } else {

    $ligne_index = str_pad($value['name'],53,$index_separator,STR_PAD_RIGHT);

    }

    $ligne_index .= str_pad($value['category'],18,$index_separator,STR_PAD_LEFT);

    $ligne_index .= str_pad($value['page'], 5, $index_separator, STR_PAD_LEFT);

    $this->Cell(1,6,"",0,0);

    $this->MultiCell(0,6,$ligne_index,0,'C');

    // echo "<br>HHHH : " . $ligne_index;

    }

    // echo "<br>HHHH wpt =" .$this->wPt . " fw =" . $this->fw. " ifw =" . $this->ifw ." text_fw =" . $this->text_fw;

    // echo "<br>HHHH hpt =" .$this->hPt . " fh =" . $this->fh. " ifh =" . $this->ifh;

    }

     

    function DrawCells($data_array)

    {

    $totallines=0;

    for($i=2;$i<(sizeof($data_array)-1);$i++)

    {

    $totallines+=$this->NbLines(($this->ifw -$data_array[0]),$data_array[$i]);

    }

     

    //5 = Höhe der Zellen - eigentlich Faktor für Füllung der Seite

    $h=5*($totallines+1)."<br>";

     

    //wenn die Beschreibung des Produktes nicht die ganze Seite nimmt

    if($h< $this->ifh)

    {

    $this->CheckPageBreak($h);

    }

     

     

    if(SHOW_PRODUCTS_LINKS)

    { // NH DIR_WS_CATALOG

    $link=HTTP_SERVER . DIR_WS_HTTP_CATALOG ."product_info.php?products_id=".$data_array[10]."&language=".$data_array[11];

    }

    else

    {

    $link='';

    }

     

    if(SHOW_IMAGES && strlen($data_array[12]) && file_exists($data_array[12]))

    {

    //If Small Image Width and Small Image Height are defined

    if(strlen($data_array[0])>1 && strlen($data_array[1])>1)

    {

    $this->ShowImage($data_array[0],$data_array[1],$link,$data_array[12]);

    $y1=$this->GetY();

    }

    //If only Small Image Width is defined

    else if(strlen($data_array[0])>1 && strlen($data_array[1]))

    {

    $heightwidth=getimagesize($data_array[12]);

    $data_array[0]=$data_array[0];

    $data_array[1]=$heightwidth[1]*PDF_TO_MM_FACTOR;

    $this->ShowImage($data_array[0],$data_array[1],$link,$data_array[12]);

    $y1=$this->GetY();

    }

    //If only Small Image Height is defined

    else if(strlen($data_array[0]) && strlen($data_array[1])>1)

    {

    $heightwidth=getimagesize($data_array[12]);

    $data_array[0]=$width=$heightwidth[0]*PDF_TO_MM_FACTOR;

    $data_array[1]=$data_array[1];

    $this->ShowImage($data_array[0],$data_array[1],$link,$data_array[12]);

    $y1=$this->GetY();

    }

    else

    {

    $heightwidth=getimagesize($data_array[12]);

    $data_array[0]=$heightwidth[0]*PDF_TO_MM_FACTOR;

    $data_array[1]=$heightwidth[1]*PDF_TO_MM_FACTOR;

    $this->ShowImage($data_array[0],$data_array[1],$link,$data_array[12]);

    $y1=$this->GetY();

    }

     

    //Margin=10

    $this->SetX(10);

    }

    else

    {

    $data_array[0]=$data_array[1]=0;

    $y1=$this->GetY();

    $this->SetFont('Arial','',8);

    }

    // Calcul l'espace libre a droite de l'image

    $this->text_fw = $this->ifw - 18 - $data_array[0];

     

    if(SHOW_NAME)

    {

    if(strlen($data_array[2]))

    {

    // Cell(marge gauche, hauteur, text, bordure, )

    $this->Cell($data_array[0]+6,5,"",0,0);

    $x=$this->GetX();

    $y=$this->GetY();

    $name_color_table=explode(",",NAME_COLOR);

    $this->SetFillColor($name_color_table[0],$name_color_table[1],$name_color_table[2]);

    $this->MultiCell($this->text_fw,5,$data_array[2],PRODUCTS_BORDER,'L',1);

    }

    }

    if(SHOW_MODEL)

    {

    if(strlen($data_array[3]))

    {

    $this->Cell($data_array[0]+6,5,"",0,0);

    $this->MultiCell($this->text_fw,5,PDF_TXT_MODEL.$data_array[3],PRODUCTS_BORDER,'L');

    }

    }

     

    if(SHOW_DATE_ADDED)

    {

    if(strlen($data_array[4]))

    {

    $this->Cell($data_array[0]+6,5,"",0,0);

    $this->MultiCell($this->text_fw,5,$data_array[4],PRODUCTS_BORDER,'L');

    }

    }

    if(SHOW_MANUFACTURER)

    {

    if(strlen($data_array[5])) {

    $this->Cell($data_array[0]+6,5,"",0,0);

    $this->SetFont('Arial','I');

    $this->MultiCell($this->text_fw,5,PDF_TXT_MANUFACTURER.$data_array[5],PRODUCTS_BORDER,'L');

    $this->SetFont('Arial','');

    }

    }

    // NH si il n'y a pas de bordure, ajout d'un petit separateur

    if (!PRODUCTS_BORDER) {

    $this->Cell($data_array[0]+6,2,"",0,0);

    $x=$this->GetX();

    $y=$this->GetY();

    $this->MultiCell($this->text_fw,1,"",0,'C');

    //$this->LineString($x+3,$y," ",2);

    $this->Line($x+4,$y,$x+15,$y);

    }

    if(SHOW_DESCRIPTION)

    {

    if(strlen($data_array[6]))

    {

    $this->Cell($data_array[0]+6,5,"",0,0);

    $this->MultiCell($this->text_fw,5,$data_array[6],PRODUCTS_BORDER,'L');

    }

    }

    if(SHOW_TAX_CLASS_ID)

    {

    if(strlen($data_array[7]))

    {

    $this->Cell($data_array[0]+6,5,"",0,0);

    $this->MultiCell($this->text_fw,5,$data_array[7],PRODUCTS_BORDER,'L');

    }

     

    }

    if(VAT == '1')

    {

    $vatprice_query=tep_db_query("select p.products_id, p.products_tax_class_id, tr.tax_rate from " . TABLE_PRODUCTS . " p, " . TABLE_TAX_RATES . " tr where p.products_id = '" . $data_array[10] . "' and p.products_tax_class_id = tr.tax_class_id");

    while($vatprice1 = tep_db_fetch_array($vatprice_query)) {

    $steuer = $vatprice1['tax_rate'];

    }

    $vatprice=sprintf("%01.".DIGITS_AFTER_DOT."f",(($steuer/100)*$data_array[9])+$data_array[9]);

    $vatspecialsprice=sprintf("%01.".DIGITS_AFTER_DOT."f",(($steuer/100)*$data_array[8])+$data_array[8]);

    }

    else

    {

    $vatprice=sprintf("%01.".DIGITS_AFTER_DOT."f",$data_array[9]);

    $vatspecialsprice=sprintf("%01.".DIGITS_AFTER_DOT."f",$data_array[8]);

    }

    if(SHOW_PRICES)

    {

    // NH si il n'y a pas de bordure, ajout d'un petit separateur

    if (!PRODUCTS_BORDER) {

    $this->Cell($data_array[0]+6,2,"",0,0);

    $x=$this->GetX();

    $y=$this->GetY();

    $this->MultiCell($this->text_fw,1,"",0,'C');

    //$this->LineString($x+3,$y," ",2);

    $this->Line($x+4,$y,$x+15,$y);

    }

     

    if(strlen($data_array[8])) //If special price

    {

    $this->Cell($data_array[0]+6,5,"",0,0);

     

    $x=$this->GetX();

    $y=$this->GetY();

    $specials_price_color_table=explode(",",SPECIALS_PRICE_COLOR);

    $this->SetTextColor($specials_price_color_table[0],$specials_price_color_table[1],$specials_price_color_table[2]);

    $this->SetFont('Arial','B','');

     

     

    if(CURRENCY_RIGHT_OR_LEFT == 'R') {

    $this->MultiCell($this->text_fw,5,$vatprice.CURRENCY."\t\t\t".$vatspecialsprice.CURRENCY,PRODUCTS_BORDER,'L'); // le rajout d'un param ,1 remplie la couleur de fond );

    } else if (CURRENCY_RIGHT_OR_LEFT == 'L') {

    $this->MultiCell($this->text_fw,5,CURRENCY.$vatprice."\t\t\t".CURRENCY.$vatspecialsprice,PRODUCTS_BORDER,'L'); // le rajout d'un param ,1 remplie la couleur de fond );

    } else {

    echo "<b>Choose L or R for CURRENCY_RIGHT_OR_LEFT</b>";

    exit();

    }

    $this->LineString($x,$y,$vatprice.CURRENCY,5);

    }

    else if(strlen($data_array[9]))

    {

    $this->Cell($data_array[0]+6,5,"",0,0);

    if(CURRENCY_RIGHT_OR_LEFT == 'R') {

    $this->MultiCell($this->text_fw,5,$vatprice.CURRENCY,PRODUCTS_BORDER,'L');

    }else if(CURRENCY_RIGHT_OR_LEFT == 'L') {

    $this->MultiCell($this->text_fw,5,CURRENCY.$vatprice,PRODUCTS_BORDER,'L');

    } else {

    echo "<b>Choose L or R for CURRENCY_RIGHT_OR_LEFT</b>";

    exit();

    }

    }

    $this->SetTextColor(0,0,0);

    }

    $y2=$this->GetY();

     

    // wenn die Beschreibung des Produktes nicht die ganze Seite nimmt

    if($h< $this->ifh)

    {

    $this->CalculatedSpace($y1,$y2,$data_array[1]);

    }

    else

    {

    $this->Ln(5);

    }

     

    }

     

    function CategoriesTree($languages_id,$languages_code,$KATEGORIE_SELECTED,$ANZAHL_KATEGORIEN)

    {

    global $no_of_files;

    if ($no_of_files == 'one_file') {

    $addquery = " AND (";

    for ($j=0; $j<$ANZAHL_KATEGORIEN; $j++) {

    $cats[] = $KATEGORIE_SELECTED[$j]; // current catID as starting value

    // put cat-IDs of all cats nested in current branch into $cats array, go through all subbranches

    for($i=0;$i<count($cats);$i++) {

    $categorie_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$cats[$i] . "'");

    while ($categorie = tep_db_fetch_array($categorie_query)) {

    $cats[] = $categorie['categories_id'];

    }

    $cats=array_unique($cats); // sort out doubles

    }}

    $cats = implode(',', $cats);

    $lenght = (strlen($cats)+1)/2;

    $cats = explode(',', $cats);

    $addquery .= "c.categories_id='".$cats[0]."'";

    for ($k=1; $k<$lenght; $k++) {

    $addquery .= " OR c.categories_id='".$cats[$k]."'"; }

    $addquery .= ")";

    }

    else {

    $cats[] = $KATEGORIE_SELECTED; // current catID as starting value

    // put cat-IDs of all cats nested in current branch into $cats array, go through all subbranches

    for($i=0;$i<count($cats);$i++) {

    $categorie_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$cats[$i] . "'");

    while ($categorie = tep_db_fetch_array($categorie_query)) {

    $cats[] = $categorie['categories_id'];

    }

    $cats=array_unique($cats); // sort out doubles

    }

    $cats = implode(',', $cats);

    $lenght = (strlen($cats)+1)/2;

    $cats = explode(',', $cats);

    $addquery = " AND (c.categories_id='".$cats[0]."'";

    for ($i=1; $i<$lenght; $i++) {

    $addquery .= " OR c.categories_id='".$cats[$i]."'"; }

    $addquery .= ")";

    }

    //selectionne toute les categories

    $query = "SELECT c.categories_id, cd.categories_name, c.parent_id

    FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd

    WHERE c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' ".$addquery."

    ORDER by sort_order, cd.categories_name";

     

    $categories_query = tep_db_query($query);

    while ($categories = tep_db_fetch_array($categories_query)) {

    //Table de hachage

    $foo[$categories['categories_id']] = array(

    'name' => $categories['categories_name'],

    'parent' => $categories['parent_id']);

    }

     

    $this->Order(0, 0, $foo, '');

    $this->AddPage();

    $this->TitreChapitre("");

    if (SHOW_INTRODUCTION) {

    $this->Ln(18);

    $file= DIR_FS_CATALOG_LANGUAGES . tep_get_languages_directory($languages_code) . '/pdf_define_intro.php';

     

    // echo "<br>HHHH " . $file;

    if (file_exists($file)) {

    $file_array = @file($file);

    $file_contents = @implode('', $file_array);

    $this->MultiCell(0,6,strip_tags($file_contents),$this->ifw,1,'J');

    }

     

    }

    $this->SetFont('Arial','',DIRECTORIES_TREE_FONT_SIZE);

    if (SHOW_TREE) {

    $this->Ln(15);

    $this->MultiCell(0,6,$this->categories_string_spe,0,1,'L');

    }

     

    }

     

    function CategoriesListing($languages_id, $languages_code)

    {

    $this->products_index_array=array();

    $this->products_index_list='';

    $this->index_lenght=0;

     

    //Recuperation de toutes les categories dans l'ordre

    $categoriesidarray=explode(" ",$this->categories_id);

    $categoriesnamearray=explode("\n",$this->categories_string);

    $categorieslevelsarray=explode(" ",$this->levels);

     

    //Convertion pixels -> mm

    $imagewidth=SMALL_IMAGE_WIDTH*PDF_TO_MM_FACTOR;

    $imageheight=SMALL_IMAGE_HEIGHT*PDF_TO_MM_FACTOR;

     

    for($i=0; $i<sizeof($categoriesidarray)-1; $i++) {

    $category_count_products = tep_products_in_category_count($categoriesidarray[$i],'false');

    if (!((!SHOW_EMPTY_CATEGORIES) and ($category_count_products < 1))) {

    $taille=0;

    $current_category_id=$categoriesidarray[$i];

    $current_category_name=$categoriesnamearray[$i];

    $current_category_level=$categorieslevelsarray[$i];

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

     

    $SHOW_catalog_query = tep_db_query($requete_prod);

    while ($print_catalog = tep_db_fetch_array($SHOW_catalog_query)) {

    $print_catalog_array[$taille++] = array(

    'id' => $print_catalog['products_id'],

    'name' => $print_catalog['products_name'], 'description' => $print_catalog['products_description'],

    'model' => $print_catalog['products_model'],

    'image' => $print_catalog['products_image'],

    'price' => $print_catalog['products_price'], 'specials_price' => $print_catalog['specials_new_products_price'],

    'tax_class_id' => $print_catalog['products_tax_class_id'],

    'date_added' => tep_date_long($print_catalog['products_date_added']),

    'manufacturer' => $print_catalog['manufacturers_name']);

    }

     

    //Forschung der Name der Vaterkategorie

    $this->parent_category_name='';

    $this->ParentsName($current_category_level,$i,$categorieslevelsarray, $categoriesnamearray);

     

    if (($current_category_level == 1) and (CATEGORIES_PAGE_SEPARATOR)) {

    $this->AddPage();

    $this->Ln(120);

    $this->SetFont('Arial','',12);

    $titles_color_table=explode(",",CENTER_TITLES_CELL_COLOR);

    $this->SetFillColor($titles_color_table[0], $titles_color_table[1], $titles_color_table[2]);

    $this->Cell(45,5,"",0,0);

    $this->MultiCell(100,10,$current_category_name,1,'C',1);

    }

     

    if ($taille > 0) { // categorie non vide

    $this->AddPage();

    if (strlen($this->parent_category_name) > 0 ) {

    $this->TitreChapitre($this->parent_category_name. CATEGORIES_SEPARATOR .$current_category_name);

    } else {

    $this->TitreChapitre($current_category_name);

    }

    $this->Ln(3); // NH

    $this->SetFont('Arial','',11);

     

    for($j=0; $j<$taille; $j++ ) {

    // NH si pas d'image definie, image par default

    if (strlen($print_catalog_array[$j]['image']) > 0 && file_exists(DIR_FS_CATALOG.DIR_WS_IMAGES.$print_catalog_array[$j]['image'])) {

    $imagepath=DIR_FS_CATALOG.DIR_WS_IMAGES.$print_catalog_array[$j]['image'];

    } else {

    $imagepath=DIR_FS_CATALOG.DIR_WS_IMAGES.'/'.DEFAULT_IMAGE;

    }

    $id=$print_catalog_array[$j]['id'];

    $name=rtrim(strip_tags($print_catalog_array[$j]['name']));

    $model=rtrim(strip_tags($print_catalog_array[$j]['model']));

    $description=rtrim(strip_tags($print_catalog_array[$j]['description']));

    $manufacturer=rtrim(strip_tags($print_catalog_array[$j]['manufacturer']));

    $price=rtrim(strip_tags($print_catalog_array[$j]['price']));

    $specials_price=rtrim(strip_tags($print_catalog_array[$j]['specials_price']));

    $tax_class_id=rtrim(strip_tags($print_catalog_array[$j]['tax_class_id']));

    $date_added=rtrim(strip_tags($print_catalog_array[$j]['date_added']));

     

    $data_array=array($imagewidth,$imageheight,$name,$model,$date_added,$manufacturer,$description,$tax_class_id,$specials_price,$price,$id,$languages_code,$imagepath);

    $this->Ln(PRODUCTS_SEPARATOR); // NH blank space before the products description cells

    $this->DrawCells($data_array);

    if (SHOW_INDEX) {

    switch (INDEX_EXTRA_FIELD) {

    case 1 : $this->PrepareIndex($name,$manufacturer,$current_category_name);

    break;

    case 2 : $this->PrepareIndex($name,$model,$current_category_name);

    break;

    case 3 : $this->PrepareIndex($name,$date_added,$current_category_name);

    break;

    default : $this->PrepareIndex($name,"",$current_category_name);

    }

    }

    }

    }

    }

    }

    }

     

    function NewProducts($languages_id, $languages_code)

    {

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

     

    $products_new_query = tep_db_query($products_new_query_raw);

     

    while($products_new = tep_db_fetch_array($products_new_query)) {

    $products_new_array[] = array('id' => $products_new['products_id'],

    'name' => $products_new['products_name'],

    'image' => $products_new['products_image'],

    'description' => $products_new['products_description'],

    'model' => $products_new['products_model'],

    'price' => $products_new['products_price'],

    'specials_price' => $products_new['specials_new_products_price'],

    'tax_class_id' => $products_new['products_tax_class_id'],

    'date_added' => tep_date_long($products_new['products_date_added']),

    'manufacturer' => $products_new['manufacturers_name']);

    }

     

    $this->AddPage();

    $this->Ln(120);

    $this->SetFont('Arial','',12);

    $new_color_table=explode(",",NEW_CELL_COLOR);

    $this->SetFillColor($new_color_table[0], $new_color_table[1], $new_color_table[2]);

    $this->Cell(45,5,"",0,0);

    $this->MultiCell(100,10,NEW_TITLE,1,'C',1);

    $this->Ln(100);

     

    //Convertion pixels -> mm

    $imagewidth=SMALL_IMAGE_WIDTH*PDF_TO_MM_FACTOR;

    $imageheight=SMALL_IMAGE_HEIGHT*PDF_TO_MM_FACTOR;

     

    for($nb=0; $nb<MAX_DISPLAY_PRODUCTS_NEW; $nb++) {

    $id=$products_new_array[$nb]['id'];

    $name=rtrim(strip_tags($products_new_array[$nb]['name']));

    $model=rtrim(strip_tags($products_new_array[$nb]['model']));

    $description=rtrim(strip_tags($products_new_array[$nb]['description']));

    $manufacturer=rtrim(strip_tags($products_new_array[$nb]['manufacturer']));

    $price=rtrim(strip_tags($products_new_array[$nb]['price']));

    $specials_price=rtrim(strip_tags($products_new_array[$nb]['specials_price']));

    $tax_class_id=rtrim(strip_tags($products_new_array[$nb]['tax_class_id']));

    $date_added=rtrim(strip_tags($products_new_array[$nb]['date_added']));

    if (strlen($products_new_array[$nb]['image']) > 0 && file_exists(DIR_FS_CATALOG.DIR_WS_IMAGES.$products_new_array[$nb]['image'])) {

    $imagepath=DIR_FS_CATALOG.DIR_WS_IMAGES.$products_new_array[$nb]['image'];

    } else {

    $imagepath=DIR_FS_CATALOG.DIR_WS_IMAGES.'/'.DEFAULT_IMAGE;

    }

    $data_array=array($imagewidth,$imageheight,$model,$name,$date_added,$manufacturer,$description,$tax_class_id,$specials_price,$price,$id,$languages_code,$imagepath);

    $this->DrawCells($data_array);

    }

    }

     

    function TitreChapitre($lib) {

    //Titel Kategorien

    $this->SetFont('Arial','',12);

    $titles_color_table=explode(",",HEIGHT_TITLES_CELL_COLOR);

    $this->SetFillColor($titles_color_table[0], $titles_color_table[1], $titles_color_table[2]);

    $this->Cell(0,6,$lib,$this->ifw,1,'L',1);

    $this->Ln(2);

    //Schutz der Ordinate

    $this->y0=$this->GetY();

    }

    }

     

    $languages = tep_get_languages();

    $languages_string = '';

    if ($no_of_files == 'one_file') {

    for ($i=0; $i<sizeof($languages); $i++)

    {

    $pdf=new PDF();

    $pdf->Open();

    $pdf->SetDisplayMode("real");

    $pdf->AliasNbPages();

    if(SHOW_NEW_PRODUCTS) $pdf->NewProducts($languages[$i]['id'],$languages[$i]['code']);

    $pdf->CategoriesTree($languages[$i]['id'],$languages[$i]['code'],$KATEGORIE_SELECTED,$ANZAHL_KATEGORIEN);

    $pdf->CategoriesListing($languages[$i]['id'],$languages[$i]['code']);

    if (SHOW_INDEX) {

    $pdf->DrawIndex();

    }

    //$pdf->Output(DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . " all selected.pdf",false);

    $pdf->Output(DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id'] ." all selected.pdf",false);

    }

    }

    else {

    for ($j=0; $j<$ANZAHL_KATEGORIEN; $j++) {

    $categories_name_query = tep_db_query('select categories_name from ' . TABLE_CATEGORIES_DESCRIPTION . ' where categories_id = "' . $KATEGORIE_SELECTED[$j] . '"');

    $categories_name = tep_db_fetch_array($categories_name_query);

    for ($i=0; $i<sizeof($languages); $i++)

    {

    $pdf=new PDF();

    $pdf->Open();

    $pdf->SetDisplayMode("real");

    $pdf->AliasNbPages();

    if(SHOW_NEW_PRODUCTS) $pdf->NewProducts($languages[$i]['id'],$languages[$i]['code']);

    $pdf->CategoriesTree($languages[$i]['id'],$languages[$i]['code'],$KATEGORIE_SELECTED[$j],$ANZAHL_KATEGORIEN);

    $pdf->CategoriesListing($languages[$i]['id'],$languages[$i]['code']);

    if (SHOW_INDEX) {

    $pdf->DrawIndex();

    }

    // $pdf->Output(DIR_FS_CATALOG . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . " " .$categories_name['categories_name'].".pdf",false);

    $pdf->Output(DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id'] ." ". $categories_name['categories_name'].".pdf",false);

    }

    }

    }

    //Neuerung ab Version 1.6

    //Dieser Link muss von Hand geändert werden wenn sich das Verzeichnis in dem pdf_catalog_info.php liegt ändert!

    }

    else{

    echo "</font><br><br><center><font size=1 face=verdana>Sie haben keine Kategorie gewählt, bitte gehen Sie auf <a href=pdf_catalogue_info2.php class=\"menuBoxContentLink\">Zum Katalog Menü</a> und machen Sie Ihre Wahl für den PDF Katalog!<br><br></cenetr>";

    }

     

    //echo "</font><center><a href=\"$file_PDF\" target=\"_blank\"><font size=2><b>Download</b></font><br><br>";

     

    ?>

×
×
  • Create New...