HikaSerial/HikaShop product quantity not working

  • Posts: 59
  • Thank you received: 2
11 years 5 months ago #80303

I linked the product quantity between HikaShop and HikaSerial successfully. While testing the import of serials, the product quantity updated properly. When I deleted the serials I used while testing the imports, the product quantity DID NOT update properly. They are removed from the Serials list, but the number of products is not lowered in the backend or frontend.

Edit: Removing quantity, and saving, when viewing product in HikaShop fixed the issue. I would rather not have to do this, though.

Thanks,
Eric

Last edit: 11 years 5 months ago by d2dpcs. Reason: marked solved

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

  • Posts: 26034
  • Thank you received: 4006
  • MODERATOR
11 years 5 months ago #80326

Hi,

Thansk for the report.
I have made a patch which would be in the next release (1.5.1)
You can edit the file "administrator/com_hikaserial/classes/serial.php" and update the delete function.
You just have to add two line just before the end of the function

	public function delete($elements) {
		//
		// Content of the "delete" function.
		//

		// Update product quantity - Just add these two lines at the end of the function, before the last "return".
		$productClass = hikaserial::get('class.product');
		$productClass->refreshQuantities();
		
		return $result;
	}
With it, the product quantity link would be reprocess (synchronize) each time a serial is deleted.

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.
Last edit: 11 years 5 months ago by Jerome.

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

  • Posts: 59
  • Thank you received: 2
11 years 5 months ago #80437

Thanks for the immediate response as always. I edited the file with your two lines before, and outside, the return false bracket (received error upon deleting serial) and within the bracket like below (serial deleted, but did not update product quantity). Thanks, Eric.

	public function delete($elements) {
		if(!is_array($elements)) {
			$elements = array($elements);
		}
		$config = hikaserial::config();
		JPluginHelper::importPlugin('hikaserial');
		$dispatcher = JDispatcher::getInstance();
		$do = true;
		$dispatcher->trigger('onBeforeSerialDelete', array(&$elements, &$do));
		if(!$do) {
		$productClass = hikaserial::get('class.product');
		$productClass->refreshQuantities();
			return false;
		}

Last edit: 11 years 5 months ago by Jerome.
The following user(s) said Thank You: Jerome

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

  • Posts: 59
  • Thank you received: 2
11 years 5 months ago #80703

Jerome, I see that you thanked me, but didn't address the fact that it didn't work for me. I'm just writing this to let you know that a little bit of clarification is needed. Thanks, Eric.

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

  • Posts: 26034
  • Thank you received: 4006
  • MODERATOR
11 years 5 months ago #80710

Hi,

Sorry, I misunderstood your previous message.
After using the code tag on your tag, I see that your modification is not the right one.
The code should be at the end of the function, at the "real" end.

			$dispatcher->trigger('onAfterSerialDelete', array(&$elements));
		}

		// Update product quantity
		//
		$productClass = hikaserial::get('class.product');
		$productClass->refreshQuantities();

		return $result;
	}

	public function consume($serial_id, $extra_data = null, $checkUser = true) {
		$app = JFactory::getApplication();
		$config = hikaserial::config();

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: d2dpcs

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

  • Posts: 59
  • Thank you received: 2
11 years 5 months ago #80713

Yes, that worked for me. Thanks for the clarification.

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

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