- Posts: 109
- Thank you received: 5
Redundant Call to CheckChangeForm
11 years 5 months ago #199257
by Ed_Hika
Redundant Call to CheckChangeForm was created by Ed_Hika
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.6.3
-- PHP version -- : 5.5.17
Hello, there.
Good morning!
Please could you explain the purpose of the following code in checkout/step.php?
In media/com_hikashop/js/hikashop.js, the hikashopCheckChangeForm does not have any test for the value of 'order' in the type parameter. Does this mean that the call to hikashopCheckChangeForm from checkout/step.php is redundant?
Thanks.
Take care!
-- Joomla version -- : 3.6.3
-- PHP version -- : 5.5.17
Hello, there.
Good morning!
Please could you explain the purpose of the following code in checkout/step.php?
Code:
echo $this->cart->displayButton($checkout_next_button,'next',$this->params, hikashop_completeLink('checkout&task=step&step='.$this->step+1),'if(hikashopCheckChangeForm(\'order\',\'hikashop_checkout_form\')){ if(hikashopCheckMethods()){ document.getElementById(\'hikashop_validate\').value=1; this.disabled = true; document.forms[\'hikashop_checkout_form\'].submit();}} return false;','id="hikashop_checkout_next_button"');
In media/com_hikashop/js/hikashop.js, the hikashopCheckChangeForm does not have any test for the value of 'order' in the type parameter. Does this mean that the call to hikashopCheckChangeForm from checkout/step.php is redundant?
Thanks.
Take care!
Please Log in or Create an account to join the conversation.
11 years 5 months ago #199315
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Redundant Call to CheckChangeForm
Hi,
The code will check the checkout form (to check the order) and submit it if good.
I don't understand why you think that the code is redundant.
Regards,
The code will check the checkout form (to check the order) and submit it if good.
I don't understand why you think that the code is redundant.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
11 years 4 months ago #200628
by Ed_Hika
Replied by Ed_Hika on topic Redundant Call to CheckChangeForm
Thanks, Jerome.
As stated, there is no test for the value of "order" in the hikashopCheckChangeForm function in the file media/com_hikashop/js/hikashop.js. How does the hikashopCheckChangeForm function check if the order is valid?
Thanks.
Take care!
As stated, there is no test for the value of "order" in the hikashopCheckChangeForm function in the file media/com_hikashop/js/hikashop.js. How does the hikashopCheckChangeForm function check if the order is valid?
Thanks.
Take care!
Please Log in or Create an account to join the conversation.
11 years 4 months ago #200638
by nicolas
Replied by nicolas on topic Redundant Call to CheckChangeForm
Hi,
There are tests for the value "order" in hikashopCheckChangeForm so I don't see what you're talking about.
This is the code of that function which test the custom fields on the checkout:
It does the check for the custom user fields, the custom address fields and the custom order fields based on what is given to that function in the first parameter. If you remove that call, it won't check the custom order fields on the checkout and thus you'll be able to finish a step with the "fields" view on the checkout even if you have required custom order fields that are not filled. So it's not redundant, it's the way it should be.
There are tests for the value "order" in hikashopCheckChangeForm so I don't see what you're talking about.
This is the code of that function which test the custom fields on the checkout:
Code:
for(var i = hikashopFieldsJs['reqFieldsComp'][type].length - 1; i >= 0; i--) {
elementName = 'data['+type+']['+hikashopFieldsJs['reqFieldsComp'][type][i]+']';
if(typeof(varform.elements[elementName]) == 'undefined')
elementName = type+'_'+hikashopFieldsJs['reqFieldsComp'][type][i];
elementToCheck = varform.elements[elementName];
elementId = 'hikashop_'+type+'_'+ hikashopFieldsJs['reqFieldsComp'][type][i];
el = d.getElementById(elementId);
if(elementToCheck && (typeof el == 'undefined' || el == null || typeof el.style == 'undefined' || el.style.display!='none') && !hikashopCheckField(elementToCheck,type,i,elementName,varform.elements)) {
if(typeof(hikashopFieldsJs['entry_id']) == 'undefined')
return false;
for(var j = 1; j <= hikashop['entry_id']; j++) {
elementName = 'data['+type+'][entry_'+j+']['+hikashopFieldsJs['reqFieldsComp'][type][i]+']';
elementToCheck = varform.elements[elementName];
elementId = 'hikashop_'+type+'_'+ hikashopFieldsJs['reqFieldsComp'][type][i] + '_' + j;
el = d.getElementById(elementId);
if(elementToCheck && (typeof el == 'undefined' || el == null || typeof el.style == 'undefined' || el.style.display != 'none') && !hikashopCheckField(elementToCheck,type,i,elementName,varform.elements)) {
return false;
}
}
}
}
Please Log in or Create an account to join the conversation.
Time to create page: 0.173 seconds