The following snippet shows how to set the needed TypoScript parameter by mostly
reusing the parameter that already were set as TypoScript constants format
EXT:cart.
e.g. EXT:sitepackage/Configuration/TypoScript/setup.typoscript
Display the language of the product which is currently edited.
Type
Products can have 4 different types:
Type
Description
simple
The default value, no special meaning.
configurable
Allows to create BE variants for the product.
virtual
Shipping costs in EXT:cart can be configured to not be calculated for virtual products, e.g. with plugin.tx_cart.shipping.countries.de.options.1.extra = by_number_of_physical_products. Individual handling for other use cases can be implemented by listening to Events during the order process.
downloadable
Same behaviour as above described in 'virtual'. There is no implemented process for this type as the process can be highly individual: Show a download link on the 'Thank you' page or in an email. Another process could be to provide a link for logged-in FE users in their user account. Another implementation could need a watersign process which individualizes a PDF. Such processes can be implemented by listening to Events during the order process.
SKU (Stock Keeping Unit)
The product identifier, when using Variants the resulting identifier will be
this base with trailed SKUs of the chosen variants.
Title
Title of the product
URL segment
The url segment which is used in the URL when RouteEnhancers are defined.
Description
Teaser
A shorter description of the product. By default this will be displayed on the
detail page below the title. In individualized implementations it could be shown
in the list view or in the search results when using a page search.
Description
A longer description of the product. This is limited to text, for further
options the below descriped 'Content' can be used.
Content
Allows to add further descriptions with any available content record ('CType').
This makes it possible to add content like it's possible on usual pages in the
backend. Longer descriptions with e.g. images and videos are possible with this
feature.
Images / Files
Images
Add images to the product which will be displayed in detail view and list view.
Files
Add files to the product. The default implementation does not render the files.
To display for example download links it would be an idea to overwrite
/Resources/Private/Template/Product/Show.html.
Prices
Minimum numbers of product items per order
Defines the minimal number that needs to be in the cart to buy this product.
It is possible to add less articles into the cart but a warning message will
be displayed in the cart itself and it's not possible to finish the order.
Note
A change of this field will not be applied to existing cart sessions. To make
it work existing cart session need be deleted.
Maximum numbers of product items per order
Defines the maximal number that are allowed to be in the cart to buy this
product.
It is possible to add more articles into the cart but a warning message will
be displayed in the cart itself and it's not possible to finish the order.
Note
A change of this field will not be applied to existing cart sessions. To make
it work existing cart session need be deleted.
Is Net Price
Decides whether the price entered in the backend is net or gross.
Price
The price of the product. When using BE variants this price will be part of the
price calculation or might be ignored at all.
Tax class
The tax class of the product. Tax classes are defined in EXT:cart.
Special Prices
Allows to add prices for logged-in FE users. This can also be limited to FE user
with a certain user group which allows to offer different prices depending on
the user group.
If multiple special prices exist the best special price will be applied.
When using BE variants this field will be ignored as the special price needs to
be defined for every single BE variant.
Quantity discount
Allows to offer better prices when the amount of products in the cart exceeds
a certain limit.
Note
This does at the moment not work for products with BE variants.
Measures
Concept of Measures
When selling products in different quantities (e.g. 0.5 kg, 1 kg, 5 kg) it can
be a legal demand to indicate the base price to make it possible for customers
to compare the different quantities ('value-for-money ratio').
The three fields in this group are used together. The following example shows
the usage. To stay with the example from
above you might enter:
Price = 10 € (defined in the tab Prices).
Price Measure = 200
Price Measure Unit = g
Base Price Measure Unit = kg
Which will result in 50 €/kg.
Note
For products with BE variants these values have to be entered for every
BE variant.
The default output is minimalistic and needs adaption to be really useful.
Concept of Service Attributes
Entering something in the service attribute fields does not have any effect by
default. These fields provide a base to implement individual functionality. An
example might be the best way to show the potential:
Example 'Output weight and dimensions'
Simply display the weight and the dimensions of the product in the frontend.
Use field Service Attribute 1 and overwrite its label with
'Weight'.
Use field Service Attribute 2 and overwrite its label with
'Dimensions'
Suppress the output of Service Attribute 2 to not confuse
editors.
Output the weight and dimensions in the detail view
(/Resources/Private/Templates/Product/Show.html) with
{product.serviceAttribute1} and {product.serviceAttribute2}.
Example 'Shipping costs depending on total weight of order'
The shipping costs shall depend on the weight of the sum of all products in the
order.
Use field Service Attribute 1 and overwrite its label with
'Weight'.
Suppress the output of the other two fields to not confuse editors.
Set in TypoScript (here for Germany (de))
plugin.tx_cart.shipping.countries.de.options.1.extra = by_service_attribute_1_sum
Set the child values (see EXT:cart documentation, section 'Flexible prices for
shipping').
More advanced scenarios are possible by adding an own ServiceInterface (see
EXT:cart documentation, section 'Flexible prices for shipping').
Stock
Stock Handling
Stock handling allows to limit the available amount of products. Customers can
not buy more products than the available amount.
Stock Handling in variants
When a product uses BE variants it is possible to activate "Stock handling in
variants". In this case it is needed to set the available amount for every BE
variant that exists for the product.
Variants
Cart comes with two types of variants for products: Frontend Variants and
Backend Variants.
Difference between Frontend Variants and Backend Variants
Backend Variants can influence the price of a product while
Frontend Variants foremost are used to get additional data from the customer.
The following example uses a T-shirt asBE variant product to illustrates the
difference of both variants.
Frontend Variant
The customer is able to enter a text which will be printed on the T-shirt.
Therefore the product has an input field.
This does not influence the price of the product but just enables the
customer to add additional information.
Backend Variant
The shop owner sells the T-Shirt in different sizes S, M, L.
The available options are stored as BE variants in the product with
different prices.
The customer can choose one of the options from a select list.
The choice of the customer changes the price of the T-Shirt.
Create Backend Variants
Note
Not all fields that can be filled in the backend during the following steps
are shown in the frontend with the default templates. To show them you need
to add custom templates.
It requires multiple steps to create Backend Variants. Which can be quite
overwhelming at the beginning offers maximum flexibility and is logical once
you get used to it.
Create a Backend Variant Attribute
A Backend Variant Attribute determines the type of variant.
An example is Size for a T-shirt.
The record for a Backend Variant Attribute is created directly within a
TYPO3 page.
Note
Backend Variants need to be placed on the same page as the product itself.
Create Backend Variant Attribute Options
A Backend Variant Attribute Options is one certain instance of a
Backend Variant Attribute which will be an option for the customer.
An example is XXL as Size of a T-shirt.
Such an attribute is created within a Backend Variant Attribute.
Set Backend Variant Attributes within Product
The above defined Backend Variants Attribute is chosen within the product
in the Tab "Variants".
It is possible to define up to 3 different Backend Variants Attributes
within a product, e.g. size, color and cut. The available combinations
are defined in the next step.
Create final Backend Variants within Product
Create a new Backend Variant.
A single Backend Variant select for every above defined a
Backend Variant Attribute an Backend Variant Attribute Option
(as defined in step 2).
Set further values for the variant
Set which price this variant shall have (as described below), additionally it
is possible to set stock and price measures.
Price calculation for Backend Variants
The price calculation for a Backend Variant can be set with multiple options:
Selection
Description
1: Product Price
Use price of product itself.
2: Variant Price
Use price of variant itself.
3: Product Price - Variant Price
Subtract variant price from product price.
4: Product Price - (Variant Price %)
Subtract variant as percentual amount of product price.
5: Product Price + Variant Price
Add variant price from product price.
6: Product Price + (Variant Price %)
Add variant as percentual amount of product price.
Create Frontend Variants
A Frontend Variant is created directly within the product in the tab Variants.
Related products
Allows to add relations to other products. Those products will be listed in the
detail view. This feature allows to propose other related products to customers
which can e.g. be worth to buy as well or as alternative to the current product.
The default implementation is quite minimal and could in an own implementation
be enriched with a preview image and the teaser text.
Tags and Categories
Tag
Add one or multiple tags to the product. By default the tag will simply be
rendered in the detail view. Page with a page search (e.g. solr) could use tags
as filter.
Main Category
Within a category it is possible to define the list view PID and detail view PID
for products which have this category.
This is the category which determines which page the product uses as detail view
if the teaser plugin is set and when the detail view PID was set within the
category.
Furthermore it is possible to define one or more categories in the list view
plugin of EXT:cart_products so that only products with this/these categories are
shown.
Associated Categories
This field can be used if a product shall be shown in multiple list view.
Access
Default TYPO3 access fields which allow to control the visibility and publishing
dates.
Plugins
Plugin "Cart: Products"
This plugin shows a list of products and / or the detail view of product.
Usage:
You MUST add a Record Storage Page.
You CAN add categories to only show products of one or multiple specific categories which are on the chosen record storage page.
When using another detail page you MUST set a Product Detail Page.
Plugin "Cart: selected Products" (also known as Teaser plugin)
This plugin shows specific products which are chosen by the editor in the Backend.
You do not need to set a detail page if every product has a category and you set
a detail page for every category.
You can set detail view for a category by opening the edit view of a system
category and then
Options → Cart: Page for the detail view of Products of this category.
For Developers
Information for developer how to extend the extension.
Triggered when the customer adds a product to the cart. It is already
heavily used by the extension itself. The ProductProduct is the object
of EXT:cart_products while CartProduct is an object of EXT:cart. The
already registered EventListener care about transferring the needed
information from ProductProduct to CartProduct. A custom EventListener
can e.g. add further information.
Allow customers to add a product to their cart directly within the list
view.
Images of products in cart product list
Usually the cart of online shops shows a small image in the product list.
EXT:cart does this not by default because the use cases for the extension can be
quite diverse and a standard might not fit everyone.
It's easy to implement this functionality with an EventListener and a customized
partial.
Integration
The following snippets show an example where the first image of a product is
used:
The TCA configuration for path_segment sets eval = uniqueInSite.
On a TYPO3 setup with multiple sites (= multiple roots) every site can have
its own product with the same path segment. This means all sites can have
an individual product with the path segment t-shirt.
Due to this setting it is not possible to share products between multiple
sites. To achieve this you need to set
When using multiple backend variants (for a t-shirt: size and color) the default
output in the frontend is not really user friendly because all available
combinations are rendered in a single selector field as shown in the following
image:
Default: Single selector for all available combinations.
By including some JavaScript that comes with EXT:cart_product you can enable
a more user-friendly version where every BackendVariant has its own selector
field. The JavaScript ensures that only available combinations can be chosen
by the customer.
Adapted: Every BackendVariant has its own selector field.
Note
At the moment it only works for two BackendVariants, not with three!
Integration
Create in your extension (e.g. your EXT:sitepackage) an overwrite of
EXT:cart_products/Resources/Private/Partials/Products/CartForm.html.
In some cases you don't need a detail page for the products and want to allow
adding products to the shopping cart within the list view.
Integration
Create in your extension (e.g. your EXT:sitepackage) an overwrite of
EXT:cart_products/Resources/Private/Partials/Products/List/Grid.html or
EXT:cart_products/Resources/Private/Partials/Products/List/Table.html.
After the release of the werkraummedia/watchlist extension for TYPO3 v13 the
WatchlistItemHandler for extcode/cart-products can be added again.
This allows products to be added to the watchlist.
If you have a long list of products, you would like to display them in a pagination
with a defined number of products per page. This is already possible with the
TypoScript configuration itemsPerPage. With a large number of products, the
display of all page links may not work well, especially when it comes to the
display on mobile devices.
The TYPO3 core offers the SlidingWindowPagination since TYPO3 v12.
This is compatible with the previously used SimplePagination if you pass the
value 0 for the number of links.
Integration
Set the new TypoScript configuration variable plugin.tx_cartproducts.maximumNumberOfLinks to a value greater than 0.
If you use an own template file for Resources/Private/Partials/Utility/Paginator.html you have to adapt the changes
to your file.
EXT:cart v9 uses modularized JavaScript without jQuery (see
[TASK] Switch from jQuery to vanilla JavaScript #438 <https://github.com/extcode/cart/pull/438>).
This allows to add the JavaScript only on pages where it's really needed which
is good for performance. The JavaScript is for detail pages is now loaded with
the TYPO3 Asset.script ViewHelper <https://docs.typo3.org/other/typo3/view-helper-reference/12.4/en-us/typo3/fluid/latest/Asset/Script.html>.
Affected Installations
All installations which overwrite
Resources/Private/Partials/Product/CartForm.html are affected.
When using the CartForm.html which comes with this extension it will work
without any changes.
Migration
The JavaScript in EXT:cart is no longer added via TypoScript. All JavaScript
files are now added via ViewHelper.
Two ViewHelpers needs to be added in Resources/Private/Partials/Product/CartForm.html:
<f:asset.script identifier="change-be-variant" src="EXT:cart/Resources/Public/JavaScript/change_be_variant.js" /> (only when working with BE Variants).
With the version for TYPO3 v12 the references uses the key 'images' in
column fieldname of table sys_file_reference. Before the key was 'image'
(singular). Due to this the images are no longer shown, neither in the backend
nor in the frontend.
Affected Installations
All installations which are not set up with version 5 of EXT:cart_products
(before TYPO3 v12).
Migration
Run the UpdateWizard "Updates image references for EXT:cart_products".
Breaking: #200 - Frontend user removed from detail view
The view for detail pages (/Resources/Private/Template/Show.html) got the
Frontend user from the controller which was never used. Due to missing usage
the user is no longer given.
Affected Installations
All existing installations that uses the Frontend user in customized templates.
Switchable Controller Actions are removed in TYPO3 v12. The existing plugin
"Cart: Products" was split into to plugins. A upgrade wizard cares about
the updating.
Important: Due to the changed pluginName you will need to adapt your
RouteEnhancers in your SiteConfiguration.
Affected Installations
All installations which are not set up with version 5 of EXT:cart_products
(before TYPO3 v12).
Migration
1. Run the UpdateWizard "Migrates plugins of existing cart_produts plugins
using switchableControllerActions".
2. Adapt the value of plugin from Products to ShowProduct in your site
configuration (config/sites/<your-site>/config.yaml):
EXT:cart v9 has an extended
\Extcode\Cart\Domain\Model\Cart\Cart\ProcessOrderCheckStockEvent.
This allows product extensions as EXT:cart_product to set a flag if any
product of an order is not available in sufficient amount (means: less articles
in stock than what a customer wants to order).
The new Event Listener
\Extcode\CartProducts\EventListener\Order\Stock\CheckStock
checks whether the stock of any article is lower than what a customer wants to
order. This situation can happen when customer B ordered the same product
after customer A put the article into the cart. Customer A will get in this case
a message that the article is no longer available in the desired amount and the
order can not be finished until customer A adapts the amount.
This prevents a TYPO3 Exception "[..] Out of range value for column 'stock'
[...]".
Impact
Negative effects are not expected. This feature works out of the box when
stock handling is activated. As long as flash messages are shown in the order
form it's not necessary to adapt anything.
It is of course possible to override the displayed message which has the key
tx_cart.error.stock_handling.order (in EXT:cart).
In TYPO3 v11 <f:paginate> has been removed and is implemented via the
controller.
Affected Installations
All installations are affected by this change.
Migration
If the templates for the lists of products in the frontend has been
overwritten, then these templates must also be adapted. If pagination is not
desired, a custom template must be used for the product list.
Because in TYPO3 v11 no pagination in the frontend is possible without an own
ViewHelper or an extension, the list action in the ProductController was
extended by the pagination. Via TypoScript it can be defined how many products
should be displayed per page.
Integration
An example was implemented in the list action template.
The backend module didn't offer much more than a customized list view so far. The detail view did not contain a ready
template and did not offer a representation like in the frontend. The list view can also be done via the List Module.
Impact
Editors must resort to the list module.
Note
If someone cannot do without this backend module, the code can be outsourced to a separate extension.
As an alternative to this module, dashboard widgets are planned, which offer the editor the possibility to see all
products whose stock is very low or which are no longer available.
In many cases the selection of backend variants in the frontend is not so user-friendly, especially if a product has
more than one backend variant. In this case, every available combination is displayed as one entry in a selector.
This version extends the selector with additional data attributes that are used to resolve this one selector into
multiple selectors for each backend variant.
Before: each backend variant is an option in a single selector
After: backend variants were split into several selectors
The redesign is done via JavaScript, so that only a selector is displayed when JavaScript is deactivated.
The JavaScript then also ensures that only available options can be selected.
Integration
Since this change in the view must first be adapted for the customer project, the necessary JavaScript is not
included by default. This will probably be done in the upcoming major version.
The JavaScript is not yet finalized. There might be some changes in the coming minor versions. For this reason you
should either include a copy via your own site package or check the behaviour in the page after each update.
In some cases you don't need a detail page for the products and want to allow adding products to the shopping cart
in the list view.
Diese Änderung erlaubt es, der showForm Action das Produkt als Parameter mitzugeben.
Integration
To display the form in list view, you have to insert the following snippet in your own template.
For each product you can activate the stock management in the backend. Up to now, stock management was carried out
independently for each language.
The online shops implemented with the extension sell products with translated product titles and descriptions, but
not translated products.
Therefore there should be a collective stock for all translations of a product.
Important
Check your database for differences in translated products.
If any query shows a result, please take a closer look at the products
or its backend variants and update them.
If you are sure, the respective update query can also be used to adapt
the data of the translations to the original language. For different
stock levels in the products or their backend variants, this should be
compared with the actual stock level.
Check and Update handle_stock in Products
SELECT orig.uid AS orig_uid, orig.title AS orig_title, orig.handle_stock AS orig_handle_stock, trans.uid AS trans_uid, trans.title AS trans_title, trans.handle_stock AS trans_handle_stock
FROM`tx_cartproducts_domain_model_product_product`AS orig
JOIN`tx_cartproducts_domain_model_product_product`AS trans ON orig.uid = trans.l10n_parent
WHERE orig.handle_stock <> trans.handle_stock
UPDATE`tx_cartproducts_domain_model_product_product`AS trans
JOIN`tx_cartproducts_domain_model_product_product`AS orig ON orig.uid = trans.l10n_parent
SET trans.handle_stock = orig.handle_stock
WHERE orig.handle_stock <> trans.handle_stock
Copied!
Check and Update handle_stock_in_variants in Products
SELECT orig.uid AS orig_uid, orig.title AS orig_title, orig.handle_stock_in_variants AS orig_handle_stock_in_variants, trans.uid AS trans_uid, trans.title AS trans_title, trans.handle_stock_in_variants AS trans_handle_stock_in_variants
FROM`tx_cartproducts_domain_model_product_product`AS orig
JOIN`tx_cartproducts_domain_model_product_product`AS trans ON orig.uid = trans.l10n_parent
WHERE orig.handle_stock_in_variants <> trans.handle_stock_in_variants
UPDATE`tx_cartproducts_domain_model_product_product`AS trans
JOIN`tx_cartproducts_domain_model_product_product`AS orig ON orig.uid = trans.l10n_parent
SET trans.handle_stock_in_variants = orig.handle_stock_in_variants
WHERE orig.handle_stock_in_variants <> trans.handle_stock_in_variants
Copied!
Check and Update stock in Products
SELECT orig.uid AS orig_uid, orig.title AS orig_title, orig.stock AS orig_stock, trans.uid AS trans_uid, trans.title AS trans_title, trans.stock AS trans_stock
FROM`tx_cartproducts_domain_model_product_product`AS orig
JOIN`tx_cartproducts_domain_model_product_product`AS trans ON orig.uid = trans.l10n_parent
WHERE orig.stock <> trans.stock
UPDATE`tx_cartproducts_domain_model_product_product`AS trans
JOIN`tx_cartproducts_domain_model_product_product`AS orig ON orig.uid = trans.l10n_parent
SET trans.stock = orig.stock
WHERE orig.stock <> trans.stock
Copied!
Check and Update stock in Backend Variants
SELECT orig.product, orig_product.title, orig.uid AS orig_uid, orig.stock AS orig_stock, trans.uid AS trans_uid, trans.stock AS trans_stock
FROM`tx_cartproducts_domain_model_product_bevariant`AS orig
JOIN`tx_cartproducts_domain_model_product_bevariant`AS trans ON orig.uid = trans.l10n_parent
JOIN`tx_cartproducts_domain_model_product_product`AS orig_product ON orig.product = orig_product.uid
WHERE orig.stock ISNOTNULLAND orig.stock <> trans.stock;
UPDATE`tx_cartproducts_domain_model_product_bevariant`AS trans
JOIN`tx_cartproducts_domain_model_product_bevariant`AS orig ON orig.uid = trans.l10n_parent
SET trans.stock = orig.stock
WHERE orig.stock ISNOTNULLAND orig.stock <> trans.stock
Copied!
Saving the products in the backend should update the field as well.
Note
If you require the old language-specific stock management, this version must not be installed.
Please contact me in this case, so that an appropriate solution can be developed.
Important: #47 - Exclude Product Type from Translation
For each product you can select a type such as simple or configurable.
The product must of course have the same type in all languages.
Therefore, this change will remove the product type in the translations and
take the type of the original language.
Important
Check your database for differences in translated products.
If you are sure, the respective update query can also be used to adapt
the data of the translations to the original language.
Check and Update product_type in Products
SELECT orig.uid AS orig_uid, orig.title AS orig_title, orig.product_type AS orig_product_type, trans.uid AS trans_uid, trans.title AS trans_title, trans.product_type AS trans_product_type
FROM`tx_cartproducts_domain_model_product_product`AS orig
JOIN`tx_cartproducts_domain_model_product_product`AS trans ON orig.uid = trans.l10n_parent
WHERE orig.product_type <> trans.product_type
UPDATE`tx_cartproducts_domain_model_product_product`AS trans
JOIN`tx_cartproducts_domain_model_product_product`AS orig ON orig.uid = trans.l10n_parent
SET trans.product_type = orig.product_type
WHERE orig.product_type <> trans.product_type
Copied!
Saving the products in the backend should update the field as well.
2.0 Changes
The version 2.0.0 is a release for TYPO3 v9.5 only. This version is compatible to Cart v6.0+.
Important
If upgrading from cart version 4.8.1 or earlier: Please read the documentation very carefully! Please make a backup of your filesystem and database! If possible test the update in a test copy of your TYPO3 instance.
1.0 Changes
The version 1.0.0 is a release for TYPO3 v8.7 only and skipped for TYPO3 v9.5. This version is compatible to Cart v5.0+.
Important
If upgrading from cart version 4.8.1 or earlier: Please read the documentation very carefully! Please make a backup of your filesystem and database! If possible test the update in a test copy of your TYPO3 instance.
Reference to the headline
Copy and freely share the link
This link target has no permanent anchor assigned.The link below can be used, but is prone to change if the page gets moved.