vethe2
Forum Replies Created
-
Forum: Plugins
In reply to: [Site Reviews] Make shop page sort in newest review orderThank you for your response. I tried your code, but it still does not work. After I submit a review, the last modified timestamp of the product is not changed. It doesn’t affect it at all. I will try to figure out myself why the hook doesn’t work at all. Thank you for your time.
Forum: Plugins
In reply to: [Site Reviews] Make shop page sort in newest review orderHello, I am still waiting.
Now I can use the Bayesian sorting feature in the Site Reviews Plugin settings. But if I use this sorting method, products with existing reviews will always be at the top, while products without reviews will remain at the bottom. It would be great if when someone reviews a product, that product jumps to the top of the product list. I really hope for your assistance.Forum: Plugins
In reply to: [Site Reviews] Make shop page sort in newest review orderThank you for your prompt response. I apologize for the unclear expression that led to your misunderstanding.
I wasn’t referring to the sorting of reviews, but rather to the products that have been reviewed.
For example: I have 3 products A, B, C.
The 3 products will be displayed on the shop page in the order A, B, C according to the latest modified order.
If product C receives a review, then on the shop page it will be displayed in the order C, A, B.
Then, if product B receives a review, the shop page will display: B, C, A.
I want the shop page to be sorted by the most recently reviewed products by default.
Although Site Reviews has replaced WooCommerce’s default reviews, it does not directly affect the product posts. Therefore, I cannot sort the products list page (not product single page) by newest review order.
I tried using this hook to add metadata to the post being reviewed after submission based on the post ID, but it was unsuccessful.
/** * Runs after a review has been created. */ add_action('site-reviews/review/created', function ($review, $command) { // do something here. }, 10, 2);I want that when a review is submitted, metadata will be added to the post based on the post ID in the hidden field of the review form. And based on the last modified metadata, the products list will be sorted by last modified, but I can’t add metadata to the post after each form submission.
add_action('site-reviews/review/created', function ($review, $command) { $product_id = $review->post_id; update_post_meta($product_id, 'last_modified', current_time('mysql')); }, 10, 2);I don’t know what else to do. Please help me.
Forum: Plugins
In reply to: [Site Reviews] Voting for reviewsPlease, add the dislike button to it too.