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


PHP VirtueMartModelCustomfields::getProductCustomSelectFieldList方法代码示例

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


在下文中一共展示了VirtueMartModelCustomfields::getProductCustomSelectFieldList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCustomEmbeddedProductCustomFields

 function getCustomEmbeddedProductCustomFields($productIds, $virtuemart_custom_id = 0, $cartattribute = -1, $forcefront = FALSE)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $q = VirtueMartModelCustomfields::getProductCustomSelectFieldList();
     static $_customFieldByProductId = array();
     $hashCwAttribute = $cartattribute;
     if ($hashCwAttribute == -1) {
         $hashCwAttribute = 2;
     }
     $productCustomsCached = array();
     foreach ($productIds as $k => $productId) {
         $hkey = (int) $productId . $hashCwAttribute;
         if (array_key_exists($hkey, $_customFieldByProductId)) {
             //$productCustomsCached = $_customFieldByProductId[$hkey];
             $productCustomsCached = array_merge($productCustomsCached, $_customFieldByProductId[$hkey]);
             unset($productIds[$k]);
         }
     }
     if (is_array($productIds) and count($productIds) > 0) {
         $q .= 'WHERE `virtuemart_product_id` IN (' . implode(',', $productIds) . ')';
     } else {
         if (!empty($productIds)) {
             $q .= 'WHERE `virtuemart_product_id` = "' . $productIds . '" ';
         } else {
             return $productCustomsCached;
         }
     }
     if (!empty($virtuemart_custom_id)) {
         if (is_numeric($virtuemart_custom_id)) {
             $q .= ' AND c.`virtuemart_custom_id`= "' . (int) $virtuemart_custom_id . '" ';
         } else {
             $virtuemart_custom_id = substr($virtuemart_custom_id, 0, 1);
             //just in case
             $q .= ' AND c.`field_type`= "' . $virtuemart_custom_id . '" ';
         }
     }
     if (!empty($cartattribute) and $cartattribute != -1) {
         $q .= ' AND ( `is_cart_attribute` = 1 OR `is_input` = 1) ';
     }
     if ($forcefront or $app->isSite()) {
         $q .= ' AND c.`published` = "1" ';
         $forcefront = true;
     }
     if (!empty($virtuemart_custom_id) and $virtuemart_custom_id !== 0) {
         $q .= ' ORDER BY field.`ordering` ASC';
     } else {
         if ($forcefront or $app->isSite()) {
             //$q .= ' GROUP BY c.`virtuemart_custom_id`';
         }
         $q .= ' ORDER BY field.`ordering`,`virtuemart_custom_id` ASC';
     }
     $db->setQuery($q);
     $productCustoms = $db->loadObjectList();
     $err = $db->getErrorMsg();
     if ($err) {
         vmError('getCustomEmbeddedProductCustomFields error in query ' . $err);
     }
     foreach ($productCustoms as $customfield) {
         $hkey = (int) $customfield->virtuemart_product_id . $hashCwAttribute;
         $_customFieldByProductId[$hkey][] = $customfield;
     }
     $productCustoms = array_merge($productCustomsCached, $productCustoms);
     if ($productCustoms) {
         $customfield_ids = array();
         $customfield_override_ids = array();
         foreach ($productCustoms as $field) {
             if ($field->override != 0) {
                 $customfield_override_ids[] = $field->override;
             } else {
                 if ($field->disabler != 0) {
                     $customfield_override_ids[] = $field->disabler;
                 }
             }
             $customfield_ids[] = $field->virtuemart_customfield_id;
         }
         $virtuemart_customfield_ids = array_unique(array_diff($customfield_ids, $customfield_override_ids));
         foreach ($productCustoms as $k => $field) {
             if (in_array($field->virtuemart_customfield_id, $virtuemart_customfield_ids)) {
                 if ($forcefront and $field->disabler) {
                     unset($productCustoms[$k]);
                 } else {
                     VirtueMartModelCustomfields::bindCustomEmbeddedFieldParams($field, $field->field_type);
                 }
             } else {
                 unset($productCustoms[$k]);
             }
         }
         return $productCustoms;
     } else {
         return array();
     }
 }
开发者ID:proyectoseb,项目名称:Matrix,代码行数:93,代码来源:customfields.php


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