Skip to main content

Adding to wishlist from Product listing

More
10 years 2 months ago #244828 by Bower
-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.5

Hi

I dont seem to be able to add to the wishlist (favourites) from the product listing page but clicking through to the product item I can add to wishlist there - am wanting to omit the extra step.

Any ideas?

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

More
10 years 2 months ago - 10 years 2 months ago #244832 by Philip
Hello,

Hard to tell, can you provide an Url link in order to see it by ourself ? Some Screenshot of your Item Menu Configuration can be useful to.

Note : You can provide these elements if needed thanks to our Contact us form, just don't forget to add an Url link to this topic.

Awaiting news from you.

Regards
Last edit: 10 years 2 months ago by Philip.

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

More
10 years 2 months ago #244845 by Bower
I've sent an email too!

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

More
10 years 2 months ago #244847 by Xavier
Hi,

If you switch the state of the option "Use AJAX when possible for add to cart buttons" in Configuration > Main > Advanced settings, does that solve the issue ?

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

More
10 years 2 months ago - 10 years 2 months ago #244906 by Bower
Thanks for that - it seemed to do the trick!
Last edit: 10 years 2 months ago by Bower. Reason: was a bit hasty in my reply!

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

More
10 years 2 months ago #245968 by Bower
Hi

I thought this had solved the problem but unfortunately it hasn't entirely fixed it!

On visiting this url 185.123.96.101/~ewga9996/index.php/glassware I click "add to favourites" on any product and the popup appears saying it's been successfully added to the cart - however I'm not logged in!

If I then click on another "Add to favourites" button the popup appears telling me I must be logged in to "add to favourites".

I also noticed that after the first click "?popup=1" gets appended to the URL.

Would you mind checking this out as this doesn't seem to work correctly!

Thanks

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

More
10 years 2 months ago - 10 years 2 months ago #245990 by Philip
Hello,

Do you have some override views ? And especially, in product/listing_div view because, the first thing that is strange is that by default in HikaShop, If you're not logged, "Add to Whishlist" (Add to favorite in your case) button won't be display.
If you have some override (save and keep the file aside) can you try to remove it, and see if that solve your last issue ?

Note : To check your override view :
- Go to Components => HikaShop => Configuration
- On Display dropdown select Views
- Use the three filter dropdown to find your view product, in your front-end template



To learn more about override system, check this tutorial, here

Awaiting news from you.

Regards
Last edit: 10 years 2 months ago by Philip.

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

More
10 years 1 month ago #248754 by Bower
Hi Philip

Thanks for the reply. I initially thought the overrides could be the problem once you had pointed it out however I have deleted all the template overrides and customisation, used the default protostar template and reinstalled Hikashop but the issue still remains where the "Add to Wishlist" button appears if you are not logged in, on first click appears to add the item to the cart then on subsequent clicks you are told "you must be logged in to add items to the wishlist".

Any further help would be much appreciated!

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

More
10 years 1 month ago - 10 years 1 month ago #248780 by nicolas
Hi,

I was able to reproduce the issue.

in media/com_hikashop/js/hikashop.js
Try changing the code
Code:
var varform = document[form];
to:
Code:
var varform = null; if(typeof(form) == 'object' && form.form) varform = form.form; else if(typeof(form) == 'string') varform = document[form];

in the file "quantity" of the view "product" via the menu display>Views.
Replace :
Code:
$formName = ',hikashop_product_form'; $cleanFormName = str_replace(array('\'',','),'',$formName); $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\''.$formName.')){ var typeField = document.querySelector(\'form[name='.$cleanFormName.'] input[name=cart_type]\'); if(typeField !== null){typeField.value = \'wishlist\';} return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';
to
Code:
$formName = ',\'hikashop_product_form\''; $cleanFormName = str_replace(array('\'',','),'',$formName); $module_id = $this->params->get('from_module', 0); $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\',this)){ var typeField = document.getElementById(\'hikashop_cart_type_'.$this->row->product_id.'_'.$module_id.'\'); if(!typeField){typeField = document.getElementById(\'cart_type\'); } if(typeField){typeField.value = \'wishlist\'; console.log(typeField); } return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';
and the code:
Code:
$wishlistAjax = 'if(hikashopCheckChangeForm(\'item\''.$formName.')){ return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';
to:
Code:
$wishlistAjax = 'if(hikashopCheckChangeForm(\'item\',this)){ return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';
That makes it work properly on my end.
Last edit: 10 years 1 month ago by Jerome.

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

More
10 years 1 month ago #248832 by Bower
Hi Nicolas

Where do I find this code? - couldn't find it in

media/com_hikashop/js/hikashop.js
or
in the file "quantity" of the view "product" via the menu display>Views.


nicolas wrote: and the code:

