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


PHP Axis::table方法代码示例

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


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

示例1: getAllowedTypes

 public function getAllowedTypes($request)
 {
     switch ($this->_config->type) {
         case 'Per Weight':
             $value = $request['weight'];
             break;
         case 'Per Item':
             $value = $request['qty'];
             break;
         case 'Per Price':
         default:
             $value = $request['price'];
             break;
     }
     $select = Axis::table('shippingtable_rate')->select();
     $select->where('value <= ? ', $value)->where('site_id = ? OR site_id = 0', Axis::getSiteId())->where('country_id = ? OR country_id = 0', $request['country']['id'])->where('zip = ? OR zip = "*"', $request['postcode'])->order('site_id DESC')->order('country_id ASC')->order('zone_id ASC')->order('zip ASC')->order('value DESC')->limit(1);
     if (isset($request['zone']['id'])) {
         $select->where('zone_id = ? OR zone_id = 0', $request['zone']['id']);
     } else {
         $select->where('zone_id = 0');
     }
     $row = $select->fetchRow();
     $this->_types = array(array('id' => $this->_code, 'title' => $this->getTitle(), 'price' => $row['price'] + (is_numeric($this->_config->handling) ? $this->_config->handling : 0)));
     return $this->_types;
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:25,代码来源:Standard.php

示例2: getSaveValue

 /**
  *
  * @param mixed $value
  * @return mixed
  */
 public static function getSaveValue($value)
 {
     if (!is_array($value)) {
         return $value;
     }
     function remove_quotes(&$str)
     {
         $str = str_replace(array('"', "'"), '', $str);
     }
     $filename = Axis::config()->system->path . '/var/export/' . current($value);
     if (@(!($fp = fopen($filename, 'r')))) {
         Axis::message()->addError(Axis::translate('core')->__("Can't open file : %s", $filename));
         return current($value);
     }
     $titles = fgetcsv($fp, 2048, ',', "'");
     array_walk($titles, 'remove_quotes');
     $rowSize = count($titles);
     Axis::table('shippingtable_rate')->delete("site_id = " . $value['siteId']);
     while (!feof($fp)) {
         $data = fgetcsv($fp, 2048, ',', "'");
         if (!is_array($data)) {
             continue;
         }
         $data = array_pad($data, $rowSize, '');
         array_walk($data, 'remove_quotes');
         $data = array_combine($titles, $data);
         Axis::table('shippingtable_rate')->insert(array('site_id' => $value['siteId'], 'country_id' => Axis::single('location/country')->getIdByIsoCode3($data['Country']), 'zone_id' => Axis::single('location/zone')->getIdByCode($data['Region/State']), 'zip' => $data['Zip'], 'value' => $data['Value'], 'price' => $data['Price']));
     }
     return current($value);
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:35,代码来源:ShippingTableRateImport.php

示例3: getSaveValue

 /**
  *
  * @static
  * @param array $value
  * @return mixed
  */
 public static function getSaveValue($value)
 {
     if (!is_array($value)) {
         return $value;
     }
     $filename = Axis::config()->system->path . '/var/export/' . current($value);
     if (@(!($fp = fopen($filename, 'w')))) {
         Axis::message()->addError(Axis::translate('core')->__("Can't write in file: %s", $filename));
         return current($value);
     }
     $titles = explode(',', 'Country,Region/State,Zip,Value,Price');
     fputcsv($fp, $titles, ',', "'");
     foreach (Axis::table('shippingtable_rate')->fetchAll() as $row) {
         fputcsv($fp, array(Axis::single('location/country')->getIsoCode3ById($row->country_id), Axis::single('location/zone')->getCodeById($row->zone_id), $row->zip, $row->value, $row->price), ',', "'");
     }
     return current($value);
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:23,代码来源:ShippingTableRateExport.php


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