Specific store php

I have to enter promotions related to a specific store.

<?php require_once 'mobiledetect/Mobile_Detect.php';
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
$scriptVersion = $detect->getScriptVersion();
if ($detect->isMobile() xor $detect->isTablet() xor $detect->isIpad()): snippet($page->intendedTemplate().'_mobile') ; else: ?>



<?php snippet('headerico') ?>
<style>

#top {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  width: 100%;
  height: 100%;



}

#background {



  width: 100%; height: 100%; top: 0; left: 0;background:url('<?php if($page->children()->find('fotonegozio')->hasImages()): echo $page->children()->find('fotonegozio')->image()->url(); else:?> <?php echo $site->url();?>/assets/images/background2.jpg<?php endif; ?>') no-repeat center top ; position: fixed; z-index: -1;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
/*background-size: cover;
  -webkit-filter: blur(10px);
  -moz-filter: blur(10px);
  -o-filter: blur(10px);
  -ms-filter: blur(10px);
  filter: blur(10px);*/
}


</style>



 <body style="">
<div id="background"></div>
<div id="top" class="container-fluid" >
<div class="row" >
<div class="col-md-6" style="padding-top: 140px;text-align: right; font-family: 'Roboto', sans-serif; color: white; font-size: 12px; ">
</div>
<div class="col-md-4" style="padding-top: 140px;text-align: right; font-family: 'Roboto', sans-serif; color: white; font-size: 12px;">
<div class="row" >
<div class="col-md-3" style=" padding-bottom:20px;text-align:center; font-weight: 700; color: black; font-size: 26px">

<?php if ($page->hasImages()):?><img src="<?php echo $page->image()->url();?>" class="img-fluid" style="background-color: white;"><?php endif;?>

</div>

<div class="col-md-9" style="background-color: white;
padding-top: 20px; padding-bottom:0px;text-align:center; font-weight: 400;
color: black; font-size: 24px; text-align: left; text-transform: uppercase;">
<div class="row" style="padding-bottom:0px">
  <div class="col-md-12" style="padding-bottom:25px;">
<span style="line-height:24px;"><?php echo $page->title();?><br/></span>
<span style="font-size: 14px; font-weight: 200;text-transform: none; margin-top: -10px;"><a href="<?php echo $page->parent()->url();?>" style="text-decoration:none; color: black;">
  <?php echo $page->parent()->title();?></a></span>

<!-- inizio dati negozio -->
<?php $conteggio = 0;?>


