tax category not considered in the producttemplate

  • Posts: 73
  • Thank you received: 3
9 years 9 months ago #190460

-- HikaShop version -- : 2.3.5
-- HikaMarket version -- : 1.5.1
-- Joomla version -- : 3.3.6

Hi
I have update the tax rules using the package available on hikashop.com that creates a new category "Electronic goods & services "
I have edited the product template to use this category for all new products.
I have tested by creating a new product from the frontend of hikamarket and the tax category is set to "none", so not according to the setting.

CEd

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 9 months ago #190464

Hi,

Can you please edit the file "components/com_hikamarket/views/product/view.html.php" and replace

if(!empty($template_id)) {
	$product->product_id = 0;
	unset($product->product_type);
	unset($product->product_code);
}
By
if(!empty($template_id)) {
	$product->product_id = 0;
	$product->product_type = 'main';
	unset($product->product_code);
}
So it will force the product_type instead of removing it ; so it should display the product tax category selection.

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: 73
  • Thank you received: 3
9 years 9 months ago #190475

I have no view "product", only the productmarket, then in the file I have these lines which are not totally the same:
l.604

if(!empty($template_id)) {
			$product->product_id = 0;
			unset($product->product_code);
		}

I have made the changes anyway and it does not work. My test :
- log as vendor in frontend >> create a new product, don't change anyting and save
- go in the admin side to check the tax rule, and still on "none"

Because the tax rule can not be changed from the vendor in frontend, it must take the default setting from the template

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 9 months ago #190482

Hi,

Okay, your problem is different than your first explanation let me think.
Regarding the current code ; I can't reproduce your issue. If there is no "product_tax_id" in the product, HikaMarket will copy the value from the product template.

In the HikaMarket product class, for the function "frontSaveForm"

if(!hikamarket::acl('product_edit_tax')) { unset($product->product_tax_id); }
will remove the product_tax_id for the product if the vendor does not have the right to edit it.

Below in the function, the product template is loaded if we are creating a new product ; and the copy of the template is made in the current product
	if(!empty($template)) {
		foreach($template as $k => $v) {
			if(!in_array($k, array('product_code','product_alias')) && !isset($product->$k))
				$product->$k = $v;
		}
	}
For what I read and what I tested ; I can't reproduce your issue so I think that there is a missing information which would explain what the real problem is.

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: 73
  • Thank you received: 3
9 years 9 months ago #190498

ok my be my explanations were not so good :)

I don't know which information could be missing. Setting the tax category in the product template shall apply it when creating a new product :)

if I check the code in the product class, there is no tax_id on the product object
this is what I get

object(stdClass)#1058 (13) { ["product_name"]=> string(0) "" ["categories"]=> string(1) "2" ["product_published"]=> string(1) "1" ["compatibility"]=> string(9) "Joomla! 3" ["responsive"]=> string(1) "0" ["demo_url"]=> string(0) "" ["photos_url"]=> string(0) "" ["author_name"]=> string(0) "" ["author_url"]=> string(0) "" ["themepositions"]=> string(0) "" ["product_id"]=> int(0) ["product_type"]=> string(4) "main" ["product_vendor_id"]=> string(2) "10" }

if you tell me where to investigate to find how the tax_id is retrieved, I can try

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

  • Posts: 73
  • Thank you received: 3
9 years 9 months ago #190501

update :
if I set the var_dump($product); just before the return $status, I get more in the object but still no tax_id ...

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

  • Posts: 73
  • Thank you received: 3
9 years 9 months ago #190504

I have found something strange near line 320

$template_id = null;
			if(!empty($template_id))
template_id will always be null in this case ...so the loop
foreach($template as $k => $v) {
					if(!in_array($k, array('product_code','product_alias')) && !isset($product->$k))
						$product->$k = $v;
						var_dump($k);
				}
will never be executed

The following user(s) said Thank You: Jerome

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 9 months ago #190508

Hi,

Wah, I missed that bug was in the previous release.
In line 320, please replace the

$template_id = null;
By what should be his right content
$template = null;
And it will fix the issue..

Sorry for the inconvenient

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: 73
  • Thank you received: 3
9 years 9 months ago #190602

I have changed this by my side, don't forget to update it for the next release ;)
Have a good day
CEd

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 9 months ago #190606

Hi,

I won't ; it's already commit since several weeks :)
(But I though that I made a new package with that fix...)

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.

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