hikashop 2.2.1 address edit popup problem

  • Posts: 64
  • Thank you received: 0
11 years 2 months ago #123420

-- HikaShop version -- : 2.2.1
-- Joomla version -- : 3.0.4 Stable
-- PHP version -- : 5.4.7
-- Browser(s) name and version -- : chrome 29.0.1547.66
-- Error-message(debug-mod must be tuned on) -- : Address edit popup does not populate correct state and country in drop down at back end. And at front problem is different, when we edit address it select the correct country and state but not of one which is selected.Like if there are more than one address if we select second one it populate state and country of first one.


Thanks,
Irfan



Attachments:

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
11 years 2 months ago #123421

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: 64
  • Thank you received: 0
11 years 2 months ago #123464

Thanks for the link.but that solution did not work for me.

I checked the file "administrator/components/com_hikashop/classes/field.php" which was mention in the link and found that changing the below code worked for me.But not sure where else will it affect.
Currently code is -

foreach($field->field_value as $oneValue => $title){
			if(isset($field->field_default) && array_key_exists($field->field_default, $field->field_value)){
				if($oneValue === $field->field_default){
					$selected = (is_string($field->field_default) && $oneValue === $field->field_default) || is_array($field->field_default) && in_array($oneValue,$field->field_default) ? 'selected="selected" ' : '';
				}else{
					$selected = ((int)$title->disabled && !$admin) ? 'disabled="disabled" ' : '';
				}
			}else{
				$selected = ((int)$title->disabled && !$admin) ? 'disabled="disabled" ' : '';
				$selected .= ((is_numeric($value) && is_numeric($oneValue) AND $oneValue == $value) || (is_string($value) && $oneValue === $value) || is_array($value) && in_array($oneValue,$value)) ? 'selected="selected" ' : '';
			}
			$id = $this->prefix.$field->field_namekey.$this->suffix.'_'.$oneValue;
			$string .= '<option value="'.$oneValue.'" id="'.$id.'" '.$selected.'>'.$this->trans($title->value).'</option>';
		}

I have changed it to-
foreach($field->field_value as $oneValue => $title){
			$selected = ((int)$title->disabled && !$admin) ? 'disabled="disabled" ' : '';
			$selected .= ((is_numeric($value) && is_numeric($oneValue) AND $oneValue == $value) || (is_string($value) && $oneValue === $value) || is_array($value) && in_array($oneValue,$value)) ? 'selected="selected" ' : '';
			$id = $this->prefix.$field->field_namekey.$this->suffix.'_'.$oneValue;
			$string .= '<option value="'.$oneValue.'" id="'.$id.'" '.$selected.'>'.$this->trans($title->value).'</option>';
		}

Would be great if someone can tell me what is the appropriate replacement of the above code.

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
11 years 2 months ago #123488

Hi,

I don't understand your modification and why you did this.

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: 64
  • Thank you received: 0
11 years 2 months ago #123514

Actually I was comparing the file with previous hika version in which address functionality was working properly.I replaced the code with working one.

Or Could you please help me what should be the solution for my problem?

Thanks.

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
11 years 2 months ago #123538

Hi,

Okay, I understand :)
Please use this code instead:

		$isValue = !empty($value) && isset($field->field_value[$value]);

		foreach($field->field_value as $oneValue => $title) {
			if(isset($field->field_default) && !$isValue) {
				if(array_key_exists($field->field_default, $field->field_value)){
					if($oneValue === $field->field_default){
						$selected = (is_string($field->field_default) && $oneValue === $field->field_default) || is_array($field->field_default) && in_array($oneValue,$field->field_default) ? 'selected="selected" ' : '';
					}else{
						$selected = ((int)$title->disabled && !$admin) ? 'disabled="disabled" ' : '';
					}
				}
			} else {
				$selected = ((int)$title->disabled && !$admin) ? 'disabled="disabled" ' : '';
				$selected .= ((is_numeric($value) && is_numeric($oneValue) && $oneValue == $value) || (is_string($value) && $oneValue === $value) || is_array($value) && in_array($oneValue,$value)) ? 'selected="selected" ' : '';
			}
			$id = $this->prefix.$field->field_namekey.$this->suffix.'_'.$oneValue;
			$string .= '<option value="'.$oneValue.'" id="'.$id.'" '.$selected.'>'.$this->trans($title->value).'</option>';
		}
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.
The following user(s) said Thank You: irfanhanfi

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

  • Posts: 64
  • Thank you received: 0
11 years 2 months ago #123553

It works,thank you so much.

Also I would like to ask one more question.
Is there any reason to use

window.top.hikashop.submitBox
Istead of
window.parent.hikashop.submitBox
?

The reason of asking is, I am displaying site within iframe and there is an error
Cannot call method 'submitBox' of undefined
.

Sorry ,if it does not make sense.

Thanks & Regards,

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
11 years 2 months ago #123564

Hi,

I have to ask you what you are talking about exactly because there is no such "submitBox" in the user address edition in the backend (and no more in the front-end).

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: 64
  • Thank you received: 0
11 years 2 months ago #123567

The code I am referring to is in this file -
administrator\components\com_hikashop\views\order\view.html.php
line no. - 1154

if($closePopup) {
hikashop_loadJslib('mootools');
$js = 'do_nothing( function(){window.top.hikashop.submitBox('.$data.');});';
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
}

Also in administrator\components\com_hikashop\views\product\view.html.php

Please let me know if this is not clear.

Regards,

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
11 years 2 months ago #123586

Hi,

Ok, the first is for the customer popup in the order and the second for a product selection (generic use).
I didn't understand the context modification, I though you were still on the address edition.

I know that there is an old reason for this "window.top" but we can hope that is reason is no more.
So we can see to change it to "window.parent".

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: 64
  • Thank you received: 0
11 years 2 months ago #123588

Thanks for your quick help.

I hope these changes will be in the next update of hika.

Regards,

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

Time to create page: 0.084 seconds
Powered by Kunena Forum