Can't Customise Display Views

  • Posts: 27
  • Thank you received: 0
5 years 2 days ago #305861

I've been trying to make various changes to the layout in HikaShop front end, including the removal of the cart is empty notification. I tried by making changes to the product / cart.php file and the checkout / cart .php file via the Display > Views customisation section. But absolutely no changes seem to be having any impact whatsoever on the front end.

I've even tried completely erasing the cart .php pages and absolutely nothing happens as a result. I tried this with all of the templates too, just incase it was related to the template, but that did nothing.

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
5 years 1 day ago #305866

Hi,

As you said, usually this is because you're doing the modifications for the wrong template.
But since you say it's not that, then I'm not sure.
Do you see the customization after you've saved it ? (a bin icon should appear under the "remove customization" column of the Display>Views menu for the view files with an override).
And if you open the customized view file, do you see your changes or an empty file ?
Sometimes security systems can mess up with the view overrides system as it flags the view overrides as potentially harmful (even if that's not the case). And in such cases, it's possible that the saving is refused, or that the saved override end up empty.

Note that you can also do view overrides via the Joomla override system (both systems are compatible together):
docs.joomla.org/Special:MyLanguage/J3.2:...r#Creating_Overrides

Last edit: 5 years 2 days ago by nicolas.

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

  • Posts: 27
  • Thank you received: 0
5 years 1 day ago #305890

Hi Nicolas, I think you may be right. The issue could be simply that I'm editing the wrong file. I tried the config option to show me what view files to edit, and I was able to make changes to elements on the front end. So perhaps my question should more be:

What file do I need to edit to adjust the alert for empty cart? As I edited the files mentioned in my original post which both have the "CART_EMPTY" language tag in them, yet my changes made no difference.

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
5 years 1 day ago #305896

Hi,

The empty cart message is not displayed by Hikashop but your template provider. HikaShop provides the text (which you can change with a translation override), but the look of it depends on your template:
stackoverflow.com/questions/10523287/how...message-php-template

Note that regarding the translations, there are two of them for the empty cart message: EMPTY_CART_MESSAGE and CART_EMPTY
You you need to change both as they are used in different situations.

Regarding the "Display view files" setting in the Hikashop configuration, it will mark all the view files used by HikaShop. You'll likely not see anything around the empty cart message since, as I said above, the cart empty message is not displayed by HikaShop.

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

  • Posts: 27
  • Thank you received: 0
5 years 1 day ago #305901

Thanks, I understood most of that already. The message may not be displayed by HikaCart, but the template still has to be told when to show a message and what to show in it. So my question is about finding what display view file handles the telling the template to show a message.

Because as I said I’ve adjusted two thus far that both mentioned ‘CART_EMPTY’ but my changes made no impact. So I may be editing the wrong file(s)?

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
5 years 17 hours ago #305903

Hi,

I don't understand what you mean ?
The empty cart message you see when you get redirected to another page is not in a view file.
It's done in a controller file.
For example, if you try to access a HikaShop checkout page while your cart is empty, the message will come from the code:

if(empty($cart) || empty($cart->cart_id) || empty($cart->products)) {
			if(!empty($cart->messages)) {
				// Display messages
				foreach($cart->messages as $msg) {
					$this->app->enqueueMessage($msg['msg'], $msg['type']);
				}
			}
			$this->setRedirect($checkoutHelper->getRedirectUrl(), JText::_('CART_EMPTY'));
			return true;
		}
in the file components/com_hikashop/controllers/checkout.php
You can't change that code with a view override as it's not a view file, it's a controller file.
Now there are many places in HikaShop which will trigger the display of that error message.
For example, there is also the code:
		if(empty($cart->products)) {
			$checkoutHelper->redirectBeforeDisplay = JText::_('CART_EMPTY');
		}
in the file administrator/components/com_hikashop/helpers/checkout/cart.php which is done when the cart is changed on the checkout.

Now, for all of these:
- if you want to change the text of that message, a translation override is the best
- if you want to change the look of that message, it's in your template that you want to do that: stackoverflow.com/questions/10523287/how...message-php-template
- besides, that then only thing left would be to remove it, and in that case, you would have to alter the code which triggers the display of the message. However, you need to beware that if you do that, you'll loose your changes after each update of HikaShop, and you might end up modifying the behavior of the system so you need to be careful when doing your changes.

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

  • Posts: 27
  • Thank you received: 0
4 years 11 months ago #306061

I've found the indirect solution to this has been to do a translation override for the message and set the text to nothing and for some reason this makes the message not display at all.

Which then allows us to create our own empty cart page.

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

Time to create page: 0.067 seconds
Powered by Kunena Forum