Various Problems on Front End Variant Edit

  • Posts: 59
  • Thank you received: 4
  • Hikashop Business
2 years 6 months ago #341607

-- url of the page with the problem -- : dadutscentral.com/index.php/component/hi...action-product/cid-4
-- HikaShop version -- : 4.5.1
-- HikaMarket version -- : 4.1.0
-- Joomla version -- : 4.1.0
-- PHP version -- : 7.4.29
-- Browser(s) name and version -- : 100.0 Firefox

Hey guys,

I'm having several problems when editing variants in the front end.

- the image delete button doesn't work

- the tinymce editor doesn't load

- delete button in my Specifications custom field doesn't work

- using upload button in Specification fields causes a "Access Forbidden" error

All of these functions work properly on the Product tab but not on the Variants.

The one problem on the Product tab is the tinymce window loads a bit funny with only the top half useable.

I've installed latest versions of HikaShop and HikaMarket

I've tested in both Rocket Theme and default templates.

The super user login I sent you for an earlier problem still shouid work.

Many thanks for your attention,

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
2 years 6 months ago #341614

Hello,

All the issues you describe indicates a JavaScript error in the page which stop the execution of the JS.
In such case, best is to open the browser console and check for errors.

But in your case, I suppose it's something related to your template.
In the "Network", we can see that the content loaded do not include JavaScript.
The last line visible in that content is

<input type="hidden" name="data[variant][product_id]" value="546">
In the "productmarket/variant" view, after that line, some JavaScript is displayed so it can be processed by the page after the block is received.
If there is no JS in the page, the elements can't be initialized.

Seeing the source code of the page, we can see that "inline" JS is added in the "head" section of the page ; which mean that the content is modified by a plugin.

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: 59
  • Thank you received: 4
  • Hikashop Business
2 years 6 months ago #341615

Hey Jerome,

Thanks again for the quick reply....on a weekend no less...thank you.

I reviewed my plugins and attempted shutting down anything that might re-position those scripts. Nothing I tried changed the behavior.

So, I tried another approach. I built a new "bare bones" site consisting only of Joomla 4.1 and the recent versions of HikaMarket and Hikashop I downloaded Friday.

I'm still getting the same non-performing scripts on the "bare bones" site !

I also saw a Notice appearing at the bottom of the Variants tab that I had missed before. I verified that this appears on the original site as well.

Notice: Array to string conversion in /home/safety/public_html/components/com_hikamarket/views/productmarket/tmpl/variant.php on line 248

You can checkout the "bare bones" site at dadutscentral.com/site2 .

I'll send you a user name and password via the contact form for site2.

Thanks again for your attention,

Cheers,

Dave

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
2 years 6 months ago #341616

Hello,

Please edit the file "components/com_hikamarket/views/productmarket/view.html.php" and replace the line

	protected $triggerView = true;
By
	protected $triggerView = true;
	protected $allowInlineJavascript = true;

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: 59
  • Thank you received: 4
  • Hikashop Business
2 years 6 months ago #341617

Thanks again Jerome.

That fixed most of it.

Site is still not loading the Description field properly when editing variants.

No title. No tinymce editor.

Verified that on "bare bones" site as well.


Cheers,

: D

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

  • Posts: 59
  • Thank you received: 4
  • Hikashop Business
2 years 6 months ago #341745

Bump

Did you guys get a chance take a look at the missing editor in the Description field of the variants tab ?

Also, the notice is still there.

Notice: Array to string conversion in /home/safety/public_html/components/com_hikamarket/views/productmarket/tmpl/variant.php on line 248

Thanks for your attention,

: D

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
2 years 6 months ago #341784

Hello,

