Change product page to show price twice.

  • Posts: 32
  • Thank you received: 1
10 years 3 months ago #166496

-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : All major browsers
-- Error-message(debug-mod must be tuned on) -- : No error message!

Dear Hikashop users, admins and contributors.

We have changed the product page layout completely but can't get one thing to work. We are editing the following file:

product / show_default.php

In this we moved the bottom part inside the left container. The right container stayed the same. We are currently showing the price just above the bottom part in the left container:

So basically our page looks as follows:

TITLE TITLE TITLE TITLE TITLE TITLE TITLE TITLE
LEFT PART BEGINS | RIGHT PART BEGINS
PRICE | OPTIONS
BOTTOM PART | PRODUCT CHARACTERS
LEFT PART ENDS | RIGHT PART ENDS

But we want to have it like this:

TITLE TITLE TITLE TITLE TITLE TITLE TITLE TITLE
LEFT PART BEGINS | RIGHT PART BEGINS
PRICE | OPTIONS
BOTTOM PART | PRODUCT CHARACTERS
LEFT PART ENDS | RIGHT PART ENDS
PRICE <== Only visible for mobile users through css.

We already tried to copy the part that calculates the price and this works only for a small part because the price is not visible but the quantity field and add to cart buttons are showing.

The first price is working but the second is not visible.
Any help would be greatly appreciated.

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
10 years 3 months ago #166502

Hi,

The price is displayed with that code:

$this->setLayout('listing_price');
			echo $this->loadTemplate();
It's not linked with the quantity or add to cart, so I'm not sure what is the link with them and your problem ?
You just need to add that code at the end of the view file in order to get the price to display a second time at the bottom. Then you probably want to add some CSS on it to only display when needed.

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

  • Posts: 32
  • Thank you received: 1
10 years 3 months ago #166703

Thank you for that answer. But a new issue arrived.

We added this text and it shows the product price. But the product price is 0 (FREE) because the product price is basically made up out of options and characters. For instance you can choose the option small, medium and large with as characters red, green, blue and 30 more characters.

The price that is shown first says: Price with options: € 100,00
The second price (on the bottom of the page) says FREE

Can we change 'listing_price' to something else to show the price with options?

Thanks for helping.

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
10 years 3 months ago #166711

You can't do that by changing listing_price or calling listing_price a second time.
Instead, you need to add a span tag with a specific id and modify the javascript of the "option" view file so that it doesn't only update the span with the id hikashop_product_price_with_options_main but also the span with your specific id.
That's the JS for the default price with option display:
var totalPrice = window.document.getElementById('hikashop_product_price_with_options_main'); if(totalPrice) totalPrice.innerHTML = result;

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

  • Posts: 32
  • Thank you received: 1
10 years 3 months ago #167870

Thank you very much Nicolas.

We have a bit of a problem with finding the 'option' view file. We have looked in display>views and we found two option files but both does not have the var totalPrice in it.

View: product | File: option
View: product | File: option_price

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
10 years 3 months ago #167872

It's the first one. You can see that variable 20 lines from the end of the file.

The following user(s) said Thank You: loginsecure

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

  • Posts: 32
  • Thank you received: 1
10 years 2 months ago #173333

Dear Nicolas,

Thank you for your suggestions and tips. Everything is working fine now. Superb support as always.

Greetings LoginSecure.

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

Time to create page: 0.072 seconds
Powered by Kunena Forum