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


PHP F0FTable::getInstance方法代码示例

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


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

示例1: init

 public function init()
 {
     // get the coupon from the session and assign it to the coupon variable
     $session = JFactory::getSession();
     // sanity check
     $this->code = $session->get('coupon', '', 'j2store');
     if (empty($this->code)) {
         return false;
     }
     static $couponsets;
     if (!is_array($couponsets)) {
         $couponsets = array();
     }
     if (!isset($couponsets[$this->code])) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select('*')->from('#__j2store_coupons')->where('coupon_code = ' . $db->q($this->code));
         $db->setQuery($query);
         try {
             $row = $db->loadObject();
         } catch (Exception $e) {
             // an error occured
             $row = F0FTable::getInstance('Coupon', 'J2StoreTable');
         }
         $couponsets[$this->code] = $row;
     }
     $this->coupon = $couponsets[$this->code];
     return true;
 }
开发者ID:afend,项目名称:RULug,代码行数:28,代码来源:coupons.php

示例2: update_inventory

 public function update_inventory()
 {
     $app = JFactory::getApplication();
     $quantity = $app->input->getInt('quantity');
     $availability = $app->input->getInt('availability');
     $manage_stock = $app->input->getInt('manage_stock');
     $variant_id = $app->input->getInt('variant_id');
     $json = array();
     if ($variant_id > 0) {
         F0FTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_j2store/tables');
         $productquantities = F0FTable::getInstance('Productquantity', 'J2StoreTable')->getClone();
         $productquantities->load(array('variant_id' => $variant_id));
         $productquantities->variant_id = $variant_id;
         $productquantities->quantity = $quantity;
         if (!$productquantities->store()) {
             $json['error'] = "Problem in Save";
         }
         $variants_table = F0FTable::getInstance('Variant', 'J2StoreTable')->getClone();
         $variants_table->load($variant_id);
         $variants_table->availability = $availability;
         $variants_table->manage_stock = $manage_stock;
         if (!$variants_table->store()) {
             $json['error'] = "Problem in Save";
         }
     }
     if (!$json) {
         $json['success'] = 'index.php?option=com_j2store&view=inventories';
     }
     echo json_encode($json);
     $app->close();
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:31,代码来源:inventories.php

示例3: save

 public function save($data)
 {
     if (parent::save($data)) {
         if ($this->otable->j2store_geozone_id) {
             if (isset($data['zone_to_geo_zone']) && count($data['zone_to_geo_zone'])) {
                 $grtable = F0FTable::getInstance('geozonerule', 'J2StoreTable');
                 $status = true;
                 foreach ($data['zone_to_geo_zone'] as $georule) {
                     $grtable->load($georule['j2store_geozonerule_id']);
                     $georule['geozone_id'] = $this->otable->j2store_geozone_id;
                     try {
                         $grtable->save($georule);
                     } catch (Exception $e) {
                         $status = false;
                     }
                     if (!$status) {
                         break;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:28,代码来源:geozones.php

示例4: save

 public function save($data)
 {
     if (parent::save($data)) {
         if ($this->otable->j2store_taxprofile_id) {
             if (isset($data['tax-to-taxrule-row']) && count($data['tax-to-taxrule-row'])) {
                 $trTable = F0FTable::getInstance('taxrules', 'Table');
                 $status = true;
                 foreach ($data['tax-to-taxrule-row'] as $taxrate) {
                     $trTable->load($taxrate['j2store_taxrule_id']);
                     $taxrate['taxprofile_id'] = $this->otable->j2store_taxprofile_id;
                     try {
                         $trTable->save($taxrate);
                     } catch (Exception $e) {
                         $status = false;
                     }
                     if (!$status) {
                         break;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:28,代码来源:taxprofiles.php

示例5: save

 public function save($data)
 {
     if (parent::save($data)) {
         if ($this->otable->j2store_option_id) {
             if (is_object($data)) {
                 $data = (array) $data;
             }
             if (isset($data['option_value']) && count($data['option_value'])) {
                 $ovTable = F0FTable::getInstance('optionvalue', 'Table');
                 $status = true;
                 foreach ($data['option_value'] as $optionvalue) {
                     $ovTable->load($optionvalue['j2store_optionvalue_id']);
                     $optionvalue['option_id'] = $this->otable->j2store_option_id;
                     if (!$ovTable->save($optionvalue)) {
                         $status = false;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:26,代码来源:options.php

示例6: onAfterGetItem

 public function onAfterGetItem(&$model, &$record)
 {
     //we just have the products. Get the variants
     $variantModel = F0FModel::getTmpInstance('Variants', 'J2StoreModel');
     $variantModel->setState('product_type', $record->product_type);
     $app = JFactory::getApplication();
     //Its a simple product. So we will have only one variant record
     try {
         $variants = $variantModel->product_id($record->j2store_product_id)->is_master(1)->getList();
         $record->variants = $variants[0];
     } catch (Exception $e) {
         $this->setError($e->getMessage());
         $record->variants = F0FTable::getInstance('Variants', 'J2StoreTable');
     }
     try {
         //lets load product options as well
         $option_model = F0FModel::getTmpInstance('ProductOptions', 'J2StoreModel')->clearState()->product_id($record->j2store_product_id)->limit(0)->limitstart(0);
         $view = $app->input->getCmd('view', '');
         //TODO we should find an alternative method. This is a quick fix.
         if ($app->isSite() && $view != 'form') {
             $option_model->setState('parent_id', 0);
         }
         $record->product_options = $option_model->getList();
     } catch (Exception $e) {
         $this->setError($e->getMessage());
     }
     $registry = new JRegistry();
     $registry->loadString($record->params, 'JSON');
     $record->params = $registry;
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:30,代码来源:configurable.php

示例7: save

 public function save($data)
 {
     $app = JFactory::getApplication();
     $task = $app->input->getString('task');
     if ($task == 'saveorder') {
         return parent::save($data);
     }
     if (parent::save($data)) {
         if (isset($this->otable->j2store_filtergroup_id)) {
             if (isset($data['filter_value']) && count($data['filter_value'])) {
                 $ovTable = F0FTable::getInstance('filter', 'J2StoreTable');
                 $status = true;
                 foreach ($data['filter_value'] as $filtervalue) {
                     $ovTable->load($filtervalue['j2store_filter_id']);
                     $filtervalue['group_id'] = $this->otable->j2store_filtergroup_id;
                     if (!$ovTable->save($filtervalue)) {
                         $status = false;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:28,代码来源:filtergroups.php

示例8: save

 function save()
 {
     $app = JFactory::getApplication();
     $sid = $app->input->getInt('j2store_shippingmethod_id');
     $values = $app->input->getArray($_POST);
     $model = F0FModel::getTmpInstance('ShippingMethods', 'J2StoreModel');
     require_once JPATH_SITE . '/plugins/j2store/shipping_standard/shipping_standard/tables/shippingmethod.php';
     $model->addIncludePath(JPATH_SITE . '/plugins/j2store/shipping_standard/shipping_standard/tables');
     $this->includeCustomTables();
     $table = F0FTable::getInstance('ShippingMethod', 'J2StoreTable');
     $table->bind($values);
     try {
         $table->save($values);
         $link = $this->baseLink();
         $this->messagetype = 'message';
         $this->message = JText::_('J2STORE_ALL_CHANGES_SAVED');
     } catch (Exception $e) {
         $link = $this->baseLink() . '&shippingTask=view&sid=' . $sid;
         $this->messagetype = 'error';
         $this->message = JText::_('J2STORE_SAVE_FAILED') . $e->getMessage();
     }
     if ($this->getTask() == 'apply') {
         $link = $this->baseLink() . '&shippingTask=view&sid=' . $table->j2store_shippingmethod_id;
     }
     $redirect = JRoute::_($link, false);
     $this->setRedirect($redirect, $this->message, $this->messagetype);
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:27,代码来源:controller.php

示例9: onBeforeSave

 public function onBeforeSave(&$data, &$table)
 {
     $app = JFactory::getApplication();
     $addressTable = F0FTable::getInstance('Address', 'J2storeTable');
     $addressTable->load($data['address_id']);
     $addressTable->save($data);
     $data['address_id'] = $addressTable->j2store_address_id;
     return true;
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:9,代码来源:manufacturers.php

示例10: getAddressById

 public function getAddressById($address_id)
 {
     static $sets;
     if (!is_array($sets)) {
         $sets = array();
     }
     if (!isset($sets[$address_id])) {
         $address_table = F0FTable::getInstance('Address', 'J2StoreTable');
         $address_table->load($address_id);
         $sets[$address_id] = $address_table;
     }
     return $sets[$address_id];
 }
开发者ID:jputz12,项目名称:OneNow-Vshop,代码行数:13,代码来源:addresses.php

示例11: init

 public function init()
 {
     //get the coupon from the session and assign it to the coupon variable
     $session = JFactory::getSession();
     $this->code = $session->get('voucher', '', 'j2store');
     if (empty($this->code)) {
         return false;
     }
     //load the coupon
     $table = F0FTable::getInstance('Voucher', 'J2StoreTable');
     $table->load(array('voucher_code' => $this->code));
     $this->voucher = $table;
     return true;
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:14,代码来源:vouchers.php

示例12: deleteTaxRule

 function deleteTaxRule()
 {
     $app = JFactory::getApplication();
     $taxrule_id = $app->input->getInt('taxrule_id');
     $taxrule = F0FTable::getInstance('taxrules', 'Table');
     $response = array();
     try {
         $taxrule->delete($taxrule_id);
         $response['success'] = JText::_('J2STORE_TAXRULE_DELETED_SUCCESSFULLY');
     } catch (Exception $e) {
         $response['error'] = JText::_('J2STORE_TAXRULE_DELETE_FAILED');
     }
     echo json_encode($response);
     $app->close();
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:15,代码来源:taxprofile.php

示例13: removeGeozoneRule

 /**
  * Method to delete
  * Geo Rule of GeoZones
  * @params
  */
 function removeGeozoneRule()
 {
     $app = JFactory::getApplication();
     $post = $app->input->getArray($_POST);
     $georule_id = $post['rule_id'];
     $georuleTable = F0FTable::getInstance('geozonerule', 'Table');
     $json = array();
     if (!$georuleTable->delete($georule_id)) {
         $json['msg'] = $georuleTable->getError();
     } else {
         $json['msg'] = JText::_('J2STORE_GEORULE_DELETED_SUCCESSFULLY');
     }
     echo json_encode($json);
     $app->close();
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:20,代码来源:geozones.php

示例14: delete

 /**
  * Method to delete customer
  */
 function delete()
 {
     // Initialise the App variables
     $app = JFactory::getApplication();
     // Assign the get Id to the Variable
     $id = $app->input->getInt('id');
     if ($id && $app->isAdmin()) {
         // store the table in the variable
         $address = F0FTable::getInstance('Address', 'J2StoreTable');
         $address->load($id);
         $email = $address->email;
         try {
             $address->delete();
             $msg = JText::_('J2STORE_ITEMS_DELETED');
         } catch (Exception $error) {
             $msg = $error->getMessage();
         }
     }
     $link = 'index.php?option=com_j2store&view=customer&task=viewOrder&email_id=' . $email;
     $this->setRedirect($link, $msg);
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:24,代码来源:customers.php

示例15: save

 public function save($data)
 {
     if (parent::save($data)) {
         if ($this->otable->j2store_filtergroup_id) {
             if (isset($data['filter_value']) && count($data['filter_value'])) {
                 $ovTable = F0FTable::getInstance('filter', 'J2StoreTable');
                 $status = true;
                 foreach ($data['filter_value'] as $filtervalue) {
                     $ovTable->load($filtervalue['j2store_filter_id']);
                     $filtervalue['group_id'] = $this->otable->j2store_filtergroup_id;
                     if (!$ovTable->save($filtervalue)) {
                         $status = false;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
开发者ID:jputz12,项目名称:OneNow-Vshop,代码行数:23,代码来源:filtergroups.php


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