[Skip to main content](#vessel-content)

#   $element is modified after onBeforeOrderDelete

##

- **[tommytom](/forum/user/11095-tommytom "View tommytom's Profile")**
- [![tommytom's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/11095-tommytom "View tommytom's Profile") Topic Author
- [ Offline](/forum/user/11095-tommytom)

Less More

- Posts: 8
- Thank you received: 0
-
-

13 years 11 months ago -  13 years 11 months ago [\#74839](#74839) by [tommytom](/forum/user/11095-tommytom "View tommytom's Profile")  *[$element is modified after onBeforeOrderDelete](/forum/3-bug-report/74839-element-is-modified-after-onbeforeorderdelete#74839 "Hello,  I am using the latest Hikashop (2.0) and I just stumbled on a problem with the onBeforeOrderDelete and onAfterOrderDelete plugin callbacks.  The $element array containing the keys of the deleted order is modified by the helper class between the before and the after callback. This array is passed by reference in the subfunctions and is modified by it causing changes of content in the before and after callback. Check the following lines:  com&#95;hikashop/classes/order.php (hikashopOrderClass-&gt;delete) line 682: $result=parent::delete($elements); com&#95;hikashop/helper/helper.php (hikashopClass-&gt;delete) line 1281: $elements&#91;$key&#93; = $this-&gt;database-&gt;Quote($val);  In this last line, the $element which is passed by reference is modified by the database-&gt;quote() function, which is adding single quotes around the order key in the array. So after returning from the helper-&gt;delete(function) the $element array is passed to the onAfterOrderDelete callback, but this time, the order keys have quotes around it.  -Tom.")* was created by *[tommytom](/forum/user/11095-tommytom "View tommytom's Profile")*

Hello,

I am using the latest Hikashop (2.0) and I just stumbled on a problem with the onBeforeOrderDelete and onAfterOrderDelete plugin callbacks.

The $element array containing the keys of the deleted order is modified by the helper class between the before and the after callback. This array is passed by reference in the subfunctions and is modified by it causing changes of content in the before and after callback. Check the following lines:

com_hikashop/classes/order.php (hikashopOrderClass-&gt;delete) line 682: $result=parent::delete($elements);
com_hikashop/helper/helper.php (hikashopClass-&gt;delete) line 1281: $elements[$key] = $this-&gt;database-&gt;Quote($val);

In this last line, the $element which is passed by reference is modified by the database-&gt;quote() function, which is adding single quotes around the order key in the array. So after returning from the helper-&gt;delete(function) the $element array is passed to the onAfterOrderDelete callback, but this time, the order keys have quotes around it.

-Tom.

Last edit: 13 years 11 months ago by [tommytom](/forum/user/11095-tommytom "View tommytom's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83NDgzOS1lbGVtZW50LWlzLW1vZGlmaWVkLWFmdGVyLW9uYmVmb3Jlb3JkZXJkZWxldGU/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86323
- Thank you received: 14283
-
-

13 years 11 months ago [\#74873](#74873) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: $element is modified after onBeforeOrderDelete](/forum/3-bug-report/74839-element-is-modified-after-onbeforeorderdelete#74873 "Hello,  I am using the latest Hikashop (2.0) and I just stumbled on a problem with the onBeforeOrderDelete and onAfterOrderDelete plugin callbacks.  The $element array containing the keys of the deleted order is modified by the helper class between the before and the after callback. This array is passed by reference in the subfunctions and is modified by it causing changes of content in the before and after callback. Check the following lines:  com&#95;hikashop/classes/order.php (hikashopOrderClass-&gt;delete) line 682: $result=parent::delete($elements); com&#95;hikashop/helper/helper.php (hikashopClass-&gt;delete) line 1281: $elements&#91;$key&#93; = $this-&gt;database-&gt;Quote($val);  In this last line, the $element which is passed by reference is modified by the database-&gt;quote() function, which is adding single quotes around the order key in the array. So after returning from the helper-&gt;delete(function) the $element array is passed to the onAfterOrderDelete callback, but this time, the order keys have quotes around it.  -Tom.")*

Hi,

Thank you for the report. We've changed that on our end so that the elements in the $elements passed to onAfterOrderDelete are not quoted.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83NDgzOS1lbGVtZW50LWlzLW1vZGlmaWVkLWFmdGVyLW9uYmVmb3Jlb3JkZXJkZWxldGU/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[tommytom](/forum/user/11095-tommytom "View tommytom's Profile")**
- [![tommytom's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/11095-tommytom "View tommytom's Profile") Topic Author
- [ Offline](/forum/user/11095-tommytom)

Less More

- Posts: 8
- Thank you received: 0
-
-

13 years 11 months ago [\#74874](#74874) by [tommytom](/forum/user/11095-tommytom "View tommytom's Profile")  Replied by *[tommytom](/forum/user/11095-tommytom "View tommytom's Profile")* on topic *[Re: $element is modified after onBeforeOrderDelete](/forum/3-bug-report/74839-element-is-modified-after-onbeforeorderdelete#74874 "Hello,  I am using the latest Hikashop (2.0) and I just stumbled on a problem with the onBeforeOrderDelete and onAfterOrderDelete plugin callbacks.  The $element array containing the keys of the deleted order is modified by the helper class between the before and the after callback. This array is passed by reference in the subfunctions and is modified by it causing changes of content in the before and after callback. Check the following lines:  com&#95;hikashop/classes/order.php (hikashopOrderClass-&gt;delete) line 682: $result=parent::delete($elements); com&#95;hikashop/helper/helper.php (hikashopClass-&gt;delete) line 1281: $elements&#91;$key&#93; = $this-&gt;database-&gt;Quote($val);  In this last line, the $element which is passed by reference is modified by the database-&gt;quote() function, which is adding single quotes around the order key in the array. So after returning from the helper-&gt;delete(function) the $element array is passed to the onAfterOrderDelete callback, but this time, the order keys have quotes around it.  -Tom.")*

Great !
When will that be available ?
-T

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83NDgzOS1lbGVtZW50LWlzLW1vZGlmaWVkLWFmdGVyLW9uYmVmb3Jlb3JkZXJkZWxldGU/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86323
- Thank you received: 14283
-
-

13 years 11 months ago [\#74875](#74875) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: $element is modified after onBeforeOrderDelete](/forum/3-bug-report/74839-element-is-modified-after-onbeforeorderdelete#74875 "Hello,  I am using the latest Hikashop (2.0) and I just stumbled on a problem with the onBeforeOrderDelete and onAfterOrderDelete plugin callbacks.  The $element array containing the keys of the deleted order is modified by the helper class between the before and the after callback. This array is passed by reference in the subfunctions and is modified by it causing changes of content in the before and after callback. Check the following lines:  com&#95;hikashop/classes/order.php (hikashopOrderClass-&gt;delete) line 682: $result=parent::delete($elements); com&#95;hikashop/helper/helper.php (hikashopClass-&gt;delete) line 1281: $elements&#91;$key&#93; = $this-&gt;database-&gt;Quote($val);  In this last line, the $element which is passed by reference is modified by the database-&gt;quote() function, which is adding single quotes around the order key in the array. So after returning from the helper-&gt;delete(function) the $element array is passed to the onAfterOrderDelete callback, but this time, the order keys have quotes around it.  -Tom.")*

It has already been fixed on our end.
Please redownload HikaShop on our website and update it on yours and it will work.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83NDgzOS1lbGVtZW50LWlzLW1vZGlmaWVkLWFmdGVyLW9uYmVmb3Jlb3JkZXJkZWxldGU/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.056 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
