I found out a little trick to do what I need.
I defined 3 prices
- a specil price for the subscribers
- the price for the non-subscribers
- a price I use to show the specil price to the non-subscribers
It works for me because we don't allow to buy more than 60 bottles.
In this way the subscribers and the non-subscribers can see both the prices and evaluate the advantages to buy a subscription.
www.madeinvino.com/la-nostra-cantina.html
This is the custom viws product/listing_price (sorry but the comments are in italian)
<?php
/**
* @package HikaShop for Joomla!
* @version 2.1.0
* @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';
} ?>
<span 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'));
}
// Stefano Start
//foreach($this->row->prices as $price){
// if($first)$first=false;
// else echo JText::_('PRICE_SEPARATOR');
$specialPrice = false;
foreach($this->row->prices as $price) {
if($price->price_access != 'all') {
$specialPrice = true;
break;
}
}
foreach($this->row->prices as $price) {
if($first)$first=false;
else echo JText::_('PRICE_SEPARATOR');
//se il cliente ha un "abbonamento valido" può vedere il prezzo speciale appicato a lui, in quel caso non si fa vedere il prezzo pubblico "di appoggio" che ha qtà >= 100
if (($specialPrice && $price->price_min_quantity<100) || !$specialPrice ) {
if($specialPrice && $price->price_access == 'all') {
echo '<span class="hikashop_strike_price">';
}
// se l'utente non ha un abbonamento attivo, uso il prezzo con qtà >= a 100 per far vedere il prezzo speciale applicato ai clienti abbonati
if($price->price_min_quantity >=100 && $price->price_access == 'all') {
echo '<span class="hikashop_strike_price">';
}
// il divisore serve per "trasformare" (togliere 2 zeri) nelle quantità >= 100
$divisore = 1;
if ($price->price_min_quantity >=100) {
$divisore = 100;
}
// Stefano End
$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){
// Stefano Start
// echo '<span class="hikashop_product_price_with_min_qty hikashop_product_price_for_at_least_'.$price->price_min_quantity.'">';
// il divisore serve per "trasformare" (togliere 2 zeri) nelle quantità >= 100
echo '<span class="hikashop_product_price_with_min_qty hikashop_product_price_for_at_least_'.$price->price_min_quantity/$divisore.'">';
// Stefano End
}
$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',3)==3){
$config =& hikashop_config();
$this->params->set('show_discount',$config->get('show_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','-1')=='-1'){
$config =& hikashop_config();
$this->params->set('show_original_price',$config->get('show_original_price'));
}
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){
}
}
echo '<span class="'.implode(' ',$classes).'">';
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','-1')=='-1'){
$config =& hikashop_config();
$this->params->set('show_original_price',$config->get('show_original_price'));
}
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){
// Stefano Start
// echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
// il divisore serve per "trasformare" (togliere 2 zeri) nelle quantità >= 100
echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity/$divisore);
// Stefano End
}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').'<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>';
}
// Stefano Start
// Chiude lo spam per il barrato del prezzo assegnato a ALL nel caso in cui il cliente abbia un abbonamento valido
if($specialPrice && $price->price_access == 'all') {
echo '</span>';
}
// NB: ho messo le 3 righe qui sopra anche appena sopa $i++ ma di fatto non cambia nulla
// Chiude lo spam per il barrato del prezzo assegnato a ALL e qtà >= 100 nel caso in cui il cliente NON abbia un abbonamento valido
if($price->price_min_quantity >=100 && $price->price_access == 'all') {
echo '</span>';
}
if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $price->price_min_quantity>1){
// aggiunge la parte che inserisce la scritta PREZZO ESCLUSIVO per il prezzo speciale dei clienti con abbonamento valido
if($specialPrice && $price->price_access != 'all') {
//echo '<span style="color: #751f2c;"><em> Prezzo a te riservato</em></span>';
//echo '<span class="hikashop_special_price"> ** Prezzo esclusivo **</span>';
echo '<span class="hikashop_special_price">'.JText::_('PRICE_SPECIAL').'</span>';
}
// aggiunge la parte che inserisce la scritta PREZZO ESCLUSIVO per il prezzo FITTIZIO dei clienti che NON hanno abbonamento valido nel prezzo con qta >=100
if($price->price_min_quantity >=100 && $price->price_access == 'all') {
echo '<span class="hikashop_special_price_notallowed">'.JText::_('PRICE_SPECIAL').'</span>';
}
}
// Stefano End
$end = JText::_('PRICE_ENDING_'.$i);
if($end!='PRICE_ENDING_'.$i){
echo $end;
}
$i++;
}
echo JText::_('PRICE_END');
// Stefano Start
}
// Stefano End
}
?></span>
these are the some custom definition in the CSS
/* Stefano Start 2013-03-06*/
/* questa parte server per mettere il prezzo barrato nel caso in cui sia presente un prezzo speciale per certi utenti */
span.hikashop_strike_price {
text-decoration: line-through;
}
/* per formattare la scritta "prezzo riservato" */
span.hikashop_special_price {
color: #751f2c;
font-style: italic;
font-size: 9pt;
}
/* Stefano End */
/* per formattare la scritta "prezzo riservato" */
span.hikashop_special_price_notallowed {
color: #751f2c;
font-style: italic;
font-size: 9pt;
text-decoration: line-through;
vertical-align: top;
}
/* Stefano End */
this is what you see if you have a valid subscription
This is waht you see if you are not a subscriber
I hope this help other users.
Best