Managed Server
Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: UVP und IHR PREIS völlig falsch wiedergegeben

    Da Sandro

    • Fördermitglied
    • Beiträge: 832
    • Geschlecht:
    UVP und IHR PREIS völlig falsch wiedergegeben
    am: 11. Dezember 2011, 20:27:20
    Hi zusammen,

    bei mir spielt sich etwas komisches ab: der UVP und "IHR PREIS" werden total wirr ausgegeben.

    Siehe hier:

    [ Für Gäste sind keine Dateianhänge sichtbar ]

    Die €1099,- wären korrekt, müssten aber zu DEIN PREIS hinzu.
    Die €978,99 hingegen sind zum einen falsch weil sie zu UVP müssten, zum anderen ist das auch noch NETTO, was eigentlich brutto ausgegeben werden müsste, also €1165,-.
    Und genau so ists auch im Backend beim Artikel eingegeben!

    Nächstes:

    [ Für Gäste sind keine Dateianhänge sichtbar ]

    [ Für Gäste sind keine Dateianhänge sichtbar ]

    Bei Produkten mit Attributen wird sowohl in der "product_listing" als auch im Produkt selber nochmal +19% gerechnet... keine Ahnung warum, die Preise sind ganz normal brutto eingegeben.

    Wo kann ich denn sowas ändern?!

    Linkback: https://www.modified-shop.org/forum/index.php?topic=17296.0
    rechtstexte für onlineshop

    Tomcraft

    • modified Team
    • Gravatar
    • Beiträge: 46.369
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #1 am: 12. Dezember 2011, 02:24:44
    [...]
    Wo kann ich denn sowas ändern?!

    Die Frage beantworte ich mal mit einer Gegenfrage:

    Was hast du denn angestellt, damit es so angezeigt wird? :-?

    Grüße

    Torsten

    Da Sandro

    • Fördermitglied
    • Beiträge: 832
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #2 am: 12. Dezember 2011, 08:40:12
    Ja ich nix, das isses ja. Jemand hat mir da halt was gemacht, aber der hat so selten Zeit. Und ich will da jetzt nicht ewig warten müssen bis das wieder klappt. :(

    Das kommt doch aus der "xtcPrice.php" oder?

    Das wäre sie:

    Code: PHP  [Auswählen]
    <?php
    /* -----------------------------------------------------------------------------------------
       $Id: xtcPrice.php 1402 2010-10-03 16:48:20Z dokuman $

       modified eCommerce Shopsoftware - community made shopping
       http://www.modified eCommerce Shopsoftware.org

       Copyright (c) 2010 modified eCommerce Shopsoftware
       -----------------------------------------------------------------------------------------
       based on:
       (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
       (c) 2002-2003 osCommerce(currencies.php,v 1.15 2003/03/17); www.oscommerce.com
       (c) 2003 nextcommerce (currencies.php,v 1.9 2003/08/17); www.nextcommerce.org
       (c) 2006 XT-Commerce (xtcPrice.php 1316 2005-10-21)

       Released under the GNU General Public License
       ---------------------------------------------------------------------------------------
       Modified by Gunnar Tillmann (August 2006)
       http://www.gunnart.de

       Everywhere a price is displayed you see any existing kind of discount in percent and
       in saved money in your chosen currency

       Changes in following lines:

       347-352 / 365-366 / 384-389
       ---------------------------------------------------------------------------------------*/


    /**
     * This class calculates and formates all prices within the shop frontend
     *
     */

    class xtcPrice {
            var $currencies;
            private $_priceStore = array();

        /**
         * Constructor initialises all required values like currencies, tax classes, tax zones etc.
         *
         * @param String $currency
         * @param Integer $cGroup
         * @return xtcPrice
         */

            function xtcPrice($currency, $cGroup) {

                    $this->currencies = array ();
                    $this->cStatus = array ();
                    $this->actualGroup = $cGroup;
                    $this->actualCurr = $currency;
                    $this->TAX = array ();
                    $this->SHIPPING = array();
                    $this->showFrom_Attributes = true;

                    // select Currencies
                    $currencies_query = "SELECT * FROM ".TABLE_CURRENCIES;
                    $currencies_query = xtDBquery($currencies_query);
                    while ($currencies = xtc_db_fetch_array($currencies_query, true)) {
                            $this->currencies[$currencies['code']] = array (
                            'title' => $currencies['title'],
                            'symbol_left' => $currencies['symbol_left'],
                            'symbol_right' => $currencies['symbol_right'],
                            'decimal_point' => $currencies['decimal_point'],
                            'thousands_point' => $currencies['thousands_point'],
                            'decimal_places' => $currencies['decimal_places'],
                            'value' => $currencies['value']
                            );
                    }
                    // select Customers Status data
                    $customers_status_query = "SELECT *
                                                            FROM "
    .TABLE_CUSTOMERS_STATUS."
                                                            WHERE customers_status_id = '"
    .$this->actualGroup."'
                                                            AND language_id = '"
    .$_SESSION['languages_id']."'";
                    $customers_status_query = xtDBquery($customers_status_query);
                    $customers_status_value = xtc_db_fetch_array($customers_status_query, true);
                    $this->cStatus = array (
                    'customers_status_id' => $this->actualGroup,
                    'customers_status_name' => $customers_status_value['customers_status_name'],
                    'customers_status_image' => $customers_status_value['customers_status_image'],
                    'customers_status_public' => $customers_status_value['customers_status_public'],
                    'customers_status_discount' => $customers_status_value['customers_status_discount'],
                    'customers_status_ot_discount_flag' => $customers_status_value['customers_status_ot_discount_flag'],
                    'customers_status_ot_discount' => $customers_status_value['customers_status_ot_discount'],
                    'customers_status_graduated_prices' => $customers_status_value['customers_status_graduated_prices'],
                    'customers_status_show_price' => $customers_status_value['customers_status_show_price'],
                    'customers_status_show_price_tax' => $customers_status_value['customers_status_show_price_tax'],
                    'customers_status_add_tax_ot' => $customers_status_value['customers_status_add_tax_ot'],
                    'customers_status_payment_unallowed' => $customers_status_value['customers_status_payment_unallowed'],
                    'customers_status_shipping_unallowed' => $customers_status_value['customers_status_shipping_unallowed'],
                    'customers_status_discount_attributes' => $customers_status_value['customers_status_discount_attributes'],
                    'customers_fsk18' => $customers_status_value['customers_fsk18'],
                    'customers_fsk18_display' => $customers_status_value['customers_fsk18_display']
                    );

                    // prefetch tax rates for standard zone
                    $zones_query = xtDBquery("SELECT tax_class_id as class FROM ".TABLE_TAX_CLASS);
                    while ($zones_data = xtc_db_fetch_array($zones_query,true)) {

                            // calculate tax based on shipping or deliverey country (for downloads)
                            if (isset($_SESSION['billto']) && isset($_SESSION['sendto'])) {
                            $tax_address_query = xtc_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . $_SESSION['customer_id'] . "' and ab.address_book_id = '" . ($this->content_type == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'"); //DokuMan - leave content_type as it is
                    $tax_address = xtc_db_fetch_array($tax_address_query);
                            $this->TAX[$zones_data['class']]=xtc_get_tax_rate($zones_data['class'],$tax_address['entry_country_id'], $tax_address['entry_zone_id']);
                            } else {
                            $this->TAX[$zones_data['class']]=xtc_get_tax_rate($zones_data['class']);
                            }
                    }
            }

        /**
         * This function searchs the inividual price for a product using the product id $pID
         *
         * @param Integer $pID product id
         * @param Boolean $format Format the result?
         * @param Double $qty quantity
         * @param Integer $tax_class tax class id
         * @param Double $pPrice product price
         * @param Integer $vpeStatus vpe status
         * @param Integer $cedit_id customer specify tax conditions
         * @return String/Array Price (if format = true both plain and formatted)
         */

            function xtcGetPrice($pID, $format = true, $qty, $tax_class, $pPrice, $vpeStatus = 0, $cedit_id = 0, $cheapest = false, $withTax = false) {

                            // check if group is allowed to see prices
            if ($this->cStatus['customers_status_show_price'] == '0')
                            return $this->xtcShowNote($vpeStatus, $vpeStatus);

                    // get Tax rate
                    if ($cedit_id != 0) {
                            $cinfo = xtc_oe_customer_infos($cedit_id);
                            $products_tax = xtc_get_tax_rate($tax_class, $cinfo['country_id'], $cinfo['zone_id']);
                    } else {
                            //BOF - DokuMan - 2010-08-23 - set undefined index
                            //$products_tax = $this->TAX[$tax_class];
                            $products_tax = isset($this->TAX[$tax_class]) ? $this->TAX[$tax_class] : 0;
                            //EOF - DokuMan - 2010-08-23 - set undefined index
                    }

                    if ($this->cStatus['customers_status_show_price_tax'] == '0')
                            $products_tax = '';
                           
                    $groupPrice = 0;
                    //if ($_SERVER['REMOTE_ADDR'] == '84.166.196.139' || $_SESSION['customers_status']['customers_status_id'] == '0') {
                            include_once("includes/classes/xtcPrice_new.php");
                            if (($groupPrice = XTC_Price_Module::getCheapestAttributePrice($pID)) !== false && $cheapest == 1) {
                            if ($_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
                        $groupPrice = ($groupPrice / 119) * 100;
                    }
               
                                    $pPrice = $groupPrice;
                            }
                    //}
                    // add taxes
                   
                   
                    if ($pPrice == 0) {
            $pPrice = $this->xtcGetGraduatedPrice($pID, 1);
            }
           
                    if ($pPrice == 0) {
                            $pPrice = $this->getPprice($pID);
                    }
                   
                    if ($groupPrice == 0 || $cheapest === false || $withTax == false) {
                      $pPrice = $this->xtcAddTax($pPrice, $products_tax);
                    }
                   
        // BOF - Tomcraft - 2009-11-28 - Included xs:booster
                    // xs:booster Auktionspreis pruefen
                    if ($sPrice = $this->xtcCheckXTBAuction($pID)) {
                            return $this->xtcFormatSpecial($pID, $sPrice, $pPrice, $format, $vpeStatus);
                            }
        // EOF - Tomcraft - 2009-11-28 - Included xs:booster

                    // check specialprice
                    if ($sPrice = $this->xtcCheckSpecial($pID)) {
                            return $this->xtcFormatSpecial($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus);
                            }

                    // check graduated
                    if ($this->cStatus['customers_status_graduated_prices'] == '1') {
                            if ($sPrice = $this->xtcGetGraduatedPrice($pID, $qty)) {
                                    return $this->xtcFormatSpecialGraduated($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $pID);
                                    }
                    } else {
                            // check Group Price
                            if ($sPrice = $this->xtcGetGroupPrice($pID, 1)) {
                                    return $this->xtcFormatSpecialGraduated($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $pID);
                                    }
                    }

                    // check Product Discount
                    if ($discount = $this->xtcCheckDiscount($pID))
                            return $this->xtcFormatSpecialDiscount($pID, $discount, $pPrice, $format, $vpeStatus);
                           

                    return $this->xtcFormat($pPrice, $format, 0, false, $vpeStatus, $pID);

            }

        /**
         * This function returns the reqular price of a product,
         * no mather if its a special offer or has graduated prices
         *
         * @param Integer $pID product id
         * @return Double price
         */

            function getPprice($pID) {
               if (isset($this->_priceStore[$pID])) {
            return $this->_priceStore[$pID];
            }
           
                    $pQuery = "SELECT products_price FROM ".TABLE_PRODUCTS." WHERE products_id='".$pID."'";
                    $pQuery = xtDBquery($pQuery);
                    $pData = xtc_db_fetch_array($pQuery, true);
                    $this->_priceStore[$pID] = $pData['products_price'];
                    return $pData['products_price'];

            }

        /**
         * Adding a tax percentage to a price
         * This function also converts the price with currency factor,
         * so take care to avoid double conversions!
         *
         * @param Double $price net price
         * @param Double $tax tax value(%)
         * @return Double gross price
         */

            function xtcAddTax($price, $tax) {
                    $price += $price / 100 * $tax;
                    $price = $this->xtcCalculateCurr($price);
                    return round($price, $this->currencies[$this->actualCurr]['decimal_places']);
            }

      // BOF - Tomcraft - 2009-11-28 - Included xs:booster
            // xs:booster start (v1.041)
            function xtcCheckXTBAuction($pID)
            {
                    if(($pos=strpos($pID,"{"))) $pID=substr($pID,0,$pos);
        //BOF - DokuMan - 2010-08-23 - suppress error php-notice on undefined index xtb0
                    //if(!is_array($_SESSION['xtb0']['tx'])) return false;
                    if(@!is_array($_SESSION['xtb0']['tx'])) return false;
        //EOF - DokuMan - 2010-08-23 - suppress error php-notice on undefined index xtb0
                    foreach($_SESSION['xtb0']['tx'] as $tx) {
                            if($tx['products_id']==$pID&&$tx['XTB_QUANTITYPURCHASED']!=0) {
                                    $this->actualCurr=$tx['XTB_AMOUNTPAID_CURRENCY'];
                                    return round($tx['XTB_AMOUNTPAID'], $this->currencies[$this->actualCurr]['decimal_places']);
                            }
                    }
                    return false;
            }
            // xs:booster end
      // EOF - Tomcraft - 2009-11-28 - Included xs:booster

        /**
         * Returns the product sepcific discount
         *
         * @param Integer $pID product id
         * @return Mixed boolean false if not found or 0.00, double if found and > 0.00
         */

            function xtcCheckDiscount($pID) {

                    // check if group got discount
                    if ($this->cStatus['customers_status_discount'] != '0.00') {

                            $discount_query = "SELECT products_discount_allowed FROM ".TABLE_PRODUCTS." WHERE products_id = '".$pID."'";
                            $discount_query = xtDBquery($discount_query);
                            $dData = xtc_db_fetch_array($discount_query, true);

                            $discount = $dData['products_discount_allowed'];
                            if ($this->cStatus['customers_status_discount'] < $discount)
                                    $discount = $this->cStatus['customers_status_discount'];
                            if ($discount == '0.00')
                                    return false;
                            return $discount;

                    }
                    return false;
            }

        /**
         * Searches the graduated price of a product for a specified quantity
         *
         * @param Integer $pID product id
         * @param Double $qty quantity
         * @return Double graduated price
         */

            function xtcGetGraduatedPrice($pID, $qty) {
                    if (GRADUATED_ASSIGN == 'true')
                            if (xtc_get_qty($pID) > $qty)
                                    $qty = xtc_get_qty($pID);
                    //if (!is_int($this->cStatus['customers_status_id']) && $this->cStatus['customers_status_id']!=0) $this->cStatus['customers_status_id'] = DEFAULT_CUSTOMERS_STATUS_ID_GUEST;
                    $graduated_price_query = "SELECT max(quantity) as qty
                                                                    FROM "
    .TABLE_PERSONAL_OFFERS_BY.$this->actualGroup."
                                                                    WHERE products_id='"
    .$pID."'
                                                                    AND quantity<='"
    .$qty."'";
                    $graduated_price_query = xtDBquery($graduated_price_query);
                    $graduated_price_data = xtc_db_fetch_array($graduated_price_query, true);
                    if ($graduated_price_data['qty']) {
                            $graduated_price_query = "SELECT personal_offer
                                                                                    FROM "
    .TABLE_PERSONAL_OFFERS_BY.$this->actualGroup."
                                                                                    WHERE products_id='"
    .$pID."'
                                                                                    AND quantity='"
    .$graduated_price_data['qty']."'";
                            $graduated_price_query = xtDBquery($graduated_price_query);
                            $graduated_price_data = xtc_db_fetch_array($graduated_price_query, true);

                            $sPrice = $graduated_price_data['personal_offer'];
                            if ($sPrice != 0.00)
                                    return $sPrice;
                    } else {
                            return;
                    }

            }

        /**
         * Searches the group price of a product
         *
         * @param Integer $pID product id
         * @param Double $qty quantity
         * @return Double group price
         */

            function xtcGetGroupPrice($pID, $qty) {

                    $graduated_price_query = "SELECT max(quantity) as qty
                                                                    FROM "
    .TABLE_PERSONAL_OFFERS_BY.$this->actualGroup."
                                                                    WHERE products_id='"
    .$pID."'
                                                                    AND quantity<='"
    .$qty."'";
                    $graduated_price_query = xtDBquery($graduated_price_query);
                    $graduated_price_data = xtc_db_fetch_array($graduated_price_query, true);
                    if ($graduated_price_data['qty']) {
                            $graduated_price_query = "SELECT personal_offer
                                                                                    FROM "
    .TABLE_PERSONAL_OFFERS_BY.$this->actualGroup."
                                                                                    WHERE products_id='"
    .$pID."'
                                                                                    AND quantity='"
    .$graduated_price_data['qty']."'";
                            $graduated_price_query = xtDBquery($graduated_price_query);
                            $graduated_price_data = xtc_db_fetch_array($graduated_price_query, true);

                            $sPrice = $graduated_price_data['personal_offer'];
                           
                            if ($sPrice != 0.00)
                                    return $sPrice;
                    } else {
                            return;
                    }

            }
        /**
         * Returns the option price of a selected option
         *
         * @param Integer $pID product id
         * @param Integer $option option id
         * @param Integer $value value id
         * @return Double option price
         */

            function xtcGetOptionPrice($pID, $option, $value) {
            $price = 0; //DokuMan - set variable $price
                    //if ($_SERVER['REMOTE_ADDR'] == '84.166.196.139' || (isset($_SESSION['customers_status']['customers_status_id']) && $_SESSION['customers_status']['customers_status_id'] == '0')) {
                            include_once("includes/classes/xtcPrice_new.php");
                            $attribute_price_data = XTC_Price_Module::getAttribute($pID, $option, $value);
                           
                            $pPrice = $this->getPprice($pID);
                           
                            if (($groupPrice = $this->xtcGetGroupPrice($pID, 1)) != null) {
                                    $pPrice = $groupPrice;
                            }
                           
                         if ($pPrice != 0 && $attribute_price_data['options_values_price'] != '') {
                            include_once("includes/classes/xtcPrice_new.php");
                                    //XTC_Price_Module::killProductPrice($pID);
                                    $pPrice = 0;
                         }
                           
                         $attribute_price_data['options_values_price'] = $attribute_price_data['options_values_price'] / 119 * 100;
                           
                            if ($pPrice != 0 && $attribute_price_data['options_values_price'] != null) {
                                    $attribute_price_data['options_values_price'] =  $attribute_price_data['options_values_price'] - $pPrice;
                            }
                    //} else {
                            /*
                    $attribute_price_query = "select pd.products_discount_allowed,pd.products_tax_class_id, p.options_values_price, p.price_prefix, p.options_values_weight, p.weight_prefix, p.products_attributes_id from ".TABLE_PRODUCTS_ATTRIBUTES." p, ".TABLE_PRODUCTS." pd where p.products_id = '".$pID."' and p.options_id = '".$option."' and pd.products_id = p.products_id and p.options_values_id = '".$value."'";
                    $attribute_price_query = xtDBquery($attribute_price_query);
                    $attribute_price_data = xtc_db_fetch_array($attribute_price_query, true);
                    // MOD attribute-group-prices by Web4Business GmbH - Designs - Modules
                    //include_once("includes/w4b/attribute-group-prices/attribute-group-prices.php");
                    //W4B_attribute_group_prices_product_options($attribute_price_data); */

                    //}
                   
                    $dicount = 0;
                    if ($this->cStatus['customers_status_discount_attributes'] == 1 && $this->cStatus['customers_status_discount'] != 0.00) {
                            $discount = $this->cStatus['customers_status_discount'];
                            if ($attribute_price_data['products_discount_allowed'] < $this->cStatus['customers_status_discount'])
                                    $discount = $attribute_price_data['products_discount_allowed'];
                    }
                    //BOF - DokuMan - 2010-08-11 - several currencies on product attributes
                    //$price = $this->xtcFormat($attribute_price_data['options_values_price'], false, $attribute_price_data['products_tax_class_id']);
                   
                    $price = $this->xtcFormat($attribute_price_data['options_values_price'], false, $attribute_price_data['products_tax_class_id'], true);
                    //EOF - DokuMan - 2010-08-11 - several currencies on product attributes
                    if ($attribute_price_data['weight_prefix'] != '+')
                            $attribute_price_data['options_values_weight'] *= -1;
                    if ($attribute_price_data['price_prefix'] == '+') {
                            $price = $price - $price / 100 * $discount;
                    } else {
                            $price *= -1;
                    }
                   
                    return array ('weight' => $attribute_price_data['options_values_weight'], 'price' => $price);
            }

        /**
         * Returns the text info for customers, whose customer group isn't allowed to see prices
         *
         * @param Integer $vpeStatus
         * @param Boolean $format
         * @return String / Array of String
         */

            function xtcShowNote($vpeStatus, $vpeStatus = 0) {
                    if ($vpeStatus == 1)
                            return array ('formated' => NOT_ALLOWED_TO_SEE_PRICES, 'plain' => 0);
                    return NOT_ALLOWED_TO_SEE_PRICES;
            }

        /**
         * Returns the special offer price of a product
         *
         * @param Integer $pID product id
         * @return Double special offer
         */

            function xtcCheckSpecial($pID) {
                    $product_query = "select specials_new_products_price from ".TABLE_SPECIALS." where products_id = '".$pID."' and status=1";
                    $product_query = xtDBquery($product_query);
                    $product = xtc_db_fetch_array($product_query, true);

                    return $product['specials_new_products_price'];

            }

        /**
         * Converts the price  with the currency factor
         *
         * @param Double $price
         * @return Double converted price
         */

            function xtcCalculateCurr($price) {
                    return $this->currencies[$this->actualCurr]['value'] * $price;
            }

        /**
         * Returns the tax part of a net price
         *
         * @param Double $price price
         * @param Double $tax tax value
         * @return Double tax part
         */

            function calcTax($price, $tax) {
                    return $price * $tax / 100;
            }

        /**
         * Removes the currency factor of a price
         *
         * @param Double $price
         * @return Double
         */

            function xtcRemoveCurr($price) {

                    // check if used Curr != DEFAULT curr
                    if (DEFAULT_CURRENCY != $this->actualCurr) {
          //BOF- web28 - 2011-04-19 - FIX for division by zero
          if ($this->currencies[$this->actualCurr]['value'] > 0) {
                              return $price * (1 / $this->currencies[$this->actualCurr]['value']);
          }
          //EOF- web28 - 2011-04-19 - FIX for division by zero
                    } else {
                            return $price;
                    }
            }

        /**
         * Removes the tax from a price, e.g. to calculate a net price from gross price
         *
         * @param Double $price price
         * @param Double $tax tax value
         * @return Double net price
         */

            function xtcRemoveTax($price, $tax) {
                    $price = ($price / (($tax +100) / 100));
                    return $price;
            }

        /**
         * Returns the tax part of a gross price
         *
         * @param Double $price price
         * @param Double $tax tax value
         * @return Double tax part
         */

            function xtcGetTax($price, $tax) {
                    $tax = $price - $this->xtcRemoveTax($price, $tax);
                    return $tax;
            }

        /**
         * Removes the discount part of a price
         *
         * @param Double $price price
         * @param Double $dc discount
         * @return Double discount part
         */

            function xtcRemoveDC($price,$dc) {
                    $price = $price - ($price/100*$dc);
                    return $price;
            }

        /**
         * Returns the discount part of a price
         *
         * @param Double $price price
         * @param Double $dc discount
         * @return Double discount part
         */

            function xtcGetDC($price,$dc) {
                    $dc = $price/100*$dc;
                    return $dc;
            }

        /**
         * Check if the product has attributes which can modify the price
         * If so, it returns a prefix ' from '
         *
         * @param Integer $pID product id
         * @return String
         */

            function checkAttributes($pID) {
                    if (!$this->showFrom_Attributes) return;
                    if ($pID == 0)
                            return;
                    // BOF - Tomcraft - 2009-10-09 - Bugfix: Don't show "from" in front of price, when all priceoptions are "0".
                    //$products_attributes_query = "select count(*) as total from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".$pID."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."'";
                    $products_attributes_query = "SELECT count(*) as total from attribute_group_prices  AS agp
            JOIN products_attributes AS pa ON agp.products_attributes_id = pa.products_attributes_id
            WHERE products_id='"
    .$pID."'
                                                                                                                                            "
    ;
                    // EOF - Tomcraft - 2009-10-09 - Bugfix: Don't show "from" in front of price, when all priceoptions are "0".
                    $products_attributes = xtDBquery($products_attributes_query);
                    $products_attributes = xtc_db_fetch_array($products_attributes, true);
                   
                    if ($products_attributes['total'] > 0) {
                return ' '.strtolower(FROM).' ';
            }
            }

            function xtcCalculateCurrEx($price, $curr) {
                    return $price * ($this->currencies[$curr]['value'] / $this->currencies[$this->actualCurr]['value']);
            }

            /*
            *    Format Functions
            */


            function xtcFormat($price, $format, $tax_class = 0, $curr = false, $vpeStatus = 0, $pID = 0) {

                    if ($curr)
                            $price = $this->xtcCalculateCurr($price);

                    if ($tax_class != 0) {
                            $products_tax = $this->TAX[$tax_class];
                            if ($this->cStatus['customers_status_show_price_tax'] == '0')
                                    $products_tax = '';
                            $price = $this->xtcAddTax($price, $products_tax);
                    }

                    if ($format) {
        // BOF - Tomcraft - 2009-11-23 - Added flotval for PHP5.3 compatibility
                            //$Pprice = number_format($price, $this->currencies[$this->actualCurr]['decimal_places'], $this->currencies[$this->actualCurr]['decimal_point'], $this->currencies[$this->actualCurr]['thousands_point']);
                            $Pprice = number_format(floatval($price), $this->currencies[$this->actualCurr]['decimal_places'], $this->currencies[$this->actualCurr]['decimal_point'], $this->currencies[$this->actualCurr]['thousands_point']);
        // EOF - Tomcraft - 2009-11-23 - Added flotval for PHP5.3 compatibility
                            $Pprice = $this->checkAttributes($pID).$this->currencies[$this->actualCurr]['symbol_left'].' '. $Pprice.' '.$this->currencies[$this->actualCurr]['symbol_right'];
                            if ($vpeStatus == 0) {
                                    return $Pprice;
                            } else {
                                    return array ('formated' => $Pprice, 'plain' => $price);
                            }
                    } else {

                            return round($price, $this->currencies[$this->actualCurr]['decimal_places']);

                    }

            }

            function xtcFormatSpecialDiscount($pID, $discount, $pPrice, $format, $vpeStatus = 0) {
                    $sPrice = $pPrice - ($pPrice / 100) * $discount;
                    if ($format) {
        //BOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest!
                            //$price = '<span class="productOldPrice">'.INSTEAD.$this->xtcFormat($pPrice, $format).'</span><br />'.ONLY.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format).'<br />'.YOU_SAVE.$discount.'%';
          $price = '<span class="productOldPrice"><small>'.INSTEAD.'</small><del>'.$this->xtcFormat($pPrice, $format).'</del></span><br />'.ONLY.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format).'<br /><small>'.YOU_SAVE.round(($pPrice-$sPrice) / $pPrice * 100).' % /'.$this->xtcFormat($pPrice-$sPrice, $format);
                            // Ausgabe des g�ltigen Kundengruppen-Rabatts (sofern vorhanden)
                            if ($discount != 0)
                                            { $price .= '<br />'.BOX_LOGINBOX_DISCOUNT.': '.round($discount).' %'; }
                                    $price .= '</small>';
        //EOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest!
                            if ($vpeStatus == 0) {
                                    return $price;
                            } else {
                                    return array ('formated' => $price, 'plain' => $sPrice);
                            }
                    } else {
                            return round($sPrice, $this->currencies[$this->actualCurr]['decimal_places']);
                    }
            }

            function xtcFormatSpecial($pID, $sPrice, $pPrice, $format, $vpeStatus = 0) {
                    if ($format) {
        //BOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest!
                            //$price = '<span class="productOldPrice">'.INSTEAD.$this->xtcFormat($pPrice, $format).'</span><br />'.ONLY.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format);
                            //BOF - vr - 2009-12-11 avoid div / 0 if product price is 0
                            if (!isset($pPrice) || $pPrice == 0)
                              $discount = 0;
                            else
                              $discount = ($pPrice - $sPrice) / $pPrice * 100;
                            $price = '<span class="productOldPrice"><small>'.INSTEAD.'</small><del>'.$this->xtcFormat($pPrice, $format).'</del></span><br />'.ONLY.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format).'<br /><small>'.YOU_SAVE.round($discount).' % /'.$this->xtcFormat($pPrice-$sPrice, $format).'</small>';
                            //EOF - vr - 2009-12-11 avoid div / 0 if product price is 0
        //EOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest!
                            if ($vpeStatus == 0) {
                                    return $price;
                            } else {
                                    return array ('formated' => $price, 'plain' => $sPrice);
                            }
                    } else {
                            return round($sPrice, $this->currencies[$this->actualCurr]['decimal_places']);
                    }
            }

      function xtcFormatSpecialGraduated($pID, $sPrice, $pPrice, $format, $vpeStatus = 0, $pID) {
        //BOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest!
        // NEU HINZUGEF�GT "Steuerklasse ermitteln"
        $tQuery = "SELECT products_tax_class_id
          FROM "
    .TABLE_PRODUCTS." WHERE
          products_id='"
    .$pID."'";
        $tQuery = xtc_db_query($tQuery);
        $tQuery = xtc_db_fetch_array($tQuery);
        $tax_class = $tQuery['products_tax_class_id'];
        // ENDE "Steuerklasse ermitteln"
        //EOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest!
        if ($pPrice == 0)
          return $this->xtcFormat($sPrice, $format, 0, false, $vpeStatus);
        if ($discount = $this->xtcCheckDiscount($pID))
          $sPrice -= $sPrice / 100 * $discount;
         
         
         
        if ($this->actualGroup == '5') {
            $sQuery = "SELECT personal_offer
            FROM "
    .TABLE_PERSONAL_OFFERS_BY. '2' ."
            WHERE products_id='"
    .$pID."'";
            $sQuery = xtDBquery($sQuery);
            $sQuery = xtc_db_fetch_array($sQuery, true);
           
            if (isset($sQuery['personal_offer']) && $sQuery['personal_offer'] != null) {
                $sPrice = ($this->actualGroup == '3') ? ($sQuery['personal_offer'] / 119 * 100) :  $sQuery['personal_offer'];
            }
        } else {
        //$pPrice = $sPrice;
        }
         
         
        if ($format) {
        //BOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest!
          $sQuery = "SELECT max(quantity) as qty
            FROM "
    .TABLE_PERSONAL_OFFERS_BY.$this->actualGroup."
            WHERE products_id='"
    .$pID."'";
          $sQuery = xtDBquery($sQuery);
          $sQuery = xtc_db_fetch_array($sQuery, true);
          // NEU! Damit "UVP"-Anzeige wieder m�glich ist
          // if ( ($this->cStatus['customers_status_graduated_prices'] == '1') || ($sQuery['qty'] > 1) ) {
          if ( ($this->cStatus['customers_status_graduated_prices'] == '1') && ($sQuery['qty'] > 1) ) {
            $bestPrice = $this->xtcGetGraduatedPrice($pID, $sQuery['qty']);
            if ($discount)
              $bestPrice -= $bestPrice / 100 * $discount;
            $price .= FROM.$this->xtcFormat($bestPrice, $format, $tax_class)
              .' <br /><small>' . UNIT_PRICE
              .$this->xtcFormat($sPrice, $format)
              .'</small>';
          } else if ($sPrice != $pPrice) { // if ($sPrice != $pPrice) {
            $price = '<span class="productOldPrice">'.MSRP.' '.$this->xtcFormat($pPrice, $format).'</span><br />'.YOUR_PRICE.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format);
        //EOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest!
            } else {
           
            if (trim($this->checkAttributes($pID)) != '') {
                $price = $this->checkAttributes($pID)  . $this->xtcFormat($sPrice, $format);
            } else {
                $price = $this->xtcFormat($sPrice, $format);
            }
           
           
          }
          if ($vpeStatus == 0) {
            return $price;
          } else {
            return array ('formated' => $price, 'plain' => $sPrice);
          }
        } else {
          return round($sPrice, $this->currencies[$this->actualCurr]['decimal_places']);
        }
      }

            function get_decimal_places($code) {
                    return $this->currencies[$this->actualCurr]['decimal_places'];
            }

    }
    ?>

    franky_n

    • Experte
    • Beiträge: 4.950
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #3 am: 12. Dezember 2011, 08:44:16
    Hallo descreator,

    vergleiche die Datei doch per WinMerge mit der aus dem originalen Paket.
    Dann solltest Du ja sehen können was verändert wurde...

    Viele Grüße

    Franky

    Da Sandro

    • Fördermitglied
    • Beiträge: 832
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #4 am: 12. Dezember 2011, 08:56:04
    Hab ich grad mal gemacht. aber das ist ja sooooooooooooooo viel, das blick ich nicht...
    Man kotzt mich sowas an... :(

    Seht ihr denn da drin nicht auf die Schnell was schief laufen könnte?

    Derzeit ist es ja so:
    Als VIP-Kunde (müsste Kundengruppe ID 5 sein):
    UVP [VIP-PREIS BRUTTO]
    DEIN PREIS [VK NETTO] (das ist der Preis der Kundengruppe "Kunde"; sollte ID 2 sein)

    Und es sollte lediglich so sein:
    UVP [VK BRUTTO]
    DEIN PREIS [VIP BRUTTO]

    EDIT: Dieser Fehler tritt übrigens nur bei Produkten OHNE Attribut auf!!! Vielleicht ist es somit leichter den Fehler einzugrenzen.

    franky_n

    • Experte
    • Beiträge: 4.950
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #5 am: 12. Dezember 2011, 09:51:48
    Hallo Descreator,

    für uns sind es genauso viel Änderungen wie für Dich!
    Daher können wir das hier auch nicht auf die Schnelle.
    Das ist eher was für Job/Codinganfragen denn schon der erste Überblick zeigt mir das dort weitaus mehr geändert wurde.
    z.B. eine weitere Klasse eingebunden:

    Code: PHP  [Auswählen]
    include_once("includes/classes/xtcPrice_new.php");
    if (($groupPrice = XTC_Price_Module::getCheapestAttributePrice($pID)) !== false && $cheapest == 1) {
      if ($_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
        $groupPrice = ($groupPrice / 119) * 100;
      }
      $pPrice = $groupPrice;
    }

    und noch viele andere kleine Änderungen gemacht...

    Nö das dauert zu lange um sich da einzufiddeln...

    Viele Grüße

    Franky

    Tomcraft

    • modified Team
    • Gravatar
    • Beiträge: 46.369
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #6 am: 12. Dezember 2011, 13:05:46
    [...] Jemand hat mir da halt was gemacht, aber der hat so selten Zeit. [...]

    Vielleicht kannst du mal einen Namen nennen? :-?

    Wenn der da was fehlerhaftes eingebaut hat, dann lass dir das von ihm korrigieren, egal wie wenig Zeit der hat! :!:

    Grüße

    Torsten

    Da Sandro

    • Fördermitglied
    • Beiträge: 832
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #7 am: 12. Dezember 2011, 13:22:24
    Nö ich will hier ja keinen durch den Kakao ziehen zumal ich ja mit der sonstigen Ausführung seiner Arbeit seeeeeeeeeehr zufrieden bin. :)

    Kann ja jedem mal passieren. Nur wer NIX arbeitet macht auch NIX falsch. ;)
    Er hat's mittlerweile auskommentiert, so dass es derweil wieder läuft - wenn auch ohne UVP und sowas. Aber das eilt ja nicht.

    Tomcraft

    • modified Team
    • Gravatar
    • Beiträge: 46.369
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #8 am: 12. Dezember 2011, 13:57:12
    Kann ich verstehen, dann schreibe ich dir mal eine E-Mail. :-)

    Grüße

    Torsten

    Da Sandro

    • Fördermitglied
    • Beiträge: 832
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #9 am: 12. Dezember 2011, 16:03:10
    Nur um die Mitlesenden - darunter sicherlich auch derjenige, der mir da in meinem Shop hilft - aufzuklären:
    Tom und ich sprechen NICHT von der selben Person. Es ist also alles OK. ;)

    Da Sandro

    • Fördermitglied
    • Beiträge: 832
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #10 am: 13. Dezember 2011, 08:56:51
    Wurde gelöst. :-PP

    Tomcraft

    • modified Team
    • Gravatar
    • Beiträge: 46.369
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #11 am: 13. Dezember 2011, 10:49:20
    Wäre prima, wenn du auch noch schreiben würdest wie es gelöst wurde. ;-)

    Grüße

    Torsten

    Da Sandro

    • Fördermitglied
    • Beiträge: 832
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #12 am: 13. Dezember 2011, 11:00:04
    Das ist eine gute Frage - ich hab's ja nicht gemacht. :D

    Da es noch nicht für alle Kundengruppen läuft, poste ich die xtcPrice.php mal noch nicht und warte noch auf diese Lösung. Dann kommt alles hier rein. :)

    Tomcraft

    • modified Team
    • Gravatar
    • Beiträge: 46.369
    • Geschlecht:
    Re: UVP und IHR PREIS völlig falsch wiedergegeben
    Antwort #13 am: 13. Dezember 2011, 11:21:39
    Vielleicht kann sich ja dein Coder dann hier kurz zu Wort melden. ;-)

    Grüße

    Torsten
    Marktplatz - Eine große Auswahl an neuen und hilfreichen Modulen sowie modernen Templates für die modified eCommerce Shopsoftware
    9 Antworten
    5469 Aufrufe
    02. September 2009, 14:48:54 von Tomcraft
    3 Antworten
    1096 Aufrufe
    05. September 2020, 15:30:08 von CHESSBASE
    18 Antworten
    1674 Aufrufe
    04. November 2022, 09:00:35 von Michael.TB