Пример #1
0
 public static function getInstance()
 {
     if (!is_object(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #2
0
 public static function getSelectableBase()
 {
     if (!self::$sbase) {
         require_once 'selectable/base.php';
         self::$sbase = K2StoreSelectableBase::getInstance();
     }
     return self::$sbase;
 }
Пример #3
0
    function display($tpl = null)
    {
        $app = JFactory::getApplication();
        $doc = JFactory::getDocument();
        $model = $this->getModel('field');
        $params = JComponentHelper::getParams('com_k2store');
        require_once JPATH_COMPONENT_ADMINISTRATOR . '/library/selectable/base.php';
        $selectableBase = new K2StoreSelectableBase();
        $fieldid = $app->input->getInt('field_id');
        if (!empty($fieldid)) {
            $field = $selectableBase->getField($fieldid);
            $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;
        $this->fieldsClass = $selectableBase;
        $lists = array();
        //get the field type
        require_once JPATH_COMPONENT_ADMINISTRATOR . '/library/selectable/fields.php';
        $fieldtype = new K2StoreSelectableFields();
        $this->assignRef('fieldtype', $fieldtype);
        $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::_('K2STORE_NO', true) . '\';
		option2.text= \'' . JText::_('K2STORE_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);
        //	$lists['value_type'] = JHTML::_('select.radiolist', $value_type_options, 'value_type', null, 'value', 'text', $data->value_type);
        //	$logged_options = array(JHTML::_('select.option', '0', JText::_('No') ),
        //			JHTML::_('select.option', '1', JText::_('Yes') )	);
        //	$lists['logged'] = JHTML::_('select.radiolist', $logged_options, 'logged', null, 'value', 'text', $data->logged);
        //country, zone type
        $zoneType = new k2storeZoneType();
        $this->assignRef('zoneType', $zoneType);
        $this->assignRef('lists', $lists);
        $this->assignRef('params', $params);
        $this->addToolBar();
        $toolbar = new K2StoreToolBar();
        $toolbar->renderLinkbar();
        parent::display($tpl);
    }
Пример #4
0
 public function processCustomFields($type, $data)
 {
     $selectableBase = new K2StoreSelectableBase();
     $address = JTable::getInstance('address', 'Table');
     $orderinfo = JTable::getInstance('Orderinfo', 'Table');
     $fields = $selectableBase->getFields($type, $address, 'address');
     $values = array();
     foreach ($fields as $fieldName => $oneExtraField) {
         if ($data[$fieldName]) {
             if (!property_exists($orderinfo, $type . '_' . $fieldName) && !property_exists($orderinfo, 'user_' . $fieldName) && $fieldName != 'country_id' && $fieldName != 'zone_id' && $fieldName != 'option' && $fieldName != 'task' && $fieldName != 'view') {
                 $values[$fieldName]['label'] = $oneExtraField->field_name;
                 $values[$fieldName]['value'] = $data[$fieldName];
             }
         }
     }
     $registry = new JRegistry();
     $registry->loadArray($values);
     $json = $registry->toString('JSON');
     return $json;
 }
Пример #5
0
# author    Ramesh Elamathi - Weblogicx India http://www.weblogicxindia.com
# copyright Copyright (C) 2012 Weblogicxindia.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://k2store.org
# Technical Support:  Forum - http://k2store.org/forum/index.html
-------------------------------------------------------------------------*/
//no direct access
defined('_JEXEC') or die('Restricted access');
$row = @$this->row;
$order = @$this->order;
$items = @$order->getItems();
require_once JPATH_ADMINISTRATOR . '/components/com_k2store/library/popup.php';
require_once JPATH_ADMINISTRATOR . '/components/com_k2store/library/k2item.php';
require_once JPATH_ADMINISTRATOR . '/components/com_k2store/library/selectable/base.php';
require_once JPATH_SITE . '/components/com_k2store/helpers/orders.php';
$selectableBase = new K2StoreSelectableBase();
$showShipping = true;
if (isset($row->is_shippable) && !empty($row->is_shippable)) {
    if ($row->is_shippable == '0') {
        $showShipping = false;
    }
} else {
    if (!$this->params->get('show_shipping_address')) {
        $showShipping = false;
    }
}
?>
<div class='row-fluid'>
	<div class="span12">
		<h3><?php 
echo JText::_("K2STORE_ORDER_DETAIL");
Пример #6
0
/*------------------------------------------------------------------------
 # com_k2store - K2 Store
# ------------------------------------------------------------------------
# author    Ramesh Elamathi - Weblogicx India http://www.weblogicxindia.com
# copyright Copyright (C) 2012 Weblogicxindia.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://k2store.org
# Technical Support:  Forum - http://k2store.org/forum/index.html
-------------------------------------------------------------------------*/
//no direct access
defined('_JEXEC') or die('Restricted access');
require_once JPATH_ADMINISTRATOR . '/components/com_k2store/library/prices.php';
require_once JPATH_ADMINISTRATOR . '/components/com_k2store/library/selectable/base.php';
require_once JPATH_SITE . '/components/com_k2store/helpers/orders.php';
$selectableBase = new K2StoreSelectableBase();
$row = @$this->row;
$order = @$this->order;
$items = @$order->getItems();
if (JFactory::getUser()->id && empty($row->billing_first_name)) {
    $recipient_name = JFactory::getUser()->name;
} else {
    $recipient_name = $row->billing_first_name . '&nbsp;' . $row->billing_last_name;
}
$showShipping = true;
if (isset($row->is_shippable) && !empty($row->is_shippable)) {
    if ($row->is_shippable == '0') {
        $showShipping = false;
    }
} else {
    if (!$this->params->get('show_shipping_address')) {
Пример #7
0
 function save()
 {
     $selectableBase = new K2StoreSelectableBase();
     $result = $selectableBase->save();
     if ($result) {
         //get process field because result is true
         $data = $selectableBase->fielddata;
         $table = $this->getTable();
         $table->bind($data);
         $table->store();
         return $table->field_id;
     } else {
         //error get it
         $errors = $selectableBase->errors;
         $error = implode(',', $errors);
         throw new Exception($error);
         return false;
     }
 }