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

新着商品・新着情報のRSSフィード機能 #4908

Merged
merged 5 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Eccube/Controller/RssFeedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(ProductRepository $productRepository, NewsRepository
}

/**
* @Route("/products_feed.xml", name="rss_feed_for_products")
* @Route("/products_feed", name="rss_feed_for_products")
*/
public function products()
{
Expand All @@ -60,14 +60,14 @@ public function products()
$response->headers->set('Content-Type', 'application/xml; charset=UTF-8');

return $this->render(
'Feed/products.xml.twig',
'Feed/products.twig',
['products' => $products],
$response
);
}

/**
* @Route("/news_feed.xml", name="rss_feed_for_news")
* @Route("/news_feed", name="rss_feed_for_news")
*/
public function news()
{
Expand All @@ -89,7 +89,7 @@ public function news()
$response->headers->set('Content-Type', 'application/xml; charset=UTF-8');

return $this->render(
'Feed/news.xml.twig',
'Feed/news.twig',
['news' => $news],
$response
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
<title>{{ BaseInfo.shop_name }} 新着情報</title>
<description>{{ BaseInfo.shop_name }} 新着情報</description>
<link>{{ url('homepage') }}</link>
<lastBuildDate>{{ "now" | date(constant('DATE_RFC822')) }}</lastBuildDate>
<lastBuildDate>{{ max( news | map(e => e.update_date) ) | date(constant('DATE_RFC2822')) }}</lastBuildDate>
<atom:link href="{{ url('rss_feed_for_news') }}" rel="self"/>

{% for article in news %}
<item>
<title>{{ article.title }}</title>
<title>{{ article.title }}
</title>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改行が入ってテストが落ちてしまっているようです。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kiy0taka すいません、修正しました。

{% if article.url %}
<link>{{ article.url }}</link>
{% else %}
<link>{{ url('homepage') }}</link>
{% endif %}
<pubDate>{{ article.publish_date|date(constant('DATE_RFC822')) }}</pubDate>
<guid>{{ url('homepage') }}rss/news/{{ article.id }}</guid>
<pubDate>{{ article.publish_date|date(constant('DATE_RFC2822')) }}</pubDate>
<guid isPermaLink="false">{{ url('homepage') }}rss/news/{{ article.id }}</guid>
<description><![CDATA[
{{ article.description|raw }}
]]></description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<title>{{ BaseInfo.shop_name }} 新着商品</title>
<description>{{ BaseInfo.shop_name }} 新着商品</description>
<link>{{ url('homepage') }}</link>
<lastBuildDate>{{ "now" | date(constant('DATE_RFC822')) }}</lastBuildDate>
<lastBuildDate>{{ max( products | map(e => e.update_date) ) | date(constant('DATE_RFC2822')) }}</lastBuildDate>
<atom:link href="{{ url('rss_feed_for_products') }}" rel="self"/>

{% for product in products %}
<item>
<title>{{ product.name }}</title>
<link>{{ url('product_detail', {'id': product.id}) }}</link>
<pubDate>{{ product.create_date|date(constant('DATE_RFC822')) }}</pubDate>
<guid>{{ url('homepage') }}rss/products/{{ product.id }}</guid>
<pubDate>{{ product.create_date|date(constant('DATE_RFC2822')) }}</pubDate>
<guid isPermaLink="true">{{ url('product_detail', {'id': product.id}) }}</guid>
<description><![CDATA[
{{ product.description_detail }}
]]></description>
Expand Down