1

私は django-shop を使用していますが、必要がないため、配送をスキップする方法がわかりません。いくつかの方法を試しましたが、問題は見つかりませんでした。

誰かアイデアがありますか?

flate_rate の配送をコピーして自分でやろうとしましたが、逆一致がないという問題に直面しています。

ここに私のファイルがあります:

# -*- coding: utf-8 -*-
from decimal import Decimal
from django.conf.urls import patterns, url
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from shop.util.decorators import on_method, shop_login_required, order_required


class PostShipping(object):
"""
This is just an example of a possible flat-rate shipping module, that
charges a flat rate defined in settings.SHOP_SHIPPING_FLAT_RATE
"""
    url_namespace = 'post'
    backend_name = 'La Poste'
    backend_verbose_name = _('La Poste')

    def __init__(self, shop):
        self.shop = shop  # This is the shop reference, it allows this backend
        # to interact with it in a tidy way (look ma', no imports!)
        self.rate = 0

@on_method(shop_login_required)
@on_method(order_required)
def view_process_order(self, request):
    """
    A simple (not class-based) view to process an order.

    This will be called by the selection view (from the template) to do the
    actual processing of the order (the previous view displayed a summary).

    It calls shop.finished() to go to the next step in the checkout
    process.
    """
    self.shop.add_shipping_costs(self.shop.get_order(request),
                                 'la poste',
                                 Decimal(self.rate))
    return self.shop.finished(self.shop.get_order(request))
    # That's an HttpResponseRedirect

@on_method(shop_login_required)
@on_method(order_required)
def view_display_fees(self, request):
    """
    A simple, normal view that displays a template showing how much the
    shipping will be (it's an example, alright)
    """
    ctx = {}
    ctx.update({'shipping_costs': Decimal(self.rate)})
    return render_to_response('shop/shipping/flat_rate/display_fees.html',
        ctx, context_instance=RequestContext(request))

def get_urls(self):
    urlpatterns = patterns('',
        url(r'^$', self.view_display_fees, name='flat'),
        url(r'^process/$', self.view_process_order, name='flat_process'),
    )
    return urlpatterns
4

1 に答える 1

0

github リポジトリを一瞥すると、配送を無効にする設定がないようです。ただし、独自の配送バックエンドを定義してカスタマイズすることはできます (配送を静かに通過させます)。

デジタル製品を販売するだけの場合は、独自のコードを作成することをお勧めします。それほど難しくありません。

于 2013-04-16T08:48:15.550 に答える