本文整理汇总了PHP中ps_product::set_child_options方法的典型用法代码示例。如果您正苦于以下问题:PHP ps_product::set_child_options方法的具体用法?PHP ps_product::set_child_options怎么用?PHP ps_product::set_child_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ps_product
的用法示例。
在下文中一共展示了ps_product::set_child_options方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
//.........这里部分代码省略.........
$d['product_categories'] = explode('|', $d['category_ids']);
}
if (sizeof(@$d["product_categories"]) < 1) {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_MISSING_CATEGORY'));
$valid = false;
}
}
/** Image Upload Validation **/
// do we have an image URL or an image File Upload?
if (!empty($d['product_thumb_image_url'])) {
// Image URL
if (substr($d['product_thumb_image_url'], 0, 4) != "http") {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_IMAGEURL_MUSTBEGIN', false));
$valid = false;
}
// if we have an uploaded image file, prepare this one for deleting.
if ($db->f("product_thumb_image") && substr($db->f("product_thumb_image"), 0, 4) != "http") {
$_REQUEST["product_thumb_image_curr"] = $db->f("product_thumb_image");
$d["product_thumb_image_action"] = "delete";
if (!vmImageTools::validate_image($d, "product_thumb_image", "product")) {
return false;
}
}
$d["product_thumb_image"] = $d['product_thumb_image_url'];
} else {
// File Upload
if (!vmImageTools::validate_image($d, "product_thumb_image", "product")) {
$valid = false;
}
}
if (!empty($d['product_full_image_url'])) {
// Image URL
if (substr($d['product_full_image_url'], 0, 4) != "http") {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_IMAGEURL_MUSTBEGIN', false));
return false;
}
// if we have an uploaded image file, prepare this one for deleting.
if ($db->f("product_full_image") && substr($db->f("product_full_image"), 0, 4) != "http") {
$_REQUEST["product_full_image_curr"] = $db->f("product_full_image");
$d["product_full_image_action"] = "delete";
if (!vmImageTools::validate_image($d, "product_full_image", "product")) {
return false;
}
}
$d["product_full_image"] = $d['product_full_image_url'];
} else {
// File Upload
if (!vmImageTools::validate_image($d, "product_full_image", "product")) {
$valid = false;
}
}
// validate attribute names
foreach ($d["attributeX"] as $attributeX) {
// if we only have one attribute it can be left empty
if ($attributeX["name"] == "" and count($d["attributeX"]) > 1) {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_MISSING_ATTRIBUTE_NAME', false));
$valid = false;
}
if (strpos($attributeX["name"], ":") or strpos($attributeX["name"], ".") or strpos($attributeX["name"], "&") or strpos($attributeX["name"], "'")) {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_INVALID_ATTRIBUTE_NAME', false));
$valid = false;
}
}
// added for advanced attribute modification
// strips the trailing semi-colon from an attribute
if (isset($d["product_advanced_attribute"])) {
if (';' == substr($d["product_advanced_attribute"], strlen($d["product_advanced_attribute"]) - 1, 1)) {
$d["product_advanced_attribute"] = substr($d["product_advanced_attribute"], 0, strlen($d["product_advanced_attribute"]) - 1);
}
}
// added for custom attribute modification
// strips the trailing semi-colon from an attribute
if (isset($d["product_custom_attribute"])) {
if (';' == substr($d["product_custom_attribute"], strlen($d["product_custom_attribute"]) - 1, 1)) {
$d["product_custom_attribute"] = substr($d["product_custom_attribute"], 0, strlen($d["product_custom_attribute"]) - 1);
}
}
$d["clone_product"] = empty($d["clone_product"]) ? "N" : "Y";
$d["product_publish"] = empty($d["product_publish"]) ? "N" : "Y";
$d["product_special"] = empty($d["product_special"]) ? "N" : "Y";
//parse quantity and child options
$d['display_headers'] = vmGet($d, 'display_headers', 'Y') == 'Y' ? 'Y' : 'N';
$d['product_list_child'] = vmGet($d, 'product_list_child', 'Y') == 'Y' ? 'Y' : 'N';
$d['display_use_parent'] = vmGet($d, 'display_use_parent', 'Y') == 'Y' ? 'Y' : 'N';
$d['product_list_type'] = vmGet($d, 'product_list_type', 'Y') == 'Y' ? 'Y' : 'N';
$d['display_desc'] = vmGet($d, 'display_desc', 'Y') == 'Y' ? 'Y' : 'N';
if (@$d['product_list'] == "Y") {
if ($d['list_style'] == "one") {
$d['product_list'] = "Y";
} else {
$d['product_list'] = "YM";
}
} else {
$d['product_list'] = "N";
}
$d['quantity_options'] = ps_product::set_quantity_options($d);
$d['child_options'] = ps_product::set_child_options($d);
$d['order_levels'] = vmRequest::getInt('min_order_level') . "," . vmRequest::getInt('max_order_level');
return $valid;
}