當前位置: 首頁>>代碼示例>>PHP>>正文


PHP J2Store::getSelectableFields方法代碼示例

本文整理匯總了PHP中J2Store::getSelectableFields方法的典型用法代碼示例。如果您正苦於以下問題:PHP J2Store::getSelectableFields方法的具體用法?PHP J2Store::getSelectableFields怎麽用?PHP J2Store::getSelectableFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在J2Store的用法示例。


在下文中一共展示了J2Store::getSelectableFields方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onAdd

    protected function onAdd($tpl = null)
    {
        $app = JFactory::getApplication();
        $doc = JFactory::getDocument();
        $model = $this->getModel('Customfields');
        $this->item = $model->getTable();
        $this->item->field_table = 'address';
        $this->item->field_type = 'text';
        $selectableBase = J2Store::getSelectableBase();
        if (!empty($this->item->j2store_customfield_id)) {
            $field = $selectableBase->getField($this->item->j2store_customfield_id);
            $data = null;
            $allFields = $selectableBase->getFields('', $data, $field->field_table);
        } else {
            $field = $model->getTable();
            $field->field_table = 'address';
            $field->field_published = 1;
            $field->field_type = 'text';
            $field->field_backend = 1;
            $allFields = array();
        }
        $this->allFields = $allFields;
        $this->field = $field;
        //get the field type
        $fieldtype = J2Store::getSelectableFields();
        $this->assignRef('fieldtype', $fieldtype);
        $this->assignRef('fieldClass', $selectableBase);
        //country, zone type
        $zoneType = new j2storeZoneType();
        $this->assignRef('zoneType', $zoneType);
        $lists = array();
        $script = 'function addLine(){
		var myTable=window.document.getElementById("tablevalues");
		var newline = document.createElement(\'tr\');
		var column = document.createElement(\'td\');
		var column2 = document.createElement(\'td\');
		var column3 = document.createElement(\'td\');
		var input = document.createElement(\'input\');
		var input2 = document.createElement(\'input\');
		var input3 = document.createElement(\'select\');
		var option1 = document.createElement(\'option\');
		var option2 = document.createElement(\'option\');
		input.type = \'text\';
		input2.type = \'text\';
		option1.value= \'0\';
		option2.value= \'1\';
		input.name = \'field_values[title][]\';
		input2.name = \'field_values[value][]\';
		input3.name = \'field_values[disabled][]\';
		option1.text= \'' . JText::_('J2STORE_NO', true) . '\';
		option2.text= \'' . JText::_('J2STORE_YES', true) . '\';
		try { input3.add(option1, null); } catch(ex) { input3.add(option1); }
		try { input3.add(option2, null); } catch(ex) { input3.add(option2); }
		column.appendChild(input);
		column2.appendChild(input2);
		column3.appendChild(input3);
		newline.appendChild(column);
		newline.appendChild(column2);
		newline.appendChild(column3);
		myTable.appendChild(newline);
		}

		function deleteRow(divName,inputName,rowName){
			var d = document.getElementById(divName);
			var olddiv = document.getElementById(inputName);
			if(d && olddiv){
				d.removeChild(olddiv);
				document.getElementById(rowName).style.display="none";
			}
			return false;
		}

		function setVisible(value){
			if(value=="product" || value=="item" || value=="category"){
				document.getElementById(\'category_field\').style.display = "";
			}else{
				document.getElementById(\'category_field\').style.display = \'none\';
			}
		}';
        $doc->addScriptDeclaration($script);
        return true;
    }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:82,代碼來源:view.html.php


注:本文中的J2Store::getSelectableFields方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。