unpublishing a former default variant results in 404

  • Posts: 138
  • Thank you received: 8
  • Hikashop Business
1 month 2 days ago #364469

Hi, me again....what can i say :(

I have a product and it has some variants, and the default variant is out of stock not coming back.
So when i et another variant as deafault that works.
If i unpublish the former default variant, it results in a 404 of the whole product page.

I tried doing mass actions canonical urls but that does nothing.

How do i solve this? i dare not delete the variant as then i could not solve the 404 issue.
Thanks

Attachments:
Last edit: 1 month 2 days ago by NicoW.

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

  • Posts: 83007
  • Thank you received: 13398
  • MODERATOR
1 month 2 days ago #364470

Hi,

I don't see why that would be the case. We would need to check the settings of the product and temporarily reproduce the issue. Could you provide a backend access via our contact form ?
www.hikashop.com/support/contact-us.html

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

  • Posts: 4760
  • Thank you received: 647
  • MODERATOR
1 month 8 minutes ago #364491

Hello,

We have received your elements, but are unable to complete them, can you please complete them with this:
- The product affected by your problem previously described.
- Specify which variant will therefore remain at 0 stock (and will not return) in this product.

In order to precise our idea, we have explore your site, and wasn't able to see a 404 error by reaching product with variants, OR by select a variant with a 0 stock.
Guide us more in order to better understand the situation.

Regards

Last edit: 1 month 1 hour ago by Philip.

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

  • Posts: 138
  • Thank you received: 8
  • Hikashop Business
3 weeks 6 days ago #364558

Hi,

You could not find the issue because i will not leave my site running with errors. this is after all the most important sales season of the year.

The product is called horizon, the variant is the 'White' 'WITH' variant which was the default variant until it run out of stock.
I have now replaced the image with an image explaining it will not come back.

If i disable the variant, the website gives an error.

BTW, the same happens if i add text in the description of the variant. (since you rebuild them to have separate boxes for description, specs, video, compare)

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

  • Posts: 83007
  • Thank you received: 13398
  • MODERATOR
3 weeks 5 days ago #364598

Hi,

Thanks for the details.
I was able to reproduce the issue by temporarily unpublishing the variant with a stock at 0.
That should indeed not happen. I'm not sure why it would.
Now, unpublishing the variant is the same as deleting it, so you could delete the variant and you should hopefully not have the same problem.
But to understand why this is happening, we'll need a FTP access in order to dig into the issue.
Could you provide it via our contact form ?

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

  • Posts: 83007
  • Thank you received: 13398
  • MODERATOR
3 weeks 1 day ago #364651

Hi,

I've spent a few hours trying to understand the problem.
I've narrowed it down to the line:

echo HTMLHelper::_('content.prepare', $html);
in the view file override product / show.
This is custom code which is not in HikaShop by default.
I've changed it to :
echo JHTML::_('content.prepare',$html);
as it corresponds more closely to what is there by default in HikaShop:
		<div id="hikashop_product_description_<?php echo $variant_name; ?>" style="display:none;"><?php
			echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$variant->product_description));
		?></div>
and the error doesn't happen.

It doesn't help that you have a mechanism on your website which makes the page redirects to a custom 404 page whenever there is a PHP fatal error happening and I don't know how to deactivate that.
Ideally, you can look in the PHP error log of your server which should contain the fatal error message.

But my change seems to help so I guess the problem can be marked as solved.

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

  • Posts: 138
  • Thank you received: 8
  • Hikashop Business
3 weeks 1 day ago #364653

Thanks, i'll thry whatever happens after black friday sales.
I'll pass this discussion on to rcatheme as he makes a lot of templates for hikashop he can probably learn from this.
It's still strange though about adding text into a variant description resulting in the same error as disabling a variant. But whatever is fixed im happy about.

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

  • Posts: 138
  • Thank you received: 8
  • Hikashop Business
3 weeks 20 hours ago #364676

This is his reply, maybe this is for amongst you 2 as i have no idea:

echo HTMLHelper::_('content.prepare', $html); and echo JHTML::_('content.prepare', $html); are the same. Starting with Joomla! 4, JHTML has been replaced with HTMLHelper.

After applying the changes, was your issue resolved? Please confirm so I can check further if needed.

(i replied to him that i tested and the issue is indeed resolved)

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

  • Posts: 83007
  • Thank you received: 13398
  • MODERATOR
3 weeks 16 hours ago #364681

Hi,

I also agree with him that both should produce the same result. But on your website, that's not the case. Not sure why.

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

Time to create page: 0.062 seconds
Powered by Kunena Forum