Default Tax Drop Down when adding new products

  • Posts: 54
  • Thank you received: 0
7 years 5 months ago #255510

-- HikaShop version -- : HikaShop Business 2.6.4 [1610121552]
-- Joomla version -- : 3.6.2
-- PHP version -- : 5.4

Is it possible to change the order the list of tax categories when creating a new product? The none is always default so either adding 'selected' to my drop down options or changing the order would help.

I notice that you can have a none category with a tax rate applied I don't have that category with tax, would re-creating that help? If so how would I do that thanks?

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

  • Posts: 81480
  • Thank you received: 13062
  • MODERATOR
7 years 5 months ago #255516

Hi,

By default, it's the last tax category that you created that is preselected when you create a new product.
None should never be available unless you deleted all your tax categories or messed with the category tree data.

You can see that on our demo website if you create a new product:
demo.hikashop.com/administrator/index.ph...trl=product&task=add

So if you deleted all your tax categories, recreating one would have it selected by default.

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

  • Posts: 54
  • Thank you received: 0
7 years 4 months ago #255568

The tax category I use is the same for all products and was added last.

If you could tell me the location of the form for entering the default I'll modify it for my needs - thanks

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

  • Posts: 81480
  • Thank you received: 13062
  • MODERATOR
7 years 4 months ago #255579

Hi,

It's done in the file administrator/components/com_hikashop/views/product/view.html.php with the code:

$categoryClass = hikashop_get('class.category');
			$mainTaxCategory = 'tax';
			$categoryClass->getMainElement($mainTaxCategory);
			$query = 'SELECT category_id FROM '. hikashop_table('category'). ' WHERE category_type = ' . $db->Quote('tax') . ' AND category_parent_id = '.(int)$mainTaxCategory.' ORDER BY category_ordering DESC';
			$db->setQuery($query);
			$product->product_tax_id = $db->loadResult();

The following user(s) said Thank You: eileensemporium

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

  • Posts: 54
  • Thank you received: 0
7 years 4 months ago #255971

It turned out to be easier than that - I noticed that there is an order by in the query (ORDER BY category_ordering DESC) so I just created a dummy unpublished category and sorted the order of the categories accordingly, now the default category is the one I require

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

  • Posts: 220
  • Thank you received: 8
7 years 1 month ago #264990

Hi,

I understand the last tax category created is preselected when creating a new product.
This is very impractible.
Until recently all products in my shop used the same tax category, But I had to add a new tax category for a few products. I will use this new tax category for these products only.
Now this tax category is preselected in every new product and I have to correct this in every new product. Mistakes are unavoidable.

So I've looked for a way to get the default tax category preselected.
Using the solution of eileensemporium doesn't work. It results in preselecting None.

Nicolas suggests deleting all tax categories and creating new ones.
Having 800 products this is no way to go.

Is there really no other way? Perhaps an override of a view?

Thanks,
Udo

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

  • Posts: 81480
  • Thank you received: 13062
  • MODERATOR
7 years 1 month ago #265008

Hi,

As you can read in this thread, the system doesn't use the last created tax category but the one with the higher ordering (which is the last one by default, unless you change the ordering of the tax categories).
So change the ordering of the tax categories on the tax categories listing and you'll be done easily.

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

  • Posts: 220
  • Thank you received: 8
7 years 1 month ago #265052

Hi,

It's as easy as that!
I've tried reordering the tax categories before, but then I put the default tax category on position 1.
Now I've put it on the last position. And hurray, it's preselected in new products.

Thanks a lot!

Udo

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

Time to create page: 0.089 seconds
Powered by Kunena Forum