BG Development


  Reply to this topicStart new topicStart Poll

> Django-ocsar Templates
dedal
: 27-07-2020, 15:27
Quote Post



:
:
:

: 138
: 17.11.10



.
django oscar
.


templates/gallery.py
CODE

{% load thumbnail %}
{% load i18n %}
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'css/my.css' %}" />
<script src="{% static 'js/my.js' %}"></script>

{% with all_images=product.get_all_images %}
{# use length rather then count as the images get queried anyways #}

{% if all_images|length > 1 %}

<div id="product_gallery" class="carousel slide">

<div class="thumbnail">
<div class="carousel-inner" role="listbox">
{% for image in all_images|slice:":1" %}
<div class="item {% if forloop.first %}active{% endif %}">
{% thumbnail image.original "440x400" upscale=False as thumb %}
<img src="{{ thumb.url }}" style="width:100%" />
{% endthumbnail %}
</div>
{% endfor %}
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>

<div class="carousel-indicators thumbnail">
{% for image in all_images %}
<!-- <div class="column">-->
{% thumbnail image.original "65x55" crop="center" as thumb %}
<img src="{{ thumb.url }}" alt="{{ product.get_title }}" class="demo cursor" onclick="currentSlide(1)" style="width:20%"/>
{% endthumbnail %}
<!-- </div>-->
{% endfor %}
</div>
</div>

{% else %}

{# Only one image to show #}
<div id="product_gallery" class="carousel">
<div class="thumbnail">
<div class="carousel-inner">
<div class="item active">
{% with image=product.primary_image %}
{% thumbnail image.original "440x400" upscale=False as thumb %}
<img src="{{ thumb.url }}" alt="{{ product.get_title }}" />
{% endthumbnail %}
{% endwith %}
</div>
</div>
</div>
</div>

{% endif %}
{% endwith %}


js/my.js
CODE

var slideIndex = 1;
showSlides(slideIndex);

// Next/previous controls
function plusSlides(n) {
showSlides(slideIndex += n);
}

// Thumbnail image controls
function currentSlide(n) {
showSlides(slideIndex = n);
}

function showSlides(n) {
var i;
var slides = document.getElementsByClassName("carousel-inner");
var dots = document.getElementsByClassName("demo");
var captionText = document.getElementById("caption");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
captionText.innerHTML = dots[slideIndex-1].alt;
}


dedal 27-07-2020, 15:29
PMEmail Poster
Top
bvbfan
: 27-07-2020, 15:50
Quote Post



:
:
:

: 3919
: 08.12.13



"", icon_smile.gif

CODE
if (n >= slides.length) {slideIndex = 0}
if (n < 1) {slideIndex = slides.length - 1}
for (i = 0; i < slides.length; i++) {
  if (i != slideIndex)
      slides[i].style.display = "none";
}


--------------------
QUOTE (Bender @ 23-04-2015, 19:11)
Xamarin: !
: ...
PMEmail Poster
Top
dedal
: 27-07-2020, 15:57
Quote Post



:
:
:

: 138
: 17.11.10



QUOTE (bvbfan @ 27-07-2020, 15:50)
"", icon_smile.gif

CODE
if (n >= slides.length) {slideIndex = 0}
if (n < 1) {slideIndex = slides.length - 1}
for (i = 0; i < slides.length; i++) {
if (i != slideIndex)
slides[i].style.display = "none";
}

.
backend.
icon_smile.gif
PMEmail Poster
Top
bvbfan
: 27-07-2020, 16:33
Quote Post



:
:
:

: 3919
: 08.12.13



-. , . JS , , none , . , 3 , - .


--------------------
QUOTE (Bender @ 23-04-2015, 19:11)
Xamarin: !
: ...
PMEmail Poster
Top
dedal
: 27-07-2020, 17:28
Quote Post



:
:
:

: 138
: 17.11.10



. ( ) .
javascript, oskar .


dedal 27-07-2020, 17:29
PMEmail Poster
Top
dedal
: 27-07-2020, 17:41
Quote Post



:
:
:

: 138
: 17.11.10



. shipping.
, .
.
100100100 .


shipping/methods.py

CODE

from oscar.core.loading import get_class
from django.utils.translation import ugettext_lazy as _
D = get_class('shipping.methods', 'D')
NoShippingRequired = get_class('shipping.methods', 'NoShippingRequired')

class HandDelivery(NoShippingRequired):
   code = "hand-delivery"
   name = " "
   charge_excl_tax = D('00.00')
   charge_incl_tax = D('0.00')


shipping/repository.py

CODE

from oscar.core.loading import get_class
from .methods import HandDelivery, Adress
from oscar.apps.shipping.models import WeightBased

Repository = get_class('shipping.repository', 'Repository')
WeightBased = get_class('oscar.apps.shipping.models', 'WeightBased')

class Repository(Repository):
   methods = [HandDelivery()]
   def get_available_shipping_methods(
           self, basket, user=None, shipping_addr=None,
           request=None, **kwargs):
       if shipping_addr:
           weightbased_set = WeightBased.objects.all().filter(countries=shipping_addr.country.code)

           if weightbased_set:
               methods = (list(weightbased_set))
               methods += [HandDelivery()]
           else:
             methods = []
       else:
           methods = [HandDelivery()]

       return methods

PMEmail Poster
Top
dedal
: 27-07-2020, 18:08
Quote Post



:
:
:

: 138
: 17.11.10



.
js
templates
defolt

CODE

{% load thumbnail %}
{% load i18n %}
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'eggs/css/my.css' %}" />
<script src="{% static 'eggs/js/my.js' %}"></script>

{% with all_images=product.get_all_images %}
{# use length rather then count as the images get queried anyways #}

{% if all_images|length > 1 %}

<div id="product_gallery" class="carousel slide">

<div class="thumbnail">
<div class="carousel-inner" role="listbox">
{% for image in all_images %}
<div class="item {% if forloop.first %}active{% endif %} ">
{% thumbnail image.original "440x400" upscale=False as thumb %}
<img src="{{ thumb.url }}" class="mySlides" style="width:100%" /> # class="mySlides"
{% endthumbnail %}
</div>
{% endfor %}
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>

<div class="carousel-indicators thumbnail">

{% for image in all_images %}
<!-- <div class="column">-->
{% thumbnail image.original "65x55" crop="center" as thumb %}
<img src="{{ thumb.url }}" alt="{{ product.get_title }}" class="demo cursor" onclick="currentSlide(1)" style="width:20%"/>
{% endthumbnail %}
<!-- </div>-->
{% endfor %}
</div>
</div>

{% else %}

{# Only one image to show #}
<div id="product_gallery" class="carousel">
<div class="thumbnail">
<div class="carousel-inner">
<div class="item active">
{% with image=product.primary_image %}
{% thumbnail image.original "440x400" upscale=False as thumb %}
<img src="{{ thumb.url }}" alt="{{ product.get_title }}" />
{% endthumbnail %}
{% endwith %}
</div>
</div>
</div>
</div>

{% endif %}
{% endwith %}


dedal 27-07-2020, 18:10
PMEmail Poster
Top
dedal
: 27-07-2020, 18:50
Quote Post



:
:
:

: 138
: 17.11.10



QUOTE (dedal @ 27-07-2020, 18:08)
.
js
templates
defolt

CODE

{% load thumbnail %}
{% load i18n %}
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'eggs/css/my.css' %}" />
<script src="{% static 'eggs/js/my.js' %}"></script>

{% with all_images=product.get_all_images %}
{# use length rather then count as the images get queried anyways #}

{% if all_images|length > 1 %}

<div id="product_gallery" class="carousel slide">

<div class="thumbnail">
<div class="carousel-inner" role="listbox">
{% for image in all_images %}
<div class="item {% if forloop.first %}active{% endif %} ">
{% thumbnail image.original "440x400" upscale=False as thumb %}
<img src="{{ thumb.url }}" class="mySlides" style="width:100%" /> # class="mySlides"
{% endthumbnail %}
</div>
{% endfor %}
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>

<div class="carousel-indicators thumbnail">

{% for image in all_images %}
<!-- <div class="column">-->
{% thumbnail image.original "65x55" crop="center" as thumb %}
<img src="{{ thumb.url }}" alt="{{ product.get_title }}" class="demo cursor" onclick="currentSlide(1)" style="width:20%"/>
{% endthumbnail %}
<!-- </div>-->
{% endfor %}
</div>
</div>

{% else %}

{# Only one image to show #}
<div id="product_gallery" class="carousel">
<div class="thumbnail">
<div class="carousel-inner">
<div class="item active">
{% with image=product.primary_image %}
{% thumbnail image.original "440x400" upscale=False as thumb %}
<img src="{{ thumb.url }}" alt="{{ product.get_title }}" />
{% endthumbnail %}
{% endwith %}
</div>
</div>
</div>
</div>

{% endif %}
{% endwith %}

. js
CODE

<img src="{{ thumb.url }}" alt="{{ product.get_title }}" class="demo cursor" onclick="currentSlide(1)" style="width:20%"/>



CODE

<img src="{{ thumb.url }}" alt="{{ product.get_title }}" class="demo cursor" onclick="currentSlide({{ forloop.counter }})" style="width:20%"/>
PMEmail Poster
Top
dedal
: 27-07-2020, 18:56
Quote Post



:
:
:

: 138
: 17.11.10



css ???
css javascript
.
CODE

.mySlides {
display: none;
}


dedal 27-07-2020, 18:57
PMEmail Poster
Top
1 (1 , 0 )
, :

Topic Options Reply to this topicStart new topicStart Poll

 


Copyright © 2003-2019 | BG Development | All Rights Reserved
RSS 2.0