Views

  • Posts: 6
  • Thank you received: 1
8 years 3 months ago #247352

Dear all,
I make use of views mainly to call MySQL procedures, which is an impressive facility.
However I can't seem to find the view associated with the backend removal of products from an order in Hikashop or the frontend removal in Hikamarket (Front End).
I do not use HS (Professional 2.6.3) for commercial purposes, but actually as a core for a corporate environment which provides different types of clothing and special pieces of equipment to various categories of personnel, which are associated with a system of credits specific in time and value to each category, and this calls for a lot of database activity.

Thank you.

Bruno

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 3 months ago #247356

Hi,

For HikaShop, the delete button is displayed by the file "show_products" of the view "order" with this code:

<a onclick="return window.orderMgr.delProduct(this, <?php echo $product->order_product_id; ?>);" href="<?php echo hikashop_completeLink('order&task=product_delete&order_id='.$this->order->order_id.'&order_product_id='.$product->order_product_id); ?>"><img src="<?php echo HIKASHOP_IMAGES; ?>delete.png" alt="<?php echo JText::_('HIKA_DELETE'); ?>"/></a>
But there is no view for after you click on the button. It just redisplays the view file.
So if you want to add processing when an order product is deleted, you want to create a small plugin of the group hikashop and implement the trigger onAfterOrderUpdate which will give you a variable $order with the products data allowing you to do what you need to do.

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

  • Posts: 6
  • Thank you received: 1
8 years 3 months ago #247404

Thank you very much Nicolas, I suspected as much but I wanted to be 100% sure.
I guess I'll have to roll up my sleeves and have a go at creating a plugin.
As a temporary solution I have created triggers on hikashop_order_product to call the procedures in question, which works fine, but I would prefer to have them explicitly called from hikashop and database triggers are understandably not encouraged by our IT people running our servers.

Thanks again.

Bruno

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 3 months ago #247414

Hi,

That's right, a plugin will be more appropriate for that specific task.
Both HikaShop and HikaMarket are re-saving the order when removing a product.
The order object have "product" set with a 0 quantity.

You can for example find in HikaMarket :

$order_product->order_product_quantity = 0;
$order->product = array(
	$order_product
);

So thanks to the trigger onAfterOrderUpdate ; you can check if the order object have that "product" variable and analyze the content.
If you found one product with a 0 quantity, you can know that the product have been removed from the order.

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: 6
  • Thank you received: 1
8 years 3 months ago #247440

Thank you Jerome for this precision, it's all beginning to fall into place now.
Bàt,

Bruno

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

  • Posts: 6
  • Thank you received: 1
8 years 3 months ago #247638

Hi Jerome and Nicolas,

You were absolutely right, plugins are the perfect solution for solving my peripheral database issues.
In particular, the fact that parameters from the order object can be passed on to the stored procedures (for example $order->order_user_id) makes these a lot more efficient in terms of execution time.

Thanks again.

Bàt,

Bruno

The following user(s) said Thank You: Jerome

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

  • Posts: 6
  • Thank you received: 1
8 years 3 months ago #247909

Hi,

Is there any particular reason why trigger function 'onBeforeOrderDelete' does not appear in your documentation?
Can you confirm that this is just an documentary oversight and that deprecating this function is not under consideration?
I use it in a plugin, and it works like a charm.

Thank you,

Bruno

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 3 months ago #247911

Hi,

The developer documentation is not up to date.
You can be sure that this specific trigger is not about to be removed due to the fact it is used by several plugins and components.

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: 6
  • Thank you received: 1
8 years 3 months ago #247975

Thanks Jerome.
Bon weekend.

Bruno

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

Time to create page: 0.071 seconds
Powered by Kunena Forum