{% set category = entries('products', 'categories').where('slug', request_segment(2)).first() %}
{% set cameras = entries('products', 'camera')
    .where('product_category_id', category.id)
    .where('slug', '!=', request_segment(3))
    .inRandomOrder()
    .take(3)
    .get() %}

{% if cameras.count() > 0 and request_segment(3) != 'lens' %}
    <section class="relatedProduct transBG cell">
        <div class="sizeCenterElm columns">
            <h2 class="titleCategory">
                related Product
            </h2>
        </div>
        <div class="cell columns">
            <div class="sizeCenterElm grid-x">
                <div class="fuji-bundling grid-margin-x">

                    {% for camera in cameras %}
                        <div class="item">
                            <div class="boxItem">
                                <a href="{{ url('product/' ~ category.slug ~ '/' ~ camera.slug) }}">
                                    <h2 class="nameProduct">{{ camera.title }}</h2>
                                </a>
                                <div class="i-camera">
                                    <a href="{{ url('product/' ~ category.slug ~ '/' ~ camera.slug) }}">
                                        <img src="{{ image(camera.product_camera[0].camera_image.cropped()).resize(191,131).url() }}" alt="">
                                    </a>
                                </div>
                                <div class="caption">
                                    <p>{{ camera.product_camera_banner_short_description }}</p>
                                </div><!-- END CAPTION -->
                            </div>
                        </div>
                    {% endfor %}

                </div>
            </div>
        </div>
        <div class="sizeCenterElm columns">

        </div>
    </section>
{% else %}
    <section class="relatedProduct related-lens transBG cell">
        <div class="sizeCenterElm columns">
            <h2 class="titleCategory">
                related Product
            </h2>
        </div>
        <div class="cell columns">
            <div class="sizeCenterElm grid-x">
                <div class="fuji-bundling grid-margin-x">

                    {% for lens in entries('products', 'lens')
                        .where('product_category_id', category.id)
                        .inRandomOrder()
                        .where('slug', '!=', request_segment(4))
                        .take(3)
                        .get()
                    %}
                        <div class="item">
                            <div class="boxItem">
                                <a href="{{ url('product/' ~ category.slug ~ '/lens/' ~ lens.slug) }}">
                                    <h2 class="nameProduct">{{ lens.title }}</h2>
                                </a>
                                <div class="i-camera">
                                    <a href="{{ url('product/' ~ category.slug ~ '/lens/' ~ lens.slug) }}">
                                        <img src="{{ image(lens.product_lens[0].lens_image.cropped()).resize(140,140).url() }}" alt="">
                                    </a>
                                </div>
                                <div class="caption">
                                    <p>{{ lens.lens_short_description }}</p>
                                </div>
                            </div>
                        </div>
                    {% endfor %}

                </div>
            </div>
        </div>
        <div class="sizeCenterElm columns">

        </div>
    </section>
{% endif %}