Error on order change

  • Posts: 55
  • Thank you received: 5
  • Hikashop Business
2 days 18 hours ago #366836

-- HikaShop version -- : 5.1.5
-- Joomla version -- : 5.3.0
-- PHP version -- : 8.4.5

Hi!

I have two isues in the order back system.

a) I configured my shop to the european decimal system. That means the divider is "." and the comma is "," - so nearly all inputs in the backend and the outputs in the frontend (or printings) are correct. But if I try to change an order via backend I have to use the english (american?) system. I guess this was overseen. ;-)

b) If I change an existing order in the backend (add new positions) the following happens:

1st: If I change the value in the tax list, the next field (price incl. tax) gets automatically the following content:

<HTML><HEAD><TITLE>403 Forbidden</TITLE><BASE href="/error_docs/"><!--[if lte IE 6]></BASE><![endif]--></HEAD><BODY><H1>Forbidden</H1>You do not have permission to access this document.<P><HR><ADDRESS>Web Server at getrankeheimdienst-chemnitz.de</ADDRESS></BODY></HTML><!-- - Unfortunately, Microsoft has added a clever new - "feature" to Internet Explorer. If the text of - an error's message is "too small", specifically - less than 512 bytes, Internet Explorer returns - its own error message. You can turn that off, - but it's pretty tricky to find switch called - "smart error messages". That means, of course, - that short error messages are censored by default. - IIS always returns error messages that are long - enough to make Internet Explorer happy. The - workaround is pretty simple: pad the error - message with a big comment like this to push it - over the five hundred and twelve bytes minimum. - Of course, that's exactly what you're reading - right now. -->


2nd: If I deleted the HTML code from above and type in a number, I get two errors in the product list (backend -> screenshot):


error 1: Warning: Attempt to read property "pfand" on null in /var/www/vhosts/path_to_website/administrator/components/com_hikashop/views/order/tmpl/show_products.php on line 191

error 2: Warning: Attempt to read property "product_parent_id" on null in /var/www/vhosts/path_to_website/administrator/components/com_hikashop/views/order/tmpl/show_products.php on line 196

And the values of the manual added position (Rückpfand) shown in the product table are totally weird. I typed in "3.75" - not "403".

Maybe here is a guess ... is it possible that the custom fields (in my case "pfand") are not integrated in the "edit order" feature in the backend? If I add a new position to the order (via backend) no custom field is shown. In my case: I can not add values for the custom field (in my case "pfand" -> means "bottle deposit").

So ... it would be important to have these fields editable.

Attachments:
Last edit: 2 days 18 hours ago by Rusty.

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

  • Posts: 83672
  • Thank you received: 13545
  • MODERATOR
2 days 13 hours ago #366842

Hi,

a. Which inputs are affected ?

b.
1st. What do you mean by "If I change the value in the tax list, the next field (price incl. tax) gets automatically the following content:" ?
The tax list of what ?

2nd. If I remember correctly, pfand is a custom field of the table "product" on your website.
Are you saying that you're trying to add a tag of that custom field in the price field of a product of an order ?
That's not possible. You can only enter a number there.
The price calculations and cart fee plugins can only process formula tags on the product page on the frontend and the cart on the frontend. They don't do anything for orders.
And more than that. Pfand is a custom product field. It is linked to the product. It is not linked to the product in the order.
If you want to change it for a product, you need to edit the product.
Only custom fields of the table "item" are linked to products in orders because they are normally set by the customer on the product page on the frontend.

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

  • Posts: 55
  • Thank you received: 5
  • Hikashop Business
2 days 12 hours ago #366851

Hi,

nicolas wrote: And more than that. Pfand is a custom product field. It is linked to the product. It is not linked to the product in the order.
If you want to change it for a product, you need to edit the product.
Only custom fields of the table "item" are linked to products in orders because they are normally set by the customer on the product page on the frontend.


Uh ... I guess I don't get it.
A custom field of type "product" can NOT be used in the checkout process, the order? What are we talking about ... since weeks? :blink: I asked for a solution to create some type of deposit. And ... it's clear that this has to be used all over the product presentation AND the order process. Otherwise it makes no sense.

