- Posts: 171
- Thank you received: 9
Update a custom field
- pepecortez
-
Topic Author
- Offline
-- Joomla version -- : 3.3.2.
-- PHP version -- : 5
Hi,
I had a small need what I want to add to the hikashop order management frontend:
when a user orders, after his order status is set to confirmed, in the order list (view/order/listing.php) a new button is shown with the option to let the user indicate, that his order has been shipped. This button works like "cancel order" button, but it makes it's status to "shipped". That's working OK, I've made a new function in controllers/order.php
But I do also want to let the user to set when his order has been shipped. So in listing.php I load the specified custom field like this:
I want to run an sql in the called function in this way:
But the custom field (kiszallitva_igenyles) is not called, it's empty. Could you provide me a small help how to fix this sql part?
Please Log in or Create an account to join the conversation.
I don't think that
If you want to read the value in the form, you should use the same kind of code that we made in HikaShop.
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- pepecortez
-
Topic Author
- Offline
- Posts: 171
- Thank you received: 9
Now saves successfully to the field it needs, but there's some problem. The field is an advanced date picker field, I choose for example 2014/08/20 (I checked in firebug console) that this is in it:
Edit: I also tried with the base Joomla calendar, same happens: not the choosed dated saved...
Turned on Bug Reporter, and getting this:
Undefined variable: data in /home/www/.../shop/templates/berettyanshop/html/com_hikashop/order/show.php on line 375 Notice: Trying to get property of non-object in /home/www/.../shop/templates/berettyanshop/html/com_hikashop/order/show.php on line 375
I also found another problem, but maybe this is in relation with the above one:
when displaying the field with this code:
the first field is working OK, but if I have more fields in the list, just the first one works.
Have u got any idea what can cause this or how to solve the above problems?
Please Log in or Create an account to join the conversation.
The advanced date picker does not provide a date in a specific format, it provides the date serialized.
Something like "YYYYMMDDHHmmSS" if I remember right.
It allows to be sorted easily and change the date format display without having to modify the database.
I think that you have to store it as a text, using $db->Quote()
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- pepecortez
-
Topic Author
- Offline
- Posts: 171
- Thank you received: 9
Jerome wrote: Hi,
The advanced date picker does not provide a date in a specific format, it provides the date serialized.
Something like "YYYYMMDDHHmmSS" if I remember right.
It allows to be sorted easily and change the date format display without having to modify the database.
I think that you have to store it as a text, using $db->Quote()
Regards,
OMG, so true, I don't know why I missed that. So the correct version looks like this, if some needs same:
Have u got any ideas for the other problem?
Can I add somehow individual ID to the displayed custom fields? I think that cause the "not-working" problem.
Please Log in or Create an account to join the conversation.
I don't understand your last problem ; what is the "if I have more fields in the list" ? Which list ? How ?
The way that you display the field is good but the value you have to the field Class is not the good one
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- pepecortez
-
Topic Author
- Offline
- Posts: 171
- Thank you received: 9
Jerome wrote: Hi,
I don't understand your last problem ; what is the "if I have more fields in the list" ? Which list ? How ?
The way that you display the field is good but the value you have to the field Class is not the good oneWhy are you concatenate the order product id to the existing value of the custom field ?Code:$data->kiszallitva_tetel.$product->order_product_id
Regards,
Sorry, I copied the wrong lines, as I want to achieve almost the same to every each ordered items on a field named that.
I successfully solved the earlier described problem by adding in datepickerfield_class.php to $id variable a randomly generated number, so in this way, the multiple fields are loaded in listing view, now loaded with different ids, so they are not confused.
So, now in listing view I successfully solved to modify the order_status and adding date field by pushing just one click.
I also wanted to use the same method on show the order page (example link: /index.php?option=com_hikashop&ctrl=order&task=show&cid=353&Itemid=139)
But it gives a 403 error, maybe because this is a task page already? Or I don't know, just getting deeper in Joomla.
I wanted to use that function, but maybe I do not implemented it to the right place, or maybe I'm calling it not the right way.
And the code that tries to use this in view/order/show.php:
Any help would be really appreciated...
Please Log in or Create an account to join the conversation.
I don't understand why you put some HikaMarket code into HikaShop views.
You have to understand that you have some luck that your code is working ; HikaMarket might not be loaded in every HikaShop pages ; so please be very very careful.
That's why I think you should see with a PHP developer for your requirement, developing new tasks for HikaShop is not something easy and it's really not recommended (because you won't be able to update HikaShop afterwards).
The best is to use plugins or view overrides (so you can't create new tasks at this moment).
Your problem is complex and is outside of what we can offer you in this support forum. It's not something which can be made in few minutes.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.