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


PHP Axis类代码示例

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


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

示例1: 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

示例2: _loadCollection

 /**
  *
  * @return array
  */
 protected function _loadCollection()
 {
     if (empty($this->_collection)) {
         $themes = Axis::model('core/option_theme');
         $layouts = array();
         $designPath = Axis::config('system/path') . '/app/design/front';
         foreach ($themes as $theme) {
             $path = $designPath . '/' . $theme . '/layouts';
             if (!file_exists($path)) {
                 continue;
             }
             $dir = opendir($path);
             while ($file = readdir($dir)) {
                 if (is_dir($path . '/' . $file) || substr($file, 0, 7) != 'layout_') {
                     continue;
                 }
                 $layout = substr($file, 0, -6);
                 if (isset($layouts[$layout])) {
                     $layouts[$layout]['themes'][] = $theme;
                     continue;
                 }
                 $layouts[$layout] = array('name' => $layout, 'themes' => array($theme));
             }
         }
         $collection = array();
         foreach ($layouts as $key => $layout) {
             $collection[$key] = $layout['name'] . ' (' . implode(', ', $layout['themes']) . ')';
         }
         $this->_collection = $collection;
     }
     return $this->_collection;
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:36,代码来源:Layout.php

示例3: collect

 /**
  *
  * @static
  * @return array
  */
 public static function collect()
 {
     if (null === self::$_collection) {
         $themes = Axis_Collect_Theme::collect();
         $layouts = array();
         $designPath = Axis::config('system/path') . '/app/design/front';
         foreach ($themes as $theme) {
             $path = $designPath . '/' . $theme . '/layouts';
             if (!file_exists($path)) {
                 continue;
             }
             $dir = opendir($path);
             while ($file = readdir($dir)) {
                 if (is_dir($path . '/' . $file) || substr($file, 0, 7) != 'layout_') {
                     continue;
                 }
                 $layout = substr($file, 0, -6);
                 if (isset($layouts[$layout])) {
                     $layouts[$layout]['themes'][] = $theme;
                     continue;
                 }
                 $layouts[$layout] = array('name' => $layout, 'themes' => array($theme));
             }
         }
         $collection = array();
         foreach ($layouts as $key => $layout) {
             $collection[$key] = $layout['name'] . ' (' . implode(', ', $layout['themes']) . ')';
         }
         self::$_collection = $collection;
     }
     return self::$_collection;
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:37,代码来源:Layout.php

示例4: getName

 /**
  *
  * @static
  * @param string  $code
  * @return string
  */
 public static function getName($code)
 {
     if (!$code) {
         return '';
     }
     return Axis::single('locale/currency')->getTitleByCode($code);
 }
开发者ID:rguedes,项目名称:axiscommerce,代码行数:13,代码来源:Currency.php

示例5: init

 public function init()
 {
     $categories = Axis::single('catalog/category')->select('*')->addName(Axis_Locale::getLanguageId())->addKeyWord()->order('cc.lft')->addSiteFilter(Axis::getSiteId())->addDisabledFilter()->fetchAll();
     if (!is_array($this->_activeCategories)) {
         $this->_activeCategories = array();
         if (Zend_Registry::isRegistered('catalog/current_category')) {
             $this->_activeCategories = array_keys(Zend_Registry::get('catalog/current_category')->cache()->getParentItems());
         }
     }
     $container = $_container = new Zend_Navigation();
     $lvl = 0;
     $view = $this->getView();
     foreach ($categories as $_category) {
         $uri = $view->hurl(array('cat' => array('value' => $_category['id'], 'seo' => $_category['key_word']), 'controller' => 'catalog', 'action' => 'view'), false, true);
         $class = 'nav-' . str_replace('.', '-', $_category['key_word']);
         $page = new Zend_Navigation_Page_Uri(array('label' => $_category['name'], 'title' => $_category['name'], 'uri' => $uri, 'order' => $_category['lft'], 'class' => $class, 'visible' => 'enabled' === $_category['status'] ? true : false, 'active' => in_array($_category['id'], $this->_activeCategories)));
         $lvl = $lvl - $_category['lvl'] + 1;
         for ($i = 0; $i < $lvl; $i++) {
             $_container = $_container->getParent();
         }
         $lvl = $_category['lvl'];
         $_container->addPage($page);
         $_container = $page;
     }
     $this->setData('menu', $container);
     return true;
 }
开发者ID:rguedes,项目名称:axiscommerce,代码行数:27,代码来源:Navigation.php

示例6: up

 public function up()
 {
     $_pickup = array('RDP' => Axis_ShippingUps_Model_Option_Standard_Pickup::RDP, 'CC' => Axis_ShippingUps_Model_Option_Standard_Pickup::CC, 'OTP' => Axis_ShippingUps_Model_Option_Standard_Pickup::OTP, 'OCA' => Axis_ShippingUps_Model_Option_Standard_Pickup::OCA, 'LC' => Axis_ShippingUps_Model_Option_Standard_Pickup::LC);
     $rowset = Axis::single('core/config_value')->select()->where('path = ?', 'shipping/Ups_Standard/pickup')->fetchRowset();
     foreach ($rowset as $row) {
         $row->value = isset($_pickup[$row->value]) ? $_pickup[$row->value] : Axis_ShippingUps_Model_Option_Standard_Pickup::CC;
         $row->save();
     }
     ///////////////////////////
     $_package = array('CP' => Axis_ShippingUps_Model_Option_Standard_Package::CP, 'ULE' => Axis_ShippingUps_Model_Option_Standard_Package::ULE, 'UT' => Axis_ShippingUps_Model_Option_Standard_Package::UT, 'UEB' => Axis_ShippingUps_Model_Option_Standard_Package::UEB);
     $rowset = Axis::single('core/config_value')->select()->where('path = ?', 'shipping/Ups_Standard/package')->fetchRowset();
     foreach ($rowset as $row) {
         $row->value = isset($_package[$row->value]) ? $_package[$row->value] : Axis_ShippingUps_Model_Option_Standard_Package::CP;
         $row->save();
     }
     ///////////////////////////
     $_dest = array('RES' => Axis_ShippingUps_Model_Option_Standard_DestinationType::RES, 'COM' => Axis_ShippingUps_Model_Option_Standard_DestinationType::COM);
     $rowset = Axis::single('core/config_value')->select()->where('path = ?', 'shipping/Ups_Standard/res')->fetchRowset();
     foreach ($rowset as $row) {
         $row->value = isset($_dest[$row->value]) ? $_dest[$row->value] : Axis_ShippingUps_Model_Option_Standard_DestinationType::RES;
         $row->save();
     }
     ///////////////////////////
     $paths = array('shipping/Ups_Standard/pickup' => 'shippingUps/option_standard_pickup', 'shipping/Ups_Standard/package' => 'shippingUps/option_standard_package', 'shipping/Ups_Standard/res' => 'shippingUps/option_standard_destinationType', 'shipping/Ups_Standard/measure' => 'shippingUps/option_standard_measure', 'shipping/Ups_Standard/type' => 'shippingUps/option_standard_requestType', 'shipping/Ups_Standard/types' => 'shippingUps/option_standard_service', 'shipping/Ups_Standard/xmlOrigin' => 'shippingUps/option_standard_origin');
     $rowset = Axis::single('core/config_field')->select()->fetchRowset();
     foreach ($rowset as $row) {
         if (isset($paths[$row->path])) {
             $row->model = $paths[$row->path];
             $row->save();
         }
     }
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:32,代码来源:0.1.3.php

示例7: postProcess

 public function postProcess(Axis_Sales_Model_Order_Row $order)
 {
     $this->saveCreditCard($order);
     $cc = $this->getCreditCard();
     $options = $this->getLineItemDetails();
     $billing = $order->getBilling();
     $optionsAll = array_merge($options, array('STREET' => $billing->getStreetAddress(), 'ZIP' => $billing->getPostcode(), 'BUTTONSOURCE' => $this->_buttonSourceDP, 'CURRENCY' => $this->getBaseCurrencyCode(), 'IPADDRESS' => $_SERVER['REMOTE_ADDR']));
     if ($cc->getCcIssueMonth() && $cc->getCcIssueYear()) {
         $optionsAll['CARDSTART'] = $cc->getCcIssueMonth() . substr($cc->getCcIssueYear(), -2);
     }
     $optionsNVP = array('CITY' => $billing->getCity(), 'STATE' => $billing->getZone()->getCode() ? $billing->getZone()->getCode() : $billing->getCity(), 'COUNTRYCODE' => $billing->getCountry()->getIsoCode2(), 'EXPDATE' => $cc->getCcExpiresMonth() . $cc->getCcExpiresYear(), 'PAYMENTACTION' => $this->_config->paymentAction == 'Authorization' ? 'Authorization' : 'Sale');
     $delivery = $order->getDelivery();
     $optionsShip = array('SHIPTONAME' => $delivery->getFirstname() . ' ' . $delivery->getLastname(), 'SHIPTOSTREET' => $delivery->getStreetAddress(), 'SHIPTOSTREET2' => $delivery->getSuburb(), 'SHIPTOCITY' => $delivery->getCity(), 'SHIPTOZIP' => $delivery->getPostcode(), 'SHIPTOSTATE' => $delivery->getZone()->getCode() ? $delivery->getZone()->getCode() : $delivery->getCity(), 'SHIPTOCOUNTRYCODE' => $delivery->getCountry()->getIsoCode2());
     // if these optional parameters are blank, remove them from transaction
     if (isset($optionsShip['SHIPTOSTREET2']) && empty($optionsShip['SHIPTOSTREET2'])) {
         unset($optionsShip['SHIPTOSTREET2']);
     }
     $response = $this->getApi()->DoDirectPayment(sprintf('%.2f', $this->getAmountInBaseCurrency($order->order_total)), $cc->getCcNumber(), $cc->getCcCvv(), $cc->getCcExpiresMonth() . $cc->getCcExpiresYear(), $billing->getFirstname(), $billing->getLastname(), $cc->getCcType(), $optionsAll, array_merge($optionsNVP, $optionsShip));
     if ($response['ACK'] != 'Success') {
         $this->log("Response : " . Zend_Debug::dump($response, null, false));
         foreach ($this->getMessages($response) as $severity => $messages) {
             Axis::message()->batchAdd($messages, $severity);
         }
         throw new Axis_Exception('DoDirectPayment Failure');
     }
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:26,代码来源:Direct.php

示例8: add

 /**
  * Add product to order
  *
  * @param array $product
  * @param int $orderId
  * @return int orderProductId
  */
 public function add($product, $orderId)
 {
     $stock = Axis::single('catalog/product_stock')->find($product['product_id'])->current();
     $backorder = $stock->backorder;
     $productVariationId = isset($product['variation_id']) ? $product['variation_id'] : null;
     $stockQuantity = $stock->getQuantity($productVariationId);
     if ($stockQuantity - $product['quantity'] > $stock->min_qty) {
         $backorder = 0;
     }
     //calculate tax
     $taxClassId = Axis::single('catalog/product')->getTaxClassId($product['product_id']);
     $orderRow = Axis::single('sales/order')->find($orderId)->current();
     $countryId = Axis::single('location/country')->getIdByName($orderRow->delivery_country);
     $zoneId = 0;
     if (!empty($orderRow->delivery_state)) {
         $zoneId = Axis::single('location/zone')->getIdByName($orderRow->delivery_state);
     }
     $geozoneIds = Axis::single('location/geozone')->getIds($countryId, $zoneId);
     $customerGroupId = Axis::single('account/customer')->getGroupId($orderRow->customer_id);
     $productTax = Axis::single('tax/rate')->calculateByPrice($product['final_price'], $taxClassId, $geozoneIds, $customerGroupId);
     $orderProductId = $this->insert(array('order_id' => $orderId, 'product_id' => $product['product_id'], 'variation_id' => $productVariationId, 'sku' => $product['sku'], 'name' => $product['name'], 'price' => $product['price'], 'tax' => $productTax, 'final_price' => $product['final_price'], 'final_weight' => $product['final_weight'], 'quantity' => $product['quantity'], 'backorder' => $backorder));
     // $orderProductId = $this->getAdapter()->lastInsertId();
     if (isset($product['attributes']) && is_array($product['attributes'])) {
         $modelAttributte = Axis::single('sales/order_product_attribute');
         foreach ($product['attributes'] as $attribute) {
             $modelAttributte->insert(array('order_product_id' => $orderProductId, 'product_option' => $attribute['product_option'], 'product_option_value' => $attribute['product_option_value']));
         }
     }
     $productRow = Axis::single('catalog/product')->find($product['product_id'])->current();
     $productRow->ordered += 1;
     //$product['quantity'];
     $productRow->save();
     return $orderProductId;
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:41,代码来源:Product.php

示例9: _beforeRender

 protected function _beforeRender()
 {
     if (!$this->hasData('product_id')) {
         return true;
     }
     if (!is_array($this->review_count)) {
         return true;
     }
     /* if review already loaded */
     if (in_array($this->product_id, array_keys($this->review_count))) {
         return true;
     }
     if (!is_array($this->product_ids)) {
         $this->setProductIds(array($this->product_id));
     } elseif (!in_array($this->product_id, $this->getProductIds())) {
         $productIds = $this->product_ids;
         $productIds[] = $this->product_id;
         $this->setProductIds($productIds);
     }
     $productIds = array_diff($this->getProductIds(), array_keys($this->review_count));
     $modelCommunityReview = Axis::single('community/review');
     $this->review_count += $modelCommunityReview->cache()->getCountByProductId($productIds);
     $this->ratings += $modelCommunityReview->cache()->getAverageProductRating($productIds, $this->getView()->config('community/review/merge_average'));
     return true;
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:25,代码来源:ReviewRating.php

示例10: removeAction

 public function removeAction()
 {
     $data = Zend_Json::decode($this->_getParam('data'));
     Axis::model('account/customer_valueSet')->delete($this->db->quoteInto('id IN (?)', $data));
     Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
     return $this->_helper->json->sendSuccess();
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:7,代码来源:ValueSetController.php

示例11: getName

 /**
  *
  * @static
  * @param int $id
  * @return string
  */
 public static function getName($id)
 {
     if (!$id) {
         return '';
     }
     return Axis::single('core/site')->getNameById($id);
 }
开发者ID:rguedes,项目名称:axiscommerce,代码行数:13,代码来源:Site.php

示例12: __construct

 public function __construct()
 {
     $select = Axis::model('discount/discount')->select('*');
     $select->joinLeft('discount_eav', 'de.discount_id = d.id', '*')->order('d.priority DESC');
     $this->_select = $select;
     $this->_filters = new Axis_Object();
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:7,代码来源:Collection.php

示例13: ratings

 /**
  * Build rating stars, according to recieved ratings array
  *
  * @param array $ratings
  *  array(
  *      array(
  *          'mark' => int,
  *          'title' => string,
  *          'product_id' => int[optional]
  *      ),...
  *  )
  * @param string $url [optional]
  * @param boolean $smallStars [optional]
  * @return string
  */
 public function ratings($ratings, $url = '', $smallStars = true)
 {
     if (isset($this->_config['rating_enabled']) && !$this->_config['rating_enabled']) {
         return '';
     }
     if (!is_array($ratings)) {
         $ratings = array();
     }
     $url = empty($url) ? '#' : $url;
     $hasRating = false;
     $html = '';
     foreach ($ratings as $rating) {
         if (!count($rating)) {
             continue;
         }
         $hasRating = true;
         $html .= '<li>';
         $html .= $this->_getRatingTitle($rating['title']);
         $html .= '<a href="' . $url . '" class="review-stars review-rate' . ($smallStars ? '-sm' : '') . ' "title="' . $rating['title'] . ': ' . $rating['mark'] . ' ' . Axis::translate('community')->__('stars') . '">
                   <span style="width: ' . $rating['mark'] * 100 / 5 . '%">' . Axis::translate('community')->__("%s stars", $rating['mark']) . '</span>
         </a>';
         $html .= '</li>';
     }
     if ($hasRating) {
         $html = '<ul class="review-ratings">' . $html . '</ul>';
     }
     return $html;
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:43,代码来源:Ratings.php

示例14: removeAction

 public function removeAction()
 {
     $customerGroupIds = Zend_Json::decode($this->_getParam('data'));
     $isValid = true;
     if (in_array(Axis_Account_Model_Customer_Group::GROUP_GUEST_ID, $customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default Guest group id: %s ", Axis_Account_Model_Customer_Group));
     }
     if (in_array(Axis_Account_Model_Customer_Group::GROUP_ALL_ID, $customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default All group id: %s ", Axis_Account_Model_Customer_Group::GROUP_ALL_ID));
     }
     if (true === in_array(Axis::config()->account->main->defaultCustomerGroup, $customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default customer group id: %s ", $id));
     }
     if (!sizeof($customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__('No data to delete'));
     }
     if ($isValid) {
         Axis::single('account/customer_group')->delete($this->db->quoteInto('id IN(?)', $customerGroupIds));
         Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
     }
     $this->_helper->json->sendJson(array('success' => $isValid));
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:26,代码来源:GroupController.php

示例15: up

 public function up()
 {
     $installer = $this->getInstaller();
     $installer->run("\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('log_url')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('log_url')}` (\n          `url_id` int(11) NOT NULL,\n          `visitor_id` int(11) NOT NULL,\n          `visit_at` datetime default NULL,\n          `site_id` smallint(9) NOT NULL,\n          PRIMARY KEY  (`url_id`,`visitor_id`)\n        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('log_url_info')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('log_url_info')}` (\n          `id` mediumint(7) NOT NULL auto_increment,\n          `url` varchar(255) default NULL,\n          `refer` varchar(255) default NULL,\n          PRIMARY KEY  (`id`)\n        ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('log_visitor')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('log_visitor')}` (\n          `id` mediumint(7) unsigned NOT NULL auto_increment,\n          `session_id` char(32) default NULL,\n          `customer_id` int(11) default NULL,\n          `last_url_id` int(11) default NULL,\n          `last_visit_at` datetime default NULL,\n          `site_id` smallint(9) NOT NULL,\n          PRIMARY KEY  (`id`),\n          UNIQUE KEY `UNQ_LOG_VISITOR` (`session_id`,`customer_id`)\n        ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('log_visitor_info')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('log_visitor_info')}` (\n          `visitor_id` int(11) NOT NULL,\n          `http_refer` varchar(255) default NULL,\n          `user_agent` varchar(255) default NULL,\n          `http_accept_charset` varchar(128) default NULL,\n          `http_accept_language` varchar(128) default NULL,\n          `server_addr` varchar(128) default NULL,\n          `remote_addr` varchar(128) default NULL,\n          PRIMARY KEY  (`visitor_id`),\n          KEY `fk_log_visitor_info_log_visitor` (`visitor_id`)\n        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n        ");
     $this->getConfigBuilder()->section('log', 'Log')->setTranslation('Axis_Log')->section('main', 'General')->option('enabled', 'Enabled', true)->setType('radio')->setModel('core/option_boolean')->option('php', 'Php log', '/var/logs/php.log')->setDescription('Path relative to AXIS_ROOT')->option('payment', 'Payment log', '/var/logs/payment.log')->setDescription('Path relative to AXIS_ROOT')->option('shipping', 'Shipping log', '/var/logs/shipping.log')->setDescription('Path relative to AXIS_ROOT')->section('/');
     Axis::single('core/page')->add('account/*/*');
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:7,代码来源:0.1.1.php


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