Improve category assignation

  • Posts: 634
  • Thank you received: 16
8 years 8 months ago #212897

-- HikaShop version -- : 2.6.5
-- HikaMarket version -- : 1.6.5

In the frontend product edition I would like to make the category tree chooser larger and with some category already unfolded so for massive maintenance it makes life easier for the data entry user.

This post is with double purpose:

First, could you advise on how could change the tree window size? I tried with several CSS editing but wasn't successful.

Second. is it possible to assign some (or all) category to be already unfolded once I open the category tree?


Second purpose, if not possible with simple file editing then I would like to suggest this as product improvements for future editions.

Indeed would be great if I could assign in the category itself if I want it to be shown already unfolded when showing in frontend or backend.

Thank you.


Attachments:
Last edit: 8 years 8 months ago by PeterChain. Reason: Added missing image

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

  • Posts: 26017
  • Thank you received: 4004
  • MODERATOR
8 years 8 months ago #212908

Hi,

The category selector is using the namebox system.
The width of the "popup" is 100% of the container and the height is by default 130px.
You can change it using the CSS selector

div.namebox-popup div.namebox-popup-content { }

For the loading of the content ; you can use an override in order to change the depth number (which is 1 by default).
		echo $this->nameboxType->display(
			'data[product][categories]',
			$categories,
			hikamarketNameboxType::NAMEBOX_MULTIPLE,
			'category',
			array(
				'delete' => true,
				'sort' => true,
				'depth' => 2,
				'root' => $this->vendorCategories,
				'default_text' => '<em>'.JText::_('HIKA_NONE').'</em>',
			)
		);
The categories of the "product category" will be automatically loaded and the "product category" will be in open state.

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: 634
  • Thank you received: 16
8 years 8 months ago #212919

Thank you very much, I will dig in your suggestions and report when I am successful.

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

  • Posts: 634
  • Thank you received: 16
8 years 4 months ago #224158

The "unfolding by default' worked perfectly for product categories tree but now I want to do the same with product tree for Options and for Related products fields and I am not successful using the depth parameter:

echo $this->nameboxType->display(
'data[product][options]',
@$this->product->options,
hikamarketNameboxType::NAMEBOX_MULTIPLE,
'product',
array(
	'delete' => true,
	'sort' => true,
	'depth' => 4,            /*  ADDED DEPTH OPENING TREE CATEGORIES   */
	'root' => 2,
	'allvendors' => (int)$this->config->get('options_all_vendors', 0),
	'default_text' => '<em>'.JText::_('HIKA_NONE').'</em>',	
	 )
);

I tried with depth value from 2 to 4 and no error is displaying but also no unfolding by default.

Am I wrong expecting depth parameter to work for product selection trees?

Last edit: 8 years 4 months ago by PeterChain. Reason: Arranged code to be better readable

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

  • Posts: 26017
  • Thank you received: 4004
  • MODERATOR
8 years 4 months ago #224160

Hi,

The "depth" setting in "product" just allow to load the data but does not unfold the categories by default.
In order to manage the "depth" for the "product" ; it requires some code in the getNameboxData of the HikaMarket product class.
The automatic unfold was not added for the products because it could display a big tree. The usage of the depth is more to pre-load data than display them directly to the user.
But we can see to add a setting for that unfolding.

In the file, you can replace

		$limit = (int)@$options['limit'];
By
		$limit = (int)@$options['limit'];
		$unfold = (int)@$options['unfold'];

And then
	if($depth > 1 && $v->category_depth < $base_depth) {
		$lookup_categories[$k] = $k;
		$o->status = 1;
	}
By
	if($depth > 1 && $v->category_depth < $base_depth) {
		$lookup_categories[$k] = $k;
		$o->status = $unfold ? 2: 1;
	}
So, you can now use the setting "unfold" with the other parameters (depth, root, ...)

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.
The following user(s) said Thank You: PeterChain

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

  • Posts: 634
  • Thank you received: 16
8 years 4 months ago #224190

Applied successfully!

BIG THANK YOU!

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

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