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


PHP VirtueMartModelCustomfields::bindParameterableByFieldType方法代码示例

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


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

示例1: displayProductCustomfieldFE

    /**
     * Formating front display by roles
     *  for product only !
     */
    public function displayProductCustomfieldFE(&$product, $customfield, $row = '')
    {
        $virtuemart_custom_id = isset($customfield->virtuemart_custom_id) ? $customfield->virtuemart_custom_id : 0;
        $value = $customfield->custom_value;
        $type = $customfield->field_type;
        $is_list = isset($customfield->is_list) ? $customfield->is_list : 0;
        $price = isset($customfield->custom_price) ? $customfield->custom_price : 0;
        $is_cart = isset($customfield->is_cart) ? $customfield->is_cart : 0;
        //vmdebug('displayProductCustomfieldFE and here is something wrong ',$customfield);
        JLoader::register('CurrencyDisplay', JPATH_VM_ADMINISTRATOR . '/helpers/currencydisplay.php');
        $currency = CurrencyDisplay::getInstance();
        if ($is_list > 0) {
            $values = explode(';', $value);
            if ($is_cart != 0) {
                $options = array();
                foreach ($values as $key => $val) {
                    $options[] = array('value' => $val, 'text' => $val);
                }
                // J3 use chosen vmJsApi::chosenDropDowns();
                return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', NULL, 'value', 'text', FALSE, TRUE);
            } else {
                $html = '';
                $html .= '<div id="custom_' . $virtuemart_custom_id . '_' . $value . '" >' . $value . '</div>';
                return $html;
            }
        } else {
            if ($price > 0) {
                $price = $currency->priceDisplay((double) $price);
            }
            switch ($type) {
                case 'A':
                    $options = array();
                    $session = JFactory::getSession();
                    $virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm');
                    $productModel = VmModel::getModel('product');
                    //parseCustomParams
                    VirtueMartModelCustomfields::bindParameterableByFieldType($customfield);
                    //Todo preselection as dropdown of children
                    //Note by Max Milbers: This is not necessary, in this case it is better to unpublish the parent and to give the child which should be preselected a category
                    //Or it is withParent, in that case there exists the case, that a parent should be used as a kind of mini category and not be orderable.
                    //There exists already other customs and in special plugins which wanna disable or change the add to cart button.
                    //I suggest that we manipulate the button with a message "choose a variant first"
                    //if(!isset($customfield->pre_selected)) $customfield->pre_selected = 0;
                    $selected = JRequest::getVar('virtuemart_product_id', 0);
                    if (is_array($selected)) {
                        $selected = $selected[0];
                    }
                    $selected = (int) $selected;
                    $html = '';
                    $uncatChildren = $productModel->getUncategorizedChildren($customfield->withParent);
                    if (empty($uncatChildren)) {
                        return $html;
                        break;
                    }
                    foreach ($uncatChildren as $k => $child) {
                        $options[] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']), 'text' => $child['product_name']);
                    }
                    $html .= JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="inputbox"', "value", "text", JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected, 'cf' . $row . '-' . $selected));
                    //vmdebug('$customfield',$customfield);
                    if ($customfield->parentOrderable == 0 and $product->product_parent_id == 0) {
                        $product->orderable = FALSE;
                    }
                    return $html;
                    break;
                    /* variants*/
                /* variants*/
                case 'V':
                    if ($price == 0) {
                        $price = JText::_('COM_VIRTUEMART_CART_PRICE_FREE');
                    }
                    /* Loads the product price details */
                    return '<input type="text" value="' . JText::_($value) . '" name="field[' . $row . '][custom_value]" /> ' . JText::_('COM_VIRTUEMART_CART_PRICE') . $price . ' ';
                    break;
                    /*Date variant*/
                /*Date variant*/
                case 'D':
                    return '<span class="product_custom_date">' . vmJsApi::date($value, 'LC1', TRUE) . '</span>';
                    //vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput;
                    break;
                    /* text area or editor No JText, only displayed in BE */
                /* text area or editor No JText, only displayed in BE */
                case 'X':
                case 'Y':
                    return $value;
                    break;
                    /* string or integer */
                /* string or integer */
                case 'S':
                case 'I':
                    return JText::_($value);
                    break;
                    /* bool */
                /* bool */
                case 'B':
                    if ($value == 0) {
                        return JText::_('COM_VIRTUEMART_NO');
//.........这里部分代码省略.........
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:101,代码来源:customfields.php

示例2: displayProductCustomfieldFE

    /**
     * Formating front display by roles
     *  for product only !
     */
    public function displayProductCustomfieldFE(&$product, $customfield, $row = '')
    {
        $virtuemart_custom_id = isset($customfield->virtuemart_custom_id) ? $customfield->virtuemart_custom_id : 0;
        $value = $customfield->custom_value;
        $type = $customfield->field_type;
        $is_list = isset($customfield->is_list) ? $customfield->is_list : 0;
        $price = isset($customfield->custom_price) ? $customfield->custom_price : 0;
        $is_cart = isset($customfield->is_cart) ? $customfield->is_cart : 0;
        //vmdebug('displayProductCustomfieldFE and here is something wrong ',$customfield);
        if (!class_exists('CurrencyDisplay')) {
            require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
        }
        $currency = CurrencyDisplay::getInstance();
        if ($is_list > 0) {
            $values = explode(';', $value);
            if ($is_cart != 0) {
                $options = array();
                foreach ($values as $key => $val) {
                    $options[] = array('value' => $val, 'text' => $val);
                }
                vmdebug('displayProductCustomfieldFE is a list ', $options);
                return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', NULL, 'value', 'text', FALSE, TRUE);
            } else {
                $html = '';
                // 				if($type=='M'){
                // 					foreach ($values as $key => $val){
                // 						$html .= '<div id="custom_'.$virtuemart_custom_id.'_'.$val.'" >'.$this->displayCustomMedia($val).'</div>';
                // 					}
                // 				} else {
                // 					foreach ($values as $key => $val){
                $html .= '<div id="custom_' . $virtuemart_custom_id . '_' . $value . '" >' . $value . '</div>';
                // 					}
                // 				}
                return $html;
            }
        } else {
            if ($price > 0) {
                $price = $currency->priceDisplay((double) $price);
            }
            switch ($type) {
                case 'A':
                    $options = array();
                    $session = JFactory::getSession();
                    $virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm');
                    $productModel = VmModel::getModel('product');
                    //parseCustomParams
                    VirtueMartModelCustomfields::bindParameterableByFieldType($customfield);
                    //Todo preselection as dropdown of children
                    //Note by Max Milbers: This is not necessary, in this case it is better to unpublish the parent and to give the child which should be preselected a category
                    //Or it is withParent, in that case there exists the case, that a parent should be used as a kind of mini category and not be orderable.
                    //There exists already other customs and in special plugins which wanna disable or change the add to cart button.
                    //I suggest that we manipulate the button with a message "choose a variant first"
                    //if(!isset($customfield->pre_selected)) $customfield->pre_selected = 0;
                    $selected = JRequest::getInt('virtuemart_product_id', 0);
                    $html = '';
                    $uncatChildren = $productModel->getUncategorizedChildren($customfield->withParent);
                    foreach ($uncatChildren as $k => $child) {
                        $options[] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']), 'text' => $child['product_name']);
                    }
                    $html .= JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="inputbox"', "value", "text", JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected));
                    //vmdebug('$customfield',$customfield);
                    if ($customfield->parentOrderable == 0 and $product->product_parent_id == 0) {
                        vmdebug('Should not be orderable');
                        $product->orderable = FALSE;
                        /*	if(!$productModel->product_parent_id){
                        							vmdebug('$customfield parentOrderable');
                        							$document = JFactory::getDocument();
                        							$document->addScriptDeclaration(
                        								'jQuery(document).ready( function($) {
                        									
                        									addToCartArea = jQuery(".productdetails-view .addtocart-bar");
                        									addToCartBar = addToCartArea.find("input[name$=addtocart]");
                        
                        									addToCartArea.css({
                        														padding: "0px 0px 0px 0px",
                        														width: "auto"
                        													}).children("span:not(:nth-child(3))").hide()
                        															.parent().children("span::nth-child(3)").css({
                        																margin: "0px 0px 0px 0px",
                        																width: "auto",
                        																float: 	"left"
                        															});
                        										
                        									addToCartButtonClassName = addToCartBar.attr("class");
                        									
                        									addToCartBar.removeClass(addToCartButtonClassName)
                        												.addClass(addToCartButtonClassName + "-disabled")
                        												.attr({
                        														disabled: "disabled",
                        														value: 	"'.JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT').'",
                        													});						
                        									}); 
                        							');
                        						}*/
                    }
                    return $html;
//.........这里部分代码省略.........
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:customfields.php


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