integration issues – custom fields, speed, drop down list sort etc
- JmaskedParticipant3 years, 6 months ago #27805
So really what I need now is…
I need to display certain attribute values on the single product item.
For example “pwb-brand_str”: [
“TOM FORD”
],
how is this called?I also need to clean up my index
the product thumbnail was never added to the index so the products don’t have images.
No variation data linked to the parent product is in the index, no product image, no variation sku or attributes.
The only thing close but not really is an empty value product attribute, this is what is in the index
_product_attributes_s [
{
name:”pa_tom-ford_color”
value:””
position:”0″
is_visible:”1″
is_variation:”1″
is_taxonomy:”1″
}
]I also need this custom attribute added to the index to display the attribute count ie: “5 Colors”:
function filter_custom_fields( array $custom_fields, WP_Post $post) { $product = wc_get_product( $post ); // Extract prices. $variations_count = 0; if ( $product instanceof WC_Product_Variable ) { $variations_count = count( $product->get_available_variations() ); $variations = $product->get_available_variations(); $attricount = count( $variations ); $allattributes = $variations[0]['attributes']; } if($attricount > 0 && is_array($allattributes) && count( $allattributes ) == 1){ foreach ($allattributes as $key => $value){ $attriname = ''; if(strpos($key, 'color')){ $attriname = 'Colors'; }elseif(strpos($key, 'size')){ $attriname = 'Sizes'; }else{ $rawattriname = substr($key, -5); $attriname = ucwords(str_replace("_","",$key)); } $variation_count_meta = $attricount . ' ' .$attriname; $custom_fields['variation_count_display'] = $variation_count_meta; } } return $custom_fields; }
wpsolrKeymaster3 years, 6 months ago #27807Elasticsearch is used only for searching, and displaying facets with our facets Widget.
If you need to display other informations, just use standard WordPress/WooCommerce functions
For instance:I need to display certain attribute values on the single product item.
$product = wc_get_product();
echo $product->get_attribute( ‘pwb-brand’ )I also have a bunch of date data in my index that I don’t think is necessary… This seems to be automatically generated
This data is used by WPSOLR for efficiently filtering or sorting in different add-ons.
JmaskedParticipant3 years, 6 months ago #27808I am using Algolia, how do I include the attribute value in my hit template using your plugin?
I am still missing product image, variation data, attribute values etc. Algolia controls the front end hits display… So I would need those values not only for hits display but for searching…I currently have the brand being generated by a function in product loops, it’s working on the homepage, however it’s broken on any pages like search or category that use algolia.
I need the custom function field for attribute count to work.
You must be logged in to reply to this topic.