Max for woocommerce attribute VALUES - wordpress

I am apparently exceeding the maximum characters allowed for the attribute VALUES in woocommerce, and I can't seem to find what the max actually is.
Clients will ultimately be adding products once I do the original set up, so it adding them as custom variables is something I want to avoid.
I also don't want to have to mess with functions; I'm trying to limit the actual values to less then the max.
Thanks in advance :)

The attribute Values will be saved in table (wp)_postmeta,
in the meta_value column (meta_key is _product_attributes).
This column is from "Longtext" type.
Longtext from the MYSQL Doc.:
"A TEXT column with a maximum length of 4,294,967,295 or 4GB (232 – 1) characters. The effective maximum length is less if the value contains multi-byte characters. The effective maximum length of LONGTEXT columns also depends on the configured maximum packet size in the client/server protocol and available memory."
Link to MYSQL Doc.
Woocommerce saves more than this Value in the field.
Here is an example:
a:1:{s:4:"attr";a:6:{s:4:"name";s:4:"attr";s:5:"value";s:5:"1 | 2
";s:8:"position";i:0;s:10:"is_visible";
i:1;s:12:"is_variation";i:0;s:11:"is_taxonomy";i:0;}}
At the End of the first line you see 1 | 2, this are my test attribute Values.

I had same problem and solved it today so I'm gonna say what I done if someone will search for it again. So you can go to your wp-content / woocommerce / includes / wc-attribute-functions.php and just ctrl + f for 28. There is the max number for your attribute slug. If you want find another places like not slug, but name and etc. just download whole woocommerce folder and search it with editor witch allows you to search for multiple files. But also I'm pretty sure your code changes will be wiped out when you update woocommerce.

Related

Getting commas in number format in OpenSearch Dashboards

I changed the Field Type from string to integer from there the value I am getting is with commas in between the value. Example mobile number(9748376253) destination field as (9,748,376,253), this is because the default number format in opensearch will take as 1000's place so it divides in such a way. So by following the below stackoverflow i changed accordingly(Kibana unwanted thousand-seperator) as type number and changed the format to 00.[000] from 0,0.[000]. but changes are not effected. Will it take time to effect or any other issue ? Is there any option to change this format number setting only for one particular index ?

WP Query - sortby with comma in number

I'm trying to sort a query of product custom post type, ordering by the product weight (ASC - from lightest to heaviest). The product weight is entered in a Advanced Custom Fields "field" on the product edit screen.
The query is working fine, except for when the number contains a comma (ex 1,000). It will put a product with a weight of 1,000 at the top of the list (first). So is somehow not looking at the number past the comma, so views it as 1, not 1,000.
Fortunately, I was able to convince my client to leave out the commas and are using the php number_format() to display the comma on the front end.
However, I don't like relying on my client to remember to exclude the comma for the sorting to work correctly.
Is there a way to have WP Query properly sort number values with commas in them? Maybe with an action or filter to remove the comma before saving in the DB and then adding it back once it's displayed in a template file? I really don't have much experience with actions and filters in WordPress yet.
Thanks in advance.

Akeneo: Get attributes from a Variant group

I want to check if some attribute values have changed after editing a Variant group in Akeneo V. 1.3.
Unfortunately I am a little bit lost: Is there a way to get from a Pim\Bundle\CatalogBundle\Entity\Group to the attribute values? Is there another better way to get these values of a Variant group that was edited?
I cannot even find out in which table the attribute values are stored in MySQL (I've just found pim_catalog_product_value for the product values).
Yes, it's not easy to dig into this part.
The values of a variant group are not stored in the same way than the products values.
These variant group values are only used to be copied in related products and are stored in a product template.
From a product template, you can fetch the values normalized in json with
$group->getProductTemplate()->getValuesData()`.
You can take a look on ProductTemplateApplier and ProductTemplateUpdater to see how we apply variant group values on products (json format is useable almost directly with product updater).
When we edit a variant group, to be able to use the same form than for the product, we use a subscriber TransformProductTemplateValuesSubscriber.
It denormalizes json values to product values objects with
$this->denormalizer->denormalize($data->getValuesData(), 'ProductValue[]', 'json');`
Don't hesitate if you need any further information.

How to list unique values of a particular field in Kibana

I am having a field named rpc in my elasticsearch database and I am displaying it using Kibana. When I search in search bar of kibana like:
rpc:*
It display all the values of rpc field but I want to have only those value to be displayed which are unique.
I have been playing around with Kibana4 since a couple of weeks now. I find it intuitive and simple and the experience has been great till now. Following your question, I tried getting unique results via a Data Table visualization. Why? Because I personally find it easier to understand. Following are the steps:
1. Get unique count
Create the visualization (Visualize -> Data Table). First lets get
the count of how many unique entries we have for a particular field
(We will use this in the later part for verification). I'm using
clientip.raw but as I see, it will work just fine with any friendly
field name too.
2. Set the aggregation right
Set you aggregation back to count and have a Split Rows as follows. Not doing this will give you count 1 for each field value (since it is looking for unique counts) when you populate the table. Noteworthy part is setting the Top field to 0. Because Kibana won't let you enter anything else than a digit (Obviously!). This was the tricky part. Hit Apply and you'll get the results. Unique field values and the count of each of them.
3. Verification:
Going to the last page of the table, we see there are exactly 543 results. This is how I know it works.
What Next?
You save this visualization and add it to a Dashboard. There you can always check the request, query, response and other stats.
Just an addition to the above mathakoot answer.
For the user of newer version (which do not allow bucket size of 0 anymore) just set a value greater than the maximum number of result
And report the value in the Options>Per Page field
I am using Kibana 6 so the UI looks a bit different than the older answers here.
Here is what worked for me
Create a visualization from your query, I used a line graph type (don't think it matters)
Under Data, set metrics aggregation = "Unique Count" and set field to your field.
Set x-axis aggregation = "Terms" and set field to your field.
Set Size > your number of records
Under Metrics and Axes, disable drawing of the graph, circles, and labels (this really helps the UI not lag)
Run query and then click "Inspect" and download CSV
Data
Metrics & Axes
I wanted to achieve something similar but I'm stuck with Kibana 3.1.
I simply added a panel of type "TERMS" and configured its Field = User-agent and left everything else on default values. This gave me a nice bar chart with one bar for each User-agent.

Change field length in drupal unit description

I'm having trouble using Drupal Rooms module.
This is when I input a description for unit.
Maximum length of Unit description is said to be 255.
I wanna input longer.
I figured out that those are stored in tables - field_data_unit_description_description and field_revision_unit_description_description.
I altered those tables, changed the length of the field to 2048.
But it still says "the text may not be longer than 255 characters."
I tried to change this value in db manually, but it never changed....
If i change the value in the site, the value in db changes, but if i change the value in db, it's not shown in the site.
Please help me.
I solved this problem myself by making a new attribute field for this.
It's quite better way I think since it works well and is fully customizable.
Created a new field in Manage Fields panel, with field attribute : Long Text.
It worked well.

Resources