本文整理汇总了PHP中Checkout::isPrerequisiteRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP Checkout::isPrerequisiteRequired方法的具体用法?PHP Checkout::isPrerequisiteRequired怎么用?PHP Checkout::isPrerequisiteRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Checkout
的用法示例。
在下文中一共展示了Checkout::isPrerequisiteRequired方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initSinglePrerequisiteValidationResults
function initSinglePrerequisiteValidationResults($variant_view_tag, $variant_tag, $variant_type_id, $variant_visible_name)
{
global $application;
loadCoreFile('UUIDUtils.php');
//Cut the suffix. CCInfo prerequisites.
// : may be to pass in PersonInfoVariantID to getValidatedDataStructure, not the tag.
$variant_view_tag_for_data_structure = UUIDUtils::cut_uuid_suffix($variant_view_tag, "js");
/**
* Call either before the construcor finishes its work,
* or satatically.
* Work on the sesson only.
*/
//Check, if data is already in the session:
if (isset($this->PrerequisitesValidationResults)) {
$PrerequisitesValidationResults = $this->PrerequisitesValidationResults;
// changing the visible name for checkout form fields
// usage: customer changes the language on the checkout
/*
if (is_array($PrerequisitesValidationResults))
foreach($PrerequisitesValidationResults as $k => $v)
if (isset($v['validatedData']) && is_array($v['validatedData']))
foreach($v['validatedData'] as $kk => $vv)
{
$new_data = execQuery('SELECT_VALIDATED_DATA_VISIBLE_LABELS', array('vid' => @$v['id'], 'aid' => @$vv['id']));
if ($new_data)
{
if (isset($vv['attribute_visible_name']))
$PrerequisitesValidationResults[$k]['validatedData'][$kk]['attribute_visible_name'] = $new_data[0]['attribute_visible_name'];
if (isset($vv['attribute_description']))
$PrerequisitesValidationResults[$k]['validatedData'][$kk]['attribute_description'] = $new_data[0]['attribute_description'];
}
}
*/
if (is_array($this->PrerequisitesValidationResults)) {
$labels = $this->getValidatedDataVisibleLabels();
foreach ($this->PrerequisitesValidationResults as $k => $v) {
if (isset($v['validatedData']) && is_array($v['validatedData'])) {
foreach ($v['validatedData'] as $kk => $vv) {
if (@$labels[$v['id']][$vv['id']]) {
if (isset($vv['attribute_visible_name'])) {
$this->PrerequisitesValidationResults[$k]['validatedData'][$kk]['attribute_visible_name'] = @$labels[$v['id']][$vv['id']]['attribute_visible_name'];
}
if (isset($vv['attribute_description'])) {
$this->PrerequisitesValidationResults[$k]['validatedData'][$kk]['attribute_description'] = @$labels[$v['id']][$vv['id']]['attribute_description'];
}
}
}
}
}
}
} else {
//Initialize from the beginning.
$PrerequisitesValidationResults = array();
}
$PrerequisitesValidationResults[$variant_view_tag] = array('variant_tag' => $variant_tag, 'isMet' => false, 'id' => $variant_type_id, 'visibleName' => $variant_visible_name, 'error_code' => '', 'error_message_parameters' => '', 'validatedData' => $this->getValidatedDataStructure($variant_view_tag_for_data_structure));
// shipping_method, , . .
// , .
// CheckoutFormEditor - .
if ($variant_view_tag == "shippingModuleAndMethod") {
$b_is_shipping_method_required = Checkout::isPrerequisiteRequired("shippingModuleAndMethod");
if ($b_is_shipping_method_required === false || Checkout::arePersonInfoTypesActive(array("shippingModuleAndMethod")) === false) {
// shipping method: AllInactive
$PrerequisitesValidationResults[$variant_view_tag]['isMet'] = true;
$PrerequisitesValidationResults[$variant_view_tag]['validatedData']['method_code']['value'] = Checkout::getAllInactiveModuleId("shipping") . "_" . modApiFunc(Checkout::getAllInactiveModuleClassAPIName("shipping"), "getSingleAvailableMethodId");
}
}
// payment_method, , . .
// , .
// CheckoutFormEditor - .
if ($variant_view_tag == "paymentModule") {
$b_is_payment_method_required = Checkout::isPrerequisiteRequired("paymentModule");
if ($b_is_payment_method_required === false || Checkout::arePersonInfoTypesActive(array("paymentModule")) === false) {
// payment method: AllInactive
$PrerequisitesValidationResults[$variant_view_tag]['isMet'] = true;
$PrerequisitesValidationResults[$variant_view_tag]['validatedData']['method_code']['value'] = Checkout::getAllInactiveModuleId("payment");
}
}
if ($variant_view_tag == 'subscriptionTopics') {
$b_is_subscription_required = Checkout::isPrerequisiteRequired("subscriptionTopics");
if ($b_is_subscription_required === false || Checkout::arePersonInfoTypesActive(array("subscriptionTopics")) === false) {
$PrerequisitesValidationResults[$variant_view_tag]['isMet'] = true;
$PrerequisitesValidationResults[$variant_view_tag]['validatedData']['Topics']['value'] = '';
}
}
$this->PrerequisitesValidationResults = $PrerequisitesValidationResults;
//modApiFunc('Session', 'set', 'PrerequisitesValidationResults', $PrerequisitesValidationResults);
}