display both discounted amounts

  • Posts: 5
  • Thank you received: 1
12 years 5 months ago #52536

How can I display in the product listing both discounted prices : discounted price and discounted amount.

F.e :

MSRP : $2000
Sale : $1500
You Save : $500

?

The drop down list in the menu "Show discounted price" can select only one or another, but I need both.


Discover Miracle Water ~ www.ionlifeusa.com

Please Log in or Create an account to join the conversation.

  • Posts: 82796
  • Thank you received: 13356
  • MODERATOR
12 years 5 months ago #52586

You will have to edit the file 'listing_price' of the view 'product' via the menu Display->Views and change the code there. Remove that line:
}elseif($this->params->get('show_discount')==2){

and change the line:
if($this->params->get('show_discount')==1){

to:
if($this->params->get('show_discount')){

The following user(s) said Thank You: lancert, ionlifeusa

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 1
12 years 5 months ago #52947

Thank you Nicolas,

I did it as a temporary solution, I would like to see a permanent solution from Hikashop that will allow this in the future without custom coding.

-Sergey


Discover Miracle Water ~ www.ionlifeusa.com

Please Log in or Create an account to join the conversation.

  • Posts: 82796
  • Thank you received: 13356
  • MODERATOR
12 years 5 months ago #53043

It's in the todo list.

Please Log in or Create an account to join the conversation.

  • Posts: 21
  • Thank you received: 0
11 years 8 months ago #90730

IonLifeUSA, would you be willing to share your listing_price.php code? I can't seem to quite get it to work properly and I see you did on your site.

Thanks!


Lance Thompson
CEO, Blue Sky Web Worx
Web Design, Web Marketing, Search Rankings, Graphic Design
www.BlueSkyWebWorx.com

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 1
11 years 8 months ago #90740

Hi, sure, this is listing_price.php :

<?php
/**
 * @package		HikaShop for Joomla!
 * @version		1.5.8
 * @author		hikashop.com
 * @copyright	(C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php
$class ='';
if(!empty($this->row->prices)&& count($this->row->prices)>1){
	$class = ' hikashop_product_several_prices';
} ?>
	<div class="hikashop_product_price_full<?php echo $class; ?>">
	<?php
	if(empty($this->row->prices)){
		echo JText::_('FREE_PRICE');
	}else{
		$first=true;
		echo JText::_('PRICE_BEGINNING');
		$i=0;
		if($this->params->get('price_with_tax',3)==3){
			$config =& hikashop_config();
			$this->params->set('price_with_tax',$config->get('price_with_tax'));
		}
		foreach($this->row->prices as $price){
			if($first)$first=false;
			else echo JText::_('PRICE_SEPARATOR');
			$start = JText::_('PRICE_BEGINNING_'.$i);
			if($start!='PRICE_BEGINNING_'.$i){
				echo $start;
			}
			if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $price->price_min_quantity>1){
				echo '<div class="hikashop_product_price_with_min_qty hikashop_product_price_for_at_least_'.$price->price_min_quantity.'">';
			}
			$classes = array('hikashop_product_price hikashop_product_price_'.$i);
			if(!empty($this->row->discount)){
				$classes[]='hikashop_product_price_with_discount';
			}
			if(!empty($this->row->discount)){
				if($this->params->get('show_discount')){
					echo '<div class="hikashop_product_price_before_discount">'.JText::_('PRICE_DISCOUNT_START');
					if($this->params->get('price_with_tax')){
						echo $this->currencyHelper->format($price->price_value_without_discount_with_tax,$price->price_currency_id);
					}
					if($this->params->get('price_with_tax')==2){
						echo JText::_('PRICE_BEFORE_TAX');
					}
					if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax')){
						echo $this->currencyHelper->format($price->price_value_without_discount,$price->price_currency_id);
					}
					if($this->params->get('price_with_tax')==2){
						echo JText::_('PRICE_AFTER_TAX');
					}
					if($this->params->get('show_original_price') && !empty($price->price_orig_value_without_discount_with_tax)){
						echo JText::_('PRICE_BEFORE_ORIG');
						if($this->params->get('price_with_tax')){
							echo $this->currencyHelper->format($price->price_orig_value_without_discount_with_tax,$price->price_orig_currency_id);
						}
						if($this->params->get('price_with_tax')==2){
							echo JText::_('PRICE_BEFORE_TAX');
						}
						if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax') && !empty($price->price_orig_value_without_discount)){
							echo $this->currencyHelper->format($price->price_orig_value_without_discount,$price->price_orig_currency_id);
						}
						if($this->params->get('price_with_tax')==2){
							echo JText::_('PRICE_AFTER_TAX');
						}
						echo JText::_('PRICE_AFTER_ORIG');
					}
					echo JText::_('PRICE_DISCOUNT_END').'</div>';
				}
			}
			echo '<div class="'.implode(' ',$classes).'">';
			if(!empty($this->row->discount)){
				if($this->params->get('show_discount')){
					echo JText::_('PRICE_SALE');
				}
			}
			if($this->params->get('price_with_tax')){
				echo $this->currencyHelper->format($price->price_value_with_tax,$price->price_currency_id);
			}
			if($this->params->get('price_with_tax')==2){
				echo JText::_('PRICE_BEFORE_TAX');
			}
			if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax')){
				echo $this->currencyHelper->format($price->price_value,$price->price_currency_id);
			}
			if($this->params->get('price_with_tax')==2){
				echo JText::_('PRICE_AFTER_TAX');
			}
			if($this->params->get('show_original_price') && !empty($price->price_orig_value)){
				echo JText::_('PRICE_BEFORE_ORIG');
				if($this->params->get('price_with_tax')){
					echo $this->currencyHelper->format($price->price_orig_value_with_tax,$price->price_orig_currency_id);
				}
				if($this->params->get('price_with_tax')==2){
					echo JText::_('PRICE_BEFORE_TAX');
				}
				if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax')){
					echo $this->currencyHelper->format($price->price_orig_value,$price->price_orig_currency_id);
				}
				if($this->params->get('price_with_tax')==2){
					echo JText::_('PRICE_AFTER_TAX');
				}
				echo JText::_('PRICE_AFTER_ORIG');
			}
			echo '</div> ';
			if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
				if($price->price_min_quantity>1){
					echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
				}else{
					echo JText::_('PER_UNIT');
				}
			}
			if($this->params->get('show_price_weight')){
				if(!empty($this->element->product_id) && isset($this->row->product_weight) && bccomp($this->row->product_weight,0,3)){
					echo JText::_('PRICE_SEPARATOR').'<div class="hikashop_product_price_per_weight_unit">';
					if($this->params->get('price_with_tax')){
						$weight_price = $price->price_value_with_tax / $this->row->product_weight;
						echo $this->currencyHelper->format($weight_price,$price->price_currency_id).' / '.JText::_($this->row->product_weight_unit);
					}
					if($this->params->get('price_with_tax')==2){
						echo JText::_('PRICE_BEFORE_TAX');
					}
					if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax')){
						$weight_price = $price->price_value / $this->row->product_weight;
						echo $this->currencyHelper->format($weight_price,$price->price_currency_id).' / '.JText::_($this->row->product_weight_unit);
					}
					if($this->params->get('price_with_tax')==2){
						echo JText::_('PRICE_AFTER_TAX');
					}
					echo '</div>';
				}
			}
			if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $price->price_min_quantity>1){
				echo '</div>';
			}
			if(!empty($this->row->discount)){
				if($this->params->get('show_discount')){
					echo '<div class="hikashop_product_discount">'.JText::_('PRICE_YOU_SAVE');
					if(bccomp($this->row->discount->discount_flat_amount,0,5)!==0){
						echo $this->currencyHelper->format(1*$this->row->discount->discount_flat_amount,$price->price_currency_id);
					}elseif(bccomp($this->row->discount->discount_percent_amount,0,5)!==0){
						echo -1*$this->row->discount->discount_percent_amount.'%';
					}
					echo JText::_('PRICE_DISCOUNT_END').'</div>';
				}
			}
			$i++;
		}
		echo JText::_('PRICE_END');
	}
	?></div>


Discover Miracle Water ~ www.ionlifeusa.com
The following user(s) said Thank You: lancert

Please Log in or Create an account to join the conversation.

Time to create page: 0.071 seconds
Powered by Kunena Forum