Adding to wishlist from Product listing

  • Posts: 51
  • Thank you received: 0
8 years 4 months ago #244828

-- 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.

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
8 years 4 months ago #244832

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: 8 years 4 months ago by Philip.

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

  • Posts: 51
  • Thank you received: 0
8 years 4 months ago #244845

I've sent an email too!

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
8 years 4 months ago #244847

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.

  • Posts: 51
  • Thank you received: 0
8 years 4 months ago #244906

Thanks for that - it seemed to do the trick!

Last edit: 8 years 4 months ago by Bower. Reason: was a bit hasty in my reply!

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

  • Posts: 51
  • Thank you received: 0
8 years 4 months ago #245968

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.

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
8 years 4 months ago #245990

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

Attachments:
Last edit: 8 years 4 months ago by Philip.

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

  • Posts: 51
  • Thank you received: 0
8 years 2 months ago #248754

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 2 months ago #248780

Hi,

I was able to reproduce the issue.

in media/com_hikashop/js/hikashop.js
Try changing the code

var varform = document[form];
to:
	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 :
	$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
	$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:
$wishlistAjax =	'if(hikashopCheckChangeForm(\'item\''.$formName.')){ return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';
to:
$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: 8 years 2 months ago by Jerome.

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

  • Posts: 51
  • Thank you received: 0
8 years 2 months ago #248832

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:

$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
$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.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 2 months ago #248833

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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 51
  • Thank you received: 0
8 years 2 months ago #248848

Hi
I found the code but I still can't find this bit in that file

$formName = ',hikashop_product_form';

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 2 months ago #248877

Hi,

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

Regards,


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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 51
  • Thank you received: 0
8 years 2 months ago #248887

nicolas wrote: and the 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
$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
	$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
$formName = ',hikashop_product_form';

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
8 years 2 months ago #248900

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 :
...
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 :
...
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

Attachments:
Last edit: 8 years 2 months ago by Philip.

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

  • Posts: 51
  • Thank you received: 0
8 years 2 months ago #249689

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 2 months ago #249734

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.

  • Posts: 51
  • Thank you received: 0
8 years 2 months ago #249834

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 2 months ago #249910

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.

  • Posts: 51
  • Thank you received: 0
8 years 2 months ago #249911

Have activated the account for you

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

Time to create page: 0.142 seconds
Powered by Kunena Forum