Jump to content

Afprijzingen op producten pagina


Eddyemmer

Recommended Posts

Hoi,

 

Ik heb een aantal producten afgeprijst en dit wil graag laten zien aan mijn bezoekers. Als ik nu op een product klik zie ik netjes staan dat hij is afgeprijst in euro's (niet in procenten)

Maar als ik op 1 van mijn hoofdmenu items klik bv tassen dan zie ik mijn hele collectie tassen (ongeveer 20 stuks) maar zie daar alleen maar de afgeprijsde prijs staan en niet iets van "sale" of de korting die erover heen is.

 

Iemand een oplossing! Prestashop versie 1.5.6.0

 

Thnks!!

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

Ik zie dat jij een mooie afprijzing (in procenten) hebt. Hoe heb je dat voor elkaar gekregen? Om deze website gaat het bij mij:

 

www.mustbeads.nl

 

Op de voorpagina zie je geen kortingen maar ook niet op de overige pagina's uit het hoofdmenu. Je ziet pas de korting als je op een product klikt.

Link to comment
Share on other sites

De onderstaande hack is voor de Category view:

 

In product-list.tpl vind je de volgende code (in PS versie 1.5.6.2 op regel 51):

				<div class="content_price">
					{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span><br />{/if}
					{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{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}<span class="warning_inline">{l s='Out of stock'}</span>{/if}</span>{/if}
				</div>

Die code heb ik aangepast naar:

				<div class="content_price">
					{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
{* PRICE REDUCTION HACK *}
						{if isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
							<div class="show_price_reduction">
								<div class="show_reductions"><span class="show_old_price" style="text-decoration:line-through">{convertPrice price=$product.price_without_reduction}</span></div>
								<div class="show_reductions"><span class="show_reduction_percent">-{$product.specific_prices.reduction*100}%</span></div>
							</div>
							<div class="discount_spacer"> </div>
						{/if}
{* END PRICE REDUCTION HACK *}
						<span class="price" style="display: inline;">
						{if !$priceDisplay}
							{convertPrice price=$product.price}
						{else}
							{convertPrice price=$product.price_tax_exc}
						{/if}
						</span><br />
					{/if}
					{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{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}
				</div>

Daarna zul je nog de CSS moeten aanpassen voor het gewenste optische resultaat.

 

Maar let op: ik ben er niet 100% zeker van of in de basisinstallatie van PS de gebruikte smarty variabelen wel beschikbaar zijn. Het is al een behoorlijke tijd geleden dat ik daaraan gewerkt heb en ik heb ingrijpende wijzigingen aangebracht in alle scripts die iets te maken hebben met prijzen en kortingen.

 

Dus eerst testen in een testomgeving.

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

Deze hack is voor de Product pagina's:

 

In product.tpl regels 376 - 442 (in PS 1.5.6.2) vind je de volgende code:

		<div class="content_prices clearfix">
			<!-- prices -->
			{if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}

			{if $product->online_only}
			<p class="online_only">{l s='Online only'}</p>
			{/if}

			<div class="price">
...
...
...
			{/if}
			{*close if for show price*}
			{/if}

Dat hele stuk heb ik grotendeels herschreven om de koritngen weer te kunnen geven zoals ik het wil:

{* Show old price, discount and new price *}
		<div class="content_prices clearfix">
			<!-- prices -->
			{if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}

			{if $product->online_only}
			<p class="online_only">{l s='Online only'}</p>
			{/if}

			<!-- new discounted price -->
			<div class="price" title="basePrice-{$basePrice} taxRate-{$taxRate} Discount-{$Discount}">
				<p class="our_price_display">
				{if $priceDisplay >= 0 && $priceDisplay <= 2}
					<span id="our_price_display">{convertPrice price=$productPrice}</span>
				{/if}
				</p>

				<!-- text messages: on sale / reduced price -->
				{if $product->on_sale}
					<img src="{$img_dir}onsale_{$lang_iso}.gif" alt="{l s='On sale'}" class="on_sale_img"/>
					<span class="on_sale">{l s='On sale!'}</span>
				{elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutReduction > $productPrice}
					<span class="discount">{l s='Reduced price!'}</span>
				{/if}
				{if $priceDisplay == 2}
					<br />
					<span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>
				{/if}
			</div>

			<!-- the discount percentage -->
			{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage' AND $product->specificPrice.reduction > 0}
				{assign var="percents" value=$product->specificPrice.reduction*100}
				{if $percents > 0}
					<p id="reduction_percent"><span id="reduction_percent_display" title="-{$percents}%">-{$percents}%</span></p>
				{/if}
			{/if}

			<!-- old non-discounted price -->
			{if $product->specificPrice AND $product->specificPrice.reduction && $product->specificPrice.reduction > 0}
				<p id="old_price"><span class="bold">
				{if $priceDisplay >= 0 && $priceDisplay <= 2}
					{if $productPriceWithoutReduction > $productPrice}
						<span id="old_price_display">{convertPrice price=$productPriceWithoutReduction}</span>
						<!-- {if $tax_enabled && $display_tax_label == 1}
							{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
						{/if} -->
					{/if}
				{/if}
				</span>
				</p>
			{/if}

			<!-- packing -->
			{if $packItems|@count && $productPrice < $product->getNoPackPrice()}
				<p class="pack_price">{l s='Instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>
				<br class="clear" />
			{/if}
			{if $product->ecotax != 0}
				<p class="price-ecotax">{l s='Include'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='For green tax'}
					{if $product->specificPrice AND $product->specificPrice.reduction}
					<br />{l s='(not impacted by the discount)'}
					{/if}
				</p>
			{/if}
			{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
				 {math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
				<p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}</p>
			{/if}
			{*close if for show price*}
			{/if}
{* End show old price, discount and new price *}

Maar ook hiervoor geldt dezelfde waarschuwing. Ik weet niet of de benodigde variabelen standaard al doorkomen of dat ik daarvoor ook nog een van de classes heb aangepast.

 

Geen idee dus of het voor jou zo zal werken.

Link to comment
Share on other sites

Hoi,

 

Ik heb een aantal producten afgeprijst en dit wil graag laten zien aan mijn bezoekers. Als ik nu op een product klik zie ik netjes staan dat hij is afgeprijst in euro's (niet in procenten)

Maar als ik op 1 van mijn hoofdmenu items klik bv tassen dan zie ik mijn hele collectie tassen (ongeveer 20 stuks) maar zie daar alleen maar de afgeprijsde prijs staan en niet iets van "sale" of de korting die erover heen is.

 

Iemand een oplossing! Prestashop versie 1.5.6.0

 

Thnks!!

 

Ik zou eerst even kijken of je het 'On sale' / 'In de aanbieding' vakje wel hebt aangevinkt.

Het is even afhankelijk van welke versie van PrestaShop je gebruikt, maar in 1.5 ziet het er als volgt uit: (zie bijlage)

 

Dit kan je vinden vlakbij waar je de kortingen / begin - eind datum invoert van je aanbieding op product niveau!

post-59285-0-45098900-1392203195_thumb.jpg

Link to comment
Share on other sites

Hej Toeareg,

 

Ik heb je eerste post over de category page even uitgeprobeerd en het werkt ook wel, alhoewel hij laat de kortingen wel in procenten zien maar dan zoiets als dit: 500%

Das wel erg veel korting. Volgens mij moet ik dan mijn klanten geld toegeven als ze een product kopen.

Waar gaat het hier dan fout?

 

Thanks!

Link to comment
Share on other sites

Tja, dat houd je niet lang vol he :)

 

Als die 500% eigenlijk 5% zou moeten zijn, dan ga ik er even simpelweg van uit dat het in deze regel zit:

<div class="show_reductions"><span class="show_reduction_percent">-{$product.specific_prices.reduction*100}%</span></div>

Dan moet je daar die *100 aan het eind even weghalen.

Als dat niet het bedoelde resultaat oplevert, dan moet ik meer details van je hebben.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...