"Add to wishlist" problems

  • Posts: 2143
  • Thank you received: 747
1 year 11 months ago #341934

-- HikaShop version -- : 4.5.1
-- Joomla version -- : 4.1.3
-- PHP version -- : 7.4.29

Hi,

I have "Enable the wishlists", "Enable multi whishlist" and "Display 'add to wishlist' button for free products" all set to yes.
Cart notification plugin is set to popup.

Clicking the "Add to wishlist" button:
... in product listing, free product: "Product not added to the wishlist"
... on product page, free product: "The product XYZ is not available"
... in product listing, $100: "Product not added to the wishlist"
... on product page, $100: "Product successfully added to the wishlist"
So, no matter the main config, it only works from the product page and if the product has a price set. Is it me? Or a bug?


Once wishlist(s) exist(s), I can view it/them through the cPanel (User control panel). But with a menu item of type "Cart listing" (cart type: Wishlist) I'm getting a 404-ish error: "Cannot access protected property Joomla\CMS\Menu\MenuItem::$params"
Call stack:

#	Function	Location
1	()	JROOT/components/com_hikashop/controllers/cart.php:416
2	CartController->listing()	JROOT/libraries/src/MVC/Controller/BaseController.php:735
3	Joomla\CMS\MVC\Controller\BaseController->execute()	JROOT/administrator/components/com_hikashop/helpers/helper.php:2312
4	hikashopController->execute()	JROOT/components/com_hikashop/hikashop.php:88
5	require_once()	JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:69
6	Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}()	JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
7	Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch()	JROOT/libraries/src/Component/ComponentHelper.php:389
8	Joomla\CMS\Component\ComponentHelper::renderComponent()	JROOT/libraries/src/Application/SiteApplication.php:204
9	Joomla\CMS\Application\SiteApplication->dispatch()	JROOT/libraries/src/Application/SiteApplication.php:243
10	Joomla\CMS\Application\SiteApplication->doExecute()	JROOT/libraries/src/Application/CMSApplication.php:278
11	Joomla\CMS\Application\CMSApplication->execute()	JROOT/includes/app.php:63
12	require_once()	JROOT/index.php:32

Thanks for your help.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
1 year 11 months ago #341938

Hi,

1. It will be hard to say much here without looking at the details of your setup and reproducing the issue there.
Could you provide a backend access and instructions to reproduce the issue with the "add to wishlist" button ?

2. Regarding the error, it's a joomla 4 compatibility issue which only happens during backward compatibility code when you have old view overrides. That's why no one reported it so far.
To fix it, we need to change the code:

				jimport('joomla.html.parameter');
				$menu_params = new HikaParameter( $menu->params );
				$cart_type = $menu_params->get('cart_type');
to:
				if(HIKASHOP_J30)
					$menuParams = $menu->getParams();
				elseif(is_object($menu->params)) {
					jimport('joomla.html.parameter');
					$menu_params = new HikaParameter( $menu->params );
				}
				if($menuParams) {
					$cart_type = $menu_params->get('cart_type');
				}
in the file components/com_hikashop/controllers/cart.php
Can you do the change on your website and confirm it fixes the problem for you too ?
We'll add the modification in HikaShop.

The following user(s) said Thank You: lousyfool

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

  • Posts: 2143
  • Thank you received: 747
1 year 11 months ago #341939

Hi Nicolas,

Thanks for your reply.

1. Uh... thought I already listed all relevant main config settings, plus 4 scenarios for you to be able to reproduce...
But ok, perhaps perhaps there's an issue in my case, albeit the site being very rudimentary as development has only just started.
I'll clone it and send you access credentials and URL of this thread via your contact form once done.

2. Just FYI, absolutely no view override here of any type. Again, just very fresh and basic setup... Cassiopeia etc.
Sorry but nope, this didn't fix it -- only changed the result slightly.
Still 404-ish error page, now "Call to a member function get() on null".
Call stack:

