Customziation of price information

  • Posts: 35
  • Thank you received: 3
  • Hikashop Business
4 days 17 hours ago #366640

-- HikaShop version -- : 5.1.5
-- Joomla version -- : 5.2.6
-- PHP version -- : 8.4.5
-- Browser(s) name and version -- : Chrome 135.0.7049.85

Hi!

1st:
I create an online shop for a german local retailer. In germany all extended price information has to be displayed on every location the price is shown - such as the category product listings. Here I face some problems. How to display the whole price information area from the product page in the category product listing (-> attached screenshot)?

I have to display all these information at the place where the price is display in the category product listing.

2nd:
How to customize the product page? I know there are some templates or "views" in the configuration. But for the view "product" there are 50 (!) of them. How to know which to use if I want to change something? Is there any documentation?

In my case I have to change the order of the "price per weight" / "price weight" information.

Attachments:

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

  • Posts: 83603
  • Thank you received: 13533
  • MODERATOR
4 days 14 hours ago #366646

Hi,

1. The same view file is already used to display the price area on both the product page and the listing of products.
However, if you want to add the price per unit weight to the listings too, you need to change the line:

if(!empty($this->element->product_id) && isset($this->row->product_weight) && bccomp(sprintf('%F',$this->row->product_weight), 0, 3)) {
to:
if(isset($this->row->product_weight) && bccomp(sprintf('%F',$this->row->product_weight), 0, 3)) {
in the product / listing_price view file.

2. Here, we explain how to edit views and how to find which one to edit:
www.hikashop.com/support/documentation/1...-display.html#layout

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

  • Posts: 35
  • Thank you received: 3
  • Hikashop Business
4 days 12 hours ago #366651

nicolas wrote: However, if you want to add the price per unit weight to the listings too, you need to change the line:

if(!empty($this->element->product_id) && isset($this->row->product_weight) && bccomp(sprintf('%F',$this->row->product_weight), 0, 3)) {
to:
if(isset($this->row->product_weight) && bccomp(sprintf('%F',$this->row->product_weight), 0, 3)) {
in the product / listing_price view file.


Hm ... doesn't work. No display of weight or weight per unit. Nothing changed.

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

  • Posts: 83603
  • Thank you received: 13533
  • MODERATOR
4 days 28 minutes ago #366654

Hi,

Did you edit the view file for the template you're using on your frontend ?
If you're editing it for another template, then it won't change anything.

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

  • Posts: 35
  • Thank you received: 3
  • Hikashop Business
3 days 22 hours ago #366662

nicolas wrote: Did you edit the view file for the template you're using on your frontend ?
If you're editing it for another template, then it won't change anything.


I think, I'm right. See my screenshot.

Attachments:

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

  • Posts: 83603
  • Thank you received: 13533
  • MODERATOR
3 days 15 hours ago #366675

Hi,

It looks ok.
Can you provide the URL of the products listing page, and a backend access via our contact form so that we can check your modifications and the situation ?
www.hikashop.com/support/contact-us.html

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

  • Posts: 83603
  • Thank you received: 13533
  • MODERATOR
2 days 16 hours ago #366707

Hi,

The issue is that you've activated the "Advanced price display" setting of the "price display" tab of your menu item.
That mode doesn't use the same view file as on the product page as it allows you to configure the displayed prices. However, it doesn't have an option to support the price per unit weight for now.
I've deactivated that setting with your backend access and now I can see both the price and the price per unit weight on your products listing, thanks to the view override you made.

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

  • Posts: 35
  • Thank you received: 3
  • Hikashop Business
2 days 32 minutes ago #366732

nicolas wrote: The issue is that you've activated the "Advanced price display" setting of the "price display" tab of your menu item.
That mode doesn't use the same view file as on the product page as it allows you to configure the displayed prices. However, it doesn't have an option to support the price per unit weight for now.
I've deactivated that setting with your backend access and now I can see both the price and the price per unit weight on your products listing, thanks to the view override you made.


Ah, okay. Thanks!
I tried to add the product_weight the same way (used the view code from product page) but doesn't work. It seems that the weight variable is not available for the listings. What can I do? I have to display the weight the same way as on the product page.

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

  • Posts: 83603
  • Thank you received: 13533
  • MODERATOR
1 day 20 hours ago #366734

Hi,

The weight variable is available too. However, if you look at the code which displays the weight on the product page it's:

<!-- WEIGHT -->
<?php
if ($this->config->get('weight_display', 0)) {
	if(isset($this->element->product_weight) && bccomp(sprintf('%F',$this->element->product_weight),0,3)){ ?>
		<span id="hikashop_product_weight_main" class="hikashop_product_weight_main">
			<?php echo JText::_('PRODUCT_WEIGHT').': '.rtrim(rtrim($this->element->product_weight,'0'),',.').' '.JText::_($this->element->product_weight_unit); ?><br />
		</span>
	<?php
	}
}
?>
<!-- EO WEIGHT -->
in the file show_block_dimensions. There, the weight comes from the variable $this->element->product_weight
And you can see the weight unit comes from $this->element->product_weight_unit
So $this->element is the variable which contains the data of the product.
However, if you edit a view of the products listing, like the listing_img_title view file, you'll see that the data of the product is actually in $this->row, not in $this->element.
In fact, if you look at the listing_price view file, you can see that the prices are in $this->row->prices.
So, you can use the code from show_block_dimensions in listing_price or in listing_img_title. However, after copy/pasting the code, you need to change $this->element to $this->row in it to adapt to the name of the variable holding the product data on listings.

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

  • Posts: 35
  • Thank you received: 3
  • Hikashop Business
1 day 19 hours ago #366742

nicolas wrote: However, if you edit a view of the products listing, like the listing_img_title view file, you'll see that the data of the product is actually in $this->row, not in $this->element.
In fact, if you look at the listing_price view file, you can see that the prices are in $this->row->prices.
So, you can use the code from show_block_dimensions in listing_price or in listing_img_title. However, after copy/pasting the code, you need to change $this->element to $this->row in it to adapt to the name of the variable holding the product data on listings.

Ah okay, thanks for this information. I'm not a coder but designer. ;)

Okay ... in the meanwhile I could find a solution. Thanks again!

Last edit: 1 day 19 hours ago by Rusty.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum