Skip to content

Instantly share code, notes, and snippets.

@wiratama
Last active February 14, 2018 06:48
Show Gist options
  • Save wiratama/35752b5657a23e090e42bdfd58fcdaae to your computer and use it in GitHub Desktop.
Save wiratama/35752b5657a23e090e42bdfd58fcdaae to your computer and use it in GitHub Desktop.
{% extends 'MoventContentBundle:Content/Layout/base:base.html.twig' %}
{% block content %}
{% include "MoventSiteBundle:Social:socialinit.html.twig" %}
<div class="main innerpage">
<div class="wrapper-center">
<div id="product-{{ object.id }}" class="productdetail">
<div class="recipe-header-breadcrumbs">
{{ sonata_block_render_event('breadcrumb', { 'context': 'content_view', 'category': category}) }}
</div>
<div class="productmain">
<div class="productimage">
<img class="main" alt="{{ object.imageMainLabel|raw }}" src="{{ movent_media_public_url(object.imageMain, 'image_395x527') }}" />
{% if object.productGallery and object.productGallery|length >= 1 %}
<div class="productThumbs">
<img alt="{{ object.imageMainLabel|raw }}" data-large="{{ movent_media_public_url(object.imageMain, 'image_395x527') }}" src="{{ movent_media_public_url(object.imageMain, 'image_113x151') }}" />
{% set gallery = object.productGallery %}
{% set index = 1 %}
{% for image in gallery.galleryHasMedias if index < 3 %}
<img alt="{{ object.imageMainLabel|raw }}" data-large="{{ movent_media_public_url(image.media, 'image_395x527') }}" src="{{ movent_media_public_url(image.media, 'image_113x151') }}" />
{% set index = index + 1 %}
{% endfor %}
</div>
{% endif %}
</div>
<div class="fleft-500px">
<div class="productinfo">
<h1>{{ object.title }}</h1>
{% if object.buyNowId is not null %}
<a data-sku-id="{{ object.buyNowId }}" class="productViewBuyNow buynow-btn"><span class="test">Beli Sekarang</span></a>
{% endif %}
{{ object.abstract }}
<div class="productBtnbox">
{% if object.imageNutritionFact %}
<a href="{% path object.imageNutritionFact, 'reference' %}" class="infomasi">Informasi gizi</a>
{% endif %}
</div>
</div>
{#<div class="resellerbox">
{% if object.productProductReseller|length %}
<h1>Reseller</h1>
<ul>
{% for reseller in object.productProductReseller %}
<li>
<!--<span class="resellerprice">Rp {{ priceFeed(reseller.priceFeed) }}</span>-->
<div class="resellerthumb">
<img src="{{ movent_media_public_url(reseller.image, 'image_115x115') }}" />
</div>
<div class="resellerinfo">
<h2>{{ reseller.name }}</h2>
<p>{{ reseller.description }}</p>
{% if reseller.isPromo %}
<a href="{{ reseller.url }}" target="_blank" class="belisekarangpromo"></a>
{% else %}
<a href="{{ reseller.url }}" target="_blank" class="belisekarang"></a>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
{% endif %}
</div>#}
</div>
{% if object.productRelatedProducts and object.productRelatedProducts|length %}
<div class="relatedProducts">
<h3>{{ "Produk Terkait"|trans }}</h3>
<div class="items">
{% for relatedProduct in object.productRelatedProducts %}
{% if loop.index <=2 %}
<div class="item" style="float:left;width: 200px;">
<div class="mov-related-products_image">
<img style="width:50%;" alt="{{ relatedProduct.relatedToProduct.imageMainLabel|raw }}" src="{{ movent_media_public_url(relatedProduct.relatedToProduct.imageMain, 'image_395x527') }}" />
</div>
<h4>{{ relatedProduct.relatedToProduct.title|raw|truncate(14, false, ' …') }}</h4>
<p>{{ relatedProduct.relatedToProduct.abstract|raw|truncate(80, true, ' …') }}</p>
<div class="relatedProduct_buttons">
<p><a href="{{ movent_content_path(relatedProduct.relatedToProduct, relatedProduct.relatedToProduct.canonicalCategory) }}" class="tab-link" style="background:red;">{{"Selengkapnya"|trans}}</a>
{% if relatedProduct.relatedToProduct.buyNowId is not null %}
<a data-sku-id="{{ relatedProduct.relatedToProduct.buyNowId }}" class="productViewBuyNow tab-link buy-now-button buynow-btn" style="background:red;"> {{"Beli Sekarang"|trans}}</a></p>
{% endif %}
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% if object.allowComment %}
<div class="fbcommentbox">
{% include "MoventContentBundle:Content/Layout/base:comment.html.twig" with {'width' : '857' } %}
</div>
{% endif %}
</div>
</div>
</div>
{% endblock content %}
{% block site_footer_scripts %}
{{ parent() }}
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
$(".infomasi").fancybox();
{#var buy_now = $(".productViewBuyNow");
var lightbox = null;
if (buy_now.length) {
lightbox = new fusepump.lightbox.buynow(buy_now.attr('data-buynow-id'));
buy_now.click(function(e) {
e.preventDefault();
lightbox.show();
});
}#}
$(".productThumbs img").click(function(){
$(".productThumbs img").removeClass("active");
$(this).addClass("active");
$(".productimage img.main").attr('src',$(this).data('large'));
});
});
//]]>
</script>
{% endblock %}
{% extends sonata_block.templates.block_base %}
{% block block %}
{% if related and related|length %}
<div class="prodsidebar mobile-sidebar">
<h3>Produk Terkait</h3>
<ul>
{% set counter = 0 %}
{% for relatedContent in related %}
{% if counter < settings.maxItem %}
{% if relatedContent and relatedContent.enabled and isProduct(relatedContent.associatedProduct) and relatedContent.associatedProduct.isActive() %}
{% set product = relatedContent.associatedProduct %}
{% set defaultCategory = product.getDefaultCategory() %}
{% if defaultCategory is not null %}
{% set url = movent_content_path(product, defaultCategory) %}
<li>
<div class="content-item-cat{{ defaultCategory.id }}">
<span class="is-loading">
<a href="{{ url }}">
<img alt="{{ product.imageMainLabel|raw }}" src="{{ movent_media_public_url(product.imageMain, 'image_113x151') }}" width="100" />
</a>
</span>
<p>
<a href="{{ url }}"><strong>{{ product.title }}</strong></a>
{{ product.abstract | truncate(50, true, ' […]') }}
<a href="{{ url }}" class="tab-link">Selengkapnya</a>
</p>
</div>
</li>
{% for productReseller in product.productProductReseller %}
{% set image_sidebar = movent_media_public_url(productReseller.image, 'reference') %}
{% set reseller_image_path = (image_sidebar is defined and image_sidebar is not empty ? image_sidebar : default_img_path) %}
<li>
<span class="is-loading">
<img alt="" src="{{ movent_media_public_url(productReseller.image, 'reference') }}" width="100" />
</span>
<div class="content-item-cat0">
<p class="sellername">
<strong>{{ productReseller.name }}</strong>
{{ productReseller.description | truncate(100, true, ' […]') }}
<b>{{ "Price: Rp %s"|format(productReseller.priceFeed) }}</b>
<a href="{{ productReseller.url }}" class="{{"%s"|format(productReseller.isPromo ? "belisekarangpromo" : "belisekarang")}}"></a>
</p>
</div>
</li>
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{% set counter = counter + 1 %}
{% endfor %}
</ul>
</div>
{% endif %}
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment