https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/kanvakanva.com/public_html/application/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/kanvakanva.com/public_html/application/views/product.php
<!-- BEGIN CONTENT PAGE -->
<section class="all-content-page">			
    <div class="container">				
        <!-- Breadcrumbs -->				
        <div class="breadcrumbs breadcrumbs-pro">
            <a href="<?=base_url()?>">Home</a>
            
            <?php
            $this->db
                ->select('brand, alias')
                ->from('brands')
                ->where('id_brands', $product->brand_id);
            $brand = $this->db->get()->row();
            ?>

            <span><a style="color:#282727;" href="<?= base_url() .
                'brand/' .
                $brand->alias ?>"><?= ucwords($brand->brand) ?></a></span>

        </div>					
        <!-- End Breadcrumbs -->
        <div class="row">									
            <!--/////////////////-->					
            <div class="col-sm-12">
                <div class="content-wrap">																    
                    <div class="row">					
                        <div class="col-sm-6 pa-r-30">
                            <div class="product-images">
                                <div class="row">
                                    <div class="col-xs-3 col-sm-2 col-md-2">
                                        <div id="gallery_01">
                                            
                                            <?php if ($product->image1 != null): ?>
                                                <a href="#" class="active" data-image="<?= base_url() .
                                                'uploads/product/large/' .
                                                $product->image1 ?>" data-zoom-image="<?= base_url() .
                                                'uploads/product/' .
                                                $product->image1 ?>">
                                                    <img src="<?= base_url() .
                                                    'uploads/product/thumbnail/' .
                                                    $product->image1 ?>"/>
                                                </a>
                                            <?php endif; ?>

                                            <?php if ($product->image2 != null): ?>
                                                <a href="#" data-image="<?= base_url() .
                                                'uploads/product/large/' .
                                                $product->image2 ?>" data-zoom-image="<?= base_url() .
                                                'uploads/product/' .
                                                $product->image2 ?>">
                                                    <img src="<?= base_url() .
                                                    'uploads/product/thumbnail/' .
                                                    $product->image2 ?>"/>
                                                </a>
                                            <?php endif; ?>

                                            <?php if ($product->image3 != null): ?>
                                                <a href="#" data-image="<?= base_url() .
                                                'uploads/product/large/' .
                                                $product->image3 ?>" data-zoom-image="<?= base_url() .
                                                'uploads/product/' .
                                                $product->image3 ?>">
                                                    <img src="<?= base_url() .
                                                    'uploads/product/thumbnail/' .
                                                    $product->image3 ?>"/>
                                                </a>
                                            <?php endif; ?>

                                            <?php if ($product->image4 != null): ?>
                                                <a href="#" data-image="<?= base_url() .
                                                'uploads/product/large/' .
                                                $product->image4 ?>" data-zoom-image="<?= base_url() .
                                                'uploads/product/' .
                                                $product->image4 ?>">
                                                    <img src="<?= base_url() .
                                                    'uploads/product/thumbnail/' .
                                                    $product->image4 ?>"/>
                                                </a>
                                            <?php endif; ?>

                                            <?php if ($product->image5 != null): ?>
                                                <a href="#" data-image="<?= base_url() .
                                                'uploads/product/large/' .
                                                $product->image5 ?>" data-zoom-image="<?= base_url() .
                                                'uploads/product/' .
                                                $product->image5 ?>">
                                                    <img src="<?= base_url() .
                                                    'uploads/product/thumbnail/' .
                                                    $product->image5 ?>"/>
                                                </a>
                                            <?php endif; ?>
										
                                        </div>
                                    </div>
                                    <div class="col-xs-9 col-sm-10 col-md-10">
                                        <div class="img-border">
                                            <img id="img1" src="<?= base_url() .
                                            'uploads/product/large/' .
                                            $product->image1 ?>" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="product-des product-des-detail">
                                <h1 class="title-product"><a href=""><?= ucwords($product->title) ?></a></h1>

                                <?php
                                $this->db
                                ->select('price,discounted_price')
                                ->from('stocks')
                                ->where('product_id', $product->id_products)
                                ->where('stock !=', 0)
                                ->limit(1);
                                $cprice = $this->db->get();

                                if($cprice->num_rows() > 0) : 
                                    $price = $cprice->row()->price;   
                                    $disc_price =  $cprice->row()->discounted_price; 
                                ?>
                                    <?php if($disc_price > 0) : ?>
                                        <span class="mc-price"><ins class="price">IDR <?= number_format(
                                        $disc_price
                                        ) ?></ins>
                                        <del class="disc_price">IDR <?= number_format(
                                        $price
                                        ) ?></del>
                                        </span>
                                    <?php else : ?>
                                        <span class="mc-price"><ins class="price">IDR <?= number_format(
                                        $price
                                        ) ?></ins>
                                        </span>
                                    <?php endif; ?>
                                
                                <?php 
                                    else : 
                                ?>

                                        <?php 
                                            if ($product->discount_price > 0): 
                                            $price = $product->discount_price;    
                                        ?>

                                            <span class="mc-price"><ins class="price">IDR <?= number_format(
                                            $product->discount_price
                                            ) ?></ins>
                                            <del class="disc_price">IDR <?= number_format(
                                            $product->price
                                            ) ?></del>
                                            </span>

                                        <?php 
                                            else: 
                                            $price = $product->price;
                                        ?>
                                            
                                            <span class="mc-price"><ins class="price">IDR <?= number_format(
                                            $product->price
                                            ) ?></ins>
                                            </span>

                                        <?php endif; ?>

                                <?php endif; ?>

                                <!----- RATING ----->
                                <?php
                                    $this->db
                                    ->select('floor(AVG(rating)) as rating,count(id_rating) as jum')
                                    ->from('rating')
                                    ->where('item_id', $product->id_products);
                                    $rating = $this->db->get();

                                    if($rating->num_rows() > 0) {
                                        $jum_rating = $rating->row('jum');
                                        if($rating->row('rating') == 5){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 4){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 3){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 2){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 1){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 0){
                                            echo '
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        echo "<span style='color:#808080;font-size:17px;'>($jum_rating)</span>";
                                    }else{
                                        echo '
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#808080;font-size:17px;">(0)</span>
                                        ';
                                    }
                                ?>
                                <!----- /RATING ----->

                                
                                <?php
                                $this->db
                                    ->select('stock')
                                    ->from('stocks')
                                    ->where('product_id', $product->id_products)
                                    ->where('stock !=', 0);
                                $count_product_stock = $this->db->get()->num_rows();
                                $this->db
                                    ->select('preorder')
                                    ->from('products')
                                    ->where('id_products', $product->id_products);
                                $preorder = $this->db->get()->row()->preorder;
                                ?>    
                                
                                <div class="available-instock">
                                    <?php
                                    if ($count_product_stock == 0 && $preorder == '1') {
                                        echo $product->preorder
                                        ? '<strong>[ PRE - ORDER ]</strong>'
                                        : '';
                                    }
                                    ?>
                                </div>

                                <div class="product-shortdes">
                                    <?=ucfirst($product->description)?>
                                </div>
                                <hr>
                                <div class="product-shortdes">
                                    <strong>EDITOR NOTES</strong>
                                    <br />
                                    <?= ucfirst($product->editor_notes) ?>
                                </div>
                                <hr>
                                <div class="product-shortdes">
                                    <strong>DIMENSIONS</strong>
                                    <br />
                                    <?= ucfirst($product->dimensions) ?>
                                </div>
                                <hr>
                                <div class="product-shortdes">
                                    <strong>MATERIAL</strong>
                                    <br />
                                    <?= ucfirst($product->material) ?>
                                </div>
                                <hr>
                                <div class="product-shortdes">
                                    <strong>GOOD TO KNOW</strong>
                                    <br />
                                    <?= ucfirst($product->good_to_know) ?>
                                </div>
                                
                                <form action="<?= base_url('cart/add') ?>" method="post">

                                <input type="hidden" name="product_id" value="<?= $product->id_products ?>">
                                <input type="hidden" name="product_name" value="<?= $product->title ?>">
                                
                                <?php if ($product->is_voucher == 'yes'): ?>
                                    <input type="hidden" name="qty" value="1">
                                    <div class="product-size margin-top-20">
                                        <p class="label-p">Input Gift Card Detail</p>
                                        <br>
                                        <p><input class="form-control" type="email" name="voucher_email" placeholder="Recipient Email" required></p>
                                        <br>
                                        <p><input class="form-control" type="text" name="voucher_message" placeholder="Your Message"></p>
                                    </div>
                                <?php endif; ?>

                                <!-- <div class="product-color margin-top-20">
                                    <p class="label-p">Color</p>
                                    <a href="#" class="c-orange"></a>
                                    <a href="#" class="active c-blue"></a>
                                    <a href="#" class="c-black"></a>
                                    <a href="#" class="c-gray"></a>
                                </div> -->

                                <?php
                                $this->db
                                    ->select('stock')
                                    ->from('stocks')
                                    ->where('product_id', $product->id_products)
                                    ->where('stock !=', 0);
                                $count_product_stock = $this->db->get()->num_rows();
                                $this->db
                                    ->select('preorder')
                                    ->from('products')
                                    ->where('id_products', $product->id_products);
                                $preorder = $this->db->get()->row()->preorder;
                                ?>

                                <?php if ($count_product_stock != 0 || $preorder == '1'): ?>
                                
                                    <div class="product-size" style="margin-bottom:20px;margin-top:20px;">
                                        <p class="label-p">Size</p>
                                        
                                        <?php 
                                            $no=1;
                                            $select = 0;
                                            foreach ($size_details as $size): 
                                                $disable = '';
                                                $color = '';
                                                $class = '';
                                                if($size->stock <= 0){
                                                    $disable = 'disabled';
                                                    $color = 'background-color:#dbdbdb;pointer-events: none;';
                                                    $class = 'size_disabled';
                                                }
                                                if($size->stock > 0 && $select == 0) : 
                                                    $select = 1;
                                        ?>  
                                                    <div style="margin-bottom:5px;display:inline-block;">
                                                    <input type="hidden" name="product_size" id="product_size" value="<?= $size->id_product_size ?>">
                                                    <a href="javascript:void(0)" class="select_size" style="padding: 5px 10px;background-color:#d5b99c;color:#fff;border-radius:3px;margin-right:unset;" id="size_<?= $size->id_product_size ?>" onclick="change_size('<?= $size->id_product_size ?>','<?= number_format($size->price) ?>','<?= number_format($size->discounted_price) ?>');return false;"><?= strtoupper($size->product_size) ?></a>
                                                    </div>
                                        <?php
                                                else :
                                        ?>
                                                    <div style="margin-bottom:5px;display:inline-block;">
                                                    <a href="javascript:void(0)" class="select_size <?=$class?>" <?=$disable?> style="<?=$color?>padding: 5px 10px;border-radius:3px;margin-right:unset;" id="size_<?= $size->id_product_size ?>" onclick="change_size('<?= $size->id_product_size ?>','<?= number_format($size->price) ?>','<?= number_format($size->discounted_price) ?>');return false;"><?= strtoupper($size->product_size) ?></a>
                                                    </div>
                                        <?php 
                                                endif;
                                            $no++;
                                            endforeach; 
                                        ?>
                                        
                                        <script>
                                            function change_size(id_size,price = 0,disc_price = 0){
                                                //var product_price = "<?=number_format($product->price)?>";
                                                
                                                if(parseInt(disc_price) > 0){
                                                    $('.disc_price').show();
                                                    $('.price').html('IDR ' + disc_price);

                                                    cprice = disc_price.replace(/,/g, "");

                                                    $('.disc_price').html('IDR ' + price);
                                                }else{
                                                    $('.price').html('IDR ' + price);
                                                    
                                                    cprice = price.replace(/,/g, "");

                                                    $('.disc_price').hide();
                                                }
                                                $('.input_price').val(cprice);

                                                $('#product_size').val(id_size);
                                                $('.select_size').attr('style','padding: 5px 10px;border-radius:3px;margin-right:unset;');
                                                $('.size_disabled').attr('style','background-color:#dbdbdb;pointer-events: none;padding: 5px 10px;border-radius:3px;margin-right:unset;');
                                                $('#size_'+id_size).attr('style','padding: 5px 10px;background-color:#d5b99c;color:#fff;border-radius:3px;margin-right:unset;');
                                            }
                                        </script>

                                    </div>
                                   

                                    <?php
                                    $this->db
                                    ->select('stocks.price,discounted_price')
                                    ->from('stocks')
                                    ->join('product_size', 'product_size.id_product_size = stocks.size_id')
                                    ->where('stocks.product_id', $product->id_products)
                                    ->where('stocks.stock !=', 0)
                                    ->order_by('product_size.priority', 'ASC')
                                    ->limit(1);
                                    $cprice = $this->db->get();

                                    if($cprice->num_rows() > 0) : 
                                        $price = $cprice->row()->price;   
                                        $disc_price =  $cprice->row()->discounted_price; 
                                    ?>
                                        <?php if($disc_price > 0) : ?>
                                            <span class="mc-price"><ins class="price">IDR <?= number_format(
                                            $disc_price
                                            ) ?></ins>
                                            <del class="disc_price">IDR <?= number_format(
                                            $price
                                            ) ?></del>
                                            </span>
                                        <?php 
                                            $price = $cprice->row()->discounted_price;  
                                            else : 
                                            $price = $cprice->row()->price;  
                                        ?>
                                            <span class="mc-price"><ins class="price">IDR <?= number_format(
                                            $price
                                            ) ?></ins>
                                            </span>
                                        <?php endif; ?>
                                   
                                    <?php 
                                        else : 
                                    ?>

                                            <?php 
                                                if ($product->discount_price > 0): 
                                                $price = $product->discount_price;    
                                            ?>

                                                <span class="mc-price"><ins class="price">IDR <?= number_format(
                                                $product->discount_price
                                                ) ?></ins>
                                                <del class="disc_price">IDR <?= number_format(
                                                $product->price
                                                ) ?></del>
                                                </span>

                                            <?php 
                                                else: 
                                                $price = $product->price;
                                            ?>
                                                
                                                <span class="mc-price"><ins class="price">IDR <?= number_format(
                                                $product->price
                                                ) ?></ins>
                                                </span>

                                            <?php endif; ?>

                                    <?php endif; ?>


                                    <div class="product-btn" style="margin-top:20px">
                                        <?php if ($product->is_voucher == 'no'): ?>
                                        <div class="quantity">
                                            <input type="number" name="qty" min="1" step="1" value="1">
                                        </div>
                                        <?php endif; ?>

                                        <input type="hidden" name="price" class="input_price" value="<?= $price ?>">

                                        <div class="add-to-cart">
                                            <button id="addToCart"type="submit" name="Submit" class="button submit">ADD TO CART</button>	
                                        </div>
                                    </div>	

                                    <script>
                                        $(document).ready(function() {

                                            $('#select_product_size').change(function() {
                                                var id_product_details = $(this).val();
                                                ajax_get_price(id_product_details);
                                            });

                                            var controller = 'ajax';
                                            var base_url = '<?php echo base_url(); ?>';

                                            function ajax_get_price(id_product_details) {

                                                $.ajax({
                                                    'url'       : '<?php echo base_url(); ?>' + 'ajax' + '/ajax_get_price',
                                                    'type'      : 'POST',
                                                    'data'      : {

                                                                    'id_product_details' : id_product_details,
                                                                    'product_id' : <?= $product->id_products ?>
                                                                    },
                                                    'success'   : function(result) {
                                                        var container = $('#headingPrice');
                                                        if (result) {
                                                            container.html(result);
                                                        };
                                                    }
                                                });
                                            }
                                        }); /*----end document ready -----*/
                                    </script>

                                <?php else: ?>

                                <p>Product out of stock</p>

                                <?php endif; ?>

                                </form>

                                <div class="product-share margin-top-30">
                                    <p class="label-p">Share:</p>
                        
                                    <ul class="f-ul-socials addsharethisinner">
                                        <li><span class="st_twitter_hcount sharebtn" displayText="Tweet"></span></li>
                                        <li><span class="st_googleplus_hcount" displayText="Google +"></span></li>
                                        <li><span class="st_pinterest_hcount sharebtn" displayText="Pinterest"></span></li>
                                        <li><span class="st_facebook_hcount sharebtn" displayText="Facebook"></span></li>
                                    </ul>
                                </div>

                                <script type="text/javascript">/* <![CDATA[ */$(function(){$(".addsharethis").addClass("loader");$(window).load(function(){$(".addsharethis").removeClass("loader");$(".addsharethisinner").show(400);});});$(function(){$(".addsharethis .sharebtn").click(function(){$(this).find("img").show("medium");})});/* ]]> */</script><script type="text/javascript">/* <![CDATA[ */var switchTo5x=true;/* ]]> */</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js">/* <![CDATA[ *//* ]]> */</script><script type="text/javascript">/* <![CDATA[ */stLight.options({publisher:"ea22d519-9f98-4018-99a9-5b5f1b100fa8",doNotHash:false,doNotCopy:false,hashAddressBar:false});/* ]]> */</script>

                            </div>	
                        </div>
                    </div>
                    <div class="tabs-product-detail margin-top-50">
                        <!-- Nav tabs -->
                        <ul class="nav nav-tabs" role="tablist">
                            <li role="presentation" class="active"><a href="#reviews" aria-controls="reviews" role="tab" data-toggle="tab">Reviews</a></li>
                        </ul>
                        <!-- Tab panes -->
                        <div class="tab-content">
                            <div role="tabpanel" class="tab-pane active" id="reviews">
                                <div class="row">
                                    <div class="col-sm-6">
                            
                                        <h4 class="title-h4">CUSTOMER REVIEWS</h4>
                                        <ul class="commentlist">

                                        <?php
                                        /*$this->db
                                            ->select('*')
                                            ->from('comments')
                                            ->where('id_product', $product->id_products)
                                            ->order_by('id_comment', 'desc')
                                            ->limit(5);
                                            $comments = $this->db->get()->result();"*/

                                        $comments = $this->db->query("SELECT * FROM (
                                            SELECT username,DATE_FORMAT(`date`, '%d %M %Y') as tgl,rating,comment
                                            FROM comments
                                            WHERE id_product = '$product->id_products'
                                            UNION ALL
                                            SELECT c.name as username,
                                                DATE_FORMAT(a.create_at, '%d %M %Y') as tgl,
                                                a.rating,a.ulasan as comment
                                            FROM rating a
                                            LEFT JOIN orders b on a.orders_id=b.id_orders
                                            LEFT JOIN customers c on b.customer_id=c.id_customers
                                            WHERE a.item_id = '$product->id_products'
                                        )z ORDER BY tgl DESC
                                        LIMIT 5")->result();
                                       
                                        ?>

                                        <?php foreach ($comments as $comment): ?>

                                            <li class="comment">
                                                <div class="comment_container">
                                                    <div class="comment-info">
                                                        <div class="meta">
                                                            <span class="author"><?= $comment->username ?></span>
                                                            <span class="date">
                                                                <?= $comment->tgl ?>
                                                            </span>
                                                        </div>
                                                        <div class="rating fivestar" style="margin:0;">	
                                                            <?php echo str_repeat(
                                                                '<i class="fa fa-star" style="color:#cda486;"></i>',
                                                                $comment->rating
                                                            ); ?>							                                
                                                        </div>												                
                                                    </div>
                                                    <div class="comment-text">
                                                        <div class="comment-content">
                                                            <?= $comment->comment ?>
                                                        </div>
                                                    </div>
                                                </div>
                                            </li>
                                        <?php endforeach; ?>

                                        </ul>
                                    </div>
                                    <div class="col-sm-6">
                                        <h4 class="title-h4">ADD A REVIEW</h4>

                                        <?php if ($login_status): ?>

                                        <form action="<?= base_url(
                                            'comment/add'
                                            ) ?>" method="post" id="comment_form">

                                            <input type="hidden" name="product_id" value="<?= $product->id_products ?>">
                                            <input type="hidden" name="username" value="<?= $this->session->userdata(
                                            'customer'
                                            )['customer_name'] ?>">
                                            <input type="hidden" name="email" value="<?= $this->session->userdata(
                                            'customer'
                                            )['customer_email'] ?>">

                                            <div class="form-group">
                                                <span>Your name : </span><br>														
                                                <input disabled type="text" class="form-control" name="username" value="<?= $this->session->userdata(
                                                    'customer'
                                                )['customer_name'] ?>">
                                            </div>
                                            <div class="form-group">	
                                                <span>Email : </span><br>														
                                                <input disabled type="email" class="form-control" name="email" value="<?= $this->session->userdata(
                                                    'customer'
                                                )['customer_email'] ?>">
                                            </div>
                                            
                                            <div class="form-group" style="float:left">
                                                <span style="float:left">Your rating : &nbsp;</span>
                                                <div class="rating_input" style="float:left">
                                                    <span><input type="radio" name="rating" id="str5" value="5" required ><label for="str5" class="fa fa-star"></label></span>
                                                    <span><input type="radio" name="rating" id="str4" value="4" ><label for="str4" class="fa fa-star"></label></span>
                                                    <span><input type="radio" name="rating" id="str3" value="3" ><label for="str3" class="fa fa-star"></label></span>
                                                    <span><input type="radio" name="rating" id="str2" value="2" ><label for="str2" class="fa fa-star"></label></span>
                                                    <span><input type="radio" name="rating" id="str1" value="1" ><label for="str1" class="fa fa-star"></label></span>
                                                </div>
                                            </div>
                                            <br>
                                            
                                            <div class="form-group">														
                                                <textarea class="form-control" name="comment" rows="3" required>Your review</textarea>
                                            </div>													
                                            <input type="submit" class="button submit" name="submit" value="ADD A REVIEW">
                                            <input type="reset" class="button clear" value="CLEAR">

                                        </form>

                                        <?php else: ?>
                                            <a href="<?= base_url() .
                                                'register/index' ?>"> <strong>LOGIN TO REVIEW</strong> </a>
                                        <?php endif; ?>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>		
                </div>
            </div>					
        </div>
    </div>
