Jump to content

Precio anterior al descuento en lista de productos


Recommended Posts

Hola!

 

He conseguido hacer un descuento de manera que salga en cada producto el precio anterior tachado, el porcentaje de descuento y el precio rebajado. También he conseguido poner el precio rebajado en el homefeatured. Pero se me atasca lo de hacer que se vea el precio anterior a mayores, tanto en el homefeatured como en el product list, me gustaría que ahí también se vieran los dos precios.

 

He leído varios posts del foro, que gracias a ello pude hacer todo lo anterior, pero no me funciona el código que se recomienda para el productlist.

 

¿Alguien sabe cuál es el código? Gracias!

Link to comment
Share on other sites

Con un codigo de este tipo te debería valer, te aparecería el precio anterior tachado

{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
<span id="old_price_display" style="text-decoration:line-through">{convertPrice price=$product.price_without_reduction}</span> {/if}
Link to comment
Share on other sites

Gracias Ventura, pero no me sale, sigue igual. 

Mi código es así:

{if isset($products)}
	<!-- Products list -->
			{assign var='nbItemsPerLine' value=3}
			{assign var='nbLi' value=$products|@count}
			{math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
<ul id="product_list" class="list row">
{foreach from=$products item=product name=products}
	{math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo}
    {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
<li class="ajax_block_product span3 num-{$smarty.foreach.products.iteration}{if $smarty.foreach.products.iteration%$nbItemsPerLine == 0} omega{elseif $smarty.foreach.products.iteration%$nbItemsPerLine == 1} alpha{/if} {if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModulo)}last_line{/if}">
		<a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}">
        	<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" />
        </a>
		<div class="center_block">
			<div class="product_flags clearfix">
				{if isset($product.new) && $product.new == 1}<span class="new title_shop">{l s='New'}!</span>{/if}
                {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}             
                {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
                <span class="availability title_shop">{if ($product.allow_oosp || $product.quantity > 0)}<!-- {l s='Available'} -->
                {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>{/if}
				{if isset($product.online_only) && $product.online_only}<span class="online_only title_shop">{l s='Online only'}</span>{/if}
                {/if}  
			</div>
            <div class="clear"></div>
            <h5><a class="product_link" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'|truncate:75:'...'}</a></h5>
            <p class="product_desc">{$product.description_short|strip_tags:'UTF-8'|truncate:450:'...'}</p>
            <p class="product_desc mob">{$product.description_short|strip_tags:'UTF-8'|truncate:90:'...'}</p>
            <p class="product_desc mob2">{$product.description_short|strip_tags:'UTF-8'|truncate:180:'...'}</p>  
		</div>																				 
		<div class="right_block">
        	{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="on_sale title_shop">{l s='On sale!'}</span>
			{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount title_shop">{l s='Reduced price!'}</span>{/if}
			{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
            {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
            <span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}  
			{/if}	 
           {if isset($comparator_max_item) && $comparator_max_item && !isset($instant_search)}
				<p class="compare checkbox choices-thin clearfix">		
                <input type="checkbox"  class="comparator" id="comparator_item_{$product.id_product}" value="comparator_item_{$product.id_product}" 
                {if isset($compareProducts) && in_array($product.id_product, $compareProducts)}checked="checked"{/if} /> 
				<label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label></p>
			{/if}
            <div class="clear noneclass"></div>
				{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && 					$product.customizable != 2 && !$PS_CATALOG_MODE}
					{if ($product.allow_oosp || $product.quantity > 0)}
						{if isset($static_token)}
							<a class="ajax_add_to_cart_button exclusive btn_add_cart" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}&token={$static_token}", false)}" title="{l s='Add to cart'}">
                            <span>{l s='Add to cart'}</span>
                           </a>
						{else}
							<a class="ajax_add_to_cart_button exclusive btn_add_cart" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}", false)} title="{l s='Add to cart'}">
                            <span>{l s='Add to cart'}</span>
                            </a>
						{/if}						
					{else}
						<span class="exclusive">{l s='Add to cart'}</span>
					{/if}
				{/if}
			<a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>          
		</div>
	</li>
	{/foreach}
<script>
(function($) {
$(function() {
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	function eraseCookie(name) {
		createCookie(name,"",-1);
	}
	$('ul.product_view').each(function(i) {
		var cookie = readCookie('tabCookie'+i);
		if (cookie) $(this).find('li').eq(cookie).addClass('current').siblings().removeClass('current')
			.parents('#center_column').find('#product_list').addClass('list').removeClass('grid').eq(cookie).addClass('grid').removeClass('list');
	})
	$('ul.product_view').delegate('li:not(.current)', 'click', function(i) {
		$(this).addClass('current').siblings().removeClass('current')
		.parents('#center_column').find('#product_list').removeClass('grid').addClass('list').eq($(this).index()).addClass('grid').removeClass('list')	
		var cookie = readCookie('tabCookie'+i);
		if (cookie) $(this).find('#product_list').eq(cookie).removeClass('grid').addClass('list').siblings().removeClass('list')
		var ulIndex = $('ul.product_view').index($(this).parents('ul.product_view'));
		eraseCookie('tabCookie'+ulIndex);
		createCookie('tabCookie'+ulIndex, $(this).index(), 365);
	})
})
})(jQuery)
    </script>
    </ul>
{/if}

Lo puse en la línea 56 y forcé compilación pero nada, sigue como está (ahora lo dejé como lo tenía).

He leído muchos temas sobre esto pero la mayoría son de  versiones muy anteriores y al parecer, ya no sirven los mismos códigos.

Link to comment
Share on other sites

En la plantilla default va incluido aqui


{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="content_price">
{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
<span itemprop="price" class="price product-price">
{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
</span>
<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
{hook h="displayProductPriceBlock" product=$product type="old_price"}
<span class="old-price product-price">
{displayWtPrice p=$product.price_without_reduction}
</span>
{hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"}
{if $product.specific_prices.reduction_type == 'percentage'}
<span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
{/if}
{/if}

Revisa que en el css no tengas ocultado el span que lo contiene

Edited by ventura (see edit history)
Link to comment
Share on other sites

No estoy segura de cuál tengo que mirar... Veo éstos y creo que no están "desactivados":

 

 

#ul_layered_price_0 span {

float: left;
margin: 5px 7px 0 0
}

 

 

.reduction {

display: none !important;
}
.products_block ul li span.price-discount {
text-decoration: line-through;
margin-top: 0px;
display: inline-block;
color: #5b5b5b;
margin-left: 5px;

 

 

#special_block_right span.price-discount {

text-decoration: line-through;

 

No sé si me he dejado alguno, la verdad. He buscado los span y te he puesto los que aparecen con la palabra descuento.

Link to comment
Share on other sites

No estoy segura de cuál tengo que mirar... Veo éstos y creo que no están "desactivados":

 

 

 

 

No sé si me he dejado alguno, la verdad. He buscado los span y te he puesto los que aparecen con la palabra descuento.

 

No estoy segura de cuál tengo que mirar... Veo éstos y creo que no están "desactivados":

 

 

 

 

No sé si me he dejado alguno, la verdad. He buscado los span y te he puesto los que aparecen con la palabra descuento.

 

 

En principio serian los dos ultimos pero prueba quitando este, borralo del css

.reduction {
display: none !important;
}
Link to comment
Share on other sites

  • nadie locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...