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


PHP Axis::getCustomerId方法代碼示例

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


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

示例1: _beforeRender

 protected function _beforeRender()
 {
     $visitor = Axis::model('log/visitor')->getVisitor();
     // select all viewed products by current visitor
     $selectInner = Axis::model('log/event')->select(array('id', 'object_id'))->order('le.id DESC');
     $customerId = $visitor->customer_id;
     if ($customerId && $customerId === Axis::getCustomerId()) {
         $selectInner->join('log_visitor', 'le.visitor_id = lv.id')->where('lv.customer_id = ?', $customerId);
     } else {
         $selectInner->where('visitor_id = ?', $visitor->id);
     }
     // filter unique product_ids from correctly ordered query
     // using adapter for specific from statement
     // this subquery is used to get the correct order for products
     // bigfix for not displayed product if the user viewed it some time ago and now opened it again
     // with single query this product will not outputted first in a row
     $adapter = Axis::model('log/event')->getAdapter();
     $select = $adapter->select()->from(array('le' => $selectInner), 'object_id')->group('le.object_id')->order('le.id DESC')->limit($this->getProductsCount());
     $productIds = $adapter->fetchCol($select);
     if (empty($productIds)) {
         return false;
     }
     $products = Axis::model('catalog/product')->select('*')->addFilterByAvailability()->addCommonFields()->addFinalPrice()->joinCategory()->where('cc.site_id = ?', Axis::getSiteId())->where('cp.id IN (?)', $productIds)->fetchProducts($productIds);
     if (empty($products)) {
         return false;
     }
     $this->products = $products;
     return $this->hasProducts();
 }
開發者ID:rguedes,項目名稱:axiscommerce,代碼行數:29,代碼來源:RecentlyViewed.php

示例2: init

 public function init()
 {
     $product = $this->getAttrib('productId');
     $this->removeAttrib('productId');
     $this->addElement('hidden', 'product', array('value' => $product));
     // ratings
     $ratings = array();
     if (!Axis::single('community/review_mark')->isCustomerVoted(Axis::getCustomerId(), $product)) {
         $marks = array('0.5' => 0.5, '1' => 1, '1.5' => 1.5, 2 => 2, '2.5' => 2.5, '3' => 3, '3.5' => 3.5, '4' => 4, '4.5' => 4.5, '5' => 5);
         //@todo make configurable
         foreach (Axis::single('community/review_rating')->getList() as $rating) {
             $this->addElement('select', 'rating_' . $rating['id'], array('required' => true, 'id' => $rating['name'], 'label' => $rating['title'], 'class' => 'required review-rating'));
             $this->getElement('rating_' . $rating['id'])->addMultiOptions($marks)->addDecorator('Label', array('tag' => '', 'class' => 'rating-title', 'placement' => 'prepend', 'separator' => ''))->setDisableTranslator(true);
             $ratings[] = 'rating_' . $rating['id'];
         }
     }
     $this->addElement('text', 'author', array('required' => true, 'label' => 'Nickname', 'value' => Axis::single('community/common')->getNickname(), 'class' => 'input-text required', 'description' => 'Your nickname. All users will be able to see it', 'validators' => array(new Axis_Community_Validate_Nickname())));
     $this->addElement('text', 'title', array('required' => true, 'label' => 'One-line summary', 'class' => 'input-text required', 'description' => 'Summarize your review in one line. up to 55 characters', 'minlength' => '10', 'maxlength' => '55', 'validators' => array(new Zend_Validate_StringLength(10, 55, 'utf-8'))));
     $this->addElement('textarea', 'pros', array('required' => true, 'label' => Axis::translate('community')->__('Pros'), 'class' => 'input-text required', 'description' => 'Tell us what you like about this product. up to 250 characters', 'rows' => '2', 'cols' => '50', 'minlength' => '10', 'maxlength' => '250', 'validators' => array(new Zend_Validate_StringLength(10, 250, 'utf-8'))));
     $this->addElement('textarea', 'cons', array('required' => true, 'label' => 'Cons', 'class' => 'input-text required', 'description' => "Tell us what you don't like about this product. up to 250 characters", 'rows' => '2', 'cols' => '50', 'minlength' => '10', 'maxlength' => '250', 'validators' => array(new Zend_Validate_StringLength(10, 250, 'utf-8'))));
     $this->addElement('textarea', 'summary', array('label' => 'Summary', 'class' => 'input-text', 'description' => "Explain to us in detail why you like or dislike the product, focusing your comments on the product's features and functionality, and your experience using the product. This field is optional.", 'rows' => '3', 'cols' => '50', 'minlength' => '10', 'validators' => array(new Zend_Validate_StringLength(10, null, 'utf-8'))));
     $this->addDisplayGroup($this->getElements(), 'review');
     if (Axis::single('community/review')->canAdd()) {
         $this->addElement('button', 'submit', array('type' => 'submit', 'class' => 'button', 'label' => 'Add Review'));
         $this->addActionBar(array('submit'));
     }
 }
