Visualizzazione dei risultati da 1 a 7 su 7

Visualizzazione discussione

  1. #7
    Utente di HTML.it
    Registrato dal
    Feb 2020
    Messaggi
    6
    Grazie ancora per la risposta, si la cosa e' un po complessa e credo che a questo punto optero' sul discorso paypal.
    Il problema che ho con paypal e' che non vengono inoltrati i dati inseriti nel modulo del sito ma vengono inoltrati soltanto prodotto, quantita', spedizione e totale. Ho letto su una guida che bisogna inserire le variabili nel form paypal ma ho inserito il possibile per testare ma non funziona.
    Spero possiate aiutarmi.


    Posto il codice del form paypal ed il codice jquery:

    codice:
    <form id="paypal-form" action="" method="post">
    <input type="hidden" name="cmd" value="_ext-enter" />
    <input type="hidden" name="redirect_cmd" value="_cart">
    <input type="hidden" name="business" value="business@example.it" />
    <input type="hidden" name="upload" value="1" />
    <input type="hidden" name="email" value="1" />
    <input type="hidden" name="first_name" value="1" />
    <input type="hidden" name="last_name" value="1" />
    <input type="hidden" name="address1" value="1" />
    <input type="hidden" name="address2" value="1" />
    <input type="hidden" name="city" value="1" />
    <input type="hidden" name="state" value="1" />
    <input type="hidden" name="zip" value="1" />
    <input type="hidden" name="day_phone_a" value="1" />
    <input type="hidden" name="quantity" value="1" />
    <input type="hidden" name="item_number" value="1" />
    <input type="hidden" name="notify_url" value="http://www.miosito.it/shop.html" />
    <input type="hidden" name="cancel_return" value="http://www.miosito.it/shop.html" />
    <input type="hidden" name="image_url" value="1" />
    <input type="hidden" name="cs" value="1" />
    <input type="hidden" name="custom" value="1" />
    <input type="hidden" name="currency_code" value="EUR" />
    <input type="hidden" name="Ic" value="IT">
    <input type="hidden" name="item_name" value="mio sito" />
    <input type="hidden" name="amount" value="2" />
    <input type="hidden" name="shipping" value="2">
    <input type="hidden" name="return" value="http://www.miosito.it/shop.html">
    <input type="hidden" name="rm" value="1">
    <input type="submit" id="paypal-btn" class="btn" value="Paga con PayPal" />
    </form>

    codice:
            // Aggiunge i valori nascosti richiesti al modulo di PayPal prima di inviare
            
            populatePayPalForm: function() {
                var self = this;
                if( self.$paypalForm.length ) {
                    var $form = self.$paypalForm;
                    var cart = self._toJSONObject( self.storage.getItem( self.cartName ) );
                    var shipping = self.storage.getItem( self.shippingRates );
                    var numShipping = self._convertString( shipping );
                    var cartItems = cart.items; 
                    var singShipping = Math.floor( numShipping / cartItems.length );
                    
                    $form.attr( "action", self.paypalURL );
                    $form.find( "input[name='business']" ).val( self.paypalBusinessEmail );
                    $form.find( "input[name='currency_code']" ).val( self.paypalCurrency );
                    
                    for( var i = 0; i < cartItems.length; ++i ) {
                        var cartItem = cartItems[i];
                        var n = i + 1;
                        var name = cartItem.product;
                        var price = cartItem.price;
                        var qty = cartItem.qty;
                        
                        $( "<div/>" ).html( "<input type='hidden' name='quantity_" + n + "' value='" + qty + "'/>" ).
                        insertBefore( "#paypal-btn" );
                        $( "<div/>" ).html( "<input type='hidden' name='item_name_" + n + "' value='" + name + "'/>" ).
                        insertBefore( "#paypal-btn" );
                        $( "<div/>" ).html( "<input type='hidden' name='item_number_" + n + "' value='Art. " + name + "'/>" ).
                        insertBefore( "#paypal-btn" );
                        $( "<div/>" ).html( "<input type='hidden' name='amount_" + n + "' value='" + self._formatNumber( price, 2 ) + "'/>" ).
                        insertBefore( "#paypal-btn" );
                        $( "<div/>" ).html( "<input type='hidden' name='shipping_" + n + "' value='" + self._formatNumber( singShipping, 2 ) + "'/>" ).
                        insertBefore( "#paypal-btn" );
                        
                    }
                    
                    
                    
                }
            },



    Codice form dati utente

    codice:
        // Visualizza le informazioni dell'utente        
            
            displayUserDetails: function() {
                if( this.$userDetails.length ) {
                    if( this.storage.getItem( "shipping-name" ) == null ) {
                        var name = this.storage.getItem( "billing-name" );
                        var email = this.storage.getItem( "billing-email" );
                        var phone = this.storage.getItem( "billing-phone" );
                        var city = this.storage.getItem( "billing-city" );
                        var province = this.storage.getItem( "billing-province" );
                        var address = this.storage.getItem( "billing-address" );
                        var zip = this.storage.getItem( "billing-zip" );
                        var country = this.storage.getItem( "billing-country" );
                        
                        var html = "<div class='detail'>";
                            html += "<h2>Fatturazione e spedizione</h2>";
                            html += "<ul>";
                            html += "<li>" + name + "</li>";
                            html += "<li>" + email + "</li>";
                            html += "<li>" + phone + "</li>";
                            html += "<li>" + city + "</li>";
                            html += "<li>" + province + "</li>";
                            html += "<li>" + address + "</li>";
                            html += "<li>" + zip + "</li>";
                            html += "<li>" + country + "</li>";
                            html += "</ul></div>";
                            
                        this.$userDetails[0].innerHTML = html;
                    } else {
                        var name = this.storage.getItem( "billing-name" );
                        var email = this.storage.getItem( "billing-email" );
                        var phone = this.storage.getItem( "billing-phone" );
                        var city = this.storage.getItem( "billing-city" );
                        var province = this.storage.getItem( "billing-province" );
                        var address = this.storage.getItem( "billing-address" );
                        var zip = this.storage.getItem( "billing-zip" );
                        var country = this.storage.getItem( "billing-country" );
                        
                        var sName = this.storage.getItem( "shipping-name" );
                        var sCity = this.storage.getItem( "shipping-city" );
                        var sProvince = this.storage.getItem( "shipping-province" );
                        var sAddress = this.storage.getItem( "shipping-address" );
                        var sZip = this.storage.getItem( "shipping-zip" );
                        var sCountry = this.storage.getItem( "shipping-country" );
                        
                        var html = "<div class='detail'>";
                            html += "<h2>Fatturazione</h2>";
                            html += "<ul>";
                            html += "<li>" + name + "</li>";
                            html += "<li>" + email + "</li>";
                            html += "<li>" + phone + "</li>";
                            html += "<li>" + city + "</li>";
                            html += "<li>" + province + "</li>";
                            html += "<li>" + address + "</li>";
                            html += "<li>" + zip + "</li>";
                            html += "<li>" + country + "</li>";
                            html += "</ul></div>";
                            
                            html += "<div class='detail right'>";
                            html += "<h2>Spedizione</h2>";
                            html += "<ul>";
                            html += "<li>" + sName + "</li>";
                            html += "<li>" + sCity + "</li>";
                            html += "<li>" + sProvince + "</li>";
                            html += "<li>" + sAddress + "</li>";
                            html += "<li>" + sZip + "</li>";
                            html += "<li>" + sCountry + "</li>";
                            html += "</ul></div>";
                            
                        this.$userDetails[0].innerHTML = html;    
                    
                    }
                }
            },
    Ultima modifica di m-power; 03-02-2020 a 14:47

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.