I need to get a product ID for the product, which is a specialty with a specific value.
What I've done so far:
$ found = false; Forex Currency ($ _productCollection $ _product) {$ attribute = $ _product- & gt; GetResource () - & gt; GetAttribute ('attribute'); $ Id = $ _product- & gt; GetId (); If ($ attribute = NULL) {// Do Nothing} if ($ attribute = "value1") {echo $ attribute "& lt; br>"; $ Value1 = $ id; } If ($ attribute = "value2") {echo $ attribute "& lt; br>"; $ Value2 = $ id; } If ($ attribute = "value3") {echo $ attribute "& lt; br>"; $ Value3 = $ id; } If ($ value1 & amp; $ value2 & amp; $ value3) {$ found = true; "All id found" echo "& Lt; br & gt;"; } If ($ mil = true) {break; }} Echo "value 1 id =" $ value1. "& Lt; br & gt;" "Value 2 ID =" $ Value2. "& Lt; br & gt;" "Value 3 id =" $ value3;
It mostly works, it is fine through products, and it can achieve attribute values for each product. But it is showing the ID for the first product in the category for each product, even if they have a feature.
Edit:
Using the ==, part of my problem has been fixed.
The other problem was that:
$ _products-> getResource () - & gt; GetAttribute ('attribute');
The attribute is not found in the way that allows me to use its values. Instead of using it:
$ _product-> getAttributeText ('attribute');
and set the attribute in the 'Use in Product List'. If this statement is used for each value, then every time I am specifying the value.
if ($ attribute = "value1") {< Code>
Use twice to compare:
if ($ attribute = = "Value1") {
No comments:
Post a Comment