開發者ID:rommmka,項目名稱:axiscommerce,代碼行數:27,代碼來源:Review.php

示例3: init

 public function init()
 {
     $configOptions = Axis::config('account/address_form')->toArray();
     $this->_fieldConfig = array_merge(array('firstname_sort_order' => -20, 'firstname_status' => 'required', 'lastname_sort_order' => -19, 'lastname_status' => 'required'), $configOptions);
     $form = $this;
     if ($subform = $this->getAttrib('subform')) {
         $form = new Axis_Form();
         // makes possible to use brackets in field names
         $form->setIsArray(true);
         $form->removeDecorator('Form');
         $this->addSubForm($form, $subform);
     }
     $countries = Axis_Collect_Country::collect();
     if (isset($countries['0']) && 'ALL WORLD COUNTRY' === $countries['0']) {
         unset($countries['0']);
     }
     $allowedCountries = $configOptions['country_id_allow'];
     if (!in_array(0, $allowedCountries)) {
         // ALL WORLD COUNTRIES is not selected
         $countries = array_intersect_key($countries, array_flip($allowedCountries));
     }
     $countryIds = array_keys($countries);
     $defaultCountry = current($countryIds);
     $zones = Axis_Collect_Zone::collect();
     $this->_zones = $zones;
     if ('billing_address' == $subform && !($customerId = Axis::getCustomerId())) {
         $form->addElement('text', 'email', array('required' => true, 'label' => 'Email', 'class' => 'input-text required email', 'validators' => array('EmailAddress')));
     }
     foreach ($this->_fields as $name => $values) {
         $status = $this->_fieldConfig[$name . '_status'];
         if ('disabled' == $status) {
             continue;
         }
         $fieldOptions = array('required' => 'required' === $status, 'label' => $values['label'], 'class' => $values['class'] . ('required' === $status ? ' required' : ''));
         if (isset($this->_fieldConfig[$name . '_sort_order'])) {
             $fieldOptions['order'] = $this->_fieldConfig[$name . '_sort_order'];
         }
         if ('country_id' == $name) {
             $fieldOptions['validators'] = array(new Zend_Validate_InArray(array_keys($countries)));
             $values['type'] = new Zend_Form_Element_Select($name, $fieldOptions);
             $values['type']->removeDecorator('HtmlTag')->addDecorator('HtmlTag', array('tag' => 'li', 'id' => "{$subform}-{$name}-row", 'class' => 'element-row'));
             $values['type']->options = $countries;
         } else {
             if ('zone_id' == $name) {
                 $values['type'] = new Zend_Form_Element_Select($name, $fieldOptions);
                 $values['type']->removeDecorator('HtmlTag')->addDecorator('HtmlTag', array('tag' => 'li', 'id' => "{$subform}-{$name}-row", 'class' => 'element-row'));
                 if (isset($zones[$defaultCountry]) && count($countries)) {
                     $values['type']->options = $zones[$defaultCountry];
                 }
                 // zone name field
                 $zoneNameOptions = $fieldOptions;
                 $zoneNameOptions['order']++;
                 $zoneNameOptions['class'] .= ' input-text';
                 $form->addElement('text', 'state', $zoneNameOptions);
             }
         }
         $form->addElement($values['type'], $name, $fieldOptions);
     }
     $form->addDisplayGroup($form->getElements(), $subform);
 }
開發者ID:rguedes,項目名稱:axiscommerce,代碼行數:60,代碼來源:Address.php

示例4: registerAction

 public function registerAction()
 {
     if (Axis::getCustomerId()) {
         $this->_redirect('account');
     }
     $this->setTitle(Axis::translate('account')->__('Create an Account'));
     $form = Axis::single('account/form_signup');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         if ($form->isValid($data)) {
             $model = Axis::single('account/customer');
             $data['site_id'] = Axis::getSiteId();
             $data['is_active'] = 1;
             list($row, $password) = $model->create($data);
             $row->setDetails($data);
             Axis::dispatch('account_customer_register_success', array('customer' => $row, 'password' => $password));
             $model->login($data['email'], $password);
             return $this->_redirect('account');
         } else {
             $form->populate($data);
         }
     }
     $this->view->formSignup = $form;
     $this->render();
 }