I'm not forgetting you and I still need to reproduce the exact environment in order to understand the nature of the JS issue with your editor.
TinyMCE always been complicated since it was not designed to be compatible with Ajax system (and in Joomla, it doesn't appreciate multiple instances too, we need to use tricks).
When loading with ajax, an event is called so the editors can think a classical page is loaded and that it needs to initialize.

For the array notice, best would be to change the line with

	if(is_string($script))
		echo '<script type="text/javascript">'."\r\n".$script."\r\n".'</script>';
	else hikashop_writeToLog($script, 'Debug Variant Scripts');
So the problematic content will be stored in the HikaShop Payment log, where you'll be able to see what kind of script cannot be added into the page (and so, be processed).

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.
Last edit: 2 years 6 months ago by Jerome.

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

  • Posts: 59
  • Thank you received: 4
  • Hikashop Business
2 years 6 months ago #341812

Thanks Jerome,

Glad you're on the case. I'm getting ready to train clients on this form and am hoping to have it cleaned up before doing so.

Below is what appeared in the log after making the changes to the productmarket/variant view you suggested.

I'll need you to interpret if it means anything useful.

Thanks,

Dave

05.20.22 16:28:02 - Debug Variant Scripts
Array
(
    [c24b8aee7a08a545f2d3daee275893eb] => 
window.hikashopFieldsJs = {
	'reqFieldsComp': {},
	'validFieldsComp': {},
	'regexFieldsComp': {},
	'regexValueFieldsComp': {}
};
    [6978e0f1eb1b7219b9d06c00b9bcfb39] => 
function hikashopToggleFields(new_value, namekey, field_type, id, prefix) {
	if(!window.hikashop) return false;
	return window.hikashop.toggleField(new_value, namekey, field_type, id, prefix);
}
    [5426f7caa4768202042e967460ff68eb] => 
setTimeout(function(){
(function($){
	if(!window.hikashopLocal) window.hikashopLocal = {};
    [e8f78d3aaf90887028abd742d0557c41] => try{WfEditor.init(.....
)

Last edit: 2 years 6 months ago by Jerome.

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
2 years 5 months ago #341892

Hello,

Sorry for the late reply.
You can use that code to avoid the Warning and fix the editor initialisation.

	if(is_string($script))
		echo '<script type="text/javascript">'."\r\n".$script."\r\n".'</script>';
	else if(is_array($script))
		echo '<script type="text/javascript">'."\r\n".implode("\r\n", $script)."\r\n".'</script>';

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: 59
  • Thank you received: 4
  • Hikashop Business
2 years 5 months ago #341994

Hey Jerome,

Took me a couple days to get checking this one out.

I implemented the latest change.

We're still missing the Description title and the tinymce editor when editing variants.

I double checked this behavior on my "bare bones" site and verified it there as well.

Got another idea ?

Thanks,

Dave

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
2 years 5 months ago #342003

Hello,

Are you using the same editor in the backend (WfEditor) ?
If you have correctly the patch, the JavaScript which was not added before (because it was condensed in an array, for a reason I do not know) should be available and processed.

I tried to take a look with the account you provided but it looks like it's not working anymore.

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: 59
  • Thank you received: 4
  • Hikashop Business
2 years 5 months ago #342011

Hey Jerome,

I'm using jce in the backend.

I've got a new super user account for you. I'll send details via contact form.

Thanks again for your help,

Dave

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
2 years 5 months ago #342027

Hello,

I was able to duplicate your environnement and reproduce your issue.
Some are related to modification in the Joomla 4 core regarding the way than the editor is initialized.
One trick used by HikaShop is no longer compatible with HikaMarket (depending an HTML element with an ID related to HikaShop).
So I made several patchs in order to retrieve the editor initialization without the HikaShop function ; I'll also propose that patch in order to improve the HikaShop core.

For the moment I've got a beta version of the next HikaMarket release (since I'm still working on some display improvements for Joomla 4 compatibility) but I can send you small patchs to apply to your version in order to make the editor working again.

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: 59
  • Thank you received: 4
  • Hikashop Business
2 years 5 months ago #342028

That sounds like good news. Glad you were able to get to the root of the problem.

Please send the patches.

Many thanks
Dave

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
2 years 5 months ago #342054

Hello,

I sent you the patch by email.

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: 59
  • Thank you received: 4
  • Hikashop Business
2 years 5 months ago #342078

Thanks for the patch... It worked !..... sort of.

The patch works on my bare bones site on cassiopia.

It's doesn't work on my main site. I've stripped that page down to the rocketheme versla template and a couple of menu's. I checked it with admin tools disabled which had no effect.

Attached is a screen shot of the errors console is reporting.

The yellow warnings occur on page load.

The Reference error occurs when I click the Variants tab.

These errors don't appear on the bare bones Cassiopia site.

Got any more tricks up your sleeve ?

thanks,

Dave

Attachments:

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
2 years 5 months ago #342084

Hello,

Looking at the content of the webpage, it looks like the editor you have for the variants is "mce_editable wf-editor" and not tinymce like for one for the main.
The error is there because the JS for the "wf-editor" was not loaded for the main page.
So I checked the code and see that for the variant, the code is looking in the HikaShop configuration and not the HikaMarket configuratin for the editor selection.
I suppose that you have TinyMCE in HikaMarket and JCE for HikaShop.

You have to edit the file "components/com_hikamarket/productmarket/view.html.php" and replace the lines

		$editorType = $shopConfig->get('editor', '');
		if(preg_match('/Edge/i', $_SERVER['HTTP_USER_AGENT']))
			$editorType = 'none';
By
		$editorType = $config->get('editor', '');
		/* if(preg_match('/Edge/i', $_SERVER['HTTP_USER_AGENT']))
			$editorType = 'none'; */
So we will be sure that the same editor is loaded for the main product and its variants.

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: 59
  • Thank you received: 4
  • Hikashop Business
2 years 5 months ago #342130

Hey Jerome,

The code fix didn't work.

I couldn't find an editor setting in Hikashop so I assume it's pulling form the Joomla global config.

I set the Joomla global editor to tiny_mce to match the Hikamarket setting. That did the trick and presented the variable Description editor properly.

Thanks for your help,

Dave

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
2 years 5 months ago #342172

Hello,

Even with the modification from "$shopConfig" to "$config" ?
That was an interesting point for me (and a fix that I'll keep in the next release).

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: 59
  • Thank you received: 4
  • Hikashop Business
2 years 5 months ago #342175

That was the right question.

I had missed the $shopConfig to $config.

So I tried it again with that fix.

Threw an error...

Notice: Undefined variable: Config in /home/safety/public_html/components/com_hikamarket/views/productmarket/view.html.php on line 1197

: D

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

Moderators: Obsidev
Time to create page: 0.095 seconds
Powered by Kunena Forum