How to apply a discount to more then one product

  • Posts: 48
  • Thank you received: 0
12 years 7 months ago #47362

Would it be possible to add a discount to more then one product, by selecting 2 or 3 products from a category.
As far as i see, i have to make as much discounts because it works on one product.

I know i can use the discount for a whole category but thats not the option i seek.

If i have 100 products with a discount i have to make 100 discounts, that seems to be a lot of work.

Any solution?

With regards,
Guido

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

  • Posts: 13201
  • Thank you received: 2322
12 years 7 months ago #47535

Hi guido,

If you want to apply discounts to many different products.
The easiest way is to use export/import method.

Create unpublished categories, apply a discount on these categories.
Then export your products, edit the CSV, just let the "product_code" and "categories" columns.

Add the unpublished and discounted category to your product.
For example:

product_code,categories
my_product_1,"2,13"
Will add the category 13 to your product.
Import the file, and the discount will be applied on all the products wanted.

Here is the documentation for the import:
http://www.hikashop.com/en/support/documentation/integrated-documentation/73-hikashop-import.html

Last edit: 12 years 7 months ago by Xavier.

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

  • Posts: 252
  • Thank you received: 3
12 years 5 months ago #52069

Hello Xavier,
Will these way of adding discount to a product stay like this.
Because you have such a nice interface by clicking a product.
Would be very handy and time winning to do the selection of mutiple products in hika it self instead of import and export.

Boudewijn

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

  • Posts: 82821
  • Thank you received: 13368
  • MODERATOR
12 years 5 months ago #52141

There is no plan to change that in the short term. We have other priorities for the time being, especially that there are solutions to do already, even if it's not optimal to the way you want to use it.

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

  • Posts: 252
  • Thank you received: 3
12 years 5 months ago #52162

Thank you for your information Nicolas. I'll wait and see

Still a small question about the lay-out on the product overview page
It now shows -50% 39.98 per stuk

I would like to have like this
39.98 € (bigger font)
79.95 € u bespaart 50% (smaller font)

Can you tell me how and where I can code this?

Thanks in advance

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

  • Posts: 82821
  • Thank you received: 13368
  • MODERATOR
12 years 5 months ago #52243

The price display is handled by the file "listing_price" of the view "product" that you can edit via the menu Display->Views.
Here is a thread with some examples:
www.hikashop.com/en/forum/4-how-to/46230...iscounted-price.html

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

  • Posts: 252
  • Thank you received: 3
12 years 5 months ago #52259

Hi Nicolas,
Thank you so far.
I have copied the code.
But is looks a bit odd.
joomla25.dodowear.nl/index.php?option=co...ated_product=1139750

Can you tell me what to do. I'm not familiar with coding.
Thank you


<?php
/**
* @package HikaShop for Joomla!
* @version 1.5.6
* @author hikashop.com
* @copyright (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
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_BEGINNING');
$i=0;
foreach($this->row->prices as $price){
if($first)$first=false;
else echo JText::_('PRICE_SEPARATOR');
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.'">';
}
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_BEFORE_ORIG');

if($this->params->get('price_with_tax')){
echo $this->currencyHelper->format($price->price_value_without_discount_with_tax-$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_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_AFTER_ORIG').'</span>';


echo '<span class="hikashop_product_discount">' .JText::_('PRICE_DISCOUNT_START') .JText::_('PRICE_DISCOUNT_START1');
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 $this->currencyHelper->format($price->price_value_without_discount-$price->price_value,$price->price_currency_id);
echo -1*$this->row->discount->discount_percent_amount.'%';

}
echo JText::_('PRICE_DISCOUNT_END').'</span>';

}elseif($this->params->get('show_discount')==3){
}
}

if(isset($price->price_min_quantity) && empty($this->cart_product_price)){
if($price->price_min_quantity>1){
echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
}else{

echo JText::_('PER_UNIT');$first=true;
$i=0;
}
}


echo '<span class="hikashop_product_price hikashop_product_price_'.$i.'">';
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)){
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>';
}
$i++;
}
echo JText::_('PRICE_END');

}
?>

</span>

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

  • Posts: 82821
  • Thank you received: 13368
  • MODERATOR
12 years 5 months ago #52324

It's quite simple, you can use that code:

echo '<span style="font-size: 2em;">'.$this->currencyHelper->format($price->price_value_with_tax,$price->price_currency_id).'</span>';
echo '<br/>';
echo '<span style="text-decoration: line-through;">'.$this->currencyHelper->format($price->price_value_without_discount_with_tax,$price->price_currency_id).'</span> u bespaart '.$this->row->discount->discount_percent_amount.'%';

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

  • Posts: 252
  • Thank you received: 3
12 years 5 months ago #52334

Hi Nicolas
Looks like it's working
I only need get this first part removed
and the percentage doesn't need two digits

(79,95 €) PRICE_DISCOUNT_START133,59 €-50% per stuk
39,98 €
79,95 € u bespaart 50.00%

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

  • Posts: 82821
  • Thank you received: 13368
  • MODERATOR
12 years 5 months ago #52385

To round the percentage fee, you can do like that:

echo '<span style="font-size: 2em;">'.$this->currencyHelper->format($price->price_value_with_tax,$price->price_currency_id).'</span>';
echo '<br/>';
echo '<span style="text-decoration: line-through;">'.$this->currencyHelper->format($price->price_value_without_discount_with_tax,$price->price_currency_id).'</span> u bespaart '.round($this->row->discount->discount_percent_amount,0).'%';

To remove the prices before, remove the code before...

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

  • Posts: 252
  • Thank you received: 3
12 years 5 months ago #54215

Hello Nicolas,
Most things worked out. And it is working. Thank you so far.
Still two minor things.
Which part of the code should be removed to remove the percentage in front of the pricing.
For both the productpage and the productlisting page.
now it says:
-50%39.98
79.95 u bespaart 50%
How to remove the -50% in the front.

The other thing is that now this part of the text is shown everywhere.
179,95 €
0,00 € u bespaart 0%

But these products don't have discount. How can I set this off?

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

  • Posts: 82821
  • Thank you received: 13368
  • MODERATOR
12 years 5 months ago #54282

By default the %age is displayed by the line:
echo -1*$this->row->discount->discount_percent_amount.'%';
in the listing_price file. Remove it and it won't display.

You should add :

if(@$this->row->discount){
.... your code....
}


so that your code is only run when there is a discount.

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

  • Posts: 252
  • Thank you received: 3
12 years 5 months ago #54313

Hello Nicolas,
Done it. Thank you very much!

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

Time to create page: 0.093 seconds
Powered by Kunena Forum