Retail price on category's products listing

  • Posts: 209
  • Thank you received: 18
  • Hikashop Business
10 years 9 months ago #115763

Hi,
My store is for wholesale orders only where resellers can login and buy products at the wholesale price. I have set a Retail Price on each product and a product price with access set to "registered" users. This works fine as unregistered visitors can see the retail price on the product page - with no add to cart. Logged in registered users see both the MSRP and the wholesale price, and can add products to the cart at the wholesale price. Perfect.

However, how can I get the Retail price to show on the category's product listing for unregistered and registered users (with no add to cart button)? At the moment it shows no price at all. I'm sure there is some code I can put into a view but can't determine what the code should be or which view.

Product page view



Category product listing view

Attachments:

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

  • Posts: 2334
  • Thank you received: 403
10 years 9 months ago #115786

Hi there,

You just have to edit the file listing_price trough our views editor (Display>Views) and change these two lines:

if(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && JRequest::getCmd('layout') == 'show' && $this->params->get('from_module','') == ''){ ?>

and
if(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && JRequest::getCmd('layout') == 'show' && $this->params->get('from_module','') == '')

To:
if(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && $this->params->get('from_module','') == ''){ ?>
and
if(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && $this->params->get('from_module','') == '')

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

  • Posts: 209
  • Thank you received: 18
  • Hikashop Business
10 years 9 months ago #116124

Thanks Eliot, but that made no difference at all.

Still have the same issue - no price showing on the category listing.

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

  • Posts: 81566
  • Thank you received: 13075
  • MODERATOR
10 years 9 months ago #116126

Edit your products listing module via the link of your menu's options screen that you can find via the menu Display->Content menus. There, you can turn on the display of the prices.

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

  • Posts: 209
  • Thank you received: 18
  • Hikashop Business
10 years 9 months ago #116136

Hi Nicolas, I have already checked the box for display of prices in the listing module - but nothing shows:

Attachments:

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

  • Posts: 2334
  • Thank you received: 403
10 years 9 months ago #116155

Your "Show taxed prices" option is set to inherit.
Try to change it ;)

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

  • Posts: 209
  • Thank you received: 18
  • Hikashop Business
10 years 9 months ago #116317

Hi Eliot, I have tried setting it to "With tax", "No Tax" and "Display Both". It makes no change whatsoever. I still don't see the MSRP price on the category listing for the associated module. Any other ideas?

cheers!

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

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #116356

Hi,

Are you sure that you have made the changes given by Eliot in the good view of the correct template via Configuration > Display > Views ?

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

  • Posts: 209
  • Thank you received: 18
  • Hikashop Business
10 years 9 months ago #116547

Hi Xavier, yes, I think I have made the change as written by Eliot. I only have one template. The view I changed is product > listing_price.

Here is what my code looks like...

<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.2.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2013 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 && $this->params->get('from_module','') == ''){ ?>
  <span class="hikashop_product_msrp_price hikashop_product_price_full">
  <?php
    echo JText::_('PRODUCT_MSRP_BEFORE');
  ?>
    <span class="hikashop_product_price">
    <?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>
<?php } ?>

  <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(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && $this->params->get('from_module','') == '')
      echo JText::_('PRODUCT_MSRP_AFTER').' ';

    if($this->params->get('price_with_tax',3)==3){
      $config =& hikashop_config();
      $this->params->set('price_with_tax',$config->get('price_with_tax'));
    }
    foreach($this->row->prices as $price){
      if($first)$first=false;
      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;
      }
      $i++;
    }
    echo JText::_('PRICE_END');
  }
  ?></span>

But I can only see the MSRP on the product pages, not on the product listings for the categories.

????

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

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #116622

Is the product listing a menu or a module ?

Because in the code there is a check on the modules, if it's a module we don't display the MSRP price.

You can check if you have a value in the msrp with (to use before the if condition):

echo $this->row->product_msrp;

To display the msrp even if it's in a module, you can remove the code:
&& $this->params->get('from_module','') == ''

The following user(s) said Thank You: verzevoul

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

  • Posts: 209
  • Thank you received: 18
  • Hikashop Business
10 years 9 months ago #116644

Success! Xavier, that was it! I am using the Hikashop content module so as soon as I removed the module related code I got what I needed. Would be good to see this as a backend parameter in future versions as the ability to display the MSRP is extremely useful.

Thanks so much to you all for your help. You guys are the best. Very happy! :)

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

Time to create page: 0.111 seconds
Powered by Kunena Forum