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


PHP CI::Customers方法代碼示例

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


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

示例1: index

 public function index()
 {
     //check to see if shipping and payment modules are installed
     $data['payment_module_installed'] = (bool) count(\CI::Settings()->get_settings('payment_modules'));
     $data['shipping_module_installed'] = (bool) count(\CI::Settings()->get_settings('shipping_modules'));
     $data['page_title'] = lang('dashboard');
     // get 5 latest orders
     $data['orders'] = \CI::Orders()->getOrders(false, 'ordered_on', 'DESC', 5);
     // get 5 latest customers
     $data['customers'] = \CI::Customers()->get_customers(5);
     $this->view('dashboard', $data);
 }
開發者ID:lekhangyahoo,項目名稱:gonline,代碼行數:12,代碼來源:AdminDashboard.php

示例2: address

 public function address()
 {
     $type = \CI::input()->post('type');
     $id = \CI::input()->post('id');
     $address = \CI::Customers()->get_address($id);
     if ($address['customer_id'] != $this->customer->id) {
         echo json_encode(['error' => lang('error_address_not_found')]);
     } else {
         if ($type == 'shipping') {
             \GC::setAttribute('shipping_address_id', $id);
         } elseif ($type == 'billing') {
             \GC::setAttribute('billing_address_id', $id);
         }
         \GC::saveCart();
         echo json_encode(['success' => true]);
     }
 }
開發者ID:lekhangyahoo,項目名稱:gonline,代碼行數:17,代碼來源:Checkout.php

示例3: forgotPassword

 public function forgotPassword()
 {
     $data['page_title'] = lang('forgot_password');
     $submitted = \CI::input()->post('submitted');
     \CI::form_validation()->set_rules('email', 'lang:address_email', ['trim', 'required', 'valid_email', ['email_callable', function ($str) {
         $reset = \CI::Customers()->reset_password($str);
         if (!$reset) {
             \CI::form_validation()->set_message('email_callable', lang('error_no_account_record'));
             return FALSE;
         } else {
             //user does exist. and the password is reset.
             return TRUE;
         }
     }]]);
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('forgot_password', $data);
     } else {
         \CI::session()->set_flashdata('message', lang('message_new_password'));
         redirect('login');
     }
 }
開發者ID:haouach,項目名稱:GoCart3,代碼行數:21,代碼來源:Login.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     $this->state_taxes = config_item('state_taxes');
     $order = GC::getCart();
     $taxType = config_item('tax_address');
     if ($taxType == 'ship') {
         if ((bool) $order->shipping_address_id) {
             $this->address = CI::Customers()->get_address($order->shipping_address_id);
         } else {
             return 0;
         }
     } else {
         if ((bool) $order->billing_address_id) {
             $this->address = CI::Customers()->get_address($order->billing_address_id);
         } else {
             return 0;
         }
     }
     if (!$this->address) {
         return 0;
     }
 }
開發者ID:lekhangyahoo,項目名稱:gonline,代碼行數:23,代碼來源:Tax.php

示例5: check_email

 public function check_email($str)
 {
     $email = \CI::Customers()->check_email($str);
     if ($email) {
         \CI::form_validation()->set_message('check_email_callable', lang('error_email'));
         return FALSE;
     } else {
         return TRUE;
     }
 }
開發者ID:haouach,項目名稱:GoCart3,代碼行數:10,代碼來源:Register.php

示例6: checkOrder

 public function checkOrder()
 {
     //start tracking errors
     $errors = [];
     $cart = new stdClass();
     $addresses = \CI::Customers()->get_address_list($this->customer->id);
     foreach ($addresses as $address) {
         if ($address['id'] == $this->cart->shipping_address_id) {
             $cart->shippingAddress = (object) $address;
         }
         if ($address['id'] == $this->cart->billing_address_id) {
             $cart->billingAddress = (object) $address;
         }
     }
     //check shipping
     if ($this->orderRequiresShipping()) {
         if (!$this->getShippingMethod()) {
             $errors['shipping'] = lang('error_choose_shipping');
         }
         if (empty($cart->shippingAddress)) {
             $errors['shippingAddress'] = lang('error_shipping_address');
         }
     }
     if (empty($cart->billingAddress)) {
         $errors['billingAddress'] = lang('error_billing_address');
     }
     //check coupons
     $checkCoupons = $this->checkCoupons();
     if (!empty($checkCoupons)) {
         $errors['coupons'] = $checkCoupons;
     }
     //check the inventory of our products
     $inventory = $this->checkInventory();
     if (!empty($inventory)) {
         $errors['inventory'] = $inventory;
     }
     //if we have errors, return them
     if (!empty($errors)) {
         return $errors;
     }
 }
