<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Der Magento Experte</title>
	<atom:link href="https://www.der-mage-experte.de/tag/scope/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.der-mage-experte.de</link>
	<description>Ihr Magento Experte &#38; Entwickler</description>
	<lastBuildDate>Fri, 03 Apr 2026 09:02:45 +0000</lastBuildDate>
	<language>de-DE</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.6</generator>
	<item>
		<title>Wert eines Produktattributes für &#8220;Alle Store Views&#8221; auslesen</title>
		<link>https://www.der-mage-experte.de/2178/magento2-wert-produktattribut-fur-alle-store-views-auslesen/</link>
		<comments>https://www.der-mage-experte.de/2178/magento2-wert-produktattribut-fur-alle-store-views-auslesen/#comments</comments>
		<pubDate>Mon, 08 Apr 2024 08:06:19 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Lösungen]]></category>
		<category><![CDATA[Attribut]]></category>
		<category><![CDATA[Magento 2]]></category>
		<category><![CDATA[Produkt]]></category>
		<category><![CDATA[Scope]]></category>

		<guid isPermaLink="false">https://www.der-mage-experte.de/?p=2178</guid>
		<description><![CDATA[Manchmal ist es erforderlich, den Wert des &#8220;Alle Store Views&#8221; (oder &#8220;All Store Views&#8221; in Englisch) in Ihrem Magento 2 Shop auszulesen in z.B. einem Template. Setzen Sie dazu einfach die Store ID auf 0, laden dann das entsprechende Produkt&#8230;]]></description>
				<content:encoded><![CDATA[<p>Manchmal ist es erforderlich, den Wert des &#8220;Alle Store Views&#8221; (oder &#8220;All Store Views&#8221; in Englisch) in Ihrem Magento 2 Shop auszulesen in z.B. einem Template. </p>
<p>Setzen Sie dazu einfach die Store ID auf 0, laden dann das entsprechende Produkt und das gewünschte Magento 2 Produktattribut. Danach setzen Sie die Store ID wieder auf den originalen Wert zurück.</p><pre class="crayon-plain-tag">public function __construct(
    \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
    \Magento\Store\Model\StoreManagerInterface $storeManager
) {
    $this-&gt;productRepository = $productRepository;
    $this-&gt;storeManager = $storeManager;
}

$original = $this-&gt;storeManager-&gt;getStore()-&gt;getId();
$this-&gt;storeManager-&gt;setCurrentStore(0);
$product = $this-&gt;productRepository-&gt;get('12345', false, 0); // 12345 ersetzen mit Ihrer Artikelnummer (SKU)
$allStoreViewsValue = $product-&gt;getCustomAttribute();
$this-&gt;storeManager-&gt;setCurrentStore($original);</pre><p>Ist der Identifier Ihres Magento 2 Produktattributes beispielsweise &#8220;baking_time&#8221;, wäre der Aufruf: </p><pre class="crayon-plain-tag">$product-&gt;getBakingTime();</pre><p>.</p>]]></content:encoded>
			<wfw:commentRss>https://www.der-mage-experte.de/2178/magento2-wert-produktattribut-fur-alle-store-views-auslesen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
