price display

  • Posts: 20
  • Thank you received: 0
12 years 13 hours ago #78512

Hi,

I am using business version of hikashop. login customers have their own price (group price), which are usually lower than the general price. how can I display both the prices after the customer logs in with a red slash on the genearal price ? Thanks.


Yong

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
12 years 3 hours ago #78541

Hi,

When HikaShop loads prices for a product, it would just load prices which are compatible with the current user.
The price with access "all" would be always load so, if the customer have an access to a specific price, the product page would display 2 prices (his special price and the price for "all").

You can edit the view "product | listing_prices" in order to change some design.
You can replace

foreach($this->row->prices as $price) {
  if($first)$first=false;
By
$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;
  if($specialPrice && $price->price_access == 'all') {
    echo '<span class="hikashop_strike_price">';
  }
With same kind of code near the end of the view:
  if($specialPrice && $price->price_access == 'all') {
    echo '</span>';
  }
  $i++;
}
echo JText::_('PRICE_END');

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 11 years 11 months ago by Jerome.

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

  • Posts: 20
  • Thank you received: 0
11 years 11 months ago #78599

Thank you, I did change the code at list_price.php as you showed, it didn't work. Maybe I messed up with the end of the code, my site won't show anything, there must be a code error. can you give me more details ?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 11 months ago #78604

Hi,

You are sure it didn't work ?
The code just add a span, after that you have to add a CSS rule in order to "strike" the text for " span.hikashop_strike_price ".

If there is no span "hikashop_strike_price" in your page, you have to check if you're editing the right view, for the right template (In HikaShop you can edit views per template).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 20
  • Thank you received: 0
11 years 11 months ago #78609

I am confused, i did edit listing_price.php, is that the right file to edit ? Thanks.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 11 months ago #78623

Hi,

Can you give us a link to your store ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 20
  • Thank you received: 0
11 years 11 months ago #78625

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 11 months ago #78635

Hi,

In the backend, on "Display > View", there are several drop down list at right.
One is for the template filtering. You have to select your current front-end template "mystique-fjt" in this list.
After that, you can select just "front end" views and make a search on "listing_price" using the textbox at the left.

After that, you should see just one "listing_price" view and this is the view you have to edit.

The modification are displayed only if you are logged with a special account.
With a guest user or with a user who is not in your special group, just one price would be proposed.

And in your CSS file add the rule:

span.hikashop_strike_price { text-decoration: line-through; }

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 11 years 11 months ago by Jerome.

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

  • Posts: 20
  • Thank you received: 0
11 years 11 months ago #78640

Thank you. I did edit the right file. after I changed as you indicated before, and the site won't show anything, I assume that there is something wrong with the code. I have no clue what I did wrong. I paste all the code after modification here. Please take a look and give me some hints.

<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.0.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'));
    }
    $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;
  if($specialPrice && $price->price_access == 'all') {
    echo '<span class="hikashop_strike_price">;
  }
      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 '<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',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){
          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').'<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;
      }
      if($specialPrice && $price->price_access == 'all') {
       echo '</span>';
      }
 
      $i++;
    }
    echo JText::_('PRICE_END');
  }
  ?></span>

Last edit: 11 years 11 months ago by Jerome.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 11 months ago #78657

Hi,

Did you test with a special account like I said in my previous post ?
Can you provide a screenshot while you are logged with an account which have access to several prices ?

I can't test anything in your website because I don't have any useful access but I don't see any problem for guest users.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 20
  • Thank you received: 0
11 years 11 months ago #78668

I can not test anything, because if I changed the code as shown above. the website stopped working due to internal error. so I changed back to the original state. if you can check the code i posted, and give me some suggestions, it would be very grateful. Thanks.

Yong

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 11 months ago #78670

Hi,

There was a missing colon in the code.
So please fix it by replacing:

echo '<span class="hikashop_strike_price">;
By
echo '<span class="hikashop_strike_price">';

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 20
  • Thank you received: 0
11 years 11 months ago #78676

This fixes the code, great, now I changed the code in listing_price, also modified the css. however when I logged in, i can see the price update, and only the discount prices are shown, no price for non-login users with a slash. is that right ?
Thank you for your quick reply.

I send you the mail with test account. in case you need it.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 11 months ago #78703

Hi,

Did you set an ACL for the "generic" price ?
You should let "all" access for this price if you want that everybody could see it.

If special users can't have access to the "generic" price, it is not possible for HikaShop to load it so, it is not possible to display it.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 20
  • Thank you received: 0
11 years 11 months ago #78743

Yes, for each of the product, I set two special prices for two groups of users respectively, and one price for all.

Thanks.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 11 months ago #78764

Hi,

So, it can't work, as I said in my previous post.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 20
  • Thank you received: 0
11 years 11 months ago #78792

Sorry, can you explain more about this. I setup three prices, two for special groups of customers, and one for all.(maybe I didn't make it clear in the previous message).

Also I did what you mentioned in your first reply in this thread, is that enough ? Thanks.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 11 months ago #78800

Hi,

I don't understand because it works fine in our local websites.
Could you send me a backend access by private message ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 20
  • Thank you received: 0
11 years 11 months ago #78841

I send the info to your email at HikaShop <This email address is being protected from spambots. You need JavaScript enabled to view it.>.

thanks.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 11 months ago #78881

Hi,

Thanks for the access.
I do not touch anything in your store.
But as you can see :


The display is correct in the product page.

In the product listing, it requires a patch which as been submit for a new version of HikaShop and which would require some tests and validation before his integration.
We want to be sure that the patch would not create side effects.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Attachments:

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

Time to create page: 0.096 seconds
Powered by Kunena Forum