Skip to main content

Product shop extension based on bda.plone.shop

Project description

https://travis-ci.org/bluedynamics/bda.plone.productshop.svg?branch=master https://coveralls.io/repos/bluedynamics/bda.plone.productshop/badge.png

Product shop extension for bda.plone.shop.

Overview

This package contains dexterity content types and the corresponding views for building a typical product shop.

A brief description about the contained types

Product

A product which can be added to folders. A product consists of default metadata, an image, a detailed description, a datasheet and related items.

Product Group

A product group is a collection of product like objects with several aspects applied to it. The contained items are of type Variant. Further a product group provides the same fields as a Product. The default variant aspects for newly created variants inside this product group can be defined on the product group.

Variant

A Variant is a Product with several aspects applied to it, like weight, size, etc. and is contained in a Product Group. The different aspects can be enabled and disabled explicitly after creation via object actions. The default aspects enabled are read from parent product group

A brief description about the contained views

product tiles

The product tiles view can be applied on site root and folders. The view displays a grid of tiles built of contained folders and buyable items. If tile context is a folder, title and description are taken from the folder, and the preview image is taken randomly from a contained buyable item. If tile context is a buyable item, title, description and preview image are taken from it and on mouse over buyable controls are rendered in an overlay for this item. The number of grid columns rendered can be defined globally in control panel, or, if IProductTilesViewSettingsBehavior is applied on folders directly (plone.app.contenttypes only, Archetypes folders are not suppoerted).

product listing

The product listing can be applied on folders and on product groups. When applied on folder it lists the first level of the contained products and product groups. When applied on a product group it lists the contained variants and a filter at the top to restrict listing by variant aspects.

product view

The product view can be applied on products, product groups an variants. When applied on products, it displays the product data and the buyable controls provided by bda.plone.shop. When applied on a variant, additionally the aspect filter gets shown which can be used for instant navigation between available variants in containing product group. When applied on a product group the first contained variant gets displayed as descibed above.

Installation

Install standalone

Install system dependencies:

sudo apt-get install python-virtualenv

Install Instance:

virtualenv --no-site-packages vpython
./vpython/bin/python bootstrap.py
./bin/buildout

Install as product

Add bda.plone.productshop to the instance eggs in buildout.cfg or depend your integration package to it.

Install as addon in plone control panel or via generic setup dependency in your integration package.

Provide additional variant aspects

If desired variant aspect is generic, fork this project from https://github.com/bluedynamics/bda.plone.productshop, add it directly there and create a pull request.

Following steps are necessary to add a variant aspect

Create a variant behavior like the ones in bda.plone.productshop.behaviors:

@provider(IFormFieldProvider)
class IDemandBehavior(IVariantAspect):
    """Demand variant behavior.
    """
    model.fieldset(
        'aspects',
        label=_(u'aspects', default=u'Aspects'),
        fields=['demand'])
    demand = schema.TextLine(
        title=_(u'demand_title', default=u'Demand'),
        description=_(u'demand_description',
                      default=u'Demand of the product'),
        required=False)
Note: Aspect field type must always be a text line to work correctly with

the filter views.

Register this behavior via ZCML:

<plone:behavior
  title="Demand"
  description="Extend content with product demand."
  provides=".behaviors.IDemandBehavior"
  for="collective.instancebehavior.IInstanceBehaviorAssignableContent" />

Create an indexer for the aspect field like the ones in bda.plone.productshop.indexer:

@indexer(IDemandBehavior)
def demand_aspect(obj):
    return obj.demand
Note: Index name must be postfixed with _aspect all over the place.

this way we hopefully avoid naming collisions.

Register the indexer via ZCML:

<adapter name="demand_aspect" factory=".indexer.demand_aspect" />

Create the index at install time via generic setup profile. Add to catalog.xml:

<index name="demand_aspect" meta_type="FieldIndex">
  <indexed_attr value="demand_aspect" />
</index>

Create the object action for the aspect that it can be enabled ttw like the ones in bda.plone.productshop.browser.actions:

class DemandAction(VariantAspectAction):
    aspect_title = _(u'aspect_demand', default=u'Demand')
    aspect_behavior = 'bda.plone.productshop.behaviors.IDemandBehavior'
    aspect_schema = IDemandBehavior

Configure necessary action views:

<!-- demand -->
<browser:page
  name="enable_demand"
  attribute="enable_aspect"
  for="..interfaces.IVariant"
  class=".actions.DemandAction"
  permission="cmf.ModifyPortalContent"
  layer="..interfaces.IProductShopExtensionLayer" />

<browser:page
  name="disable_demand"
  attribute="disable_aspect"
  for="..interfaces.IVariant"
  class=".actions.DemandAction"
  permission="cmf.ModifyPortalContent"
  layer="..interfaces.IProductShopExtensionLayer" />

<browser:page
  name="can_enable_demand"
  attribute="can_enable"
  for="*"
  class=".actions.DemandAction"
  permission="cmf.ModifyPortalContent"
  layer="..interfaces.IProductShopExtensionLayer" />

<browser:page
  name="can_disable_demand"
  attribute="can_disable"
  for="*"
  class=".actions.DemandAction"
  permission="cmf.ModifyPortalContent"
  layer="..interfaces.IProductShopExtensionLayer" />

Create the corresponding object actions at install time via generic setup profile. Add to actions.xml:

<!-- demand -->
<object name="enable_demand"
        meta_type="CMF Action"
        i18n:domain="bda.plone.productshop">
  <property name="title" i18n:translate="">
      Add demand
  </property>
  <property name="description" i18n:translate="">
      Add demand to product variant
  </property>
  <property name="url_expr">
      string:${object/absolute_url}/@@enable_demand
  </property>
  <property name="icon_expr"></property>
  <property name="available_expr">
      object/@@can_enable_demand
  </property>
  <property name="permissions">
      <element value="Modify portal content" />
  </property>
  <property name="visible">True</property>
</object>

<object name="disable_demand"
        meta_type="CMF Action"
        i18n:domain="bda.plone.productshop">
  <property name="title" i18n:translate="">
      Remove demand
  </property>
  <property name="description" i18n:translate="">
      Remove demand from product variant
  </property>
  <property name="url_expr">
      string:${object/absolute_url}/@@disable_demand
  </property>
  <property name="icon_expr"></property>
  <property name="available_expr">
      object/@@can_disable_demand
  </property>
  <property name="permissions">
      <element value="Modify portal content" />
  </property>
  <property name="visible">True</property>
</object>

TODO

  • Define which richtext fields of a product gets rendered as tabs in product view.

  • Create control panel. This should contain global configuration which variant aspects are available in the instance.

Contributors

  • Robert Niederreiter (Autor)

  • Espen Moe-Nilssen

  • Peter Holzer

Dummy product image from

Changes

1.0b1 (2024-04-22)

  • Plone 6 compatibility. [petschki, agitator]

  • Fix problem with AvailableVariantAspectsVocabulary not repescting named behaviors. [jensens]

  • Fix some namings and DE translation. [jensens]

  • Edit icon in and edit on overlay in listing. [jensens]

  • Remove dummy image from product view, only show image if uploaded. [jensens]

  • Basic responsive tiles view using bootstrap classes [jensens]

  • Show empty Folders oder Folders without image in tiles listing [jensens]

  • Fix depreaction warnings in behaviors [jensens]

  • Fix Problem with Python 3 division (float instead of int) [jensens]

  • Remove binding to CMFDefault skin in ZCML [jensens]

  • fix condition for details richtext [petschki]

  • Added italian translations [ale-rt]

0.8

  • Add ajax overlay with large product image in product view when clicking on thumb. [rnix]

  • Improve tiles view. [rnix]

0.7

  • Display invalid aspects message in red. [rnix]

  • Check for ILeadImage on folder instead of whether image attributes exists in ProductTiles.query_tile_items. [rnix]

  • Add Generic Setup viewlets.xml file and hide plone.belowcontentbody.relateditems by default. [rnix]