開發者ID:berkapavel,項目名稱:GoCart3,代碼行數:41,代碼來源:GoCart.php

示例7: giftCardForm

 public function giftCardForm($id = false, $duplicate = false)
 {
     $this->product_id = $id;
     \CI::load()->library('form_validation');
     \CI::load()->model(array('ProductOptions', 'Categories'));
     \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>');
     $data['categories'] = \CI::Categories()->get_categories_tiered();
     $data['page_title'] = lang('giftcard_product_form');
     $data['groups'] = \CI::Customers()->get_groups();
     //default values are empty if the product is new
     $data['id'] = '';
     $data['sku'] = '';
     $data['primary_category'] = '';
     $data['name'] = '';
     $data['slug'] = '';
     $data['description'] = '';
     $data['excerpt'] = '';
     $data['track_stock'] = '';
     $data['seo_title'] = '';
     $data['meta'] = '';
     $data['is_giftcard'] = 1;
     $data['taxable'] = '';
     $data['images'] = [];
     $data['product_categories'] = [];
     $data['product_files'] = [];
     foreach ($data['groups'] as $group) {
         $data['enabled_' . $group->id] = '';
     }
     //create the photos array for later use
     $data['photos'] = [];
     if ($id) {
         // get product & options data
         $data['ProductOptions'] = \CI::ProductOptions()->getProductOptions($id);
         $product = \CI::Products()->find($id, true);
         //if the product does not exist, redirect them to the product list with an error
         if (!$product) {
             \CI::session()->set_flashdata('error', lang('error_not_found'));
             redirect('admin/products');
         }
         //helps us with the slug generation
         $this->product_name = \CI::input()->post('slug', $product->slug);
         //set values to db values
         $data['id'] = $id;
         $data['sku'] = $product->sku;
         $data['primary_category'] = $product->primary_category;
         $data['name'] = $product->name;
         $data['seo_title'] = $product->seo_title;
         $data['meta'] = $product->meta;
         $data['slug'] = $product->slug;
         $data['description'] = $product->description;
         $data['excerpt'] = $product->excerpt;
         $data['quantity'] = $product->quantity;
         $data['taxable'] = $product->taxable;
         $data['fixed_quantity'] = $product->fixed_quantity;
         $data['is_giftcard'] = $product->is_giftcard;
         foreach ($data['groups'] as $group) {
             $data['enabled_' . $group->id] = $product->{'enabled_' . $group->id};
         }
         //make sure we haven't submitted the form yet before we pull in the images/related products from the database
         if (!\CI::input()->post('submit')) {
             $data['product_categories'] = [];
             foreach ($product->categories as $product_category) {
                 $data['product_categories'][] = $product_category->id;
             }
             $data['related_products'] = $product->related_products;
             $data['images'] = (array) json_decode($product->images);
         }
     }
     if (!is_array($data['product_categories'])) {
         $data['product_categories'] = [];
     }
     //no error checking on these
     \CI::form_validation()->set_rules('caption', 'Caption');
     \CI::form_validation()->set_rules('primary_photo', 'Primary');
     \CI::form_validation()->set_rules('sku', 'lang:sku', 'trim');
     \CI::form_validation()->set_rules('seo_title', 'lang:seo_title', 'trim');
     \CI::form_validation()->set_rules('meta', 'lang:meta_data', 'trim');
     \CI::form_validation()->set_rules('name', 'lang:name', 'trim|required|max_length[64]');
     \CI::form_validation()->set_rules('slug', 'lang:slug', 'trim');
     \CI::form_validation()->set_rules('description', 'lang:description', 'trim');
     \CI::form_validation()->set_rules('excerpt', 'lang:excerpt', 'trim');
     \CI::form_validation()->set_rules('taxable', 'lang:taxable', 'trim|numeric');
     \CI::form_validation()->set_rules('fixed_quantity', 'lang:fixed_quantity', 'trim|numeric');
     \CI::form_validation()->set_rules('option[giftcard_values]', 'lang:giftcard_values', 'required');
     foreach ($data['groups'] as $group) {
         \CI::form_validation()->set_rules('enabled_' . $group->id, lang('enabled') . '(' . $group->name . ')', 'trim|numeric');
     }
     /*
     if we've posted already, get the photo stuff and organize it
     if validation comes back negative, we feed this info back into the system
     if it comes back good, then we send it with the save item
     
     submit button has a value, so we can see when it's posted
     */
     if ($duplicate) {
         $data['id'] = false;
     }
     if (\CI::input()->post('submit')) {
         //reset the product options that were submitted in the post
         $data['ProductOptions'] = \CI::input()->post('option');
//.........這裏部分代碼省略.........
開發者ID:vandona,項目名稱:v3,代碼行數:101,代碼來源:AdminProducts.php

示例8: form

 function form($id = false)
 {
     $data['groups'] = \CI::Customers()->get_groups();
     $config['upload_path'] = 'uploads/images/full';
     $config['allowed_types'] = 'gif|jpg|png';
     $config['max_size'] = config_item('size_limit');
     $config['max_width'] = '1024';
     $config['max_height'] = '768';
     $config['encrypt_name'] = true;
     \CI::load()->library('upload', $config);
     $this->category_id = $id;
     \CI::load()->helper('form');
     \CI::load()->library('form_validation');
     \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>');
     $data['categories'] = \CI::Categories()->getCategoryOptionsMenu($id);
     $data['page_title'] = lang('category_form');
     //default values are empty if the customer is new
     $data['id'] = '';
     $data['name'] = '';
     $data['slug'] = '';
     $data['description'] = '';
     $data['excerpt'] = '';
     $data['sequence'] = '';
     $data['image'] = '';
     $data['seo_title'] = '';
     $data['meta'] = '';
     $data['parent_id'] = 0;
     $data['error'] = '';
     foreach ($data['groups'] as $group) {
         $data['enabled_' . $group->id] = '';
     }
     //create the photos array for later use
     $data['photos'] = [];
     if ($id) {
         $category = \CI::Categories()->find($id);
         //if the category does not exist, redirect them to the category list with an error
         if (!$category) {
             \CI::session()->set_flashdata('error', lang('error_not_found'));
             redirect('admin/categories');
         }
         //helps us with the slug generation
         $this->category_name = \CI::input()->post('slug', $category->slug);
         //set values to db values
         $data['id'] = $category->id;
         $data['name'] = $category->name;
         $data['slug'] = $category->slug;
         $data['description'] = $category->description;
         $data['excerpt'] = $category->excerpt;
         $data['sequence'] = $category->sequence;
         $data['parent_id'] = $category->parent_id;
         $data['image'] = $category->image;
         $data['seo_title'] = $category->seo_title;
         $data['meta'] = $category->meta;
         foreach ($data['groups'] as $group) {
             $data['enabled_' . $group->id] = $category->{'enabled_' . $group->id};
         }
     }
     \CI::form_validation()->set_rules('name', 'lang:name', 'trim|required|max_length[64]');
     \CI::form_validation()->set_rules('slug', 'lang:slug', 'trim');
     \CI::form_validation()->set_rules('description', 'lang:description', 'trim');
     \CI::form_validation()->set_rules('excerpt', 'lang:excerpt', 'trim');
     \CI::form_validation()->set_rules('sequence', 'lang:sequence', 'trim|integer');
     \CI::form_validation()->set_rules('parent_id', 'parent_id', 'trim');
     \CI::form_validation()->set_rules('image', 'lang:image', 'trim');
     \CI::form_validation()->set_rules('seo_title', 'lang:seo_title', 'trim');
     \CI::form_validation()->set_rules('meta', 'lang:meta', 'trim');
     foreach ($data['groups'] as $group) {
         \CI::form_validation()->set_rules('enabled_' . $group->id, lang('enabled') . '(' . $group->name . ')', 'trim|numeric');
     }
     // validate the form
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('category_form', $data);
     } else {
         $uploaded = \CI::upload()->do_upload('image');
         if ($id) {
             //delete the original file if another is uploaded
             if ($uploaded) {
                 if ($data['image'] != '') {
                     $file = [];
                     $file[] = 'uploads/images/full/' . $data['image'];
                     $file[] = 'uploads/images/medium/' . $data['image'];
                     $file[] = 'uploads/images/small/' . $data['image'];
                     $file[] = 'uploads/images/thumbnails/' . $data['image'];
                     foreach ($file as $f) {
                         //delete the existing file if needed
                         if (file_exists($f)) {
                             unlink($f);
                         }
                     }
                 }
             }
         }
         if (!$uploaded) {
             $data['error'] = \CI::upload()->display_errors();
             if ($_FILES['image']['error'] != 4) {
                 $data['error'] .= \CI::upload()->display_errors();
                 $this->view('category_form', $data);
                 return;
                 //end script here if there is an error
             }
//.........這裏部分代碼省略.........
開發者ID:buzkall,項目名稱:GoCart3,代碼行數:101,代碼來源:AdminCategories.php

示例9: deleteAddress

 public function deleteAddress($customer_id = false, $id = false)
 {
     if ($id) {
         $address = \CI::Customers()->get_address($id);
         //if the customer does not exist, redirect them to the customer list with an error
         if (!$address) {
             \CI::session()->set_flashdata('error', lang('error_address_not_found'));
             if ($customer_id) {
                 redirect('admin/customers/addresses/' . $customer_id);
             } else {
                 redirect('admin/customers');
             }
         } else {
             //if the customer is legit, delete them
             \CI::Customers()->delete_address($id, $customer_id);
             \CI::session()->set_flashdata('message', lang('message_address_deleted'));
             if ($customer_id) {
                 redirect('admin/customers/addresses/' . $customer_id);
             } else {
                 redirect('admin/customers');
             }
         }
     } else {
         //if they do not provide an id send them to the customer list page with an error
         \CI::session()->set_flashdata('error', lang('error_address_not_found'));
         if ($customer_id) {
             redirect('admin/customers/addresses/' . $customer_id);
         } else {
             redirect('admin/customers');
         }
     }
 }
開發者ID:thijmenvenus,項目名稱:GoCart3,代碼行數:32,代碼來源:AdminCustomers.php

示例10: contact

 public function contact()
 {
     if (isset($_POST['status']) && isset($_POST['id'])) {
         \CI::Customers()->update_contact($_POST['status'], $_POST['id']);
         echo true;
         return;
     } else {
         $data['contacts'] = \CI::Customers()->get_contacts();
         $data['page_title'] = 'Contact';
         //echo '<pre>'; print_r($data['contacts']);exit;
         $this->view('contact', $data);
     }
 }
開發者ID:lekhangyahoo,項目名稱:gonline,代碼行數:13,代碼來源:AdminCustomers.php

示例11: createGuest

 private function createGuest()
 {
     //create a temp customer
     $customerID = CI::Customers()->createGuest();
     $customer = CI::db()->where('id', $customerID)->get('customers')->row();
     CI::session()->set_userdata('customer', $customer);
 }
開發者ID:haouach,項目名稱:GoCart3,代碼行數:7,代碼來源:Login.php

示例12: delete

 public function delete($id)
 {
     \CI::Customers()->delete_address($id, $this->customer->id);
     echo 1;
 }
開發者ID:alextoshinov,項目名稱:musymeshop,代碼行數:5,代碼來源:Addresses.php


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