#	Function	Location
1	()	JROOT/components/com_hikashop/controllers/cart.php:422
2	CartController->listing()	JROOT/libraries/src/MVC/Controller/BaseController.php:735
3	Joomla\CMS\MVC\Controller\BaseController->execute()	JROOT/administrator/components/com_hikashop/helpers/helper.php:2312
4	hikashopController->execute()	JROOT/components/com_hikashop/hikashop.php:88
5	require_once()	JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:69
6	Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}()	JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
7	Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch()	JROOT/libraries/src/Component/ComponentHelper.php:389
8	Joomla\CMS\Component\ComponentHelper::renderComponent()	JROOT/libraries/src/Application/SiteApplication.php:204
9	Joomla\CMS\Application\SiteApplication->dispatch()	JROOT/libraries/src/Application/SiteApplication.php:243
10	Joomla\CMS\Application\SiteApplication->doExecute()	JROOT/libraries/src/Application/CMSApplication.php:278
11	Joomla\CMS\Application\CMSApplication->execute()	JROOT/includes/app.php:63
12	require_once()	JROOT/index.php:32
Nothing urgent... you'll also see once you have site access. And I'll get you FTP as well.

Thanks again & more soon.

EDIT:
Updated the call stack so you have correct line # for cart.php. (First I had some /* comments */ in, shifting the lines...)


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Last edit: 1 year 11 months ago by lousyfool. Reason: See note in post

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
1 year 11 months ago #341941

Hi,

1. There are many things which can influence if a product can be added or not. How the product is configured, the fact you're logged or not, other settings of the configuration, etc.

2. Please use this code instead:

				if(HIKASHOP_J30)
					$menu_params = $menu->getParams();
				elseif(is_object($menu->params)) {
					jimport('joomla.html.parameter');
					$menu_params = new HikaParameter( $menu->params );
				}
				if($menu_params) {
					$cart_type = $menu_params->get('cart_type');
				}
It was just a bad copy/paste on my part.

Last edit: 1 year 11 months ago by nicolas.
The following user(s) said Thank You: lousyfool

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

  • Posts: 2143
  • Thank you received: 747
1 year 11 months ago #341946

Hi again,

1. Yes, you're right. Instead of a clone I built another even fresher test site from scratch and -- tadaaa! -- adding to wishlist works perfectly fine. So, while I was logged in on the original site, I must have screwed up somewhere, indeed. Sorry for bothering, and never mind, I'll find the culprit.

2. Yup, with this code the error is gone, thanks.
But... a "cart listing" menu item always leads to the cPanel (User control panel), not to any wishlist listing (or cart listing, if set for cart) -- with "/user/cpanel" auto-appended to the menu item's alias. What's the purpose of the menu item type "cart listing", then?


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
1 year 11 months ago #341951

Hi,

2. The cart listing and the wishlist listing are there to display a listing of wishlists and a listing of carts.
If you have the enable multiple cart or the enable multiple wishlist settings turned off, then these menu items will direct to the control panel instead. So I suppose that it's what's going on here.

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

  • Posts: 2143
  • Thank you received: 747
1 year 11 months ago #341968

nicolas wrote: If you have the enable multiple cart or the enable multiple wishlist settings turned off, then these menu items will direct to the control panel instead. So I suppose that it's what's going on here.


Hi,

As I said in my initial post, all the time I had and have "Enable the wishlists", "Enable multi whishlist" and "Display 'add to wishlist' button for free products"turned on. But not the "Enable multi carts", because I sure hadn't guessed that this is necessary, too, though I know that technically wishlists are also carts.
You said, "enable multiple cart or the enable multiple wishlist", but just by chance I figured it must be "and": EDIT: Correction -- reading your sentence again, I now understand: only when turning on both "Enable multi carts" and "Enable multi whishlist" as well, something other than the cPanel appears. Not very intuitive and AFAIK nowhere explained, but now I do know, haha.

However, there's still an issue -- sorry. The "cart listing" menu item's setting for "cart" or "wishlist" does not matter, the page only shows the same "carts" listing. In my case now & here there is no cart, while a wishlist does exist. Plus there's "Notice: Undefined variable: menuParams in XYZ/components/com_hikashop/controllers/cart.php on line 421" -- the line number appearing to be in the region of the new code you had provided earlier.

Various screenshots attached.

Again, nothing too urgent, but thanks in advance for a final solution.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Attachments:
Last edit: 1 year 11 months ago by lousyfool. Reason: See strike-through and EDIT

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
1 year 11 months ago #341982

Hi,

The code was still wrong in www.hikashop.com/forum/wishlist/904468-a...problems.html#341941
I've modified there. Please try that new version of the code and it should take the type into account properly.

The following user(s) said Thank You: lousyfool

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

  • Posts: 2143
  • Thank you received: 747
1 year 11 months ago #341983

YESSSSS, now working!

Thanks again, Nicolas!


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

Time to create page: 0.068 seconds
Powered by Kunena Forum