示例#1
0
 /**
  * List customers
  *
  * @access public
  * @return string
  */
 public function list_customers()
 {
     $start = $this->input->get_post('start') ? $this->input->get_post('start') : 0;
     $limit = $this->input->get_post('limit') ? $this->input->get_post('limit') : MAX_DISPLAY_SEARCH_RESULTS;
     $search = $this->input->get_post('search');
     $records = array();
     $customers = $this->customers_model->get_customers($start, $limit, $search);
     if ($customers !== NULL) {
         foreach ($customers as $customer) {
             //build the extra information of the customers
             $customers_info = array('field_email_address' => array('label' => lang('field_gender'), 'value' => $customer['customers_email_address']), 'field_customers_group' => array('label' => lang('field_customers_group'), 'value' => $customer['customers_groups_name']), 'field_number_of_logons' => array('label' => lang('field_number_of_logons'), 'value' => $customer['number_of_logons']), 'field_date_last_logon' => array('label' => lang('field_date_last_logon'), 'value' => get_date_short($customer['date_last_logon'])), 'field_gender' => array('label' => lang('field_gender'), 'value' => $customer['customers_gender'] == 'm' ? lang('gender_male') : lang('gender_female')));
             $records[] = array('customers_id' => $customer['customers_id'], 'customers_lastname' => $customer['customers_lastname'], 'customers_firstname' => $customer['customers_firstname'], 'customers_credits' => $this->currencies->format($customer['customers_credits']), 'date_account_created' => $customer['date_account_created'], 'customers_status' => $customer['customers_status'], 'customers_info' => $customers_info);
         }
     }
     $this->output->set_output(json_encode(array(EXT_JSON_READER_TOTAL => $this->customers_model->get_totals($search), EXT_JSON_READER_ROOT => $records)));
 }
示例#2
0
        ?>
" alt="<?php 
        echo sprintf(lang('rating_of_5_stars'), $review['reviews_rating']);
        ?>
" src="<?php 
        echo image_url('stars_' . $review['reviews_rating'] . '.png');
        ?>
">
                	&nbsp;&nbsp;&nbsp;&nbsp;<?php 
        echo sprintf(lang('reviewed_by'), $review['customers_name']);
        ?>
&nbsp;&nbsp;<?php 
        echo lang('field_posted_on');
        ?>