</section>
<!-- END CONTENT PAGE -->

<!-- BEGIN RELATED PRODUCTS -->
<section class="related-products margin-top-30">
    <div class="container">			
        <h3 class="title-product-box">YOU MAY ALSO LIKE<small>The Best Local Home Goods to Shop Today</small></h3>			
        
        <div class="row margin-top-50">
            
                <?php
                $this->db
                ->select('id_category')
                ->from('category_product')
                ->where('id_product', $product->id_products)
                ->order_by('id_category_product')
                ->limit(1);
                $related_category_id = $this->db->get()->row()->id_category;
                $this->db
                ->select('id_product')
                ->from('category_product')
                ->where('id_category', $related_category_id)
                ->order_by('id_category_product', 'RANDOM')
                ->limit(8);
                $related_products_id = $this->db->get()->result();
                ?>

                <?php foreach ($related_products_id as $related_product_id): ?>

                    <?php
                     $this->db
                       ->select(
                         'id_products ,alias, image1, title, brand_id, price, discount_price, product_status, new_arrival'
                       )
                       ->from('products')
                       ->where('id_products', $related_product_id->id_product);
                     $item = $this->db->get()->row();
                     ?>
                     <?php if ($item->product_status == '1'): ?> 

                        <?php
                            $this->db
                            ->select('price,discounted_price')
                            ->from('stocks')
                            ->where('product_id', $item->id_products)
                            ->where('stock !=', 0)
                            ->limit(1);
                            $cprice = $this->db->get();

                            $disc_price = 0;
                            if($cprice->num_rows() > 0) : 
                                if($cprice->row()->discounted_price > 0):
                                    $disc_price = $cprice->row()->discounted_price;  
                                endif;
                            else:
                                if($item->discount_price > 0) :
                                    $disc_price = $item->discount_price;
                                endif;
                            endif;
                        ?>
                        
                        <div class="col-lg-3 col-md-3 col-sm-4 col-xs-6">
                        <div class="item">
                            <div class="product-wrap">
                                <a href="<?= base_url() .
                                    'product/' .
                                    $item->alias ?>">

                                    <?php if ($item->new_arrival == 'yes'): ?>
                                        <div style="width: 50px;height: 50px;color: white !important;background: grey;display: block;line-height: 40px;text-align: center;font-weight: bold;position: absolute;left: 1px;padding-top: 5px;z-index:1;">
                                        NEW
                                        </div>
                                    <?php endif; ?>
                                    <?php if ($disc_price > 0): ?>
                                        <div style="width: 50px;height: 50px;color: white !important;background: grey;display: block;line-height: 40px;text-align: center;font-weight: bold;position: absolute;right: 1px;padding-top: 5px;z-index:1;">
                                        SALE
                                        </div>
                                    <?php endif; ?>

                                    <img class="img-responsive" style="width:100%" src="<?= base_url() .
                                    'uploads/product/small/' .
                                    $item->image1 ?>" alt="<?=$item->alias?>">
                                </a>	
                                <div class="product-des text-align-center margin-top-30">
                                    <h2>
                                        <a href="<?= base_url() .
                                            'product/' .
                                            $item->alias ?>"><?=$item->title?></a>
                                    </h2>
                                    <?php
                                        $this->db
                                        ->select('brand, alias')
                                        ->from('brands')
                                        ->where('id_brands', $item->brand_id);
                                        $brand = $this->db->get()->row();
                                    ?>

                                    <a class="f-text-links" href="<?= base_url() .
                                        'brand/' .
                                        $brand->alias ?>"><?= ucwords(
                                    $brand->brand
                                    ) ?></a>

                                    
                                    <?php

                                        if($cprice->num_rows() > 0) : 
                                            $price = $cprice->row()->price;   
                                            $disc_price =  $cprice->row()->discounted_price; 
                                    ?>
                                            <?php if($disc_price > 0) : ?>
                                                <span class="mc-price"><ins>IDR <?= number_format($disc_price) ?></ins>&nbsp;<del>IDR <?= number_format($price) ?></del></span>
                                            <?php else : ?>
                                                <span class="mc-price"><ins>IDR <?= number_format($price) ?></ins></span>
                                            <?php endif; ?>
                                    <?php       
                                        else : 
                                    ?>
                                        <?php if ($item->discount_price > 0): ?>
                                        <span class="mc-price"><ins>IDR <?= number_format($item->discount_price) ?></ins>&nbsp;<del>IDR <?= number_format($item->price) ?></del></span>
                                        <?php else: ?>
                                        <span class="mc-price"><ins>IDR <?= number_format($item->price) ?></ins></span>
                                        <?php endif; ?>

                                    <?php endif; ?> 

                                    <!----- RATING ----->
                                <?php
                                    $this->db
                                    ->select('floor(AVG(rating)) as rating,count(id_rating) as jum')
                                    ->from('rating')
                                    ->where('item_id', $item->id_products);
                                    $rating = $this->db->get();

                                    if($rating->num_rows() > 0) {
                                        $jum_rating = $rating->row('jum');
                                        if($rating->row('rating') == 5){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 4){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 3){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 2){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 1){
                                            echo '
                                                <span style="color:#cda486;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        if($rating->row('rating') == 0){
                                            echo '
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                                <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            ';
                                        }
                                        echo "<span style='color:#808080;font-size:17px;'>($jum_rating)</span>";
                                    }else{
                                        echo '
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#e6e6e6;font-size:17px;">&#9733;</span>
                                            <span style="color:#808080;font-size:17px;">(0)</span>
                                        ';
                                    }
                                ?>
                                <!----- /RATING ----->

                                </div>
                                
                            </div>
                        </div>
                        </div>

                    <?php endif; ?>
                <?php endforeach; ?>

        </div>
    </div>
</section>
<!-- END RELATED PRODUCTS -->	


<script>
window.addEventListener('DOMContentLoaded', (event) => {

  fbq('track', 'ViewContent',{ content_ids: ['<?= $product->alias ?>'], content_type: 'product', });

  document.getElementById('addToCart').addEventListener('click', function() {
    fbq('track', 'AddToCart',{ content_ids: ['<?= $product->alias ?>'], content_type: 'product', });
  });

});

$(document).ready(function(){
    // Check Radio-box
    $(".rating_input input:radio").attr("checked", false);

    $('.rating_input input').click(function () {
        $(".rating_input span").removeClass('checked');
        $(this).parent().addClass('checked');
    });

    $('input:radio').change(
      function(){
        var userRating = this.value;
        // alert(userRating);
    });
});
</script>

https://t.me/RX1948 - 2025