like to have the price with option on top in show_default template

  • Posts: 334
  • Thank you received: 5
  • Hikashop Business
2 months 6 days ago #337018

-- HikaShop version -- : 4..1.1
-- Joomla version -- : 3.10.2
-- PHP version -- : 7.4.x

Hello,
In the view of the show default template, we now have the price of the product or the product variant on top. In the bottom we get the full price with options. We would like to show the full price on top as well.. how can i accomplish that???

Hope you can help..



Thanks,

Mark

Attachments:

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

  • Posts: 74542
  • Thank you received: 11498
  • MODERATOR
2 months 6 days ago #337020

Hi,

Moving the display of that price elsewhere in the interface is quite easy, you just have to move the "price with option" zone with the layout drag&drop interface when you're editing your show_default view file.
And if you don't have the interface because you've made too many modifications, you can move its code directly:

<!-- PRICE WITH OPTIONS -->
<?php
	if($this->params->get('show_price')) {
?>
		<span id="hikashop_product_price_with_options_main" class="hikashop_product_price_with_options_main">
		</span>
<?php
	}
?>
<!-- EO PRICE WITH OPTIONS -->
Duplicating it is more complex since you can only have one element with the same ID in HTML.
You would have to duplicate that code and change the ID in it, which means that you'll also have to edit the file option.php to add custom javascript code to handle that new ID.
For example, you could duplicate the code:
var target = d.getElementById("hikashop_product_price_with_options_main");
		if(target)
			o.xRequest("'.hikashop_completeLink('product&task=price'.$url_itemid,true,true).'", {mode:"POST",data:"price="+price_with_options.value,update:target});
That would lead to the AJAX request to get the price with options being done twice instead of once each time, so it's not that nice, but it's way easier than modifying the code to copy the data after the AJAX request.

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

  • Posts: 334
  • Thank you received: 5
  • Hikashop Business
2 months 3 days ago #337064

Thanks,

This works fine..
Super!! :)

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

  • Posts: 334
  • Thank you received: 5
  • Hikashop Business
2 months 1 day ago #337148

Hi,
As i said in my previous reply, your solution works fine.. but what i forgot is that if a product only has variants and no options the price of the product is gone.. how can i accomplish that if the product has no options it shows the price without options..
hope you understand what i mean..

Attachments:

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

  • Posts: 74542
  • Thank you received: 11498
  • MODERATOR
2 months 1 day ago #337156

Hi,

Well, HikaShop displays the price by default.
So there is nothing to do normally.
Which means that you've removed the display of the default price to only display the price with options. And of course, the price with options doesn't display when there are no options.
The system isn't made to display the price with options when there are no options. That would require complex changes.
I would rather recommand that you display the normal price displayed by HikaShop by default. And then, if you only want to display it when there are no options that's quite easy. You can just have that code like that:

if(empty($this->element->options)) {
 // default code of HikaShop to display the price without the options
}

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

  • Posts: 334
  • Thank you received: 5
  • Hikashop Business
2 months 9 hours ago #337222

Hi Nicolas,

Thanks for the reply. In which file do i need to have this code?
In the view -> product/options.php or the show_default?
Tried both,
but can not get the main price to show up..
Hope you can help a little more..
Thanks.

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

  • Posts: 334
  • Thank you received: 5
  • Hikashop Business
2 months 8 hours ago #337227

Hey Nicolas,

Thanks.. I think i figure it out.. and now it seems like it goes the way we want to have it..

I will check on multiple products to see ..

I am allready happy so far.. :)

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

Time to create page: 0.084 seconds
Powered by Kunena Forum