I do not see the problem. Currently I CAN use the custom field for the product page AND the checkout / order. Only if I try to change an existing order via backend we get problems. I think, the only thing we need is the custom fields in the order edit screen.

If not with custom fields - how else should you set up a deposit solution?
I'm pretty confused right now.

Last edit: 2 days 11 hours ago by Rusty.

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

  • Posts: 83672
  • Thank you received: 13545
  • MODERATOR
2 days 42 minutes ago #366854

Hi,

Well, I'm pretty confused as well.

The solution I proposed is in 3 steps:
- you have a custom product field in each product, where you can specify a deposit value
- you have the cart fee plugin which sums the deposit value of each product in the cart and adds it as an extra fee to the cart
- HikaShop will convert the cart to an order at the end of the checkout, and the extra fee will be displayed in the additional information area of the order.
Until you opened this new thread on our forum, I believed that this solution met all your needs for a deposit capability.

There is no mechanism in HikaShop at the moment to be able to edit the extra fees linked to an order. No one requested that capability so far. And you didn't mention as something you would need to be able to do either, so I didn't even consider this as something that would be needed.

So I don't understand what you're trying to edit in the order interface, nor how you get these errors since there is no interface to be able to edit the extra fee.
You're talking about changing the value of the custom product field in the order, but that doesn't make sense. The custom product field is linked to the product, not the order. It's the extra fee which is linked to the order.

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

  • Posts: 55
  • Thank you received: 5
  • Hikashop Business
2 days 19 minutes ago #366860

Hi nicolas,

maybe I did not make it clear enough. Even if I do not want to change custom field values in an existing order, I can not change the order itself - it causes errors BECAUSE the custom field is missing, I guess (in the edit screen). I made a little screencast to show the errors (attached).

Cheers

Attachments:

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

  • Posts: 83672
  • Thank you received: 13545
  • MODERATOR
1 day 19 hours ago #366862

Hi,

Thanks for the screencast, that helps.
So the error happens when you're trying to add a new order product to an order. That's something you had not mentioned, but it is a crucial information in order to understand what we're talking about.

I understand the first error happens when you're trying to change the tax rate selection in the new product popup.
That error is not linked to having or not the custom field on that form contrary to what you're saying.
I'm not sure why you get that error since I don't have it on my end.
I would need a backend access AND a FTP access in order to check on the issue.

There are a few issues with what you're doing :
- the "pfand" is a custom field linked to products. If you need to provide that value, it needs to be done when creating a normal product in the Products menu, not in a order. Here you're not adding a new product, but an order product. When HikaShop creates a new order, it will create an order product entry for each product in the cart. This way, if you change a product in the future, the information from that product won't be changed in previous orders. And order product doesn't have product custom fields. It has instead custom fields of the table "item". So, it is normal there is no pfand field in that popup.
- Now, you might think that a solution to circumvent this would be to create a normal product in the Products menu, and then use the "select" button instead of the "new" button of the order products listing to select that product. That way, you could enter the pfand value in the product before adding it to the order as an order product. However, as I said in a previous message, the cart fee plugin doesn't do anything with orders. So, the cart fees added by the plugin won't be recalculated after you add that new order product, even if a product with a pfand value is selected to be added as an order product.
- To be able to update the fees of an order would require an extra interface added to HikaShop. At the moment, once a fee is added to cart and the cart is converted into an order, the fee can't be changed.

You didn't tell me why you're trying to add a new order product to an existing order. Is that something you'll have to do normally ?
Do you need to be able to add new order products to an order ? Do you need them to have a pfand value ? Do you need to subsequently update the cart fee ?
The errors you got might actually not be relevant to what you're trying to achieve.

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

  • Posts: 55
  • Thank you received: 5
  • Hikashop Business
1 day 19 hours ago #366865

Hi,

nicolas wrote: I understand the first error happens when you're trying to change the tax rate selection in the new product popup.
That error is not linked to having or not the custom field on that form contrary to what you're saying.
I'm not sure why you get that error since I don't have it on my end.
I would need a backend access AND a FTP access in order to check on the issue.


Okay, will send it via your form.

