исправить способ сортировки товаров wordpress
Есть товары *В наличии* и *Под заказ*.
Суть заключается в сортировке товаров, когда нажимаешь на какой-то бренд, открывается страница с исходящей сортировкой товаров *сначала в наличии*, а потом уже идут товары те, что под заказ.
Добавлен код, который берет данные из атрибутов доставки (1-2 дня -- это значит товар в наличии; 10-20 рабочих дней -- это товар под заказ).
Проблема в том, что сверху выводится только часть товаров (в наличии), другие где-то теряются в середине.
В чем ошибка может быть?
Код:
/************* Добавляем сортировку по атрибутам **************/
/**
* Определяем критерии для сортировки с опциями, определенными в методе ниже
*/
add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args');
function custom_woocommerce_get_catalog_ordering_args( $args ) {
global $wp_query;
// Меняем $_SESSION на $_GET
if (isset($_GET['orderby'])) {
switch ($_GET['orderby']) :
case 'pa_dostavka' :
$args['orderby'] = 'meta_value';
$args['order'] = 'ASC';
$args['meta_key'] = '';
break;
endswitch;
}
return $args;
}
/**
* Добавляем способ сортировки в выпадающий список
*/
add_filter('woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby');
function custom_woocommerce_catalog_orderby( $sortby ) {
$sortby['pa_dostavka'] = 'В наличии';
return $sortby;
}
/************ Конец сортировки ***************************/
-
208 Добрый день.
Ознакомилась с ТЗ, готова выполнить для вас данную работу. Пишите, буду рада сотрудничеству! Имею уверенный опыт в WordPress.
Более точную стоимость и сроки можно будет установить после детального рассмотрения проекта.
С Уважением Екатерина.
https://haltentech.com/
Skype: haltentech
+380 97 478 77 66 (WhatsApp, Viber, WeChat, Telegram, LINE).
-
1060 45 0 Во-первых, у вас пустой ключ для сортировки. Во-вторых, в WooCommerce сортировка по числам (там же сравнение по срокам доставки, верно?) происходит иным образом. Готов взяться за задачку прямо сейчас, пишите, постараюсь решить в течение двух часов.
-
10689 591 6 10 Готов взяться за работу, пишите, сделаю все качественно! Опыт работы уже больше 8ми лет!
Current freelance projects in the category Content Management Systems
Development of a WordPress + WooCommerce online store# Development of an Online Store for Agricultural Equipment The design mockup is currently in the final stages of development. I fully understand that without a ready mockup, the final estimate will be inaccurate. However, if you have already implemented similar e-commerce… Content Management Systems, HTML & CSS ∙ 2 days 6 hours back ∙ 75 proposals |
Integration needed: KeyCRM → Cash Register KashalotIt is necessary to set up integration between KeyCRM and the Cash Register Kahalot. When placing an order in KeyCRM, the data must be automatically transmitted to Kahalot: • order information • products, nomenclature • prices • quantity More details in private. Content Management Systems, PHP ∙ 2 days 16 hours back ∙ 28 proposals |
I am looking for a WordPress/Elementor/Woo specialist who has extensive experience with the Woodmart template.
112 USD
It is necessary to update the visual design and structure of the online store for dental products (link will be sent in a private message). The site operates on the WordPress + WooCommerce framework. The template is Woodmart. Tasks: Update the header, footer, and content on… Content Management Systems, HTML & CSS ∙ 3 days 20 hours back ∙ 37 proposals |
No applications are coming to TG ocStore (OpenCart)Requests from the online store to Telegram have stopped coming. There are 5 websites hosted on the same server, the version of the engine and modules is the same, but a few weeks ago, requests stopped coming to TG from all sites (the TG bots and groups are different). Requests… Content Management Systems, Web Programming ∙ 3 days 22 hours back ∙ 66 proposals |
Integration of HubSpot with lead generation sources (Perspective, WordPress, Meta Ads)
90 USD
Good day! Project goal: To build end-to-end automation for lead collection from a multi-platform ecosystem into HubSpot CRM. It is necessary to ensure the creation/updating of contacts and the automatic opening of deals while preserving the full attribution chain of traffic… Content Management Systems, Data Processing ∙ 4 days 2 hours back ∙ 18 proposals |