0.6

  • Format actions.xml to make action translations work properly. GS Profile application required. [rnix]

  • Remove item_number from bda.plone.productshop.behaviors.IProductBehavior. It’s provided by bda.plone.shop.dx.ITradingBehavior now for products and variants, and productgroups do not rely on this information at all. [rnix]

  • Apply bda.plone.shop.dx.ITradingBehavior behavior to product and variant content types. [rnix]

  • Display link to manual download in product view description tab if present. [rnix]

  • Also hide buyable controls overlay if mouse cursor enters empty placeholder column. [rnix]

  • Consider view buyable information permission in product tiles. [rnix]

  • Consider image field on folder if present in product tiles view. [rnix]

  • Add bda.plone.productshop.behavior.IProductManualBehavior and apply it to product and variant content types. [rnix]

  • Add bda.plone.shop.dx.IBuyablePeriodBehavior to product and variant content types. [rnix]

  • Rename shopviews.css to productshop.css. Re-applying GS profile required. [rnix]

  • Fix product tiles view, overlay buyable controls are shown only if tile item represents buyable item directly. [rnix]

0.5

  • Display buyable controls as overlay on mouse over on product tiles if displayed item in tile is buyable. [rnix]

  • Add IProductShopSettings and IProductTilesViewSettingsBehavior, both providing product_tiles_view_columns and product_tiles_view_image_scale properties, used in ProductTiles view. [rnix]

0.4

  • Add product tiles view for plone site and folders. [rnix]

  • Enable discount settings on productgroup. [rnix]

  • Absolute imports. [rnix]

  • Add IMaterialBehavior variant aspect. [rnix]

  • Apply notification text behaviors to product shop types. [rnix]

0.3

  • Product listing is now batched. [rnix]

  • Add IAngleBehavior variant aspect. [rnix]

  • Add IIPCodeBehavior variant aspect. [rnix]

  • Handle query criteria as unicode to avoid UnicodeDecodeError. [rnix]

  • Add IShippingBehavior to product and variant types. [rnix]

  • Add item number to IProduct. [rnix]

  • Add variant aspects ILengthBehavior, IWidthBehavior and IHeightBehavior. [rnix]

0.2

  • Productgroup can define default variant aspects. [rnix]

  • Add german translation. [rnix]

  • Introduce IProductExcludeFromNavigation. [rnix]

  • Rename package to bda.plone.productshop. [rnix]

  • Add content types product, productgroup, variant. [rnix]

  • Reduce available views. [rnix]

0.1

  • Initial work. [espenmn]

License

Copyright (c) 2013-2024, Espen Moe-Nilssen, BlueDynamics Alliance All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the BlueDynamics Alliance nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY BlueDynamics Alliance AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BlueDynamics Alliance BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bda.plone.productshop-1.0b1.tar.gz (93.3 kB view details)

Uploaded Source

Built Distribution

bda.plone.productshop-1.0b1-py3-none-any.whl (110.1 kB view details)

Uploaded Python 3

File details

Details for the file bda.plone.productshop-1.0b1.tar.gz.

File metadata

  • Download URL: bda.plone.productshop-1.0b1.tar.gz
  • Upload date:
  • Size: 93.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.2

File hashes

Hashes for bda.plone.productshop-1.0b1.tar.gz
Algorithm Hash digest
SHA256 b58375fd9129c39a33ac037988627fa2fba93648d53a759a9807b3bbbf5c8e66
MD5 d734913d9cc9405cebb07f3db75888a8
BLAKE2b-256 06911aabc8269f5358d840d0008e9854bca65fd9518abeb56a0c2a4b85bb1ef8

See more details on using hashes here.

File details

Details for the file bda.plone.productshop-1.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for bda.plone.productshop-1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 287f233a261b4cad7231d861fd400680bb4b99ab124d6a7aa35b7338c87b0cfc
MD5 731ca2bdeefbe7e49bf504805e44b705
BLAKE2b-256 1a844af7182e197e18d39219bcf1ae16752bd9850b629657437bbc938232d1fa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page