- Posts: 112
- Thank you received: 7
Wishlist not adding products
- karendunne
-
Topic Author
- Offline
Less
More
8 years 11 months ago #282508
by karendunne
Wishlist not adding products was created by karendunne
-- HikaShop version -- : 3.2.1
-- Joomla version -- : 3.8.1
-- PHP version -- : 7.0.25
-- Browser(s) name and version -- : Any
I'm workin in catalog mode for a site and the wishlist does not seem to work as expected.
As a logged in user, when I try to add a product to the wishlist it says that product is not available.
I have customized a bit the add to wishlist button to use this code in product view:
Which looks ok to me as far as I can see in your Demo.
I have checked that the products have stock and even setting stock to "Unlimited", they cannot be added.
Can you please let me know where I should look next? I cannot find why the products are not being added to the wishlist.
Thanks!!
Carlos
-- Joomla version -- : 3.8.1
-- PHP version -- : 7.0.25
-- Browser(s) name and version -- : Any
I'm workin in catalog mode for a site and the wishlist does not seem to work as expected.
As a logged in user, when I try to add a product to the wishlist it says that product is not available.
I have customized a bit the add to wishlist button to use this code in product view:
Code:
<a class="swan-heart-icon" href="<?php echo hikashop_completeLink($classical_url); ?>" rel="nofollow" onclick="if(window.hikashop.addToWishlist) { return window.hikashop.addToWishlist(this); }" data-addToWishlist="<?php echo $this->element->product_id ?>" data-addTo-div="hikashop_product_form" data-addTo-class="add_in_progress">
Which looks ok to me as far as I can see in your Demo.
I have checked that the products have stock and even setting stock to "Unlimited", they cannot be added.
Can you please let me know where I should look next? I cannot find why the products are not being added to the wishlist.
Thanks!!
Carlos
Please Log in or Create an account to join the conversation.
8 years 11 months ago #282516
by nicolas
Replied by nicolas on topic Wishlist not adding products
Hi,
It would be great if you could provide a test user account in such cases so that we can directly analyze the situation.
Right now, I can only provide some vague guidance. If you activate the display of the add to wishlist button (so that HikaShop displays its own button) do you see the button and does it work ?
Also, you're using the variable $this->element, but on a products listing, the data of the product is available in $this->row and not $this->element. Maybe that would explain why you get that error as the id you give is not the correct one ?
It would be great if you could provide a test user account in such cases so that we can directly analyze the situation.
Right now, I can only provide some vague guidance. If you activate the display of the add to wishlist button (so that HikaShop displays its own button) do you see the button and does it work ?
Also, you're using the variable $this->element, but on a products listing, the data of the product is available in $this->row and not $this->element. Maybe that would explain why you get that error as the id you give is not the correct one ?
Please Log in or Create an account to join the conversation.
- karendunne
-
Topic Author
- Offline
Less
More
- Posts: 112
- Thank you received: 7
8 years 11 months ago - 8 years 11 months ago #282938
by karendunne
Replied by karendunne on topic Wishlist not adding products
Hi Nicolas,
thank you very much for your reply!
I'm afraid it didn't help that much:
No, it has exactly the same behaviour.
No, I'm using the code shown for Product View, for Product DETAIL view
thank you very much for your reply!
I'm afraid it didn't help that much:
Right now, I can only provide some vague guidance. If you activate the display of the add to wishlist button (so that HikaShop displays its own button) do you see the button and does it work ?
No, it has exactly the same behaviour.
Also, you're using the variable $this->element, but on a products listing,
No, I'm using the code shown for Product View, for Product DETAIL view
This message contains confidential information
Last edit: 8 years 11 months ago by karendunne.
Please Log in or Create an account to join the conversation.
8 years 11 months ago #282978
by nicolas
Replied by nicolas on topic Wishlist not adding products
Hi,
From hat I can see, the issue is that you've deactivated the "Display 'add to cart' button for free products" setting in the HikaShop configuration, and that you didn't configure any price in the prices listing of the product (which you've actually removed from the product edition screen).
If I turn on that option, then it works fine.
From hat I can see, the issue is that you've deactivated the "Display 'add to cart' button for free products" setting in the HikaShop configuration, and that you didn't configure any price in the prices listing of the product (which you've actually removed from the product edition screen).
If I turn on that option, then it works fine.
The following user(s) said Thank You: karendunne
Please Log in or Create an account to join the conversation.
- karendunne
-
Topic Author
- Offline
Less
More
- Posts: 112
- Thank you received: 7
8 years 11 months ago #283015
by karendunne
Replied by karendunne on topic Wishlist not adding products
Thank you very much!!
And just in case you can provide a quick answer. Do you estore in the item object any information to show that the product is already in a wishlist? I want to change the button accordingly
Thanks!!
Carlos Cámara
And just in case you can provide a quick answer. Do you estore in the item object any information to show that the product is already in a wishlist? I want to change the button accordingly
Thanks!!
Carlos Cámara
Please Log in or Create an account to join the conversation.
8 years 11 months ago #283016
by nicolas
Replied by nicolas on topic Wishlist not adding products
Hi,
No, there is no such data in the product object that you have access to in the views. You would have to load the wishlist, go through the products in it and see if one is a match with some custom coding.
It's only a few lines of code so it's not that hard.
Something like that:
No, there is no such data in the product object that you have access to in the views. You would have to load the wishlist, go through the products in it and see if one is a match with some custom coding.
It's only a few lines of code so it's not that hard.
Something like that:
Code:
$cartClass = hikashop_get('class.cart');
$wishlist = $cartClass->getFullCart($cartClass->getCurrentCartId('wishlist'));
foreach($wishlist->products as $product){
if($product->product_id == $this->row->product_id){
// my process
}
}
The following user(s) said Thank You: karendunne
Please Log in or Create an account to join the conversation.
- karendunne
-
Topic Author
- Offline
Less
More
- Posts: 112
- Thank you received: 7
8 years 11 months ago #283218
by karendunne
Replied by karendunne on topic Wishlist not adding products
Thank you very much!! It's an easy solution indeed
Please Log in or Create an account to join the conversation.
Time to create page: 0.097 seconds