<?php if ($page->tel() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
  <i class="fas fa-phone"></i>
<span style="font-size: 10px; font-weight: 200"><?php echo $page->tel();?></span></span>
<?php $conteggio = $conteggio+1;
if($conteggio % 2 == 0){
        echo "<br/>";
    } ?>
<?php endif; ?>

<?php if ($page->email() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
  <i class="far fa-envelope"></i>

<span style="font-size: 10px; font-weight: 200"><a href="mailto:<?= str::encode($page->email()) ?>" style="text-transform: none; text-decoration:none; color:black;">
    <?= str::encode($page->email()) ?>
</a></span></span>
<?php $conteggio = $conteggio+1;
if($conteggio % 2 == 0){
        echo "<br/>";
    } ?>
<?php endif; ?>


<?php if ($page->web() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
  <i class="fas fa-globe"></i>


<span style="font-size: 10px; font-weight: 200">
  <?php $var = $page->web();

  if(strpos($var, 'http://') !== 0) {

    if (strpos($var, 'https://') !== 0) {
    $sito = 'http://' . $var; } else { $sito = $var;
  }} else {
    $sito = $var;
  }?>


  <a href="<?php echo $sito;?>" style="text-decoration:none; color: black; " target="_blank"><?php echo $page->web();?></a></span></span>

<?php endif; ?>
<br/>

<?php if ($page->facebook() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->facebook();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-facebook"></i></a>

</span>

<?php endif; ?>

<?php if ($page->instagram() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->instagram();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-instagram"></i></a>

</span>

<?php endif; ?>

<?php if ($page->twitter() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->twitter();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-twitter"></i></a>

</span>

<?php endif; ?>

<?php if ($page->youtube() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->youtube();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-youtube"></i></a>

</span>

<?php endif; ?>
<?php if ($page->linkedin() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->linkedin();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-linkedin"></i></a>

</span>

<?php endif; ?>



<!-- fine dati negozio -->



</div>
<div class="col-md-12" style="padding-bottom:25px;">
<span style="font-weight: 50; font-size: 16px; display: block; line-height:20px !important; text-align:justify; text-transform: none;">
  <?php echo $page->descrizionenegozio();?><br/></span>
</div>
<?php $codice = $page->cod();
$codice = preg_replace('/[^A-Za-z0-9?!]/', '', $codice); ?>
<div class="col-md-12" style="background-color: #dd152a;
padding-top: 2px; padding-bottom:2px;text-align:center; font-weight: 200;
color: white; font-size: 12px; text-align: left; text-transform: uppercase;"><a href="<?php echo $pages->find('negozi')->children()->find('mappa')->url();?>?location=A<?php echo $codice;?>" style="color: white; text-decoration: none;">
  Mostra <span style="font-weight: 700 !important"><i><?php echo $page->title();?></i></span>  sulla mappa</a></div>
  <div class="col-md-12" style="background-color: #C51439;
  padding-top: 2px; padding-bottom:2px;text-align:center; font-weight: 200;
  color: white; font-size: 12px; text-align: left; text-transform: uppercase;"><a href="<?php echo $page->parent()->url();?>" style="color: white; text-decoration: none;">
    Torna all'elenco dei negozi</a></div>
</div></div>

</div>

</div></div>

<!---promozioni relative al negozio --->
<div class="row" style="padding-left:0px; padding-right: 0px; height: 40vh;">

  <?php $eventi = $pages->find('promozioni')->children()->map(function($page) {
$page->timestampfield = strtotime($page->dateend());
return $page;
})->sortBy('timestampfield', 'desc')->paginate(3);
?>
<?php foreach($eventi as $evento):
?><span></span><?php endforeach; ?>

  <div class="col-md-1 pl-0 my-auto">
    <?php


    $pagination = $eventi->pagination();

    ?>


    <?php if($pagination->hasPrevPage()): ?>
    <a class="next" href="<?= $pagination->prevPageURL() ?>"><img src="<?php echo $site->url();?>/assets/images/sinistra.svg"  class="img-fluid" width="80%"></a>
  <?php else: echo ''; ?><?php endif ?></div>
<div class="col-md-1"></div>
  <div class="col-md-8 my-auto">

<div class="row">
<?php if ($eventi->count() >= 1):?>
<?php foreach($eventi as $evento):
?>
<div class="col-md-4" style="text-align: center"><a href="<?php echo $evento->url();?>" >

	<div class="container2">
  <img src="
  <?php if ($evento->hasImages()):
echo thumb($evento->image(), array('width' => 600, 'height' => 600, 'crop' => true))->url();
else:
  $myimage = new Asset('assets/images/granshoppingdefault.jpg');
echo thumb($myimage, array('width' => 600, 'height' => 600, 'crop' => true))->url(); endif;
  ?>

  " class="img-fluid image2" width="70%" style="-webkit-box-shadow: 0px 0px 53px 13px rgba(0,0,0,0.60);
-moz-box-shadow: 0px 0px 53px 13px rgba(0,0,0,0.60);
box-shadow: 0px 0px 53px 13px rgba(0,0,0,0.60);">
  <div class="overlay2">
    <div class="text2"><?php echo $evento->title();?></div>
  </div>
</div>
  </a></div>

<?php endforeach; ?><?php else: ?><div class="col-md-12 my-auto" style="text-align:center; color: white; font-family: 'Roboto'"><h1>A presto per le nuove promozioni!</h1> </div><?php endif; ?>
</div></div>
<div class="col-md-1"></div>
<div class="col-md-1 pr-0 my-auto" style="text-align:right;">
  <?php if($eventi->pagination()->hasNextPage()): ?>
  <a class="next" href="<?= $eventi->pagination()->nextPageURL() ?>"><img src="<?php echo $site->url();?>/assets/images/destra.svg"  class="img-fluid" width="80%"></a>
 <?php else: echo ''; ?><?php endif ?></div>
</div>

<?php snippet('footer') ?><?php endif;?>
<?php snippet('footerjs') ?>

What is your question?

my question is that on this page I want to show only the promotions of a specific store, the code written now shows all the promotions

What is your page structure? Please also show the relevant code. It’s hard to find it in the above.

the page is this :https://www.granshoppingmongolfiera.it/negozi/categorie/elettronica-casa-e-tempo-libero/store
and this is the page “promozioni” https://www.granshoppingmongolfiera.it/promozioni
this is the blueprint page “promozioni”

title: Promozione

files:
  sortable: true

pages: false

fields:
  title:
    label: Titolo
    width: 2/3
    type:  text

  negozio:
    label: Negozio
    width: 1/3
    type: select
    options: query
    query:
      page: /negozi/categorie
      fetch: grandchildren
      value: '{{url}}'
      text: '{{title}}'

  datestart:
    label: Data Inizio
    type:  date
    width: 1/4
    default: today
    format: DD/MM/YYYY

  dateend:
    label: Data fine
    type:  date
    width: 1/4
    default: tomorrow
    format: DD/MM/YYYY

  timestart:
    label: Ora inizio
    type:  time
    width: 1/4

  timeend:
    label: Ora fine
    type:  time
    width: 1/4

  descrizionebreve:
    label: Descrizione Breve (max 120 caratteri)
    type:  textarea
    validate:
      maxLength: 120

  text:
    label: Descrizione
    type:  textarea

  metadescription:
    label: SEO Descrizione
    type:  text

  metakeywords:
    label: SEO Parole chiave
    type:  text

Sorry, I meant the folder structure.

Please wrap code blocks in three backticks (```) on a separate line before and after your code, like this

58

this?
56

Well, yes.

So you have shops (negozi) and you have promotions (promozioni). How are the promotions assigned to individual shops?

21


on the promotions page there is a select

Ok, then you can filter your promotions by that field:

$shopPromotions = page('promozioni')->children()->visible()->filterBy('negozio', 'name_of_negozio');

perfect. But where should I put it?

I don’t know? Instead of your current code I guess where you show all promotions. If you post the code where that happens instead of a complete template…

this is the code

<?php require_once 'mobiledetect/Mobile_Detect.php';
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
$scriptVersion = $detect->getScriptVersion();
if ($detect->isMobile() xor $detect->isTablet() xor $detect->isIpad()): snippet($page->intendedTemplate().'_mobile') ; else: ?>



<?php snippet('headerico') ?>
<style>

#top {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  width: 100%;
  height: 100%;



}

#background {



  width: 100%; height: 100%; top: 0; left: 0;background:url('<?php if($page->children()->find('fotonegozio')->hasImages()): echo $page->children()->find('fotonegozio')->image()->url(); else:?> <?php echo $site->url();?>/assets/images/background2.jpg<?php endif; ?>') no-repeat center top ; position: fixed; z-index: -1;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
/*background-size: cover;
  -webkit-filter: blur(10px);
  -moz-filter: blur(10px);
  -o-filter: blur(10px);
  -ms-filter: blur(10px);
  filter: blur(10px);*/
}


</style>



 <body style="">
<div id="background"></div>
<div id="top" class="container-fluid" >
<div class="row" >
<div class="col-md-6" style="padding-top: 140px;text-align: right; font-family: 'Roboto', sans-serif; color: white; font-size: 12px; ">
</div>
<div class="col-md-4" style="padding-top: 140px;text-align: right; font-family: 'Roboto', sans-serif; color: white; font-size: 12px;">
<div class="row" >
<div class="col-md-3" style=" padding-bottom:20px;text-align:center; font-weight: 700; color: black; font-size: 26px">

<?php if ($page->hasImages()):?><img src="<?php echo $page->image()->url();?>" class="img-fluid" style="background-color: white;"><?php endif;?>

</div>

<div class="col-md-9" style="background-color: white;
padding-top: 20px; padding-bottom:0px;text-align:center; font-weight: 400;
color: black; font-size: 24px; text-align: left; text-transform: uppercase;">
<div class="row" style="padding-bottom:0px">
  <div class="col-md-12" style="padding-bottom:25px;">
<span style="line-height:24px;"><?php echo $page->title();?><br/></span>
<span style="font-size: 14px; font-weight: 200;text-transform: none; margin-top: -10px;"><a href="<?php echo $page->parent()->url();?>" style="text-decoration:none; color: black;">
  <?php echo $page->parent()->title();?></a></span>

<!-- inizio dati negozio -->
<?php $conteggio = 0;?>


<?php if ($page->tel() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
  <i class="fas fa-phone"></i>
<span style="font-size: 10px; font-weight: 200"><?php echo $page->tel();?></span></span>
<?php $conteggio = $conteggio+1;
if($conteggio % 2 == 0){
        echo "<br/>";
    } ?>
<?php endif; ?>

<?php if ($page->email() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
  <i class="far fa-envelope"></i>

<span style="font-size: 10px; font-weight: 200"><a href="mailto:<?= str::encode($page->email()) ?>" style="text-transform: none; text-decoration:none; color:black;">
    <?= str::encode($page->email()) ?>
</a></span></span>
<?php $conteggio = $conteggio+1;
if($conteggio % 2 == 0){
        echo "<br/>";
    } ?>
<?php endif; ?>


<?php if ($page->web() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
  <i class="fas fa-globe"></i>


<span style="font-size: 10px; font-weight: 200">
  <?php $var = $page->web();

  if(strpos($var, 'http://') !== 0) {

    if (strpos($var, 'https://') !== 0) {
    $sito = 'http://' . $var; } else { $sito = $var;
  }} else {
    $sito = $var;
  }?>


  <a href="<?php echo $sito;?>" style="text-decoration:none; color: black; " target="_blank"><?php echo $page->web();?></a></span></span>

<?php endif; ?>
<br/>

<?php if ($page->facebook() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->facebook();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-facebook"></i></a>

</span>

<?php endif; ?>

<?php if ($page->instagram() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->instagram();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-instagram"></i></a>

</span>

<?php endif; ?>

<?php if ($page->twitter() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->twitter();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-twitter"></i></a>

</span>

<?php endif; ?>

<?php if ($page->youtube() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->youtube();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-youtube"></i></a>

</span>

<?php endif; ?>
<?php if ($page->linkedin() != ''): ?>
<span style="font-size: 14px; text-transform: none; padding-right:30px;">
<a href="<?php echo $page->linkedin();?>" style="text-decoration: none; color: black;" target="_blank"><i class="fab fa-linkedin"></i></a>

</span>

<?php endif; ?>



<!-- fine dati negozio -->



</div>
<div class="col-md-12" style="padding-bottom:25px;">
<span style="font-weight: 50; font-size: 16px; display: block; line-height:20px !important; text-align:justify; text-transform: none;">
  <?php echo $page->descrizionenegozio();?><br/></span>
</div>
<?php $codice = $page->cod();
$codice = preg_replace('/[^A-Za-z0-9?!]/', '', $codice); ?>
<div class="col-md-12" style="background-color: #dd152a;
padding-top: 2px; padding-bottom:2px;text-align:center; font-weight: 200;
color: white; font-size: 12px; text-align: left; text-transform: uppercase;"><a href="<?php echo $pages->find('negozi')->children()->find('mappa')->url();?>?location=A<?php echo $codice;?>" style="color: white; text-decoration: none;">
  Mostra <span style="font-weight: 700 !important"><i><?php echo $page->title();?></i></span>  sulla mappa</a></div>
  <div class="col-md-12" style="background-color: #C51439;
  padding-top: 2px; padding-bottom:2px;text-align:center; font-weight: 200;
  color: white; font-size: 12px; text-align: left; text-transform: uppercase;"><a href="<?php echo $page->parent()->url();?>" style="color: white; text-decoration: none;">
    Torna all'elenco dei negozi</a></div>
</div></div>

</div>

</div></div>

<!---promozioni relative al negozio --->
<div class="row" style="padding-left:0px; padding-right: 0px; height: 40vh;">

  <?php $eventi = $pages->find('promozioni')->children()->map(function($page) {
$page->timestampfield = strtotime($page->dateend());
return $page;
})->sortBy('timestampfield', 'desc')->paginate(3);
?>
<?php foreach($eventi as $evento):
?><span></span><?php endforeach; ?>

  <div class="col-md-1 pl-0 my-auto">
    <?php


    $pagination = $eventi->pagination();

    ?>


    <?php if($pagination->hasPrevPage()): ?>
    <a class="next" href="<?= $pagination->prevPageURL() ?>"><img src="<?php echo $site->url();?>/assets/images/sinistra.svg"  class="img-fluid" width="80%"></a>
  <?php else: echo ''; ?><?php endif ?></div>
<div class="col-md-1"></div>
  <div class="col-md-8 my-auto">

<div class="row">
<?php if ($eventi->count() >= 1):?>
<?php foreach($eventi as $evento):
?>
<div class="col-md-4" style="text-align: center"><a href="<?php echo $evento->url();?>" >

	<div class="container2">
  <img src="
  <?php if ($evento->hasImages()):
echo thumb($evento->image(), array('width' => 600, 'height' => 600, 'crop' => true))->url();
else:
  $myimage = new Asset('assets/images/granshoppingdefault.jpg');
echo thumb($myimage, array('width' => 600, 'height' => 600, 'crop' => true))->url(); endif;
  ?>

  " class="img-fluid image2" width="70%" style="-webkit-box-shadow: 0px 0px 53px 13px rgba(0,0,0,0.60);
-moz-box-shadow: 0px 0px 53px 13px rgba(0,0,0,0.60);
box-shadow: 0px 0px 53px 13px rgba(0,0,0,0.60);">
  <div class="overlay2">
    <div class="text2"><?php echo $evento->title();?></div>
  </div>
</div>
  </a></div>

<?php endforeach; ?><?php else: ?><div class="col-md-12 my-auto" style="text-align:center; color: white; font-family: 'Roboto'"><h1>A presto per le nuove promozioni!</h1> </div><?php endif; ?>
</div></div>
<div class="col-md-1"></div>
<div class="col-md-1 pr-0 my-auto" style="text-align:right;">
  <?php if($eventi->pagination()->hasNextPage()): ?>
  <a class="next" href="<?= $eventi->pagination()->nextPageURL() ?>"><img src="<?php echo $site->url();?>/assets/images/destra.svg"  class="img-fluid" width="80%"></a>
 <?php else: echo ''; ?><?php endif ?></div>
</div>

<?php snippet('footer') ?><?php endif;?>
<?php snippet('footerjs') ?>

That is complete template. Please don’t expect us to read through all that to find the relevant part. Please only post the code you want to replace.

And for which page is that code anyway, for a single shop?

<div class="row"> <h1 style="text-align:center;text-transform:uppercase; color:white;"> ecco le promozioni </h1></div>
promozioni relative al negozio
<div class="row" style="padding-left:0px; padding-right: 0px; height: 40vh;">

  <?php $eventi = $pages->find('promozioni')->children()->map(function($page) {
$page->timestampfield = strtotime($page->dateend());

return $page;
})->sortBy('timestampfield', 'desc')->paginate(3);
?>
<?php foreach($eventi as $evento):
?><span></span><?php endforeach; ?>

  <div class="col-md-1 pl-0 my-auto">
    <?php


    $pagination = $eventi->pagination();

    ?>


    <?php if($pagination->hasPrevPage()): ?>
    <a class="next" href="<?= $pagination->prevPageURL() ?>"><img src="<?php echo $site->url();?>/assets/images/sinistra.svg"  class="img-fluid" width="80%"></a>
  <?php else: echo ''; ?><?php endif ?></div>
<div class="col-md-1"></div>
  <div class="col-md-8 my-auto">

<div class="row">
<?php if ($eventi->count() >= 1):?>
<?php foreach($eventi as $evento):
?>
<div class="col-md-2" style="text-align: center"><a href="<?php echo $evento->url();?>" >

	<div class="container2">
  <img src="
  <?php if ($evento->hasImages()):
echo thumb($evento->image(), array('width' => 600, 'height' => 600, 'crop' => true))->url();
else:
  $myimage = new Asset('assets/images/granshoppingdefault.jpg');
echo thumb($myimage, array('width' => 600, 'height' => 600, 'crop' => true))->url(); endif;
  ?>

  " class="img-fluid image2" width="70%" style="-webkit-box-shadow: 0px 0px 53px 13px rgba(0,0,0,0.60);
-moz-box-shadow: 0px 0px 53px 13px rgba(0,0,0,0.60);
box-shadow: 0px 0px 53px 13px rgba(0,0,0,0.60);">
  <div class="overlay2">
    <div class="text2"><?php echo $evento->title();?></div>
  </div>
</div>
  </a></div>

<?php endforeach; ?><?php else: ?><div class="col-md-12 my-auto" style="text-align:center; color: white; font-family: 'Roboto'"><h1>A presto per le nuove promozioni!</h1> </div><?php endif; ?>
</div></div>
<div class="col-md-1"></div>
<div class="col-md-1 pr-0 my-auto" style="text-align:right;">
  <?php if($eventi->pagination()->hasNextPage()): ?>
  <a class="next" href="<?= $eventi->pagination()->nextPageURL() ?>"><img src="<?php echo $site->url();?>/assets/images/destra.svg"  class="img-fluid" width="80%"></a>
 <?php else: echo ''; ?><?php endif ?></div>
</div>

this is the specific code, this code is negozio.php

Ok, so you have to add the filter here

  <?php $eventi = $pages->find('promozioni')->children()->filterBy('negozio', $page->uid())->map(function($page) {
$page->timestampfield = strtotime($page->dateend());

return $page;
})->sortBy('timestampfield', 'desc')->paginate(3);
?>

Assuming that the UID of the page is stored in the content file.

unfortunately it does not work
https://www.granshoppingmongolfiera.it/sitoprova/negozi/categorie/cura-della-presona/bottega-verde
because there are promotions but it tells me that there are not, a question but it shows me only the promotions in progress?

These are the promotions?

yes