Is onAfterProductUpdate triggering when navigating

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
10 years 5 months ago #195198

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 2.5

I created a plugin that trigger when

onAfterProductCreate(&$element)

and

onAfterProductUpdate(&$element)

but I found that just by navigating with the default navigation arrows from a standard product view the plugin triggers all the time, so it looks like something is updating with every each frontend product view.

Is this right? Can be disabled?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #195201

Hi,

This trigger is really only called once a product has been created or updated for the second one.
What seems to be strange to you, a value is updated when just navigating ?

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

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
10 years 5 months ago #195321

Xavier wrote: What seems to be strange to you, a value is updated when just navigating ?


Yes. I don't know if I can say 'strange', but at least inconvenient for me. What data is updating when navigating? A visits counter maybe?

Can it be disabled or make it to not trigger the regular DataUpdate triggers?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #195378

Hi,

My bad, it is indeed called when navigating through products for the hit (visit counter) increment.
So you could potentially edit the code of your plugin in order to do more checks on for example the url, if it is on frontend or backend, or checking what are the data to changed in the product and if it is only the product_hit, so do a return.
This way your code is not executed.

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

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
10 years 5 months ago #195465

Ok. This is a possibility. But what if I'm not interested in the hit count? Could I turn off this hit counting by disabling some code so the counter incrementer is not called?

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

  • Posts: 84220
  • Thank you received: 13673
  • MODERATOR
10 years 4 months ago #195471

Hi,

You can remove the code:

$prod = new stdClass();
		$prod->product_id = $product_id;
		$prod->product_hit = $element->product_hit + 1;
		$prod->product_last_seen_date = time();
		$productClass->save($prod, true);
in the file components/com_hikashop/views/product/view.html.php

The following user(s) said Thank You: PeterChain

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

Time to create page: 0.055 seconds
Powered by Kunena Forum