Inserting Products into Article Content

  • Posts: 141
  • Thank you received: 3
  • Hikashop Business
2 years 3 months ago #337559

-- HikaShop version -- : 4.4.4
-- Joomla version -- : 4.0.4

I'm attempting to insert a Product entry into an article. (I will be customizing the Layout used to render it, once it's working for me)

The insert tools in the editor seem to be working, but only a little under half of the live products show up on the list of products to choose from. There seems to be no correlation with product categories and what is visible. I'll take a look at permission settings on the products, but I know some which are missing are fully available to all shoppers. If I can spot any pattern at all, I'll add more detail.

Is there some characteristic settings of a product needed to make it available to this tool?

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

  • Posts: 4491
  • Thank you received: 609
  • MODERATOR
2 years 3 months ago #337566

Hello,

Do you mean that you try to use the " Product TAG insertion " and don't be able to get all your available product in the Product TAG listing ?...



If yes, can you provide these elements in order to go more far in your subject, and better understand the context :
- User Backend references (with maximum Acl)
- Url link to administrator access

Note : Use our Contact us form to provide these elements and don't forget to add an Url link to this topic.
Regards

Last edit: 2 years 3 months ago by Philip.

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

  • Posts: 141
  • Thank you received: 3
  • Hikashop Business
2 years 3 months ago #337744

I've found the issue and implemented a temporary workaround. Here are the details.

The problem isn't with the TAG insertion or translation plugins: It's with HikaShop's xtd-editor plugin. When it makes the query request to assemble the Products to build it's selection list, the query demands only Products available to ALL viewers. My guess is that the TAG insertion plugin isn't smart enough to filter out Products that the User isn't allowed to see, so the xtd-editor plugin doesn't allow that option.

I've modified

$Where = ' WHERE product_type=\'main\' AND product_access=\'all\' AND product_published=1 ';
to become
$Where = ' WHERE product_type=\'main\' AND product_published=1 ';
and I must deliberately choose Products based upon who can view that particular article.

I made a similar change to the product insertion tag.

I suspect that both plugins might be updated to be aware of which groups can view the article being edited, and modify the Product query appropriately, but I don't have enough time to build that right now. ( It would be necessary to make the insertion plugin smarter as well, since the editor plugin would only be able to respond when the insertion code is created, but unable to proofread previously inserted codes ).

I realize this is probably a low priority, but I do request you include this on the list of possible future HikaShop updates.
Thanks.

Last edit: 2 years 3 months ago by icomex.

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

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
2 years 3 months ago #337768

Hi,

That would be impossible.
The editor can be display in many different places. It could be in a Joomla article, but it could be a K2 item, or something else. Anything else displaying a Joomla HTML editor. So we can't check the access levels of the item being edited as we don't know what item it could be.
And you might not want to allow someone to access all the products.
For, example, the editor can appear on the joomla article editor on the frontend for autors. And you might not want autors to see all the products of your shop, regardless of the access level of the article.

I suppose the best would be to allow access to all the products in the backend, and only access to the products based on the user groups of the current user on the frontend.

This can be done by changing this code to:

		$filters = array('product_type=\'main\'', 'product_published=1');
		if(hikashop_isClient('site')) {
			hikashop_addACLFilters($filters, 'product_access');
		}
		$Where = ' WHERE '. implode(' AND ', $filters);
Let us know if that works fine for you.
We can then add that to the next version of HikaShop.

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

Time to create page: 0.061 seconds
Powered by Kunena Forum