Jump to content

Second price Prestashop 1.6.1.4


kontakt@xonik.pl
 Share

Recommended Posts

Hello

I would like to add a second price to the product which will be called "Deposit". How to convert the prices.tpl file to get this effect? The second thing is that such an additional "deposit" amount is added to the final amount in the basket

 

I added to prices.tpl this:

</div>
	{include file="controllers/products/multishop/check_fields.tpl" product_tab="Prices"}
	<div class="form-group">
		<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="Deposit" type="price"}</span></div>
		<label class="control-label col-lg-2" for="deposit">
			<span class="label-tooltip" data-toggle="tooltip" title="{l s='Deposit price'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Deposit'}{else}{l s='Deposit'}{/if}</span>
		</label>
		<div class="col-lg-2">
			<div class="input-group">
				<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
				<input maxlength="27" name="Deposit" id="Deposit" type="text" value="{{toolsConvertPrice price=$product->Deposit}|string_format:$priceDisplayPrecisionFormat}" onchange="this.value = this.value.replace(/,/g, '.');" />
			</div>
			{if isset($pack) && $pack->isPack($product->id)}<p class="help-block">{l s='Deposit price' sprintf=[$currency->prefix,{toolsConvertPrice price=$pack->noPackDeposit($product->id)|string_format:$priceDisplayPrecisionFormat},$currency->suffix]}</p>{/if}
		</div>
	</div>

 

In product.tpl :

<div>								
								<p class="our_price_display" itemprop="Deposit" itemscope itemtype="default">{strip}
									{if $product->quantity > 0}<link itemprop="availability" href="https://schema.org/InStock"/>{/if}
									{if $priceDisplay >= 0 && $priceDisplay <= 2}
									{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) || !isset($display_tax_label))}
											{if $priceDisplay == 1} {l s='Deposit '}{else} {l s='Deposit '}{/if}
										<span id="our_price_display" class="Deposit" itemprop="Deposit" content="{$productwDeposit}">{convertPrice price=$product->Deposit|floatval|floatval}</span>
										
										{/if}
										<meta itemprop="productDepositCurrency" content="{$currency->iso_code}" />
										{hook h="displayProductPriceBlock" product=$product type="Deposit"}
									{/if}
								{/strip}</p>								
								<p id="reduction_percent" {if $productPriceWithoutReduction <= 0 || !$product->specificPrice || $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}>{strip}
									<span id="reduction_percent_display">
										{if $product->specificPrice && $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}
									</span>
								{/strip}</p>
							</div>

 


I added "Deposit:" to blockcart

<div class="layer_cart_row">
					<strong class="dark">
						{l s='Deposit:' mod='blockcart'}
						{if $use_taxes && $display_tax_label && $show_tax}
							{if $priceDisplay == 1}
							{/if}
						{/if}
					</strong>
						<span class="ajax_block_cart_deposit"> 
						{if $cart_qties > 0}
							{if $priceDisplay == 1}
								{Tools::displayPrice($productDdeposit)}
								{else}
								{convertPrice price=$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS)}					
							{/if}
						{/if}
						</span>
				</div>

 

everything works now, but when I click Add To Cart, the Deposit price is not refreshed and until I refresh the page myself, the deposit is not charged. Where can I set it to refresh the price itself and sum the Deposit and Product Price.
And I would also like to do so that each added product with a deposit will have another deposit price added to it

Edited by [email protected] (see edit history)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More