wishlist_items.php 3.85 KB
Newer Older
Phạm Văn Đoan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
<?php
$user_details = $this->user_model->get_user($this->session->userdata('user_id'))->row_array();
$cart_items = $this->session->userdata('cart_items');
?>
<div class="icon">
    <a href=""><i class="far fa-heart"></i></a>
    <span class="number"><?php echo sizeof($this->crud_model->getWishLists()); ?></span>
</div>
<div class="dropdown course-list-dropdown corner-triangle top-right">
    <div class="list-wrapper">
        <div class="item-list">
            <ul>
                <?php
                foreach (json_decode($user_details['wishlist']) as $wishlist):
                    $course_details = $this->crud_model->get_course_by_id($wishlist)->row_array();
                    $instructor_details = $this->user_model->get_all_user($course_details['user_id'])->row_array();
                    ?>
                    <li>
                        <div class="item clearfix">
                            <div class="item-image">
                                <a href="">
                                    <img src="<?php echo $this->crud_model->get_course_thumbnail_url($wishlist);?>" alt="" class="img-fluid">
                                </a>
                            </div>
                            <div class="item-details">
                                <a href="">
                                    <div class="course-name"><?php echo $course_details['title']; ?></div>
                                    <div class="instructor-name">
                                        <?php echo get_phrase('by').' '.$instructor_details['first_name'].' '.$instructor_details['last_name']; ?>
                                    </div>

                                    <div class="item-price">
                                        <?php if ($course_details['is_free_course'] == 1): ?>
                                            <span class="current-price"><?php echo get_phrase('free'); ?></span>
                                        <?php else:  ?>
                                            <?php if ($course_details['discount_flag'] == 1): ?>
                                                <span class="current-price"><?php echo currency($course_details['discounted_price']); ?></span>
                                                <span class="original-price"><?php echo currency($course_details['price']); ?></span>
                                            <?php else: ?>
                                                <span class="current-price"><?php echo currency($course_details['price']); ?></span>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                    </div>
                                </a>
                                <button type="button" id = "<?php echo $course_details['id']; ?>" onclick="handleCartItems(this)" class = "<?php if(in_array($course_details['id'], $cart_items)) echo 'addedToCart'; ?>">
                                    <?php
                                    if(in_array($course_details['id'], $cart_items)){
                                        echo get_phrase('added_to_cart');
                                    }else {
                                        echo get_phrase('add_to_cart');
                                    }
                                    ?>
                                </button>
                            </div>
                        </div>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
        <div class="dropdown-footer">
            <a href = "<?php echo site_url('home/my_wishlist'); ?>"><?php echo get_phrase('go_to_wishlist'); ?></a>
        </div>
    </div>
    <div class="empty-box text-center d-none">
        <p><?php echo get_phrase('your_wishlist_is_empty'); ?>.</p>
        <a href=""><?php echo get_phrase('explore_courses'); ?></a>
    </div>
</div>