woocommerce / storefront

Official theme for WooCommerce
https://wordpress.org/themes/storefront/
972 stars 472 forks source link

Product pagination does not reflect product sorting oder #983

Open geeklore opened 5 years ago

geeklore commented 5 years ago

Describe the bug This is a duplicate of a bug I opened for WooCommerce. But it might not be a WooCommerce bug, it could be the way pagination is done in Storefront.

Here is the original bug: https://github.com/woocommerce/woocommerce/issues/21375

Please see Developer comments.

With the Product Pagination enabled for the Product Page and the sort order set to Default sorting (custom ordering +name) the sort order is displayed on the shop page as expected. But the pagination does not paginate according to the sort order. It's looks like it's by publish date, but sometimes there are no products loaded into the pagination.

To Reproduce Steps to reproduce the behavior:

  1. Please test with the Storefront thme. Go to Appearance -> Customization -> WooCommerce -> Product Catalog and make sure that Default product sorting is set to Default sorting (custom ordering + name).
  2. Go to Appearance -> Customization -> Product Page and make sure Product Pagination is enabled.
  3. Go to the Products page and click on the sorting option and drag and drop to create an order.
  4. Visit the Shop page and confirm that the order is as expected.
  5. Click on a product and then look for the previous and next links for the previous and next products.
  6. You should see that the order does not reflect the sorting.

Screenshots see screen shot Link: http://cld.wthms.co/UOKRG4

see screen shot Link: http://cld.wthms.co/MSbzxa

see screen shot Link: http://cld.wthms.co/ftKZU5

Expected behavior The expectation is that the pagination order would follow the same as the sorted order.

Isolating the problem (mark completed items with an [x]):

WordPress Environment

