Pricing display

  • Posts: 6
  • Thank you received: 0
9 years 4 months ago #237758

-- HikaShop version -- : 2.6.2
-- Joomla version -- : 3.5.1

I am having trouble putting the pricing in the way I'd like it. I have attached a screen shot of how it currently looks.
I would like it to say:
1-4 units $69.90 per unit incl. GST
4-49 units $65.50 per unit incl. GST
50+ units $59.50 per unit incl. GST

How do I go about doing this?

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #237783

Hi,

This will require the edition of the view "product / listing_price" and replace the following code:

				if($price->price_min_quantity>1){
					echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
				}else{
					echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
				}
Some PHP knowledges are required.
www.hikashop.com/support/documentation/1...ize-the-display.html

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

  • Posts: 6
  • Thank you received: 0
9 years 4 months ago #238155

Yes I have been playing around with different options in that bit of coding but still can't figure it out. What do I need to replace it with?

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

  • Posts: 6
  • Thank you received: 0
9 years 4 months ago #238161

This is the code I have so far

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 '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('%s or more - ',$price->price_min_quantity).'</span>';
				}else{
					echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
				}
			}

I have attached an image of how it looks.
I would like to have the pricing after the quantity but can't work out how to change that. And also have the different prices on separate lines

Attachments:

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
9 years 4 months ago #238240

Hi,

The pricing is displayed with that:

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');
			}
And the quantity with that:
if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
				if($price->price_min_quantity>1){
					echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
				}else{
					echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
				}
			}
so if you want to revert the order, just swap both.
You can add a line like that after the pricing display and it will go to the next line:
echo '<br/>';

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

  • Posts: 6
  • Thank you received: 0
9 years 4 months ago #238294

Hi Nicolas

So I am getting closer to what i want.

This is the code I have so far

echo '<span class="'.implode(' ',$classes).'">';
				if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
       		if($price->price_min_quantity>1){
         
				$minQties = array();
			foreach($this->row->prices as $priceBis){
				$minQties[] = $priceBis->price_min_quantity;
			}
			foreach($minQties as $key => $minQty){
				if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
   					if($price->price_min_quantity == $minQty){
     					$key++;
     					echo sprintf('%s - %s = ',$price->price_min_quantity,$minQties[$key]);
 			   		}
				}
			}
				}
			}
			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(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
				if($price->price_min_quantity>1){
					echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT').'</span>';
				}else{
					echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
				}
			}

Which gives me:
$76.89 per unit incl. GST
4 - 50= $72.05 per unit incl. GST
50 - = $65.45 per unit incl. GST

I have been playing around with the code and looked in old forums but can't get it to say:
1-4 = $76.89 per unit incl. GST
4 - 50= $72.05 per unit incl. GST
50 + = $65.45 per unit incl. GST


The code I tried replaced a section with:
if(count($minQties) >= 1 && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
    if($price->price_min_quantity == 0){
      $key++;
      echo sprintf('%s - %s off = ','1',$minQties[$key]);
    }
    elseif($price->price_min_quantity == $minQty || $price->price_min_quantity == 0){
      $key++;
      echo sprintf('%s - %s off = ',$price->price_min_quantity,$minQties[$key]);
    }else{
      echo sprintf('%s + = ',$price->price_min_quantity);
    }
}

But that gave me
$76.89 per unit Incl. GST
4 + = 4-50 off = 4 + = $72.05 per unit Incl. GST
50 + = 50 + = 50 - off $65.45 per unit Incl. GST

What am I doing wrong here?

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

  • Posts: 12953
  • Thank you received: 1778
9 years 4 months ago #238340

Hello,

In your case, the best solution will be to directly see what you have in the variables that you are using by using for example that kind of code :

var_dump($price);
To see what your exactly have in your $price variable and adapt your algorithm.

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

Time to create page: 0.082 seconds
Powered by Kunena Forum