No different kind of units in the frontend

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

-- url of the page with the problem -- : not visible because of development
-- HikaShop version -- : 2.3.0
-- Joomla version -- : 2.5.18
-- PHP version -- : 5.4.16
-- Browser(s) name and version -- : Firefox 25.0.1

I need to display different kind of units in the frontend, e.g. per person, per piece and more

I have made a custom field, which is displayed in my article screen. But what do I have to change in the listing_price.php file in order to display the units i have entered?

I am no php programmer, so could anybody help me with this?

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

  • Posts: 84243
  • Thank you received: 13689
  • MODERATOR
11 years 6 months ago #144899

It's explained in the "I sell packed products, how can I change "each" text in the product page ?" section of our FAQ:
www.hikashop.com/support/support/documen...on/106-faq.html#tran

In the menu Display -> Views, edit the product / listing_price.php file. In this file, replace:
echo JText::_('PER_UNIT');

By:
if(isset($this->element->main)) echo JText::_($this->element->main->salemethod);
elseif(isset($this->row)) echo JText::_($this->row->salemethod);
else echo JText::_($this->element->salemethod);

And to finish, you just have to create a new translation, in Display -> Languages, edit your language file and add in the override area :
PER_PACK="each pack"

This translation is an example, but you can write what you want.

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

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

Hi,

I saw that post you are referring to, but there is a difference in files I think, because echo JText::_('PER_UNIT'); is not there in my version of the file. Instead of that, this is what I find:

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

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

  • Posts: 12953
  • Thank you received: 1778
11 years 6 months ago #144998

Hi,
In your case you'll just have to replace the line :

echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
By :
if(isset($this->element->main)) echo JText::_($this->element->main->salemethod);
elseif(isset($this->row)) echo JText::_($this->row->salemethod);
else echo JText::_($this->element->salemethod);

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

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

Super. It works just fine.

Thank you for your time and effort.

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

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

This works fine now, but unfortunatelyI now see that the following "problem" occurs in the frontend when it comes to displaying the current availability of the item. It only shows "articles in stock" and not such thing as "seats available" of "sets available"

Where do I have to change this?

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

  • Posts: 84243
  • Thank you received: 13689
  • MODERATOR
11 years 6 months ago #145096

You can change any text in HikaShop with a translation override:
www.hikashop.com/download/languages.html#modify

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

Time to create page: 0.073 seconds
Powered by Kunena Forum