| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | Mark Forums Read | User manuals | Login |
Retrieving class attribute data, per product | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Retrieving class attribute data, per product
I have added a product class "Foo" and that product class has a text attribute "bar". I can set a different value for "bar" for each product under the "Attributes -> Global" tab.
Now in a decorator for \XLite\Model\OrderItem->isValid() I would like to retrieve the value of "foo" for the item in question. How is this done? I have tried several methods of accessing the database via getRepo(), but in no instance could I get the class attributes for a specific Product. For instance, this returns all the class attributes for all the products, with no way to then loop for the correct product as there is nothing to identify the product by: Code:
This returns the product-specific attributes for the correct product, but not the class attributes: Code:
This returns the global attributes for all products, but not the class attributes, and anyway there is no way to tell which attributes belong to which products: Code:
I did manage to get the data using an SQL query in the MySQL CLI: Code:
However, now how do I transform that SQL query into something that I can run in X-Cart? I tried using Doctrine joins, but I have been unable to properly set up the class type hinting. If we look at just the first JOIN from above, this is my failed attempt to convert that to Doctrine: Code:
I think that I did decorate the AttributeOptionTranslation class properly: Code:
Alas, I get this error: Code:
My original intention was to use OneToMany but that returned the same error. So my questions are: 1) Is there a proper way to retrieve the class attribute data, given a specific Product object or product_id integer? 2) If not, then how can I convert the SQL query into a Doctrine query? Thank you
__________________
The requested URL /VERSION was not found on this server. |
|||||||
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|