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


PHP J2Store::getSelectableBase方法代碼示例

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


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

示例1: onAdd

 /**
  * Executes before rendering the page for the Add task.
  *
  * @param   string  $tpl  Subtemplate to use
  *
  * @return  boolean  Return true to allow rendering of the page
  */
 protected function onAdd($tpl = null)
 {
     $id = $this->input->getInt('id');
     $this->order = F0FTable::getAnInstance('Order', 'J2StoreTable');
     $this->order->load($id);
     $this->item = $this->order;
     $this->fieldClass = J2Store::getSelectableBase();
     $this->params = J2Store::config();
     $this->currency = J2Store::currency();
     $this->taxes = $this->order->getOrderTaxrates();
     $this->shipping = $this->order->getOrderShippingRate();
     $this->coupons = $this->order->getOrderCoupons();
     $this->vouchers = $this->order->getOrderVouchers();
     $this->orderinfo = $this->order->getOrderInformation();
     $this->orderhistory = $this->order->getOrderHistory();
     parent::onAdd();
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:24,代碼來源:view.html.php

示例2: save

 /**
  * This method runs before the $data is saved to the $table. Return false to
  * stop saving.
  *
  * @param   array     &$data   The data to save
  * @param   F0FTable  &$table  The table to save the data to
  *
  * @return  boolean  Return false to prevent saving, true to allow it
  */
 public function save($data)
 {
     $status = true;
     //get the customfieldtable
     $table = $this->getTable();
     $selectableBase = J2Store::getSelectableBase();
     $result = $selectableBase->save();
     if ($result) {
         //get process field because result is true
         $data = $selectableBase->fielddata;
         //$table = $this->getTable();
         //$table->bind($data);
         $status = parent::save($data);
         //return true;
         //return $table->field_id;
     } else {
         //error get it
         $errors = $selectableBase->errors;
         $error = implode(',', $errors);
         throw new Exception($error);
         $status = false;
     }
     return true;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:33,代碼來源:customfields.php

示例3: setOrderinfo

 /**
  * Method to edit orderinfo based on the address type
  *
  */
 function setOrderinfo()
 {
     $order_id = $this->input->getString('order_id');
     $address_type = $this->input->getString('address_type');
     $orderinfo = F0FTable::getAnInstance('Orderinfo', 'J2StoreTable');
     $orderinfo->load(array('order_id' => $order_id));
     $type = "all_" . $address_type;
     $custom_datas = json_decode($orderinfo->{$type});
     $processed = $this->removePrefix((array) $orderinfo, $address_type);
     foreach ($custom_datas as $key => $custom_data) {
         $processed->{$key} = $custom_data->value;
     }
     $model = F0FModel::getTmpInstance('Orders', 'J2StoreModel');
     $view = $this->getThisView();
     $view->setModel($model, true);
     $view->addTemplatePath(JPATH_ADMINISTRATOR . '/components/com_j2store/views/order/tmpl/');
     $view->set('address_type', $address_type);
     $fieldClass = J2Store::getSelectableBase();
     $view->set('fieldClass', $fieldClass);
     $view->set('orderinfo', $processed);
     $view->set('item', $orderinfo);
     $view->setLayout('address');
     $view = $this->display();
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:28,代碼來源:orders.php

示例4: processCustomFields

 public function processCustomFields($type, $data)
 {
     $selectableBase = J2Store::getSelectableBase();
     $address = F0FTable::getAnInstance('Address', 'J2StoreTable');
     $orderinfo = F0FTable::getAnInstance('Orderinfo', 'J2StoreTable');
     $fields = $selectableBase->getFields($type, $address, 'address');
     if (is_array($data)) {
         $data = JArrayHelper::toObject($data);
     }
     $values = array();
     foreach ($fields as $fieldName => $oneExtraField) {
         if (isset($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;
 }
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:23,代碼來源:order.php

示例5: shipping_payment_method_validate

 function shipping_payment_method_validate()
 {
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     $user = JFactory::getUser();
     $params = J2Store::config();
     $address_model = F0FModel::getTmpInstance('Addresses', 'J2StoreModel');
     $view = $this->getThisView();
     if ($model = $this->getThisModel()) {
         // Push the model into the view (as default)
         $view->setModel($model, true);
     }
     $order = F0FModel::getTmpInstance('Orders', 'J2StoreModel')->initOrder()->getOrder();
     $redirect_url = JRoute::_('index.php?option=com_j2store&view=checkout');
     //now get the values posted by the plugin, if any
     $values = $app->input->getArray($_POST);
     $json = array();
     //first validate custom fields
     $selectableBase = J2Store::getSelectableBase();
     $json = $selectableBase->validate($values, 'payment', 'address');
     if (!$json) {
         $json = J2Store::plugin()->eventWithArray('CheckoutValidateShippingPayment', array($values));
     }
     if (!$json) {
         //validate weather the customer is logged in
         $billing_address = '';
         if ($user->id && $session->has('billing_address_id', 'j2store')) {
             $billing_address = $address_model->getItem($session->get('billing_address_id', '', 'j2store'));
         } elseif ($session->has('guest', 'j2store')) {
             $guest = $session->get('guest', array(), 'j2store');
             $billing_address = $guest['billing'];
         }
         if (empty($billing_address)) {
             $json['redirect'] = $redirect_url;
         }
         //cart has products?
         if ($order->getItemCount() < 1) {
             $json['redirect'] = $redirect_url;
         }
         if (!$json) {
             $isShippingEnabled = $order->isShippingEnabled();
             //validate selection of shipping methods and set the shipping rates
             if ($params->get('show_shipping_address', 0) || $isShippingEnabled) {
                 //shipping is required.
                 if ($user->id && $session->has('shipping_address_id', 'j2store')) {
                     $shipping_address = $address_model->getItem($session->get('shipping_address_id', '', 'j2store'));
                 } elseif ($session->has('guest', 'j2store')) {
                     $guest = $session->get('guest', array(), 'j2store');
                     $shipping_address = $guest['shipping'];
                 }
                 //check if shipping address id is set in session. If not, redirect
                 if (empty($shipping_address)) {
                     $json['error']['shipping'] = JText::_('J2STORE_CHECKOUT_ERROR_SHIPPING_ADDRESS_NOT_FOUND');
                     $json['redirect'] = $redirect_url;
                 }
                 try {
                     $this->validateSelectShipping($values, $order);
                 } catch (Exception $e) {
                     $json['error']['shipping'] = $e->getMessage();
                 }
                 if (!$json) {
                     $shipping_values = array();
                     $shipping_values['shipping_price'] = isset($values['shipping_price']) ? $values['shipping_price'] : 0;
                     $shipping_values['shipping_extra'] = isset($values['shipping_extra']) ? $values['shipping_extra'] : 0;
                     $shipping_values['shipping_code'] = isset($values['shipping_code']) ? $values['shipping_code'] : '';
                     $shipping_values['shipping_name'] = isset($values['shipping_name']) ? $values['shipping_name'] : '';
                     $shipping_values['shipping_tax'] = isset($values['shipping_tax']) ? $values['shipping_tax'] : 0;
                     $shipping_values['shipping_plugin'] = isset($values['shipping_plugin']) ? $values['shipping_plugin'] : '';
                     //set the shipping method to session
                     $session->set('shipping_method', $shipping_values['shipping_plugin'], 'j2store');
                     $session->set('shipping_values', $shipping_values, 'j2store');
                 }
             }
         }
         if (!$json) {
             // is shipping mandatory
             if ($params->get('shipping_mandatory', 0)) {
                 //yes it is. Check if session has shipping values
                 $shipping_values = $session->get('shipping_values', array(), 'j2store');
                 $shipping_method = $session->get('shipping_method', null, 'j2store');
                 if (count($shipping_values) < 1 || empty($shipping_method)) {
                     //now value selected
                     $json['error']['shipping'] = JText::_('J2STORE_CHECKOUT_SHIPPING_METHOD_SELECTION_MANDATORY');
                 }
             }
         }
         //validate selection of payment methods
         if (!$json) {
             //re initialise the order
             $order = F0FModel::getTmpInstance('Orders', 'J2StoreModel')->initOrder()->getOrder();
             $showPayment = true;
             if ((double) $order->order_total == (double) '0.00') {
                 $showPayment = false;
             }
             if ($showPayment) {
                 $payment_plugin = $app->input->getString('payment_plugin');
                 if (!isset($payment_plugin)) {
                     $json['error']['warning'] = JText::_('J2STORE_CHECKOUT_ERROR_PAYMENT_METHOD');
                 } elseif (!isset($payment_plugin)) {
                     $json['error']['warning'] = JText::_('J2STORE_CHECKOUT_ERROR_PAYMENT_METHOD');
//.........這裏部分代碼省略.........
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:101,代碼來源:checkouts.php

示例6: saveAddress

 /**
  * Method to save Address
  * edit / new address will be saved
  * @param post data
  * @return result
  */
 function saveAddress()
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $values = $app->input->getArray($_POST);
     $values['id'] = $values['address_id'];
     $values['user_id'] = isset($values['user_id']) && $values['user_id'] ? $values['user_id'] : $user->id;
     $values['email'] = $user->email;
     $model = $this->getModel('myprofile');
     $selectableBase = J2Store::getSelectableBase();
     $json = $selectableBase->validate($values, $values['type'], 'address');
     if (empty($json['error'])) {
         $table = F0FTable::getAnInstance('Address', 'J2StoreTable');
         $values['user_id'] = isset($values['user_id']) ? $values['user_id'] : $user->id;
         $values['email'] = isset($values['user_id']) ? $values['email'] : $user->email;
         if ($table->save($values)) {
             $json['success']['url'] = JRoute::_('index.php?option=com_j2store&view=myprofile&task=editAddress&layout=address&tmpl=component&address_id=' . $table->j2store_address_id);
             $json['success']['msg'] = JText::_('J2STORE_' . strtoupper($table->type) . '_ADDRESS_SAVED_SUCCESSFULLY');
             $json['success']['msgType'] = 'success';
         } else {
             $json['error']['msgType'] = 'Warning';
         }
     }
     echo json_encode($json);
     $app->close();
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:32,代碼來源:myprofile.php

示例7: formatCustomFields

 function formatCustomFields($type, $data_field, &$order)
 {
     $address = F0FTable::getAnInstance('Address', 'J2StoreTable');
     $fields = J2Store::getSelectableBase()->getFields($type, $address, 'address', '', true);
     foreach ($fields as $field) {
         $order[$type . '_' . JString::strtolower($field->field_namekey)] = '';
     }
     $registry = new JRegistry();
     $registry->loadString(stripslashes($data_field), 'JSON');
     $custom_fields = $registry->toObject();
     $row = F0FTable::getAnInstance('Orderinfo', 'J2StoreTable');
     if (isset($custom_fields) && count($custom_fields)) {
         foreach ($custom_fields as $namekey => $field) {
             if (!property_exists($row, $type . '_' . strtolower($namekey)) && !property_exists($row, 'user_' . $namekey) && $namekey != 'country_id' && $namekey != 'zone_id' && $namekey != 'option' && $namekey != 'task' && $namekey != 'view' && $namekey != 'email') {
                 if (is_object($field)) {
                     $string = '';
                     if (is_array($field->value)) {
                         $k = count($field->value);
                         $i = 1;
                         foreach ($field->value as $value) {
                             $string .= JText::_($value);
                             if ($i != $k) {
                                 $string .= '|';
                             }
                             $i++;
                         }
                     } elseif (is_object($field->value)) {
                         //convert the object into an array
                         $obj_array = JArrayHelper::fromObject($field->value);
                         $k = count($obj_array);
                         $i = 1;
                         foreach ($obj_array as $value) {
                             $string .= JText::_($value);
                             if ($i != $k) {
                                 $string .= '|';
                             }
                             $i++;
                         }
                     } elseif (J2Store::utilities()->isJson(stripslashes($field->value))) {
                         $json_values = json_decode(stripslashes($field->value));
                         if (is_array($json_values)) {
                             $k = count($json_values);
                             $i = 1;
                             foreach ($json_values as $value) {
                                 $string .= JText::_($value);
                                 if ($i != $k) {
                                     $string .= '|';
                                 }
                                 $i++;
                             }
                         } else {
                             $string .= JText::_($field->value);
                         }
                     } else {
                         $string = JText::_($field->value);
                     }
                     if (!empty($string)) {
                         $order[$type . '_' . JString::strtolower($namekey)] = $string;
                     }
                 }
             }
         }
     }
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:64,代碼來源:orders.php

示例8:

?>
		<tr>
			<td><?php 
echo JText::_('J2STORE_ORDER_TRANSACTION_LOG');
?>
</td>
			<td>  <!-- Button to trigger modal -->
   				 <a href="#myTransaction" role="button" class="btn btn-success" data-toggle="modal"><?php 
echo JText::_('J2STORE_VIEW');
?>
</a>
  			</td>
		</tr>
		<tr>			
			<td colspan="2"><?php 
echo J2Store::getSelectableBase()->getFormatedCustomFields($this->orderinfo, 'customfields', 'payment');
?>
</td>			
		</tr>
		
</table>
</div>

<!-- Transaction log modal window -->
  <div id="myTransaction" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myTransactionLabel" aria-hidden="true">
   <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    	<h3 id="myTransactionLabel">
			<?php 
echo JText::_('J2STORE_TRANSACTION_LOG_HEADER');
?>
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:31,代碼來源:form_payment.php


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