nicolas wrote: There are a few issues with what you're doing :
- the "pfand" is a custom field linked to products. If you need to provide that value, it needs to be done when creating a normal product in the Products menu, not in a order. Here you're not adding a new product, but an order product. When HikaShop creates a new order, it will create an order product entry for each product in the cart. This way, if you change a product in the future, the information from that product won't be changed in previous orders. And order product doesn't have product custom fields. It has instead custom fields of the table "item". So, it is normal there is no pfand field in that popup.
- Now, you might think that a solution to circumvent this would be to create a normal product in the Products menu, and then use the "select" button instead of the "new" button of the order products listing to select that product. That way, you could enter the pfand value in the product before adding it to the order as an order product. However, as I said in a previous message, the cart fee plugin doesn't do anything with orders. So, the cart fees added by the plugin won't be recalculated after you add that new order product, even if a product with a pfand value is selected to be added as an order product.
- To be able to update the fees of an order would require an extra interface added to HikaShop. At the moment, once a fee is added to cart and the cart is converted into an order, the fee can't be changed.


Okay, thanks for your clarification. I understand the difference between product in shop frontend and ordered product in backend.

nicolas wrote: You didn't tell me why you're trying to add a new order product to an existing order. Is that something you'll have to do normally ?
Do you need to be able to add new order products to an order ? Do you need them to have a pfand value ? Do you need to subsequently update the cart fee ?
The errors you got might actually not be relevant to what you're trying to achieve.


Yes, we would daily (!) change/add "order products" as we take deposit packages from the clients back. Workflow is: customer is purchasing - we delivering - customer give deposit package back - we make credit note on his order (add new "order product" with negative value) - print invoice - and send it to the customer.

BUT ... as a possible workaround ... maybe it would be a simple solution if we could add a simple "order product" as credit note ... we could name it "pfand". Btw. this is what I tried to achive as I faced the errors I showed you in the screencast.

Last edit: 1 day 19 hours ago by Rusty.

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

  • Posts: 83672
  • Thank you received: 13545
  • MODERATOR
1 day 15 hours ago #366867

Hi,

Great. We're getting on the same page. I now have a clearer understand on your situation and where we need to go.
I'll wait for the FTP access to be able to check your situation with the errors linked to the new order product popup. That's something I should be able to fix.

I'm not sure adding an order product to the order will help you do what you want.
From what I understand, if you have an order with a product costing 100€ and a shipping fee of 50€ and a deposit fee of 200€, the total amount will be 100 + 50 + 200 = 350€. The subtotal amount will be 100€.
If the customer pays the deposit fee of 200€, the subtotal amount would have to be -100€. I'm not sure if the system allows for it. And that might look strange.

An alternative might be to add the deposit fee as a coupon in the "additional information" popup of the order. I would recommend testing this as a possible solution ?

Another solution would be to create a custom field of the table "order" with the name "amount paid by the customer" and another one with the name "amount paid taken into account" for example. That way, in the "additional information" popup of the order, you could enter the amount paid by the customer.
And, for it to apply to the total amount, you could create a mass action with the trigger "after an order is updated", a filter on the "amount paid by the customer" column being greater than 0, a filter on the "amount paid taken into account" column being smaller than 1, an action "update the values" on the "order_full_price" with the "operation" mode and the value order.order_full_price-order.xxx where xxx is the column name of the "amount paid by the customer" column, and an action "update the values" on the "amount paid taken into account" column with the "int" mode and the value "1".
That way, the first time you enter the amount in the custom order field, the total amount would get its value reduced by the amount you provided, and subsequent saves of the order wouldn't change that.
However, this is a bit clunky as if you add later on another product, or change the shipping fee or something else which requires recalculating the total amount of the order, the amount in that custom order field won't be taken into account.

Ideally, being able to add extra fees to orders, and modify existing fees would be a nice addition to HikaShop in the future. That would make for a nicer solution with a lot of potential. However, this requires quite a bit of development on our end.

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

  • Posts: 55
  • Thank you received: 5
  • Hikashop Business
1 day 19 minutes ago #366877

Hi,

nicolas wrote: I'll wait for the FTP access to be able to check your situation with the errors linked to the new order product popup. That's something I should be able to fix.

Sent it. Good luck!

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

Time to create page: 0.086 seconds
Powered by Kunena Forum