valkiriashoes Posted January 2, 2017 Share Posted January 2, 2017 (edited) Buenas, tengo un problema que llevo días intentado dar con la solución a través de este foro. Os comento: Tengo una web en la que existen 2 tipos de precios, particular y empresa/representante. Cada producto tiene varios precios dependiendo del tipo de tela que se utilice. Los precios de cada tela (serie) para particulares los hemos dado de alta mediante las combinaciones, poniendo un precio base de 0 al producto y añadiendo el impacto en el precio en cada combinación. Los precios de tela para empresa/representante los hemos creado mediante especificaciones de precio del producto. añadiendo una cantidad base fija y un descuento, en este caso de la mitad del articulo (solo Serie A y Tela cliente, Serie B y D son pruebas). El problema viene en la visualización del producto en product.tpl, me salen importes que no cuadran y por más que reviso todo, sospecho que el problema está en el javascript. Ya que tanto en el home como en el resumen del carrito de compra, están dando los resultados idóneos Si alguien tiene alguna idea de la solución, lo agradecería. Información de interés: Hay un grupo representante con 0% de descuento. La tasa de moneda euro es 1 Versión de prestashop: 1.6.1.9 Producto: http://seyjadecor.com/es/coleccion-vintage/24-butaca-genova.html Cuenta representante usuario/pass: [email protected]/representanteprueba Edited January 2, 2017 by valkiriashoes (see edit history) Link to comment Share on other sites More sharing options...
ventura Posted January 3, 2017 Share Posted January 3, 2017 Puede deberse a alguna incompatibilidad con la plantilla que estés utilizando. Prueba a ver con el product.js de la plantilla default Link to comment Share on other sites More sharing options...
valkiriashoes Posted January 3, 2017 Author Share Posted January 3, 2017 Efectivamente, el problema está en product.js de la plantilla. //update display of the the prices in relation to tax, discount, ecotax, and currency criteria if (!selectedCombination['unavailable'] && productShowPrice == 1) { var priceTaxExclWithoutGroupReduction = ''; // retrieve price without group_reduction in order to compute the group reduction after // the specific price discount (done in the JS in order to keep backward compatibility) priceTaxExclWithoutGroupReduction = ps_round(productPriceTaxExcluded, 6) * (1 / group_reduction); var tax = (taxRate / 100) + 1; var taxExclPrice = priceTaxExclWithoutGroupReduction + (selectedCombination['price'] * currencyRate); if (selectedCombination.specific_price && selectedCombination.specific_price['id_product_attribute']) { if (selectedCombination.specific_price['price'] && selectedCombination.specific_price['price'] >=0) var taxExclPrice = (specific_currency ? selectedCombination.specific_price['price'] : selectedCombination.specific_price['price'] * currencyRate); else var taxExclPrice = productBasePriceTaxExcluded * currencyRate + (selectedCombination['price'] * currencyRate); } else if (product_specific_price.price && product_specific_price.price >= 0) var taxExclPrice = (specific_currency ? product_specific_price.price : product_specific_price.price * currencyRate) + (selectedCombination['price'] * currencyRate); if (!displayPrice && !noTaxForThisProduct) productPriceDisplay = ps_round(taxExclPrice * tax, 2); // Need to be global => no var else productPriceDisplay = ps_round(taxExclPrice, 2); // Need to be global => no var productPriceWithoutReductionDisplay = productPriceDisplay * group_reduction; var reduction = 0; if (selectedCombination['specific_price'].reduction_price || selectedCombination['specific_price'].reduction_percent) { reduction_price = (specific_currency ? selectedCombination['specific_price'].reduction_price : selectedCombination['specific_price'].reduction_price * currencyRate); reduction = productPriceDisplay * (parseFloat(selectedCombination['specific_price'].reduction_percent) / 100) + reduction_price; if (reduction_price && (displayPrice || noTaxForThisProduct)) reduction = ps_round(reduction / tax, 6); } else if (product_specific_price && product_specific_price.reduction && !selectedCombination.specific_price) { if (product_specific_price.reduction_type == 'amount') reduction_price = (specific_currency ? product_specific_price.reduction : product_specific_price.reduction * currencyRate); else reduction_price = 0; if (product_specific_price.reduction_type == 'percentage') reduction_percent = productPriceDisplay * parseFloat(product_specific_price.reduction); reduction = reduction_price + reduction_percent; if (reduction_price && (displayPrice || noTaxForThisProduct)) reduction = ps_round(reduction / tax, 6); } if (selectedCombination.specific_price) { if (selectedCombination.specific_price.reduction_percent > 0) { $('#reduction_amount').hide(); $('#reduction_percent_display').html('-' + parseFloat(selectedCombination['specific_price'].reduction_percent) + '%'); $('#reduction_percent').show(); } else if (selectedCombination.specific_price.reduction_price > 0) { $('#reduction_amount_display').html('-' + formatCurrency(reduction_price, currencyFormat, currencySign, currencyBlank)); $('#reduction_percent').hide(); $('#reduction_amount').show(); } else { $('#reduction_percent').hide(); $('#reduction_amount').hide(); } } if (product_specific_price['reduction_type'] != '' || selectedCombination.specific_price.reduction_percent > 0 || selectedCombination.specific_price.reduction_price > 0) $('#discount_reduced_price,#old_price').show(); else $('#discount_reduced_price,#old_price').hide(); if ((product_specific_price['reduction_type'] == 'percentage' && selectedCombination.specific_price.reduction_percent > 0) || selectedCombination['specific_price'].reduction_type == 'percentage') $('#reduction_percent').show(); else $('#reduction_percent').hide(); if (product_specific_price['price'] || (selectedCombination.specific_price && selectedCombination.specific_price['price'])) $('#not_impacted_by_discount').show(); else $('#not_impacted_by_discount').hide(); productPriceDisplay -= reduction; productPriceDisplay = ps_round(productPriceDisplay * group_reduction, 2); var ecotaxAmount = !displayPrice ? ps_round(selectedCombination['ecotax'] * (1 + ecotaxTax_rate / 100), 2) : selectedCombination['ecotax']; if (ecotaxAmount != default_eco_tax) productPriceDisplay += ecotaxAmount - default_eco_tax; else productPriceDisplay += ecotaxAmount; if (ecotaxAmount != default_eco_tax) productPriceWithoutReductionDisplay += ecotaxAmount - default_eco_tax; else productPriceWithoutReductionDisplay += ecotaxAmount; var our_price = ''; if (productPriceDisplay > 0) { our_price = formatCurrency(productPriceDisplay, currencyFormat, currencySign, currencyBlank); } else { our_price = formatCurrency(0, currencyFormat, currencySign, currencyBlank); } $('#our_price_display').text(our_price); $('#old_price_display').text(formatCurrency(productPriceWithoutReductionDisplay, currencyFormat, currencySign, currencyBlank)); if (productPriceWithoutReductionDisplay > productPriceDisplay) $('#old_price,#old_price_display,#old_price_display_taxes').show(); else $('#old_price,#old_price_display,#old_price_display_taxes').hide(); // Special feature: "Display product price tax excluded on product page" var productPricePretaxed = ''; if (!noTaxForThisProduct) productPricePretaxed = productPriceDisplay / tax; else productPricePretaxed = productPriceDisplay; $('#pretaxe_price_display').text(formatCurrency(productPricePretaxed, currencyFormat, currencySign, currencyBlank)); // Unit price productUnitPriceRatio = parseFloat(productUnitPriceRatio); if (productUnitPriceRatio > 0 ) { newUnitPrice = (productPriceDisplay / parseFloat(productUnitPriceRatio)) + parseFloat(selectedCombination['unit_price']); $('#unit_price_display').text(formatCurrency(newUnitPrice, currencyFormat, currencySign, currencyBlank)); } } alguien me podría ayudar con el código? lo he comparado con el product.js de la plantilla por defecto y es completamente diferente. Lo único que necesito es que haga bien la resta del precio final de la combinación o precio fijo (misma cantidad) del precio específico con el impacto del precio especifico. ya que, internamente funciona bien, el problema viene a la hora de visualizar los precios. Un saludo. gracias de antemano. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now