開發者ID:rguedes,項目名稱:axiscommerce,代碼行數:25,代碼來源:AuthController.php

示例5: isExistNickname

 /**
  *
  * @param string $nickname
  * @return bool
  */
 public function isExistNickname($nickname)
 {
     $select = $this->select('id')->join('account_customer_field', 'acf.id = acd.customer_field_id')->where('acf.name = ?', 'nickname')->where('acd.data = ?', $nickname);
     if ($customerId = Axis::getCustomerId()) {
         $select->where('acd.customer_id <> ?', $customerId);
     }
     return (bool) $select->fetchOne();
 }
開發者ID:rommmka,項目名稱:axiscommerce,代碼行數:13,代碼來源:Detail.php

示例6: _beforeRender

 protected function _beforeRender()
 {
     if ($this->identity = Axis::getCustomerId()) {
         Axis::dispatch('account_box_navigation_prepare', $this);
         ksort($this->_items);
         $this->items = $this->_items;
     }
 }
開發者ID:baisoo,項目名稱:axiscommerce,代碼行數:8,代碼來源:Navigation.php

示例7: _beforeRender

 protected function _beforeRender()
 {
     $orders = Axis::model('sales/order')->getOrdersByCustomer(Axis::getCustomerId());
     if (!count($orders)) {
         return false;
     }
     $this->orders = $orders;
 }
開發者ID:baisoo,項目名稱:axiscommerce,代碼行數:8,代碼來源:Recent.php

示例8: init

 public function init()
 {
     if ($this->identity = Axis::getCustomerId()) {
         Axis::dispatch('account_box_navigation_prepare', $this);
         ksort($this->_items);
         $this->items = $this->_items;
     }
     return true;
 }
開發者ID:rguedes,項目名稱:axiscommerce,代碼行數:9,代碼來源:Navigation.php

示例9: init

 public function init()
 {
     $orders = Axis::single('sales/order')->getOrdersByCustomer(Axis::getCustomerId());
     if (!count($orders)) {
         return false;
     }
     $this->orders = $orders;
     return true;
 }
開發者ID:rguedes,項目名稱:axiscommerce,代碼行數:9,代碼來源:Recent.php

示例10: removeAction

 public function removeAction()
 {
     $this->_helper->layout->disableLayout();
     $productId = $this->_getParam('id');
     $customerId = Axis::getCustomerId();
     Axis::single('account/wishlist')->delete(array($this->db->quoteInto('id = ?', $productId), $this->db->quoteInto('customer_id = ?', $customerId)));
     Axis::dispatch('account_whishlist_remove_product_success', array('customer_id' => $customerId, 'product_id' => $productId));
     $this->_redirect('/account/wishlist');
 }
開發者ID:rguedes,項目名稱:axiscommerce,代碼行數:9,代碼來源:WishlistController.php

示例11: getVisitor

 /**
  * Return visitor row
  *
  * @return Zend_Db_Table_Row_Abstract
  */
 public function getVisitor()
 {
     if (!isset(Axis::session()->visitorId) || !($row = $this->find(Axis::session()->visitorId)->current())) {
         $row = $this->createRow(array('session_id' => Zend_Session::getId(), 'customer_id' => Axis::getCustomerId() ? Axis::getCustomerId() : new Zend_Db_Expr('NULL')));
         $row->save();
         Axis::session()->visitorId = $row->id;
         //unset only on logout
     }
     return $row;
 }
開發者ID:baisoo,項目名稱:axiscommerce,代碼行數:15,代碼來源:Visitor.php

示例12: logging

 /**
  * @param array $data
  * @return mixed
  */
 public function logging(array $data = array())
 {
     $pdata = array('num_results' => $data['num_results'], 'created_at' => Axis_Date::now()->toSQLString(), 'visitor_id' => Axis::single('log/visitor')->getVisitor()->id, 'customer_id' => Axis::getCustomerId(), 'site_id' => Axis::getSiteId());
     $query = Axis::single('search/log_query')->getQuery($data['query']);
     $query->hit++;
     $query->save();
     $pdata['query_id'] = $query->id;
     /* @todo analize search query */
     return parent::insert($pdata);
 }
開發者ID:baisoo,項目名稱:axiscommerce,代碼行數:14,代碼來源:Log.php

