zaeng LiteCart Fan از کشور Germany عضو از آوریل 2024 zaeng 24 آوریل 2024 16:39 Hi, Is there a way to show attributes and supplier on the product page? I did not find a page which displays attributes or supplier at all... Thx.
tim Founder از کشور Sweden عضو از مهٔ 2013 tim 25 آوریل 2024 00:59 We don't have a current way. Ideas are welcome. Suppliers was intended for administration and addons. Attributes is used for category filters. In 3.0 you will have the option to autogenerate technical data from attributes. Here is something to play with. var_dump(reference::product($product_id)->supplier->name); var_dump(reference::product($product_id)->attributes); https://www.litecart.net/en/wiki/products https://www.litecart.net/en/wiki/attributes https://www.litecart.net/en/wiki/references
zaeng LiteCart Fan از کشور Germany عضو از آوریل 2024 zaeng 28 آوریل 2024 14:50 Hi, thanks for the tips. The output of the manufacturer works with echo reference::product($product_id)->supplier->name; How can you access attributes in the same way? The background is that a number of necessary fields are missing and we are trying to solve this via supplier and attributes. To give a concrete example: the "manufacturer" of a work of art is the artist, but there is often also the affiliation to a collection of works of art ("portfolio") or a publisher (supplier), which should also be specified and searchable. We do not have delivery codes, but we do, for example, have various dimensions (picture size, sheet size, frame size). If we solve this via attributes, that would be ok - but you should include examples of evaluations in the documentation.
tim Founder از کشور Sweden عضو از مهٔ 2013 tim 28 آوریل 2024 17:07 That was the other example: var_dump(reference::product($product_id)->attributes); That will show you the contents of the variable. From there you should be able to work out what you need. foreach (reference::product($product_id)->attributes as $attribute) { ... }
zaeng LiteCart Fan از کشور Germany عضو از آوریل 2024 zaeng 28 آوریل 2024 21:24 Difficult for me as a layman ;-) With var_dump(reference::product($product_id)->attributes); I get an array: ["1-1"]=> array(8) { ["id"]=> int(8) ["product_id"]=> int(9) ["group_id"]=> int(1) ["value_id"]=> int(1) ["custom_value"]=> string(0) "" ["code"]=> string(7) "Condition" ["group_name"]=> string(7) "Condition" ["value_name"]=> string(8) "Flawless" } }``` With ```foreach (reference::product($product_id)->attributes as $attribute) { echo functions::escape_html($attribute); }``` Only "Array" is returned How do I get the output "Condition: flawless"?
tim Founder از کشور Sweden عضو از مهٔ 2013 tim 28 آوریل 2024 23:18 Yes, var_dump shows you the contents of the variable. From there you will know the names of the data you like to address. Try this: echo $attribute['group_name'] .': '. $attribute['value_name']; }```
zaeng LiteCart Fan از کشور Germany عضو از آوریل 2024 zaeng 29 آوریل 2024 21:16 Thanks. This is working. We just added a paragraph like this: echo '<b>'.$attribute['group_name'] .':</b> '. $attribute['value_name'] .' '. $attribute['custom_value']; } ``` Also the technical data display is working very well. Good job!