Skip to content
Browse files

updates

  • Loading branch information...
1 parent 44c2109 commit 95caa9027a15669b49ae899f68872b5498e37755 Zenobius Jiricek committed Jan 23, 2012
View
7 cmsplugin_configurableproduct/cms_plugins.py
@@ -37,14 +37,15 @@ def render(self, context, instance, placeholder):
types = ProductType.objects.all()
+ chosen_categories = instance.categories.all()
+ if chosen_categories :
+ types = chosen_categories
+
if instance.hide_empty_categories :
objects = Product.objects.filter(active=True)
used_types = objects.values("type").distinct()
types = types.filter(pk__in = used_types)
-# chosen_categories = instance.categories.all()
-# if chosen_categories.count() > 0:
-# types.filter(pk__in = instance.categories.values('id'))
context.update({
'Types': types,
View
8 cmsplugin_configurableproduct/models.py
@@ -12,8 +12,7 @@
from .lib.choices import (
DynamicTemplateChoices,
- DynamicChoice,
- )
+ DynamicChoice, )
STATIC_URL = getattr(settings, "STATIC_URL", '/static')
STATIC_ROOT = getattr(settings, "STATIC_ROOT", None)
@@ -30,12 +29,13 @@ class ApplicationSettings(AppConf):
PRODUCT_CONTAINER_TEMPLATES = os.path.join(TEMPLATE_BASE_PATH, "product-list", 'containers')
PRODUCT_ITEM_TEMPLATES = os.path.join(TEMPLATE_BASE_PATH, "product-list", 'items')
- DEFAULT_CATEGORY_IMAGE_URL = '{0}/defaults/img/product-category'.format(STATIC_URL)
- DEFAULT_CATEGORY_IMAGE_ROOT = '{0}/defaults/img/product-category'.format(STATIC_ROOT)
+ DEFAULT_CATEGORY_IMAGE_URL = os.path.join(STATIC_URL, 'defaults', 'img',
+ 'product-category', 'missing-icon-{0}.png')
CATEGORY_IMAGE_URL = '{0}/product-category'.format(MEDIA_URL)
CATEGORY_IMAGE_ROOT = '{0}/product-category'.format(MEDIA_ROOT)
+
class ProductTypeIcon(models.Model):
upload_path = lambda instance, filename: "files/product-category/{0}".format(
"{0}-{1}".format(slugify(instance.product_type), filename) )
View
3 cmsplugin_configurableproduct/templatetags/cmsplugin_configurableproduct_tags.py
@@ -35,7 +35,6 @@ def render_tag(self, context, product_type, tag):
try:
icon= product_type.icons.get(name = tag)
return settings.MEDIA_URL+str(icon.image)
-# return "/".join((ApplicationSettings.CATEGORY_IMAGE_URL, icon.image))
except Exception, error:
- return ApplicationSettings.DEFAULT_CATEGORY_IMAGE_URL
+ return ApplicationSettings.DEFAULT_CATEGORY_IMAGE_URL.format(tag.lower())

0 comments on commit 95caa90

Please sign in to comment.
Something went wrong with that request. Please try again.