当前位置: 首页>>代码示例>>PHP>>正文


PHP ps_product::set_quantity_options方法代码示例

本文整理汇总了PHP中ps_product::set_quantity_options方法的典型用法代码示例。如果您正苦于以下问题:PHP ps_product::set_quantity_options方法的具体用法?PHP ps_product::set_quantity_options怎么用?PHP ps_product::set_quantity_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ps_product的用法示例。


在下文中一共展示了ps_product::set_quantity_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;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:101,代码来源:ps_product.php


注:本文中的ps_product::set_quantity_options方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。