Hinzufügen von Versandkosten

Bislang wurde der PayPal Bestellung keine Versandkosten hinzugefügt. Diese Erweiterung des front.order_process.inc.php ändert das.


Suche in front.order_process.inc.php:

                $total_amount += ($cart[$key]['shopprod_price'] * $cart[$key]['shopprod_quantity'] ); // my total price
            }
 
            $p->add_field('num_cart_items', ($i-1));
            $p->add_field('payment_gross',     $total_amount);


Ersetze die Funktion mit:

                $total_amount += ($cart[$key]['shopprod_price'] * $cart[$key]['shopprod_quantity'] ); // my total price
                $subtotal['weight'] += $cart[$key]['shopprod_quantity'] * $cart[$key]['shopprod_weight']; // + q23.rst 290212 my total weight
            }
 
            // + q23.rst 29022012 calculate shipping
            foreach( _getConfig( 'shop_pref_shipping', '_shopPref' ) as $item_key => $row ) {
                // do nothing as long shipping fee = 0
                if( $row['net'] == 0 ) {
                    continue;
                }
 
                $row['calculate'] = false;
                // lower weight and current shipping fee lower then this
                if( $subtotal['weight'] <= $row['weight'] ) {
                    $row['calculate'] = true;
                }
                if( $row['calculate'] ) {
                    $subtotal['shipping_net']    = $row['net'];
                    $subtotal['shipping_gross']    = $subtotal['shipping_net'] * ( 1 + ($row['vat'] / 100) );
                    $subtotal['shipping_vat']    = $subtotal['shipping_gross'] - $subtotal['shipping_net'];
 
                    break;
                }
            }
 
            // + q23.rst 29022012 now add shipping cost to ipn
            $p->add_field('item_number_'         . $i, 'Versand');
            $p->add_field('item_name_'           . $i, 'DHL Paket');
            $p->add_field('quantity_'            . $i, '1');
            $p->add_field('amount_'              . $i, $subtotal['shipping_net']);
 
            $p->add_field('num_cart_items', ($i)); // + q23.rst 290212 remove -1 because of shipping
            //$p->add_field('payment_gross',     $total_amount);
deutsch/module/shop/paypal-versandkosten.txt · Last modified: 2018/06/03 18:09 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0