File: /var/www/vhosts/creativefellows.nl/test.creativefellows.nl/tekenmappen/views/view.products.php
<?php
/*
* Get Header
*/
$header_top_color = $data["page"][0]->contents == "" || !preg_match("/.image-showcase/",$data["page"][0]->contents) ? "" : "has-showcase";
require_once 'inc/header.php';
/*
* Order product
*/
$html = '<div class="grid-container">';
$html .= '<div class="grid-x grid-padding-x align-middle">';
$html .= '<div class="small-12 medium-6 cell">';
$html .= '<h1>'.$page[0]->getProperty("titel").'<span class="item-price">'. $page[0]->getProperty("prijs","price") .'</span></h1>';
$html .= $page[0]->getProperty("formaat","h3");
$html .= $page[0]->getProperty("lead");
// materials
$materialen = $data["cassette"]->getPage("materialen");
$html.= '<form action="'. $router->pathFor('shop.addBasket') .'" method="post" enctype="multipart/form-data">';
// fake input
if($page[0]->getProperty("product_type") != "normaal"){
$html .= '<div class="fake-input-wrapper"><input type="hidden" name="article_material" id="article_material" value="0" class="choose-option" data-msg="Je hebt nog geen kleur gekozen" />';
$html .= '<div class="form-text fake-input not-selected">';
$html .= '<div id="chosen-material"><i class="fa fa-caret-right" aria-hidden="true"></i>Kies je kleur '. $page[0]->getProperty("product_type") .'</div>';
$html .= '</div>';
$html .= '<div class="fake-input-values inlays hidden" id="values-'. uniqid() .'">';
$html .= '<ul class="fake-input-selector">';
foreach($materialen as $inl)
{
$html .= '<li>';
$html .= '<a href="#" data-value="'. $inl->getProperty("naam") .'" data-return="chosen-material" data-input="article_material" data-label="'. $inl->getProperty("naam") .'" class="option">';
$html .= $inl->getProperty("image","img") . '<span class="visible">' . $inl->getProperty("naam") .'</span>';
$html .= '</a>';
$html .= '</li>';
}
$html .= '</ul>';
$html .= '</div>';
$html .= '</div>';
}
// hidden inputs
$html .= '<input type="hidden" name="uid" value="'. uniqid() .'" />';
$html .= '<input type="hidden" name="type" value="'. $page[0]->getProperty("product_type") .'" />';
$html .= '<input type="hidden" name="amount" value="1" />';
$html .= '<input type="hidden" name="article" id="article" value="'. $page[0]->getProperty("titel") .'" />';
$html .= '<input type="hidden" name="pid" value="'. $page[0]->getProperty("uid") .'" />';
$html .= '<input type="hidden" name="price" id="price" value="'. $page[0]->getProperty("prijs") .'" />';
$html .= '<input type="hidden" name="size" id="size" value="'. $page[0]->getProperty("formaat") .'" />';
$html .= '<input type="hidden" name="article_img" id="article_img" value="'. $page[0]->getProperty('image','single_image',0) .'" />';
// order button
$html .= '<button class="button primary check-product" data-select="article_material"><i class="fal fa-plus"></i> In winkelwagen</button>';
$html.= '</form>';
$html .= '</div>';
// preview image
$html .= '<div class="small-12 medium-6 cell text-center">';
$html .= '<div class="template-image">';
$html .= '<div class="mask '. $page[0]->getProperty("product_type") .'"></div>';
switch($page[0]->getProperty("product_type")){
default:
$html .= $materialen[0]->getProperty('image','image',['class' => 'material']);
break;
case "normaal":
$html .= $page[0]->getProperty('image','image');
break;
}
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
echo $data["config"]->wrapAsSection($html,"","order-product");
//d($page[0]);
/*
* Related products
*/
$tags = $data["page"][0]->getProperty("tags");
//d($tags);
if($tags["related"])
{
$html = '<div class="grid-container">';
$html .= '<div class="grid-x grid-padding-x align-center">';// align-middle
$html .= '<div class="small-12 cell text-center related-products">';
$html .= '<h3>Anderen bekeken ook</h3>';
$html .= '<hr />';
$html .= '</div>';
foreach($tags["related"] as $i => $entry)
{
//if($i == 0) continue;
$html .= '<div class="small-6 medium-3 cell text-center">';
$html .= '<h3><a href="'. $entry->getUrl() .'">'. $entry->getProperty("titel") .'</a></h3>';
$html .= '<h4>'. $entry->getProperty("formaat") .'</h4>';
$html .= '<div class="product">';
$html .= '<div class="inner">';
$html .= '<a href="'. $entry->getUrl() .'">';
$html .= '<strong class="price">'. $entry->getProperty("prijs") .'</strong>';
$html .= '<span class="lengte">'. $entry->getProperty("lengte") .' cm</span>';
$html .= '<span class="hoogte">'. $entry->getProperty("hoogte") .' cm</span>';
$html .= $entry->getProperty("image","img");
$html .= '</a>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
}
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
// wrap as section
echo $data["config"]->wrapAsSection($html,"","row-category");
}
/*
* Check if entry has a form
*/
if( $cassetteForm = $data["page"][0]->getForm() )
{
$form = '<div class="grid-container">';
$form .= '<div class="grid-x grid-padding-x">';
$form .= '<div class="small-12 cell text-center">';
//$hide_form = preg_match("/data-toggle/",$cassetteForm->getFormIntro()) ? true : false;
$valid_response = $data["cassette"]->hasValidResponse($_GET["h"],$_GET["id"]);
// form not sent en hidden with button
if($valid_response == false ) $form .= $cassetteForm->getFormIntro();
elseif($valid_response == false) $form .= '<h2 class="text-center">'. $cassetteForm->getFormName() .'</h2>';
else $form .= 'resp msg';
$form .= '</div>';
$form .= '<div class="large-12 cell" id="contact-general">';
if($valid_response === false) $form .= $cassetteForm->getForm();
$form .= '</div>';
$form .= '</div>';
$form .= '</div>';
echo $data["config"]->wrapAsSection($form,null,"panel-gray");
}
/*
* Get Footer
*/
require_once 'inc/footer.php';
?>