Search orders by 'customer choice' attribute

Permalink Browser Info Environment
Hi there, I'm trying to create a page within my website to display orders (not through the dashboard). Is this at all possible? I've searched everywhere but can't find any discussion on it. I'm kinda thinking like the page /checkout/finish/ when an order is completed, but with multiple orders...

Secondly, if the above is possible, how am I able to filter by 'customer choice' attribute? Again, I can't find any discussion on this.

The ultimate goal here is to produce a page within the website which displays all of the items sold which have a particular 'customer choice'...

I know this is a BIG ask, but if anyone can point me in the right direction, I'd be very grateful.

(I've even gone through each table in MySQL to see if I can see where the 'customer choice' textfield is stored, but I can find no reference at all to it. If I could identify where the data is stored, I might be able to whip up a MySQL request to drag the relevant information out, but I can't find me a starting place)

Thanks

Rob

Type: Pre-Sale
Status: In Progress
rc255
View Replies:
ConcreteCMS replied on at Permalink Reply
ConcreteCMS
Hi Rob,
There is unfortunately no way to do what you're asking for in the current version of ecommerce. If you're familiar with SQL, the tables you want are:

CoreCommerceOrderProducts
CoreCommerceProductOptionAttributeValues
CoreCommerceProductAttributeValues
AttributeKeys


Depending on what you know about what you're searching for (like whether you know the akID and the avID) you can use some or all of these tables to select the number you need in a single query.

Otherwise, you'll need to use an orderlist and loop through all products in all orders to determine the product and the attribute values and doing so will be extremely costly on the performance of your website. Instead I'd recommend creating a database table and adding an event on order completion that adds to a table row whenever a specifically configured product is purchased. Then you can simply select from this table to get the current count. https://www.concrete5.org/marketplace/addons/ecommerce/documentation...

Best wishes,
Korvin
rc255 replied on at Permalink Reply
rc255
Thanks Korvin, I will look into what I can do and I will report back with my findings :)

Rob
rc255 replied on at Permalink Reply
rc255
Hi there Korvin, hope you are well. I've made some progress with this and I am able to drag the orders out of the database :)

What is confusing me is where C5 stores the actual data. So, I need to run a query on a particular attribute value to collect all the orders associated with that value. But I cannot find the table which holds the data.

I'm presuming that all attribute values are stored in the same place - I've checked table 'AttributeValues' but that table only contains int(10)'s and datestamps etc. In fact, most of the tables I've searched through are int's, I can't find the actual stored data.

If I can just find the correct table which hold this info, I'm laughin'

If you can throw any light onto this for me, I'd be very grateful

Thanks

Rob
Korvin replied on at Permalink Reply
Korvin
It depends on the attribute type. You can find out what table it's in by finding the "getValue" in the attribute type controller. For example, if you want to find the values for an order_adjustment attribute type, you'll find the values in `atCoreCommerceOrderAdjustment`. Otherwise, you'll find the values in whichever at* table your type uses.

Best wishes,
Korvin
rc255 replied on at Permalink Reply
rc255
Hi Korvin, sorry to bother you again with this, but I think I'm going crazy....

I cannot find any reference to my attribute nor its value in any database table for the entire site... I have been through every table (in the entire c5 db) at least 6 times and I can't see anything :(

Basically, in eCommerce, I have created a "Global Customer Choice" attribute called 'storename' (handle 'storename' name 'Customer') - this is what I'm searching for but I cannot find any reference to either. It's driving me bonkers...

If I could just find out which table CoreCommerce saves the Global Choice Attribute info into, I can move forward.

The Commerce db schema is such a headache. I'm so close, yet so far away :(

If you can point me in the right direction it would really help me out

Thank mate

Rob
rc255 replied on at Permalink Reply
rc255
Hurray, I have finally found what I'm looking for!

The Global Customer Choice attributes are stored in the table 'Attribute Keys'

I can now run a query where akID in AttributeKeys = whatever

concrete5 Environment Information

# concrete5 Version
5.6.2.1

# concrete5 Packages
Bootswatch (0.9.1), CoolInput Search (1.0), Downloadable File Purchase (1.2.2), eCommerce (2.8.12), File Upload Attribute (1.0), Google Map (Premium) (2.1), Handy Toolbar (1.0.2), Mailing List (2.54), PHP block by ND (1.0), Pro Forms (7.5.9), Quick Attribute View (1.0.0.3), Reviews (1.4.1), Sage Pay eCommerce Payment Provider (0.9.3), Stack Randomizer (1.2.0), Syntax Highlighter (1.0.1).

# concrete5 Overrides
blocks/image, blocks/product, blocks/page_list, blocks/reviews, controllers/login.php, elements/profile, models/collection_types.php, models/attribute, single_pages/login.php, single_pages/register.php, themes/bluecustard

# Server Software
Apache/2.2.22

# Server API
apache2handler

# PHP Version
5.3.10-1ubuntu3.18

# PHP Extensions
apache2handler, apc, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imap, json, ldap, libxml, mbstring, mcrypt, mhash, mysql, mysqli, openssl, pcre, PDO, pdo_mysql, Phar, posix, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, zip, zlib.

# PHP Settings
max_execution_time - 30
apc.max_file_size - 1M
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 256M
post_max_size - 12M
safe_mode - Off
safe_mode_exec_dir - <i>no value</i>
safe_mode_gid - Off
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 10M
ldap.max_links - Unlimited
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH

Browser User-Agent String

Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.