Back to top

Autore Topic: wrapper-php-gategay-carrello  (Letto 1150 volte)

Offline sandrix80

  • Nuovo arrivato
  • *
  • Post: 7
    • Mostra profilo
wrapper-php-gategay-carrello
« il: 27 Giu 2013, 11:36:26 »
Buongiorno,

sono giorni che sto smanettando sul forum per cercare aiuto.

Ho installato Joomla 2.5 per realizzare un B2B.

La mia esigenza è questa in breve:

Il mio fornitore mi ha fornito uno script in php:

Codice: [Seleziona]
<?php

$login    
"miologin";
$passwd   "miapassword";
$gateway  "sitodelfornitore.it/scripts/xxxxxxxx.dll/yy1234";
$imglarge "http://www.immagine.it/preview/xy";
$urlphp   "";
$urlcgi   "http://" $login ":" $passwd "@" $gateway;





    if (isset(
$_GET['cmd'])) 
        
$cmd  $_GET['cmd'];
    else 
        
$cmd "";

    switch (
$cmd) {

        case 
"":
            
html_open_std ();
            
ingave_artikel ("""""""");
            
html_close ();
            break;

        case 
"search":
            
html_open_std ();
            
toon_banden ();
            
html_close ();
            break;

        case 
"preview":
            
$foto    $_GET['foto'];
            
toon_preview ($foto);
            break;
    }

#------------------------------------------------------------

function ingave_artikel ($art1$art2$art3$errormelding)
{
    global 
$urlphp;
    global 
$urlcgi;
    global 
$ad;

    echo 
"<h1>Ricerca prodotto</h1>\n";
        
    echo 
"<form method=\"POST\" action=\"?cmd=search\">\n";
    echo 
"<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";

    echo 
"<tr>\n";
    echo 
"<td>Parametro di ricerca 1</td>\n";
    echo 
"<td>&nbsp</td>\n";
    echo 
"<td>Paramentro di ricerca 2</td>\n";
    echo 
"<td>&nbsp</td>\n";
    echo 
"<td>Parametro di ricerca 3</td>\n";
    echo 
"</tr>\n";

    echo 
"<tr>\n";
    echo 
"<td><input type=\"text\" name=\"art1\" value=\"" $art1 
            
"\" size=\"5\"></td>\n";
    echo 
"<td>/</td>\n";
    echo 
"<td><input type=\"text\" name=\"art2\" value=\"" $art2 
            
"\" size=\"5\"></td>\n";
    echo 
"<td>x</td>\n";
    echo 
"<td><input type=\"text\" name=\"art3\" value=\"" $art3 
            
"\" size=\"5\"></td>\n";
    echo 
"</tr>\n";

    if (! empty (
$errormelding))
            echo 
"<tr><td colspan=\"5\"><font color=\"red\">" 
                
$errormelding "</td></tr>\n";

    echo 
"<tr>\n";
    echo 
"<td colspan=\"3\">\n";
    echo 
"<input type=\"submit\" value=\"Cerca\">\n";
    echo 
"</td>\n";
    echo 
"</tr>\n";

    echo 
"</table>\n";
    echo 
"</form>\n";

}

#------------------------------------------------------------

function toon_banden ()
{
    global 
$urlphp;
    global 
$urlcgi;

    
java_scr_preview ();

    
$art1 trim($_POST["art1"]);
    
$art2 trim($_POST["art2"]);
    
$art3 trim($_POST["art3"]);

    if (empty (
$art1)  || empty ($art3)) {
        
ingave_artikel ($art1$art2$art3
                    
"Prego inserischi tutti i dati");
        return (-
1);
    }

        
$f open_url ($urlcgi "?3," 
            
$art1 $art2 "R" $art3);
    
$t 0;
    
$ncol 4;

    while ((
$s readnext ($f)) != "") {
               list (
$codice,
                      
$articolo,
                      
$marca,
                      
$rubrica,
                      
$descrizione,
                      
$valuta,
                      
$netto,
                      
$bruto,
                      
$disponibilita,
                      
$foto,
                      
$draagvrm,
                      
$levid,
                      
$garpr,
                      
$altpr,
                      
$eancode) = split ("\t"$s);

        if (
$t == 0) {
            echo 
"<h1>Panoramica prodotti disponibili a magazzino</h1>\n";
            echo 
"<table border=\"0\" cellspacing=\"2\" cellpadding=\"5\">\n";
            echo 
"<tr>\n";
            echo 
"<td>Codice</td>\n";
            echo 
"<td>Marca</td>\n";
            echo 
"<td>Descrizione</td>\n";
            echo 
"<td>Eancode</td>\n";
            echo 
"<td>LI/SI</td>\n";
            echo 
"<td align=\"right\">Prezzo lordo</td>\n";
            echo 
"<td align=\"right\">Prezzo Netto " $valuta "</td>\n";
            echo 
"<td align=\"right\">Disponibilità</td>\n";
            echo 
"<td></td>\n";
            echo 
"</tr>\n";
        }

        
### klantprijs opslag 25 %

        
$klantpr $netto 1.25;
        
$klantpr_str sprintf ("%7.2f"$klantpr);

        echo 
"<tr>\n";
        echo 
"<td>" $codice "</td>\n";
        echo 
"<td>" $marca "</td>\n";
        echo 
"<td>" $descrizione "</td>\n";
        echo 
"<td>" $eancode "</td>\n";
        echo 
"<td>" $draagvrm "</td>\n";
        echo 
"<td align=\"right\">" $bruto "</td>\n";
        echo 
"<td align=\"right\">" $klantpr_str "</td>\n";
        echo 
"<td align=\"right\">" $beschikbaar "</td>\n";
        if (empty (
$foto))
            echo 
"<td></td>\n";
        else {
            echo 
"<td>";
            echo 
'<a href="javascript:Preview';
            echo 
"('?cmd=preview&foto=$foto')";
            echo 
'">';
            echo 
"foto";
            echo 
'[/url]';
            echo 
"</td>\n";
        }
        echo 
"</tr>\n";
        
$t++;

    }

    if (
$t == 0)
        
ingave_artikel ($art1$art2$art3
                    
"Nessun articolo trovato!");
    else {
        echo 
'</table>';
        
ingave_artikel ("""""""");
    }

}