Code:
$formName = ',hikashop_product_form'; $cleanFormName = str_replace(array('\'',','),'',$formName); $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\''.$formName.')){ var typeField = document.querySelector(\'form[name='.$cleanFormName.'] input[name=cart_type]\'); if(typeField !== null){typeField.value = \'wishlist\';} return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';
to
Code:
$formName = ',\'hikashop_product_form\''; $cleanFormName = str_replace(array('\'',','),'',$formName); $module_id = $this->params->get('from_module', 0); $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\',this)){ var typeField = document.getElementById(\'hikashop_cart_type_'.$this->row->product_id.'_'.$module_id.'\'); if(!typeField){typeField = document.getElementById(\'cart_type\'); } if(typeField){typeField.value = \'wishlist\'; console.log(typeField); } return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';

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

More
10 years 1 month ago #248833 by Jerome
Hi,

Please re-read the Nicolas' message ; I made it a little more explicit about the files.

Regards;

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

More
10 years 1 month ago #248848 by Bower
Hi
I found the code but I still can't find this bit in that file
Code:
$formName = ',hikashop_product_form';

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

More
10 years 1 month ago #248877 by Jerome
Hi,

I am afraid that I don't understand your message.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

More
10 years 1 month ago #248887 by Bower

nicolas wrote: and the code:

Code:
$formName = ',hikashop_product_form'; $cleanFormName = str_replace(array('\'',','),'',$formName); $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\''.$formName.')){ var typeField = document.querySelector(\'form[name='.$cleanFormName.'] input[name=cart_type]\'); if(typeField !== null){typeField.value = \'wishlist\';} return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';
to
Code:
$formName = ',\'hikashop_product_form\''; $cleanFormName = str_replace(array('\'',','),'',$formName); $module_id = $this->params->get('from_module', 0); $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\',this)){ var typeField = document.getElementById(\'hikashop_cart_type_'.$this->row->product_id.'_'.$module_id.'\'); if(!typeField){typeField = document.getElementById(\'cart_type\'); } if(typeField){typeField.value = \'wishlist\'; console.log(typeField); } return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';



I found this code to be able to replace
Code:
$cleanFormName = str_replace(array('\'',','),'',$formName); $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\''.$formName.')){ var typeField = document.querySelector(\'form[name='.$cleanFormName.'] input[name=cart_type]\'); if(typeField !== null){typeField.value = \'wishlist\';} return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';

but I wasn't able to find this code in the file
Code:
$formName = ',hikashop_product_form';

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

More
10 years 1 month ago - 10 years 1 month ago #248900 by Philip
Hello,

That's quite strange, this line have to be there, and especially if your on HikaShop 2.6.3.

See this screenshot :



So, I suggest you to add this missing line, more precisely (if I use your code), remove this :
Code:
... if($formName == ',0') $cleanFormName = str_replace(array('\'',','),'',$formName); $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\''.$formName.')){ var typeField = document.querySelector(\'form[name='.$cleanFormName.'] input[name=cart_type]\'); if(typeField !== null){typeField.value = \'wishlist\';} return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }'; ...
For this :
Code:
... if($formName == ',0') $formName = ',\'hikashop_product_form\''; $cleanFormName = str_replace(array('\'',','),'',$formName); $module_id = $this->params->get('from_module', 0); $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\',this)){ var typeField = document.getElementById(\'hikashop_cart_type_'.$this->row->product_id.'_'.$module_id.'\'); if(!typeField){typeField = document.getElementById(\'cart_type\'); } if(typeField){typeField.value = \'wishlist\'; console.log(typeField); } return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }'; ...

Hope that's will help you.

Regards
Last edit: 10 years 1 month ago by Philip.

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

More
10 years 2 weeks ago #249689 by Bower
Hi

I found that the quantity.php file was from hikashop 2.6.1 - must have been an override still there from when I updated to 2.6.3 which is why I couldn't find the code!

Anyhow - I decided to take a backup - update all the software locally - so am now on joomla 3.6.2 and hikashop 2.6.4 - I'm also using the protostar default template with no overrides or customisation and the issue still exists. :(

Any help greatly appreciated - Thanks

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

More
10 years 2 weeks ago #249734 by nicolas
Hi,

I've checked your website and I don't see the modifications that I talked about in www.hikashop.com/forum/wishlist/885431-a...-listing.html#248780
Cna you please make sure that you made these changes ?

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

More
10 years 2 weeks ago #249834 by Bower
Hi

I did the changes locally and have now uploaded them here

185.123.96.101/~ewga9996/test/index.php/glassware

Thanks

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

More
10 years 2 weeks ago #249910 by nicolas
Hi,

I wanted to look at the issue but I'm not receiving the activation link for the user account I had to create to be able to test the wishlist.

Could you activate the account ?

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

More
10 years 2 weeks ago #249911 by Bower
Have activated the account for you

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

Time to create page: 0.341 seconds
Powered by Kunena Forum