Change promotion display

  • Posts: 86
  • Thank you received: 0
12 years 11 months ago #31614

I've been struggling to display a promotion the way my customer wants.

It should like the attached picture, with the following changes:

1. Only the old price should be striped out
2. Now B 350 should be in a different color.

Can anyone tell me how to do this. I know I have to change it in the code below, but I have no idea how:

<?php
/**
* @package HikaShop for Joomla!
* @version 1.5.2
* @author hikashop.com
* @copyright (C) 2010-2011 HIKARI SOFTWARE. All rights reserved.
* @license www.hikashop.com/commercial_license.php
*/
defined('_JEXEC') or die('Restricted access');
?>
<span class="hikashop_product_price_full">
<?php
if(empty($this->row->prices)){
echo JText::_('FREE_PRICE');
}else{
$first=true;
echo JText::_('PRICE_PRODUCT');
foreach($this->row->prices as $price){
if($first)$first=false;
else echo JText::_('PRICE_SEPARATOR');
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);
}else{
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');
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')){
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>';
}
}
echo '<span class="hikashop_product_price">';
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($this->params->get('show_price_weight')){
if(!empty($this->element->product_id) && isset($this->row->product_weight) && bccomp($this->row->product_weight,0,3)){
$weight_price = $price->price_value_with_tax / $this->row->product_weight;
echo JText::_('PRICE_SEPARATOR').$this->currencyHelper->format($weight_price,$price->price_currency_id).' / '.JText::_($this->row->product_weight_unit);
}
}
}
echo JText::_('PRICE_END');
}
?></span>

Thanks in advance!

Gert.

Attachments:

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
12 years 11 months ago #31641

Hi,

You should not have to edit any PHP code to do that.
The old price is already stripped by default by HikaShop, so there is nothing to do.
For the color of the new price, you should be able to change it by adding some CSS like that:

.hikashop_product_price{ color: red !important; }

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

  • Posts: 86
  • Thank you received: 0
12 years 11 months ago #31870

Hi Nicholas,

I got a bit further with this, but still not as I want it.

If you look at the image you see that the line-through also strikes out the new price.

I have set the css for span.hikashop_product_price_before_discount to text-decoration=line-through
The css for span.hikashop_product_price is set to text-decoration=none

Still the new price shows a line-through.

I also added a new css class span.hikashop_product_price_after_discount

I need this because i want to show the new price in red, but if I do that in span.hikashop_product_price it changes the price for all products to red.

As you see in the picture I have managed to get this to work for the text before the new price, but I cannot get it to work for the new price. I think this requires changes in the code, but I cannot figure out how.

Could you please help me with this?

Attachments:

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
12 years 11 months ago #31899

The default system correctly strikes the discounted price. You can see that here:
www.demo.hikashop.com/index.php?option=c...e=&Itemid=78&lang=en
If it doesn't work properly for you, it means that you modified the code of the listing_price view file (which you apparently did to swap the discounted price and the normal price) but that you didn't do it correctly. Apparently there is a problem with the spans but hard to say without knowing what you modified and the resulting HTML code...

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

  • Posts: 86
  • Thank you received: 0
12 years 11 months ago #32018

Hi Nicholas,

I've tried to do this with the default system. It has the same problem on my site:

Gert.

Attachments:

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
12 years 11 months ago #32045

Only one price is stroke now where you had the two prices stroke before. So it's working properly. It's just a matter of adapting the text strings that you overrode.

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

Time to create page: 0.078 seconds
Powered by Kunena Forum