Hide retail prices in products that only have product prices

  • Posts: 20
  • Thank you received: 1
8 years 6 months ago #256153

-- url of the page with the problem -- : chromothesis.gr/index.php/construction/tile-adhes
-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.4

Hello,
I run a small e-shop and I have an issue with the products that have no retail price.
As you will see in the following link I have 3 products without retail price ( 0,00$ value) and one product with retail price which it shows correctly.

The same problem appears in the shopping cart if a product has no retail price then it shows 0,00$

I would like to HIDE the retail price for the products that have no retail value instead of showing 0.00$ and only show the product price.

chromothesis.gr/index.php/construction/tile-adhes




Thank you in advance

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
8 years 6 months ago #256176

Hi,

That's already the case on our end.
Your display of the product page has been customized to display the retail price like that.
As we don't know how it was customized, we can't say what to change.
I can only say that it probably comes from the file templates/YOUR_TEMPLATE/html/com_hikashop/product/listing_price.php
You can try renaming it and that should fix that. But then, the display of the price will look like it looks by default in HikaShop, so you might need to add extra CSS to compensate.
So the best would be to ask the person who did that customization (it might be your template provider).

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

  • Posts: 20
  • Thank you received: 1
8 years 6 months ago #256256

Hi, can you take a quick look at the listing_price.php and tell me what's wrong with it?

I just added some code to make the retail price show with line-through style (hikashop_product_price_catalog) but probably messed up something else :(
I appreciate your help,
Daniela

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.6.4
 * @author	hikashop.com
 * @copyright	(C) 2010-2016 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';
}
if(isset($this->element->main->product_msrp) && !(@$this->row->product_msrp > 0.0) )
	$this->row->product_msrp = $this->element->main->product_msrp;
if(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && JRequest::getCmd('layout') == 'show' && $this->params->get('from_module','') == ''){ ?>
	<span class="hikashop_product_msrp_price hikashop_product_price_full">
		<span class="hikashop_product_msrp_price_title">
		<?php
			echo JText::_('PRODUCT_MSRP_BEFORE');
		?>
		

		
	</span>
<?php } ?>
<span class="hikashop_product_price_catalog">
<?php
			$mainCurr = $this->currencyHelper->mainCurrency();
			$app = JFactory::getApplication();
			$currCurrency = $app->getUserState( HIKASHOP_COMPONENT.'.currency_id', $mainCurr );
			$msrpCurrencied = $this->currencyHelper->convertUniquePrice($this->row->product_msrp,$mainCurr,$currCurrency);
			if($msrpCurrencied == $this->row->product_msrp)
				echo $this->currencyHelper->format($this->row->product_msrp,$mainCurr);
			else
				echo $this->currencyHelper->format($msrpCurrencied,$currCurrency).' ('.$this->currencyHelper->format($this->row->product_msrp,$mainCurr).')';
		?></span>
		</span>
	<span class="hikashop_product_price_full<?php echo $class; ?>">
	<?php
	if(empty($this->row->prices) || $this->row->prices[0]->price_value_with_tax == 0.0){
		echo JText::_('FREE_PRICE');
	}else{
		$first = true;
		echo JText::_('PRICE_BEGINNING');
		$i=0;

		if(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && JRequest::getCmd('layout') == 'show' && $this->params->get('from_module','') == ''){
			echo '<span class="hikashop_product_our_price_title">'.JText::_('PRODUCT_MSRP_AFTER').'</span> ';
		}

		$config =& hikashop_config();
		if($this->params->get('price_with_tax',3)==3){
			$this->params->set('price_with_tax',$config->get('price_with_tax'));
		}
		if($this->params->get('show_discount',3)==3){
			$this->params->set('show_discount',$config->get('show_discount'));
		}
		if($this->params->get('show_original_price','-1')=='-1'){
			$this->params->set('show_original_price',$config->get('show_original_price'));
		}
		if($this->params->get('show_original_price','-1')=='-1'){
			$this->params->set('show_original_price',$config->get('show_original_price'));
		}

		foreach($this->row->prices as $k => $price){
			if($first)$first=false;
			else echo JText::_('PRICE_SEPARATOR');
			if(!empty($this->unit) && isset($price->unit_price)){
				$price =& $price->unit_price;
			}
			$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 '<span 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')==1){
					echo '<span class="hikashop_product_discount">'.JText::_('PRICE_DISCOUNT_START');
					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').'</span>';
				}elseif($this->params->get('show_discount')==2){
					echo '<span 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').'</span>';
				}elseif($this->params->get('show_discount')==3){

				}
			}

			$attributes = '';
			if(!empty($this->element->product_id) && !@$this->element->displayed_price_microdata){
				$round = $this->currencyHelper->getRounding($price->price_currency_id, true);
				$this->element->displayed_price_microdata = true;
				if($this->params->get('price_with_tax')){
					$attributes = ' itemprop="price" content="'. str_replace(',','.',$this->currencyHelper->round($price->price_value_with_tax, $round)) .'"';
				}else{
					$attributes = ' itemprop="price" content="'. str_replace(',','.',$this->currencyHelper->round($price->price_value, $round)) .'"';
				}
			}
			echo '<span class="'.implode(' ',$classes).'"'.$attributes.'>';

			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 '</span> ';
			if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
				if($price->price_min_quantity>1){
					echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
				}else{
					echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
				}
			}
			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').'<span 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 '</span>';
				}
			}
			if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $price->price_min_quantity>1){
				echo '</span>';
			}
			$end = JText::_('PRICE_ENDING_'.$i);
			if($end!='PRICE_ENDING_'.$i){
				echo $end;
			}
			$i++;
		}
		echo JText::_('PRICE_END');

	}
	?></span>

