{% extends "layout/layout.html.twig" %}
{% block content %}
{% set locale = app.request.locale %}
{% if locale == 'en_GB' %}
{% set locale = 'en' %}
{% endif %}
{% if category != null %}
{% if category[0].video %}
{% set Video = category[0].video.data %}
{% set value = true %}
{% endif %}
{% else %}
{% set value = false %}
{% endif %}
<!--Start Banner Video-->
<span class = "pagetype d-none" >Product Listing Page</span>
<div class="banner-recipe">
<!-- <video id="home-video" class="video-js" controls autoplay loop preload="auto" poster="<= $category[0]->getVideo_Thumbnail() ?>"
data-setup="{}" height="400">
<source src="<= $value == true ? $video->getPath().$video->getFilename() : ''?>" type="video/mp4">
</video> -->
<div class="rec-hm-cont">
<h1 class ="gtm-contentval">{{category[0].name }} {{"Products"|trans }}</h1>
</div>
<img src="{{category[0].video_Thumbnail}}" alt="">
</div>
<!--End Banner Video-->
<!--Start Breadcrumbs-->
<nav aria-label="breadcrumb" class="breadcrumb-holder">
<div class="container-xl custom-container-xl">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/{{ locale }}">{{"Home"|trans }}</a></li>
<li class="breadcrumb-item"><a href="/{{ locale }}/{{"products"|trans }}">{{"Products"|trans }}</a></li>
<li class="breadcrumb-item active" aria-current="page">{{category[0].name}}
{# <!-- <a href="/<?php echo $weblink; ?>/productlist/<= $category[0]->getId();?>" class="breadcm-product-list"><= $category[0]->getName(); ?></a> --> #}
</li>
</ol>
</div>
</nav>
<!--End Breadcrumbs-->
<!--Start Products Holder Holder-->
<section class="products-holder products-detail-holder-edited">
<div class="container-xl custom-container-xl">
<!--Start Product Banner-->
<section class="products-banner">
<div class="row">
<div class="col-xl-6 products-banner-info">
<h1 class="sub-xl-heading">{{category[0].name}}</h1>
<p>{{category[0].description}}</p>
</div>
<div class="col-xl-6 products-banner-img" data-aos="zoom-in-up">
<img src="{{category[0].image}}" alt="">
</div>
</div>
</section>
<!--End Product Banner-->
<!--Start Products Listing-->
<section class="products-listing-holder">
<!--Start Listing-->
<div class="products-listing product-list-box single-product-list">
<div class="row">
{% for categProducts in category[0].products %}
{% set regions = categProducts.regions %}
{% set show = false %}
{% if regions %}
{% for key , region in regions %}
{% if region in groupids %}
{% set show = true %}
{% endif %}
{% endfor %}
{% endif %}
{# <?php
$categProducts = $category[0]->getProducts();
for($i=0; $i<count($categProducts); $i++){
$regions = $categProducts[$i]->getRegions();
$show = false;
if ($regions) {
foreach($regions as $key => $region) {
if (array_search($region, $groupids) !== false) {
$show = true;
}
}
}
if ($show):
$categProdAttrs = $categProducts[$i]->getAttributes();
if($categProdAttrs){
for($cpa = 0; $cpa < count($categProdAttrs); $cpa++){
?> #}
{% if show %}
{% if categProducts.attributes %}
{% for categProdAttrs in categProducts.attributes %}
<div class="col-12 col-md-4 col-xl-3">
<div class="slide">
<div class="slide-holder product-list-sty pl-box">
<div class="slide-img {{ "img" ~ categProdAttrs.size }}" data-aos="zoom-in-up">
{% if categProdAttrs %}
<a href="/{{ locale }}/{{"products"|trans }}/{{categProdAttrs.url}}"><img class="img-fluid"
src="{{categProdAttrs.images[0].path ~ categProdAttrs.images[0].filename }}"
xoriginal="{{categProdAttrs.images[0].path ~ categProdAttrs.images[0].filename }}" /></a>
{% endif %}
<!-- <img alt="" class="img-fluid" src="/static/assets/images/product-01.png" /> -->
</div>
<div class="slide-info">
{% if categProducts.name == 'Rainbow Evaporated Milk Low Cholesterol' %}
{# <?php $str = explode(" ", $categProducts[$i]->getName()); $last = $str[count($str)-1]?> #}
<a class="remove-anchor-style2" href="/{{ locale }}/{{"products"|trans }}/{{categProdAttrs.url}}"><small>{{'Rainbow'}}</small></a>
<a class="remove-anchor-style2" href="/{{ locale }}/{{"products"|trans }}/{{categProdAttrs.url}}"><h5 class="text_three__line_elipsis">{{'Evaporated Milk'}}<strong>{{'Low Cholesterol'}}</strong></h5></a>
{% elseif categProducts.name == 'Rainbow Sweetened Condensed Milk' %}
{# <?php $str = explode(" ", $categProducts[$i]->getName()); $last = $str[count($str)-1]?> #}
<a class="remove-anchor-style2" href="/{{ locale }}/{{"products"|trans }}/{{categProdAttrs.url}}"><small>{{'Rainbow'}}</small></a>
<a class="remove-anchor-style2" href="/{{ locale }}/{{"products"|trans }}/{{categProdAttrs.url}}"><h5 class="text_three__line_elipsis">{{'Sweetened'}}<strong>{{'Condensed Milk'}}</strong></h5></a>
{% else %}
{# <?php $str = explode(" ",$categProducts[$i]->getName()); $last = $str[count($str)-1]?> #}
{% if locale == 'ar' %}
<a class="remove-anchor-style2" href="/{{ locale }}/{{"products"|trans }}/{{categProdAttrs.url}}"><small>{{categProducts.name}}</small></a>
{% else %}
{% set str = categProducts.name|split(' ') %}
{% set srt_middle_word = "" %}
{% for a in 1..str|length -2 %}
{% set srt_middle_word = srt_middle_word ~ ' ' ~ str[a] %}
{% endfor %}
<a class="remove-anchor-style2" href="/{{ locale }}/{{"products"|trans }}/{{categProdAttrs.url}}"><small>{{str[0]}}</small></a>
<a class="remove-anchor-style2" href="/{{ locale }}/{{"products"|trans }}/{{categProdAttrs.url}}"><h5 class="text_three__line_elipsis">{{srt_middle_word}}<strong>{{str|last}}</strong></h5></a>
{% endif %}
{% endif %}
<span class="text-white">{{categProdAttrs.size}}</span>
</div>
{% set regionslinks = categProdAttrs.buttonlinks %}
{% set rlink = [] %}
{% for key , link in regionslinks %}
{% if link['country'].data == country %}
{% set rlink = link %}
{% endif %}
{% endfor %}
{% if not rlink %}
{% for key , link in regionslinks %}
{% if link['country'].data == 'AE' %}
{% set rlink = link %}
{% endif %}
{% endfor %}
{% endif %}
{# <?php
$regionslinks = $category[0]->getProducts()[$i]->getAttributes()[0]->getButtonlinks();
$rlink = [];
foreach ($regionslinks as $key => $link) {
if ($link['country']->getData() == $country) {
$rlink = $link;
}
}
if (!$rlink) {
foreach ($regionslinks as $key => $link) {
if ($link['country']->getData() == 'AE') {
$rlink = $link;
}
}
}
// echo '<pre>';
// print_r($rlink);
// echo '</pre>';
?> #}
<div class="btn-holder pl-btn">
<a class="btn btn-primary ico-btn productbuynow"
data-lulu="{{ (rlink['lulu']) ? rlink['lulu'].data : '' }}"
data-union="{{ (rlink['unioncool']) ? rlink['unioncool'].data : '' }}"
data-amazon="{{ (rlink['amazon']) ? rlink['amazon'].data : '' }}"
data-carrefour="{{ (rlink['carrefour']) ? rlink['carrefour'].data : '' }}"
data-c4="{{ (rlink['c4']) ? rlink['c4'].data : '' }}"
data-noon="{{ (rlink['noon']) ? rlink['noon'].data : '' }}"
data-danube="{{ (rlink['danube']) ? rlink['danube'].data : '' }}"
data-tawseel="{{ (rlink['tawseel']) ? rlink['tawseel'].data : '' }}"
data-sultancenter="{{ (rlink['sultancenter']) ? rlink['sultancenter'].data : '' }}" data-aos="zoom-in-up">
<i><img src="/static/assets/images/shopping-cart.svg" alt=""></i>
<span>{{"BuyNow"|trans }}</span>
<!-- <= $this->translate("BuyNow"); ?> -->
</a>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
</div>
</div>
<!--End Listing-->
</section>
<!--End Products Listing-->
</div>
</section>
<!--End Recipe Holder-->
{% if (locale =='ar') %}
{% set topMenu ="/en/products/" ~ category[0].url('en') %}
{% else %}
{% set topMenu ="/ar/منتجات/" ~ category[0].url('ar') %}
{% endif %}
<script type="text/javascript">
var _TopMenuLink = "{{topMenu }}"
</script>
{% endblock %}