{if $priceDisplay >= 0 && $priceDisplay <= 2} {if $cookie->isLogged(true)} <p class="srp">SRP: <span id="old_price_display" class="srp">{convertPrice price=$product->getFullPrice(true, $smarty.const.NULL,2)}</span></p> <p class="vip">VIP Price: <span id="our_price_display" class="vip">{convertPrice price=$product->getPrice(true, $smarty.const.NULL,2)}</span></p> {else} <p class="srp">SRP:<span id="our_price_display" class="srp">{convertPrice price=$product->getPrice(true, $smarty.const.NULL,2)}</span></p> {/if} {/if}
a w product.php
ControllerFactory::getController('ProductController')->run(); class Product extends ProductCore { /** * Price calculation / Get product price * * @param integer $id_shop Shop id * @param integer $id_product Product id * @param integer $id_product_attribute Product attribute id * @param integer $id_country Country id * @param integer $id_state State id * @param integer $id_currency Currency id * @param integer $id_group Group id * @param integer $quantity Quantity Required for Specific prices : quantity discount application * @param boolean $use_tax with (1) or without (0) tax * @param integer $decimals Number of decimals returned * @param boolean $only_reduc Returns only the reduction amount * @param boolean $use_reduc Set if the returned amount will include reduction * @param boolean $with_ecotax insert ecotax in price output. * @param variable_reference $specific_price_output If a specific price applies regarding the previous parameters, this variable is filled with the corresponding SpecificPrice object * @return float Product price **/ public static function priceFullCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_groupReduction) { // Caching if ($id_product_attribute === NULL) $product_attribute_label = 'NULL'; else $product_attribute_label = ($id_product_attribute === false ? 'false' : $id_product_attribute); $cacheId = $id_product.'-'.$id_shop.'-'.$id_currency.'-'.$id_country.'-'.$id_state.'-'.$id_county.'-'.$id_group.'-'.$quantity.'-'.$product_attribute_label.'-'.($use_tax?'1':'0').'-'.$decimals.'-'.($only_reduc?'1':'0').'-'.($use_reduc?'1':'0').'-'.$with_ecotax; // reference parameter is filled before any returns $specific_price = SpecificPrice::getSpecificPrice((int)($id_product), $id_shop, $id_currency, $id_country, $id_group, $quantity); return self::$_prices[$cacheId]; // fetch price & attribute price $cacheId2 = $id_product.'-'.$id_product_attribute; self::$_pricesLevel2[$cacheId2] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' SELECT p.`price`, '.($id_product_attribute ? 'pa.`price`' : 'IFNULL((SELECT pa.price FROM `'._DB_PREFIX_.'product_attribute` pa WHERE id_product = '.(int)$id_product.' AND default_on = 1), 0)').' AS attribute_price, p.`ecotax` '.($id_product_attribute ? ', pa.`ecotax` AS attribute_ecotax' : '').' FROM `'._DB_PREFIX_.'product` p '.($id_product_attribute ? 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON pa.`id_product_attribute` = '.(int)($id_product_attribute) : '').' WHERE p.`id_product` = '.(int)$id_product); $result = self::$_pricesLevel2[$cacheId2]; if (!$specific_price || $specific_price['price'] == 0) $price = (float)$result['price']; else $price = (float)$specific_price['price']; // convert only if the specific price is in the default currency (id_currency = 0) if (!$specific_price OR !($specific_price['price'] > 0 AND $specific_price['id_currency'])) $price = Tools::convertPrice($price, $id_currency); // Attribute price $attribute_price = Tools::convertPrice(array_key_exists('attribute_price', $result) ? (float)($result['attribute_price']) : 0, $id_currency); if ($id_product_attribute !== false) // If you want the default combination, please use NULL value instead $price += $attribute_price; // TaxRate calculation $tax_rate = Tax::getProductTaxRateViaRules((int)$id_product, (int)$id_country, (int)$id_state, (int)$id_county); if ($tax_rate === false) $tax_rate = 0; // Add Tax if ($use_tax) $price = $price * (1 + ($tax_rate / 100)); $price = Tools::ps_round($price, $decimals); return $price; } ////////////// public static function getFullPriceStatic($id_product, $usetax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = false, $id_customer = NULL, $id_cart = NULL, $id_address = NULL, &$specificPriceOutput = NULL, $with_ecotax = true, $use_groupReduction = true) { $cur_cart = $cart; Tools::displayParameterAsDeprecated('divisor'); if (!Validate::isBool($usetax) OR !Validate::isUnsignedId($id_product)) // Initializations if (!$id_customer) $id_customer = ((Validate::isCookie($cookie) AND isset($cookie->id_customer) AND $cookie->id_customer) ? (int)($cookie->id_customer) : NULL); $id_group = $id_customer ? (int)(Customer::getDefaultGroupId($id_customer)) : _PS_DEFAULT_CUSTOMER_GROUP_; { /* * When a user (e.g., guest, customer, Google...) is on PrestaShop, he has already its cart as the global (see /init.php) * When a non-user calls directly this method (e.g., payment module...) is on PrestaShop, he does not have already it BUT knows the cart ID */ if (!$id_cart AND !Validate::isCookie($cookie)) $cur_cart = $id_cart ? new Cart((int)($id_cart)) : new Cart((int)($cookie->id_cart)); } $cart_quantity = 0; if ((int)($id_cart)) { $condition = ''; $cache_name = (int)($id_cart).'_'.(int)($id_product); if(Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) { $cache_name = (int)($id_cart).'_'.(int)($id_product).'_'.(int)($id_product_attribute); $condition = ' AND `id_product_attribute` = '.(int)($id_product_attribute); } if (!isset(self::$_cart_quantity[$cache_name]) OR self::$_cart_quantity[$cache_name] != (int)($quantity)) { self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT SUM(`quantity`) FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.(int)($id_product).' AND `id_cart` = '.(int)($id_cart).' '.$condition ); $cart_quantity = self::$_cart_quantity[$cache_name]; } } $quantity = ($id_cart AND $cart_quantity) ? $cart_quantity : $quantity; $id_currency = (int)(Validate::isLoadedObject($cur_cart) ? $cur_cart->id_currency : ((isset($cookie->id_currency) AND (int)($cookie->id_currency)) ? $cookie->id_currency : Configuration::get('PS_CURRENCY_DEFAULT'))); // retrieve address informations $id_country = (int)Country::getDefaultCountryId(); $id_state = 0; $id_county = 0; if (!$id_address) $id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}; if ($id_address) { $address_infos = Address::getCountryAndState($id_address); if ($address_infos['id_country']) { $id_country = (int)($address_infos['id_country']); $id_state = (int)($address_infos['id_state']); $postcode = (int)$address_infos['postcode']; $id_county = (int)County::getIdCountyByZipCode($id_state, $postcode); } } { // fetch address from cookie $id_country = (int)$cookie->id_country; $id_state = (int)$cookie->id_state; $postcode = (int)$cookie->postcode; $id_county = (int)County::getIdCountyByZipCode($id_state, $postcode); } if (Tax::excludeTaxeOption()) $usetax = false; if ($usetax != false AND !empty($address_infos['vat_number']) AND $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY') AND Configuration::get('VATNUMBER_MANAGEMENT')) $usetax = false; $id_shop = (int)(Shop::getCurrentShop()); return Product::priceFullCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity, $usetax, $decimals, $only_reduc, $usereduc, $with_ecotax, $specificPriceOutput, $use_groupReduction); } ///////////// public function getFullPrice($tax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false, $usereduc = false, $quantity = 1) { $fullprice = Product::getFullPriceStatic((int)($this->id), $tax, $id_product_attribute, $decimals, $divisor, $only_reduc, $usereduc, $quantity); return $fullprice; } }
http://www.pneumaticon.pl/presta/product.php?id_product=48 Błąd wywala przez getFullPrice w pierwszym pliku. Może ktoś pomoże jak to naprawić aby getFullprice działał. Dodam, że to cms Prestashop.