&nbsp;(<?php 
        echo get_date_short($review['date_added']);
        ?>
)
              	</dt>
              	<dd>
              		<?php 
        if (isset($review['ratings']) && count($review['ratings']) > 0) {
            $customers_ratings = $review['ratings'];
            ?>
              		<table class="customers-ratings">
              			<?php 
            foreach ($customers_ratings as $rating) {
                ?>
              			<tr>
              				<td class="name"><?php 
                echo $rating['name'];
示例#3
0
        ?>
 </p>
                <td>
                	<textarea id="comments[<?php 
        echo $product['products_id'];
        ?>
]" rows="5" cols="20" name="comments[<?php 
        echo $product['products_id'];
        ?>
]"><?php 
        echo $product['comments'];
        ?>
</textarea>
                </td>
                <td width="96" class="visible-desktop"><?php 
        echo get_date_short($product['date_added']);
        ?>
</td>
                <td class="center btn-toolbar visible-desktop">
        			<a href="<?php 
        echo site_url('wishlist/delete/' . $product['products_id']);
        ?>
" class="btn btn-mini pull-left"><?php 
        echo lang('button_delete');
        ?>
</a>&nbsp;
					<a href="<?php 
        echo site_url('cart_add/' . $product['products_id']);
        ?>
" class="btn btn-mini"><?php 
        echo lang('button_buy_now');
 * @filesource
*/
?>

<h1><?php 
echo $articles_categories_name;
?>
</h1>

<?php 
if (!empty($articles)) {
    foreach ($articles as $article) {
        ?>
<div class="module-box clearfix">
    <h6><span class="pull-right"><?php 
        echo get_date_short($article['articles_date_added']);
        ?>
</span><a href="<?php 
        echo site_url('articles/' . $article['articles_id']);
        ?>
"><?php 
        echo $article['articles_name'];
        ?>
</a></h6>
    
    <div class="content">
        <p>
            <?php 
        $description = strip_tags($article['articles_description']);
        echo substr($description, 0, 100) . (strlen($description) >= 100 ? '..' : '');
        ?>
示例#5
0
 /**
  * Synchronize with database
  * 
  * @access public
  * @return void
  */
 public function synchronize_with_database()
 {
     if (!$this->ci->customer->is_logged_on()) {
         return;
     }
     $this->customers_id = $this->ci->customer->get_id();
     //get wishlist
     $data = $this->ci->wishlist_model->get_wishlist_by_customers_id($this->customers_id);
     if ($data !== NULL) {
         $products = $this->ci->wishlist_model->get_wishlist_products($this->wishlists_id);
         if (is_array($products) && !empty($products)) {
             //delete temp wishlist
             $temp_wishlists_id = $this->wishlists_id;
             $contents = $this->contents;
             //reset wishlist
             $this->reset();
             //assign wishlists data
             $this->wishlists_id = $data['wishlists_id'];
             $this->token = $data['wishlists_token'];
             //assign products
             foreach ($products as $products_id) {
                 $product = load_product_library($products_id);
                 if ($product->is_valid()) {
                     $this->contents[$products_id] = array('products_id' => $products_id, 'name' => $product->get_title(), 'image' => $product->get_image(), 'price' => $product->get_price(), 'date_added' => get_date_short(get_date_now()), 'variants' => array(), 'comments' => '');
                 } else {
                     //remove invalid products id from database
                     $this->ci->wishlist_model->delete_product($this->wishlists_id, $products_id);
                 }
             }
             //merge current wishlists
             foreach ($contents as $products_id => $content) {
                 $this->add_product($products_id);
             }
             //remove temp wishlists
             $this->ci->wishlist_model->delete_product($temp_wishlists_id);
             //remove temp wishlists
             $this->ci->wishlist_model->delete_wishlist($temp_wishlists_id);
             //save session
             $this->save_session();
         }
     } else {
         if ($this->has_wishlist_id()) {
             //regenerate token
             $token = $this->generate_token();
             //update model
             $this->ci->wishlist_model->update_wishlist($this->wishlists_id, $this->customers_id, $token);
             //save session
             $this->save_session();
         }
     }
 }
示例#6
0
 /**
  * Add product to shopping cart
  *
  * @param string $products_id_string
  * @param array $variants
  * @param int $quantity
  * @param stirng $action
  */
 function add($products_id_string, $variants = NULL, $quantity = NULL, $action = 'add')
 {
     //load product object
     $product = load_product_library($products_id_string);
     if ($product->is_valid()) {
         //if product has variants and variants is not given
         if ($product->has_variants() && $variants == NULL) {
             $variant = $product->get_default_variant();
             $variants = parse_variants_from_id_string($variant['product_id_string']);
         }
         //get products id string
         $products_id_string = get_product_id_string($products_id_string, $variants);
         //if product already exists in shopping cart
         if ($this->exists($products_id_string)) {
             $old_quantity = $this->get_quantity($products_id_string);
             //if quantity is not specified
             if (!is_numeric($quantity)) {
                 $quantity = $this->get_quantity($products_id_string) + 1;
             } else {
                 if (is_numeric($quantity) && $quantity == 0) {
                     $this->remove($products_id_string);
                     return;
                 } else {
                     if ($action == 'add') {
                         $quantity = $this->get_quantity($products_id_string) + $quantity;
                     }
                 }
             }
             //check minimum order quantity
             $products_moq = $product->get_moq();
             if ($quantity < $products_moq) {
                 $quantity = $products_moq;
                 $error = sprintf(lang('error_minimum_order_quantity'), $product->get_title(), $products_moq);
             }
             //check maximum order quantity
             $products_max_order_quantity = $product->get_max_order_quantity();
             if ($products_max_order_quantity > 0) {
                 if ($quantity > $products_max_order_quantity) {
                     $quantity = $products_max_order_quantity;
                     $error = sprintf(lang('error_maximum_order_quantity'), $product->get_title(), $products_max_order_quantity);
                 }
             }
             //check order increment
             $increment = $product->get_order_increment();
             if (($quantity - $products_moq) % $increment != 0) {
                 $quantity = $products_moq + (floor(($quantity - $products_moq) / $increment) + 1) * $increment;
                 $error = sprintf(lang('error_order_increment'), $product->get_title(), $increment);
             }
             //set error to session
             if (isset($error) && !empty($error)) {
                 $this->contents[$products_id_string]['error'] = $error;
             }
             $price = $product->get_price($variants, $quantity);
             //specials
             $this->contents[$products_id_string]['quantity'] = $quantity;
             $this->contents[$products_id_string]['price'] = $price;
             $this->contents[$products_id_string]['final_price'] = $price;
             // update database
             if ($this->ci->customer->is_logged_on()) {
                 $this->ci->shopping_cart_model->update_content($this->ci->customer->get_id(), $products_id_string, $quantity);
             }
         } else {
             if (!is_numeric($quantity)) {
                 $quantity = 1;
             }
             //check minimum order quantity
             $products_moq = $product->get_moq();
             if ($quantity < $products_moq) {
                 $quantity = $products_moq;
                 $error = sprintf(lang('error_minimum_order_quantity'), $product->get_title(), $products_moq);
             }
             //check order increment
             $increment = $product->get_order_increment();
             if (($quantity - $products_moq) % $increment != 0) {
                 $quantity = $products_moq + (floor(($quantity - $products_moq) / $increment) + 1) * $increment;
                 $error = sprintf(lang('error_order_increment'), $product->get_title(), $increment);
             }
             $price = $product->get_price($variants, $quantity);
             $this->contents[$products_id_string] = array('id' => $products_id_string, 'name' => $product->get_title(), 'type' => $product->get_product_type(), 'keyword' => $product->get_keyword(), 'sku' => $product->get_sku($variants), 'image' => $product->get_image(), 'price' => $price, 'final_price' => $price, 'quantity' => $quantity, 'weight' => $product->get_weight($variants), 'tax_class_id' => $product->get_tax_class_id(), 'date_added' => get_date_short(get_date_now()), 'weight_class_id' => $product->get_weight_class());
             //set in stock status
             $this->contents[$products_id_string]['in_stock'] = $this->is_in_stock($products_id_string);
             //set error to session
             if (isset($error) && !empty($error)) {
                 $this->contents[$products_id_string]['error'] = $error;
             }
             // insert into database
             if ($this->ci->customer->is_logged_on()) {
                 $this->ci->shopping_cart_model->insert_content($this->ci->customer->get_id(), $products_id_string, $quantity, $price);
             }
             if (is_array($variants) && !empty($variants)) {
                 $variants_array = $product->get_variants();
                 $products_variants_id_string = get_product_id_string($products_id_string, $variants);
                 $products_variants_id = $variants_array[$products_variants_id_string]['variants_id'];
                 $this->contents[$products_id_string]['products_variants_id'] = $products_variants_id;
                 if (isset($variants_array[$products_variants_id_string]['filename']) && !empty($variants_array[$products_variants_id_string]['filename'])) {
                     $this->contents[$products_id_string]['variant_filename'] = $variants_array[$products_variants_id_string]['filename'];
                     $this->contents[$products_id_string]['variant_cache_filename'] = $variants_array[$products_variants_id_string]['cache_filename'];
                 }
                 foreach ($variants as $group_id => $value_id) {
                     $names = $this->ci->products_model->get_product_variant_group_and_value_name($product->get_id(), $group_id, $value_id);
                     $this->contents[$products_id_string]['variants'][$group_id] = array('groups_id' => $group_id, 'variants_values_id' => $value_id, 'groups_name' => $names['products_variants_groups_name'], 'values_name' => $names['products_variants_values_name']);
                 }
             }
         }
         $this->clean_up();
         $this->calculate();
     }
 }
示例#7
0
 /**
  * Display wishlist
  *
  * @access public
  * @return void
  */
 public function display($token = NULL)
 {
     if ($token !== NULL) {
         $contents = $this->wishlist->get_products_by_token($token);
         $products = array();
         if ($contents != NULL) {
             foreach ($contents as $content) {
                 $product = load_product_library($content['products_id']);
                 if ($product->is_valid()) {
                     $products[] = array('products_id' => $content['products_id'], 'name' => $product->get_title(), 'image' => $product->get_image(), 'price' => $product->get_price(), 'date_added' => get_date_short($content['date_added']), 'variants' => array(), 'comments' => $content['comments']);
                 }
             }
         }
     }
     $this->template->build('account/display_wishlist', array('products' => $products));
 }
<?php 
if (isset($status_history)) {
    ?>
<h6><?php 
    echo lang('order_history_heading');
    ?>
</h6>

<div class="module-box">
	<table width="100%" cellspacing="0" cellpadding="2">
        <?php 
    foreach ($status_history as $status) {
        ?>
		<tr>
			<td valign="top" width="70"><?php 
        echo get_date_short($status['date_added']);
        ?>
</td>
			<td valign="top" width="70"><?php 
        echo $status['orders_status_name'];
        ?>
</td>
			<td valign="top" width="70"><?php 
        echo !empty($status['comments']) ? nl2br($status['comments']) : '&nbsp;';
        ?>
</td>
		</tr>
        <?php 
    }
    ?>
    </table>