Skip to main content

hikashop 2.2.1 address edit popup problem

More
13 years 2 weeks ago #123420 by irfanhanfi
-- 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


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

More
13 years 2 weeks ago #123421 by Jerome

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

More
13 years 2 weeks ago #123464 by irfanhanfi
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 -
Code:
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-
Code:
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.

More
13 years 2 weeks ago #123488 by Jerome
Hi,

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

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

More
13 years 2 weeks ago #123514 by irfanhanfi
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.

More
13 years 2 weeks ago #123538 by Jerome
Hi,

Okay, I understand :)
Please use this code instead:
Code:
$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.
The following user(s) said Thank You: irfanhanfi

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

More
13 years 2 weeks ago #123553 by irfanhanfi
It works,thank you so much.

Also I would like to ask one more question.
Is there any reason to use
Code:
window.top.hikashop.submitBox
Istead of
Code:
window.parent.hikashop.submitBox
?

The reason of asking is, I am displaying site within iframe and there is an error
Code:
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.

More
13 years 2 weeks ago #123564 by Jerome
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.

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

More
13 years 2 weeks ago #123567 by irfanhanfi
The code I am referring to is in this file -
administrator\components\com_hikashop\views\order\view.html.php
line no. - 1154
Code:
if($closePopup) { hikashop_loadJslib('mootools'); $js = 'window.addEvent("domready", 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.

More
13 years 2 weeks ago #123586 by Jerome
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.

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

More
13 years 2 weeks ago #123588 by irfanhanfi
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.238 seconds
Powered by Kunena Forum