Metadata-Version: 2.1
Name: bda.plone.productshop
Version: 1.0b1
Summary: Product shop extension based on bda.plone.shop
Home-page: https://github.com/bluedynamics/bda.plone.productshop
Author: Bluedynamics Alliance
Author-email: dev@bluedynamics.com
License: GPL version 2
Project-URL: PyPI, https://pypi.python.org/pypi/bda.plone.productshop
Project-URL: Source, https://github.com/bluedynamics/bda.plone.productshop
Project-URL: Tracker, https://github.com/bluedynamics/bda.plone.productshop/issues
Keywords: Python Plone e-commerce
Classifier: Framework :: Plone
Classifier: Framework :: Plone :: 6.0
Classifier: Framework :: Plone :: Addon
Classifier: Framework :: Zope
Classifier: Framework :: Zope :: 5
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
License-File: LICENSE.rst
License-File: LICENSE_GPL.rst
Requires-Dist: setuptools
Requires-Dist: Products.CMFPlone>=6.0.0
Requires-Dist: bda.plone.shop
Requires-Dist: collective.instancebehavior
Provides-Extra: test
Requires-Dist: plone.app.testing; extra == "test"
Requires-Dist: plone.app.robotframework[debug]; extra == "test"

=====================
bda.plone.productshop
=====================

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

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
========================

- http://thelittlereaper.deviantart.com/art/Test-Crash-Dummy-169618976


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.