``` ` ### WordPress Environment ### Home URL: https://sellanything.blog Site URL: https://sellanything.blog WC Version: 3.4.5 Log Directory Writable: ✔ WP Version: 4.9.8 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: ✔ WP Cron: ✔ Language: en_US External object cache: ✔ ### Server Environment ### Server Info: nginx PHP Version: 7.0.31 - We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version PHP Post Max Size: 100 MB PHP Time Limit: 300 PHP Max Input Vars: 6144 cURL Version: 7.61.0 OpenSSL/1.1.0f SUHOSIN Installed: – MySQL Version: 5.5.5-10.1.17-MariaDB Max Upload Size: 100 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 3.4.5 WC Database Prefix: wp_ Total Database Size: 29.54MB Database Data Size: 21.27MB Database Index Size: 8.27MB wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB wp_woocommerce_order_itemmeta: Data: 0.13MB + Index: 0.14MB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB wp_advanced_notifications: Data: 0.02MB + Index: 0.00MB wp_advanced_notification_triggers: Data: 0.02MB + Index: 0.00MB wp_cart_notices: Data: 0.02MB + Index: 0.00MB wp_commentmeta: Data: 0.02MB + Index: 0.03MB wp_comments: Data: 0.09MB + Index: 0.09MB wp_failed_jobs: Data: 0.02MB + Index: 0.00MB wp_followup_coupons: Data: 0.02MB + Index: 0.03MB wp_followup_coupon_logs: Data: 0.02MB + Index: 0.05MB wp_followup_customers: Data: 0.02MB + Index: 0.06MB wp_followup_customer_carts: Data: 0.02MB + Index: 0.03MB wp_followup_customer_notes: Data: 0.02MB + Index: 0.03MB wp_followup_customer_orders: Data: 0.02MB + Index: 0.02MB wp_followup_email_coupons: Data: 0.02MB + Index: 0.02MB wp_followup_email_excludes: Data: 0.02MB + Index: 0.05MB wp_followup_email_logs: Data: 0.02MB + Index: 0.05MB wp_followup_email_orders: Data: 0.06MB + Index: 0.09MB wp_followup_email_order_coupons: Data: 0.02MB + Index: 0.02MB wp_followup_email_tracking: Data: 0.02MB + Index: 0.08MB wp_followup_followup_history: Data: 0.08MB + Index: 0.05MB wp_followup_order_categories: Data: 0.02MB + Index: 0.03MB wp_followup_order_items: Data: 0.02MB + Index: 0.05MB wp_followup_subscribers: Data: 0.02MB + Index: 0.03MB wp_followup_subscribers_to_lists: Data: 0.02MB + Index: 0.03MB wp_followup_subscriber_lists: Data: 0.02MB + Index: 0.03MB wp_links: Data: 0.02MB + Index: 0.02MB wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB wp_options: Data: 2.19MB + Index: 0.06MB wp_postmeta: Data: 11.48MB + Index: 5.97MB wp_posts: Data: 1.31MB + Index: 0.38MB wp_queue: Data: 0.02MB + Index: 0.00MB wp_snippets: Data: 0.02MB + Index: 0.00MB wp_termmeta: Data: 0.05MB + Index: 0.03MB wp_terms: Data: 0.02MB + Index: 0.03MB wp_term_relationships: Data: 0.06MB + Index: 0.05MB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB wp_usermeta: Data: 0.03MB + Index: 0.03MB wp_users: Data: 0.02MB + Index: 0.05MB wp_wcpv_commissions: Data: 0.02MB + Index: 0.00MB wp_wcpv_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB wp_wc_booking_relationships: Data: 0.02MB + Index: 0.03MB wp_wc_deposits_payment_plans: Data: 0.02MB + Index: 0.00MB wp_wc_deposits_payment_plans_schedule: Data: 0.02MB + Index: 0.02MB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB wp_wc_gpf_render_cache: Data: 0.02MB + Index: 0.02MB wp_wc_points_rewards_user_points: Data: 0.02MB + Index: 0.03MB wp_wc_points_rewards_user_points_log: Data: 0.02MB + Index: 0.05MB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB wp_woocommerce_bundled_itemmeta: Data: 0.03MB + Index: 0.03MB wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB wp_woocommerce_exported_csv_items: Data: 0.14MB + Index: 0.02MB wp_woocommerce_gpf_google_taxonomy: Data: 2.02MB + Index: 0.00MB wp_woocommerce_shipping_table_rates: Data: 0.02MB + Index: 0.00MB wp_wpml_mails: Data: 2.52MB + Index: 0.00MB wp_wp_optimisation_sizes_info: Data: 0.02MB + Index: 0.00MB ### Post Type Counts ### attachment: 111 bookable_person: 8 bookable_resource: 10 custom_css: 1 customize_changeset: 19 event_ticket: 17 follow_up_email: 8 jetpack_migration: 2 jp_img_sitemap: 2 jp_sitemap: 2 jp_sitemap_master: 2 nav_menu_item: 28 oembed_cache: 1 page: 31 post: 1 product: 114 product_variation: 993 revision: 81 scheduled-action: 103 shop_coupon: 7 shop_order: 46 shop_order_refund: 3 shop_subscription: 3 wc_booking: 7 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (1) ### WooCommerce: by Automattic – 3.4.5 ### Settings ### API Enabled: ✔ Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: accommodation-booking (accommodation-booking) booking (booking) bundle (bundle) composite (composite) external (external) grouped (grouped) mix and match (mix-and-match) simple (simple) subscription (subscription) variable (variable) variable subscription (variable-subscription) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) ### WC Pages ### Shop base: #3 - / Cart: #4 - /cart/ Checkout: #5 - /checkout/ My account: #6 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Storefront Version: 2.3.2 – 2.3.3 is available Author URL: https://woocommerce.com/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔ ### Templates ### Overrides: storefront/woocommerce/emails/admin-new-order.php ` ```
kloon commented 5 years ago

The issue seems to be related to the use of the get_next_post and get_previous_post functions, they do not support custom orders so Storefront will need to work around that by seeing it we can add some sort of filter in to fix this.

https://github.com/woocommerce/storefront/blob/fbe240c26fcad7126dc93a8b5a520e7213bbd178/inc/woocommerce/storefront-woocommerce-template-functions.php#L716-L718