w product.tpl daje coś takiego

  1. {if $priceDisplay >= 0 && $priceDisplay <= 2}
  2. {if $cookie->isLogged(true)}
  3. <p class="srp">SRP:
  4. <span id="old_price_display" class="srp">{convertPrice price=$product->getFullPrice(true, $smarty.const.NULL,2)}</span></p>
  5. <p class="vip">VIP Price:
  6. <span id="our_price_display" class="vip">{convertPrice price=$product->getPrice(true, $smarty.const.NULL,2)}</span></p>
  7. {else}
  8. <p class="srp">SRP:<span id="our_price_display" class="srp">{convertPrice price=$product->getPrice(true, $smarty.const.NULL,2)}</span></p>
  9. {/if}
  10. {/if}


a w product.php
  1. require(dirname(__FILE__).'/config/config.inc.php');
  2. ControllerFactory::getController('ProductController')->run();
  3.  
  4. define('_CUSTOMIZE_FILE_', 0);
  5. define('_CUSTOMIZE_TEXTFIELD_', 1);
  6.  
  7. class Product extends ProductCore
  8. {
  9.  
  10. /**
  11. * Price calculation / Get product price
  12. *
  13. * @param integer $id_shop Shop id
  14. * @param integer $id_product Product id
  15. * @param integer $id_product_attribute Product attribute id
  16. * @param integer $id_country Country id
  17. * @param integer $id_state State id
  18. * @param integer $id_currency Currency id
  19. * @param integer $id_group Group id
  20. * @param integer $quantity Quantity Required for Specific prices : quantity discount application
  21. * @param boolean $use_tax with (1) or without (0) tax
  22. * @param integer $decimals Number of decimals returned
  23. * @param boolean $only_reduc Returns only the reduction amount
  24. * @param boolean $use_reduc Set if the returned amount will include reduction
  25. * @param boolean $with_ecotax insert ecotax in price output.
  26. * @param variable_reference $specific_price_output If a specific price applies regarding the previous parameters, this variable is filled with the corresponding SpecificPrice object
  27. * @return float Product price
  28. **/
  29. 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)
  30. {
  31. // Caching
  32. if ($id_product_attribute === NULL)
  33. $product_attribute_label = 'NULL';
  34. else
  35. $product_attribute_label = ($id_product_attribute === false ? 'false' : $id_product_attribute);
  36. $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;
  37.  
  38. // reference parameter is filled before any returns
  39. $specific_price = SpecificPrice::getSpecificPrice((int)($id_product), $id_shop, $id_currency, $id_country, $id_group, $quantity);
  40.  
  41. if (isset(self::$_prices[$cacheId]))
  42. return self::$_prices[$cacheId];
  43.  
  44. // fetch price & attribute price
  45. $cacheId2 = $id_product.'-'.$id_product_attribute;
  46. if (!isset(self::$_pricesLevel2[$cacheId2]))
  47. self::$_pricesLevel2[$cacheId2] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
  48. SELECT p.`price`,
  49. '.($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,
  50. p.`ecotax`
  51. '.($id_product_attribute ? ', pa.`ecotax` AS attribute_ecotax' : '').'
  52. FROM `'._DB_PREFIX_.'product` p
  53. '.($id_product_attribute ? 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON pa.`id_product_attribute` = '.(int)($id_product_attribute) : '').'
  54. WHERE p.`id_product` = '.(int)$id_product);
  55. $result = self::$_pricesLevel2[$cacheId2];
  56.  
  57. if (!$specific_price || $specific_price['price'] == 0)
  58. $price = (float)$result['price'];
  59. else
  60. $price = (float)$specific_price['price'];
  61.  
  62. // convert only if the specific price is in the default currency (id_currency = 0)
  63. if (!$specific_price OR !($specific_price['price'] > 0 AND $specific_price['id_currency']))
  64. $price = Tools::convertPrice($price, $id_currency);
  65.  
  66. // Attribute price
  67. $attribute_price = Tools::convertPrice(array_key_exists('attribute_price', $result) ? (float)($result['attribute_price']) : 0, $id_currency);
  68. if ($id_product_attribute !== false) // If you want the default combination, please use NULL value instead
  69. $price += $attribute_price;
  70.  
  71. // TaxRate calculation
  72. $tax_rate = Tax::getProductTaxRateViaRules((int)$id_product, (int)$id_country, (int)$id_state, (int)$id_county);
  73. if ($tax_rate === false)
  74. $tax_rate = 0;
  75.  
  76. // Add Tax
  77. if ($use_tax)
  78. $price = $price * (1 + ($tax_rate / 100));
  79. $price = Tools::ps_round($price, $decimals);
  80.  
  81. return $price;
  82. }
  83. //////////////
  84. public static function getFullPriceStatic($id_product, $usetax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false,
  85. $usereduc = true, $quantity = 1, $forceAssociatedTax = false, $id_customer = NULL, $id_cart = NULL, $id_address = NULL, &$specificPriceOutput = NULL, $with_ecotax = true, $use_groupReduction = true)
  86. {
  87. global $cookie, $cart;
  88. $cur_cart = $cart;
  89.  
  90. if (isset($divisor))
  91. Tools::displayParameterAsDeprecated('divisor');
  92.  
  93. if (!Validate::isBool($usetax) OR !Validate::isUnsignedId($id_product))
  94. die(Tools::displayError());
  95. // Initializations
  96. if (!$id_customer)
  97. $id_customer = ((Validate::isCookie($cookie) AND isset($cookie->id_customer) AND $cookie->id_customer) ? (int)($cookie->id_customer) : NULL);
  98. $id_group = $id_customer ? (int)(Customer::getDefaultGroupId($id_customer)) : _PS_DEFAULT_CUSTOMER_GROUP_;
  99. if (!is_object($cur_cart) OR (Validate::isUnsignedInt($id_cart) AND $id_cart))
  100. {
  101. /*
  102. * When a user (e.g., guest, customer, Google...) is on PrestaShop, he has already its cart as the global (see /init.php)
  103. * 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
  104. */
  105. if (!$id_cart AND !Validate::isCookie($cookie))
  106. die(Tools::displayError());
  107. $cur_cart = $id_cart ? new Cart((int)($id_cart)) : new Cart((int)($cookie->id_cart));
  108. }
  109.  
  110. $cart_quantity = 0;
  111. if ((int)($id_cart))
  112. {
  113. $condition = '';
  114. $cache_name = (int)($id_cart).'_'.(int)($id_product);
  115.  
  116. if(Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION'))
  117. {
  118. $cache_name = (int)($id_cart).'_'.(int)($id_product).'_'.(int)($id_product_attribute);
  119. $condition = ' AND `id_product_attribute` = '.(int)($id_product_attribute);
  120. }
  121.  
  122. if (!isset(self::$_cart_quantity[$cache_name]) OR self::$_cart_quantity[$cache_name] != (int)($quantity))
  123. {
  124. self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
  125. SELECT SUM(`quantity`)
  126. FROM `'._DB_PREFIX_.'cart_product`
  127. WHERE `id_product` = '.(int)($id_product).'
  128. AND `id_cart` = '.(int)($id_cart).' '.$condition
  129. );
  130.  
  131. $cart_quantity = self::$_cart_quantity[$cache_name];
  132. }
  133. }
  134. $quantity = ($id_cart AND $cart_quantity) ? $cart_quantity : $quantity;
  135. $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')));
  136.  
  137. // retrieve address informations
  138. $id_country = (int)Country::getDefaultCountryId();
  139. $id_state = 0;
  140. $id_county = 0;
  141.  
  142. if (!$id_address)
  143. $id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
  144.  
  145. if ($id_address)
  146. {
  147. $address_infos = Address::getCountryAndState($id_address);
  148. if ($address_infos['id_country'])
  149. {
  150. $id_country = (int)($address_infos['id_country']);
  151. $id_state = (int)($address_infos['id_state']);
  152. $postcode = (int)$address_infos['postcode'];
  153.  
  154. $id_county = (int)County::getIdCountyByZipCode($id_state, $postcode);
  155. }
  156. }
  157. elseif (isset($cookie->id_country))
  158. {
  159. // fetch address from cookie
  160. $id_country = (int)$cookie->id_country;
  161. $id_state = (int)$cookie->id_state;
  162. $postcode = (int)$cookie->postcode;
  163.  
  164. $id_county = (int)County::getIdCountyByZipCode($id_state, $postcode);
  165. }
  166.  
  167. if (Tax::excludeTaxeOption())
  168. $usetax = false;
  169.  
  170. if ($usetax != false AND !empty($address_infos['vat_number']) AND $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY') AND Configuration::get('VATNUMBER_MANAGEMENT'))
  171. $usetax = false;
  172.  
  173. $id_shop = (int)(Shop::getCurrentShop());
  174.  
  175. 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,
  176. $usereduc, $with_ecotax, $specificPriceOutput, $use_groupReduction);
  177. }
  178. /////////////
  179. public function getFullPrice($tax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false, $usereduc = false, $quantity = 1)
  180. {
  181. $fullprice = Product::getFullPriceStatic((int)($this->id), $tax, $id_product_attribute, $decimals, $divisor, $only_reduc, $usereduc, $quantity);
  182. return $fullprice;
  183. }
  184. }


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.