Edit order in the backend - Custom fields issue

  • Posts: 382
  • Thank you received: 77
8 years 9 months ago #231097

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.4.8

Hi,

There are many item custom fields on my site, above 80.
For each product is available from 0 to 4 item custom fields.
On the front end, all works fine.

The problem appears when I want to edit the order on the backend.
In the popup's window for editing product there are all my item custom fields.
And the same is in the popup's window for adding product to order.

Thank you forward

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

  • Posts: 11
  • Thank you received: 1
8 years 9 months ago #231143

Hello,

It's normal that the item custom fields are display in the editing product popup and the adding product popup.
With that, the administrator is able to set value from back end, while it's not possible in the front end.

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

  • Posts: 382
  • Thank you received: 77
8 years 9 months ago #231186

Hi, Farida

I may be not clear to describe it above.
The problem is that all item custom fields are display in popup, not only item custom fields allowed for the product.

Thank you in any case

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 9 months ago #231189

Hi,

That's also normal.
There is no "restriction" on fields when you edit a order item ; because the product might have been modified since the order creation so we display all fields.

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: 382
  • Thank you received: 77
8 years 9 months ago #231298

Hi,

I do not understand why you need to show the fields that are specified for other products.
Furthermore, after saving the information, all the fields appear in the order, even if nothing is changed.

Look at the screenshots:

1. The product page. There are two item custom fields. All is fine.
2. The checkout page. All is fine too.
3. The order's show on user control panel. All is fine too.
4. The popup to edit product. I just save it whithout editing.
5. The order's show on user control panel after previous step. All fields are here.

And if I try to add new product to the order I get all fields in order show again.

Hope your help

Regards

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
8 years 8 months ago #231355

Hello,

Farida and Jerome have already told you everything, is it normal that ALL custom fields are displayed.

Let's take an example :
- You have an order with a product that works with only 2 custom field A & B
- But later after this order, you add a new custom field (C) in your product configuration.
- You want edit your order and more especially this product, AND we choose to only kept linked custom fields in the order.
As result : your database only write these 2 custom field A & B and so you won't be able to modify your product with his new custom field C.

And so the most simple is to have ALL custom field to don't lock your future management evolution.

Hope this will answer your question.

Regards,

Last edit: 8 years 8 months ago by Philip.

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

  • Posts: 382
  • Thank you received: 77
8 years 8 months ago #231495

Hi,

Thank you all for your attention.
I wrote code to solve my problem.

I edit the backend's view 'order edit_products' for isis temlate.

The line #60:

foreach($this->fields['item'] as $fieldName => $oneExtraField) {

Instead of it I insert:
//almika I begin
		echo '<script type="text/javascript">
		jQuery(document).ready(function($) {
			$(".almika_remove").click(function() {
				$("input[name=\'almikacheckbox\']").each(function(i, val) {
					if (!val.checked) {
						$("."+$(val).attr(\'class\')).remove();
					}
					$(val).remove();
				});
				$(".almikalable").remove();
			});
		});
	</script>';
		echo '<a href="#" class="almika_remove btn">Delete unchecked</a><br />';
		//almika I end
		foreach($this->fields['item'] as $fieldName => $oneExtraField) {
		//almika II begin
		if(!empty($this->orderProduct->$fieldName) && strlen($this->orderProduct->$fieldName)) {
			$almikachecked = ' checked="checked"';
		}
		else {
			$almikachecked = '';
		}
		echo '<input type="checkbox" name="almikacheckbox" class="hikashop_order_product_customfield_'.$fieldName.'"'.$almikachecked.'><label class="almikalable">'.$fieldName.'</label>';
		//almika II end	

Now I can check custom fields to save to the product. The non empty fields are checked by default.
Then I can delete unchecked fields. To do this it is necessary to click 'Delete unchecked'.

Thus the edited product has only fields that you want to give it.

It works for me.

Best regards

Last edit: 8 years 8 months ago by almika.

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

Time to create page: 0.080 seconds
Powered by Kunena Forum