Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add description and shortdescription on view product #245

Merged
merged 4 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions spec/Factory/ProductViewFactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ function it_builds_product_view(

$productTranslation->getName()->willReturn('Hat');
$productTranslation->getSlug()->willReturn('hat');
$productTranslation->getDescription()->willReturn('Et voluptas qui fuga aut unde ex non ducimus');
$productTranslation->getShortDescription()->willReturn('Dolormque quibudam dolor laudantium modi temporibus.');
$productTranslation->getMetaKeywords()->willReturn('hat');
$productTranslation->getMetaDescription()->willReturn('hat');

$taxonView = new ProductTaxonView();
$taxonView->main = 'MAIN';
Expand All @@ -86,6 +90,10 @@ function it_builds_product_view(
$productView->code = 'HAT_CODE';
$productView->averageRating = 5;
$productView->slug = 'hat';
$productView->description = 'Et voluptas qui fuga aut unde ex non ducimus';
$productView->shortDescription = 'Dolormque quibudam dolor laudantium modi temporibus.';
$productView->metaKeywords = 'hat';
$productView->metaDescription = 'hat';
$productView->taxons = $taxonView;
$productView->images = [new ImageView(), new ImageView()];
$productView->attributes = [];
Expand Down
4 changes: 4 additions & 0 deletions src/Factory/ProductViewFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public function create(ProductInterface $product, ChannelInterface $channel, str
$translation = $product->getTranslation($locale);
$productView->name = $translation->getName();
$productView->slug = $translation->getSlug();
$productView->description = $translation->getDescription();
$productView->shortDescription = $translation->getShortDescription();
$productView->metaKeywords = $translation->getMetaKeywords();
$productView->metaDescription = $translation->getMetaDescription();

/** @var ProductImageInterface $image */
foreach ($product->getImages() as $image) {
Expand Down
12 changes: 12 additions & 0 deletions src/Resources/config/serializer/ProductView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ Sylius\ShopApiPlugin\View\ProductView:
breadcrumb:
expose: true
type: string
description:
expose: true
type: string
shortDescription:
expose: true
type: string
metaKeywords:
expose: true
type: string
metaDescription:
expose: true
type: string
averageRating:
expose: true
type: integer
Expand Down
20 changes: 20 additions & 0 deletions src/View/ProductView.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ class ProductView
*/
public $breadcrumb;

/**
* @var string
*/
public $description;

/**
* @var string
*/
public $shortDescription;

/**
* @var string
*/
public $metaKeywords;

/**
* @var string
*/
public $metaDescription;

/**
* @var string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down Expand Up @@ -63,6 +64,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down Expand Up @@ -115,6 +117,7 @@
"code": "LOGAN_HAT_CODE",
"name": "Logan Hat",
"slug": "logan-hat",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "HAT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_HAT_CODE",
"name": "Logan Hat",
"slug": "logan-hat",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "HAT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_HAT_CODE",
"name": "Logan Hat",
"slug": "logan-hat",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "HAT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down Expand Up @@ -66,6 +67,7 @@
"name": "Logan Hat",
"slug": "logan-hat",
"averageRating": 0,
"description": "Some description Lorem ipsum dolor sit amet.",
"taxons": {
"main": "HAT",
"others": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_HAT_CODE",
"name": "Logan Hut",
"slug": "logan-hut",
"description": "Einige Beschreibung Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "HAT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"code": "LOGAN_HAT_CODE",
"name": "Logan Hut",
"slug": "logan-hut",
"description": "Einige Beschreibung Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "HAT",
Expand Down Expand Up @@ -199,6 +200,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"code": "LOGAN_HAT_CODE",
"name": "Logan Hut",
"slug": "logan-hut",
"description": "Einige Beschreibung Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "HAT",
Expand Down Expand Up @@ -199,6 +200,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "Logan Hut",
"slug": "logan-hut",
"breadcrumb": "hute\/logan-hut",
"description": "Einige Beschreibung Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "HAT",
Expand Down Expand Up @@ -138,6 +139,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"code": "LOGAN_HAT_CODE",
"name": "Logan Hat",
"slug": "logan-hat",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "HAT",
Expand Down Expand Up @@ -89,6 +90,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down Expand Up @@ -139,6 +141,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down Expand Up @@ -216,6 +219,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"code": "LOGAN_HAT_CODE",
"name": "Logan Hat",
"slug": "logan-hat",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "HAT",
Expand Down Expand Up @@ -89,6 +90,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down Expand Up @@ -139,6 +141,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down Expand Up @@ -216,6 +219,7 @@
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
"slug": "logan-mug",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "MUG",
Expand Down Expand Up @@ -266,6 +270,7 @@
"code": "LOGAN_SHOES_CODE",
"name": "Logan Shoes",
"slug": "logan-shoes",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"others": []
Expand All @@ -284,6 +289,7 @@
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
"slug": "logan-t-shirt",
"description": "Some description Lorem ipsum dolor sit amet.",
"averageRating": 0,
"taxons": {
"main": "T_SHIRTS",
Expand Down
Loading