#------------------------------------------------------------

function toon_preview ($fotonr)
{
        global 
$imglarge;

        
html_open_std ();
    echo 
'<center>';
    echo 
'[br /]';
    echo 
'<img border="0" src="' $imglarge '/' $fotonr '">';
        
html_close ();
}

#------------------------------------------------------------

function toon_selektie ($marca$modello$type$diameter)
{
    echo 
'<table border="0" cellspacing="0" cellpadding="0">';
    echo 
'<tr><td width="70">Marca</td><td>' $marca '</td></tr>';
    echo 
'<tr><td>Modello</td><td>' $modello '</td></tr>';
    echo 
'<tr><td>Type</td><td>' $type '</td></tr>';
    echo 
'<tr><td>Diametro</td><td>' $diameter '</td></tr>';
    echo 
'</table>';
    echo 
'';
}

#------------------------------------------------------------

function open_url ($url)
{
    
$file = @fopen ($url"r");

    
#echo '$HTTP_Response_Header = ' . $http_response_header[0] . '[br /]';
    #echo '$HTTP_Response_Header = ' . $http_response_header[1] . '[br /]';
    #echo '$HTTP_Response_Header = ' . $http_response_header[2] . '[br /]';
    #echo '$HTTP_Response_Header = ' . $http_response_header[3] . '[br /]';
    #echo '$HTTP_Response_Header = ' . $http_response_header[4] . '[br /]';

    
if (! $file) {
            die (
"--> URL NOTFOUND <-- " $file ); 
    }
    return (
$file);
}

#------------------------------------------------------------

function readnext ($file)
{
    
        
$s fgets ($file10000);

    if (
$s == "" || substr ($s05) == "*END*")
        return (
"");
    else 
        if (
substr ($s07) == "*ERROR*")
            die (
"invalid argument(s)");
        else
            return (
$s);
}

#------------------------------------------------------------

function html_open_std ()
{
    echo 
'<html>';
    echo 
'<head>';
    echo 
'<title>Prodotti a magazzino</title>';
    echo 
'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
    echo 
'<meta name="robots" content="noinclude, nofollow">';
    echo 
'<link rel="stylesheet" href="tyre.css" type="text/css">';
    echo 
'</head>';
    echo 
'<body>';
}

#------------------------------------------------------------

function html_close ()
{
    echo 
"</body>";
    echo 
"</html>";
}

#------------------------------------------------------------

function java_scr_preview ()
{
    echo 
'<SCRIPT LANGUAGE="JavaScript">';
    echo 
'function Preview(url)';
    echo 
'{';
    echo 
"window.open(url,'_blank','location=no,scrollbars=yes,toolbar=no,width=500,height=700')";
    echo 
'}';
    echo 
'</SCRIPT>';
}

?>



Questo script mi va a cercare e prendere dal sito del mio fornitore la lista dei prodotti disponibili e me li stampa a video.

Vorrei implementare questa lista ottenuta con un carrello. Ogni riga della lista dovrebbe avere una textfield dove inserire la quantità e un tasto "aggiungi al carrello".

Come posso fare?
« Ultima modifica: 27 Giu 2013, 11:38:05 da sandrix80 »

Offline sandrix80

  • Nuovo arrivato
  • *
  • Post: 7
    • Mostra profilo
Re:wrapper-php-gateway-carrello
« Risposta #1 il: 27 Giu 2013, 11:41:25 »
Ah dimenticavo, questo script lo sto usando in Joomla tramite un wrapper e funziona benissimo.


 



Web Design Bolzano Kreatif