示例13: init

 public function init()
 {
     $this->addElement('text', 'email', array('required' => true, 'label' => 'Email', 'class' => 'input-text required email', 'validators' => array('EmailAddress', new Axis_Validate_Exists(Axis::single('account/customer'), 'email', "id <> " . Axis::getCustomerId() . " AND site_id = " . Axis::getSiteId()))));
     $this->addElement('text', 'firstname', array('required' => true, 'label' => 'Firstname', 'class' => 'input-text required'));
     $this->addElement('text', 'lastname', array('required' => true, 'label' => 'Lastname', 'class' => 'input-text required'));
     $this->addDisplayGroup(array('email', 'firstname', 'lastname'), 'login', array('legend' => 'General information'));
     $rows = Axis::single('account/customer_field')->getFields();
     $groupsFields = array();
     foreach ($rows as $row) {
         $field = 'field_' . $row['id'];
         $config = array('id' => 'field_' . $row['name'], 'required' => (bool) $row['required'], 'label' => $row['field_label'], 'class' => in_array($row['field_type'], array('textarea', 'text')) ? 'input-text' : '');
         if ($row['field_type'] == 'textarea') {
             $config['rows'] = 6;
             $config['cols'] = 60;
         }
         $this->addElement($row['field_type'], $field, $config);
         $el = $this->getElement($field);
         if ($row['required']) {
             $el->addValidator('NotEmpty')->setAttrib('class', $el->getAttrib('class') . ' required');
         }
         if (!empty($row['validator'])) {
             if ($row['validator'] == 'Date') {
                 $el->addValidator($row['validator'], false, array('format' => 'yyyy-MM-dd'));
                 $el->setAttrib('class', $el->getAttrib('class') . ' input-date');
             } else {
                 $el->addValidator($row['validator']);
             }
         }
         if (!empty($row['axis_validator'])) {
             $el->addValidator(new $row['axis_validator']());
         }
         if (isset($row['customer_valueset_id'])) {
             $values = Axis::single('account/Customer_ValueSet_Value')->getCustomValues($row['customer_valueset_id'], Axis_Locale::getLanguageId());
             if (method_exists($el, 'setMultiOptions')) {
                 $el->setMultiOptions($values);
             }
         }
         $groupsFields[$row['customer_field_group_id']][$row['id']] = $field;
     }
     /* add field groups */
     if (count($groupsFields)) {
         $groups = Axis::single('account/customer_fieldGroup')->getCustomGroups(array_keys($groupsFields), Axis_Locale::getLanguageId());
         foreach ($groups as $row) {
             $this->addDisplayGroup(array_values($groupsFields[$row['id']]), empty($row['name']) ? $row['id'] : $row['name'], array('legend' => $row['group_label']));
             $this->getDisplayGroup(empty($row['name']) ? $row['id'] : $row['name'])->setDisableTranslator(true);
         }
     }
     $this->addElement('checkbox', 'change_password_toggle', array('label' => 'Change password', 'onchange' => "togglePasswordForm(this.checked)"));
     $this->addElement('password', 'password', array('disabled' => 'disabled', 'label' => 'New password', 'class' => 'input-text required password', 'validators' => array('NotEmpty', new Axis_Validate_PasswordConfirmation())));
     $this->addElement('password', 'password_confirm', array('disabled' => 'disabled', 'label' => 'Confirm new password', 'class' => 'input-text required password'));
     $this->addElement('password', 'password_current', array('disabled' => 'disabled', 'label' => 'Current password', 'class' => 'input-text required password', 'validators' => array('NotEmpty', new Axis_Validate_PasswordEqual(Axis::getCustomer()->password))));
     $this->addDisplayGroup(array('password_current', 'password', 'password_confirm'), 'change_password', array('legend' => 'Change password', 'style' => 'display: none;'));
     $this->addElement('button', 'submit', array('type' => 'submit', 'class' => 'button', 'label' => 'Save'));
     $this->addActionBar(array('submit'));
 }
開發者ID:baisoo,項目名稱:axiscommerce,代碼行數:55,代碼來源:ChangeInfo.php

示例14: _beforeRender

 protected function _beforeRender()
 {
     if (!($customerId = Axis::getCustomerId())) {
         return false;
     }
     $result = Axis::single('account/wishlist')->findByCustomerId($customerId);
     if (!$result) {
         return false;
     }
     $this->wishlist = $result;
 }
開發者ID:baisoo,項目名稱:axiscommerce,代碼行數:11,代碼來源:Wishlist.php

示例15: isValid

 public function isValid($addressId)
 {
     $row = Axis::single('account/customer_address')->find($addressId)->current();
     if (!$row instanceof Axis_Db_Table_Row) {
         return true;
     }
     if ($row->customer_id == Axis::getCustomerId()) {
         return true;
     }
     $this->_messages[] = Axis::translate('account')->__('Invalid address data. Try again.');
     return false;
 }
開發者ID:baisoo,項目名稱:axiscommerce,代碼行數:12,代碼來源:AddressId.php


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