Last edit: 8 years 6 months ago by Philip.

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

  • Posts: 4820
  • Thank you received: 654
  • MODERATOR
8 years 6 months ago #256288

Hello,

I was okey to have a quick look in order to find where is the issue, but I don't really understand your aim when you modify this file, and so it will take a lot of time to understand it and find what's wrong.
You have to understand that we are here, to help people to configure HikaShop, and developer to custom it by give way to process and direction, you can't ask us to correct custom code, or do the customization for you.

For this, the best things is to process like Nicolas told you, in order to avoid to have price with 0 value.

Regards

Last edit: 8 years 6 months ago by Philip.
The following user(s) said Thank You: danielle71

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

  • Posts: 20
  • Thank you received: 1
8 years 6 months ago #256351

Hi Philip, thank you for taking the time to reply. In the Hikashop script you have the same style applied to both retail price and product price. I was trying to add a style for the retail price (line-through and red letters without changing the product price (our price).
The lines I have added to the listing_price file are located near the beginning of the php file:


<span class="hikashop_product_price_catalog">
<?php
$mainCurr = $this->currencyHelper->mainCurrency();
$app = JFactory::getApplication();
$currCurrency = $app->getUserState( HIKASHOP_COMPONENT.'.currency_id', $mainCurr );
$msrpCurrencied = $this->currencyHelper->convertUniquePrice($this->row->product_msrp,$mainCurr,$currCurrency);
if($msrpCurrencied == $this->row->product_msrp)
echo $this->currencyHelper->format($this->row->product_msrp,$mainCurr);
else
echo $this->currencyHelper->format($msrpCurrencied,$currCurrency).' ('.$this->currencyHelper->format($this->row->product_msrp,$mainCurr).')';
?></span>
</span>


If you can't help me it's ok, I appreciate your effort anyway.

Thank you again,
Daniela

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

  • Posts: 20
  • Thank you received: 1
8 years 6 months ago #256451

NEVER MIND, I FOUND IT!!!
THANK YOU ANYWAY, I know you are trying your best to help people and it is well appreciated :) !!!

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
8 years 6 months ago #256399

Hi,

You should add a check around your code like that:

<?php if(!empty($this->row->product_msrp){ ?>
... your code  ....
<?php } ?>

The following user(s) said Thank You: danielle71

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

Time to create page: 0.056 seconds
Powered by Kunena Forum