How to remove duplicate product with same product ID in Woocommerce? - mysql

I updated the database. After the update I was faced with duplicate products in Woocommerce -- even though I didn't have duplicate products in database.
I deleted the transient but it's not fixed. I'd appreciate it if you guide me on how to fix it.
Thanks in advance.
The below block shows the list of active plugins
+------------------------------------------------+--------+------------------------------+----------+
| name | status | update | version |
+------------------------------------------------+--------+------------------------------+----------+
| wc-abandoned-carts-by-small-fish-analytics | active | none | 2.6.2 |
| admin-menu-search | active | none | 1.2 |
| woo-advanced-shipment-tracking | active | available | 3.1.4 |
| woo-auto-coupons | active | none | 1.3.2 |
| better-search-replace | active | none | 1.3.3 |
| bookly-responsive-appointment-booking-tool | active | none | 18.9 |
| bookly-addon-pro | active | none | 3.1 |
| code-snippets | active | none | 2.14.0 |
| commercegurus-commercekit | active | none | 1.1.7 |
| customizer-export-import | active | none | 0.9.2 |
| delete-duplicate-posts | active | none | 4.4.7 |
| elementor | active | none | 3.0.13 |
| elementor-pro | active | available | 3.0.5 |
| essential-addons-for-elementor-lite | active | none | 4.3.6 |
| essential-addons-elementor | active | available | 4.2.1 |
| export-import-menus | active | none | 1.6.0 |
| facebook-for-woocommerce | active | available | 1.9.11 |
| kliken-marketing-for-google | active | none | 1.0.6 |
| jet-engine | active | available | 2.5.2 |
| kirki | active | none | 3.1.5 |
| mailchimp-for-woocommerce | active | none | 2.4.7 |
| one-click-demo-import | active | none | 2.6.1 |
| payment-gateways-by-user-roles-for-woocommerce | active | none | 1.2.3 |
| seo-by-rank-math | active | available | 1.0.52.1 |
| redux-framework | active | available | 4.1.21 |
| google-site-kit | active | none | 1.20.0 |
| smart-variations-images-premium | active | none | 4.0.75 |
| string-locator | active | none | 2.4.1 |
| analogwp-templates | active | none | 1.7.5 |
| transients-manager | active | none | 1.8.1 |
| updraftplus | active | available | 1.16.29 |
| woo-variation-swatches | active | available | 1.1.0 |
| woocommerce | active | none | 4.7.0 |
| woocommerce-advanced-bulk-edit | active | none | 4.5 |
| advanced-product-labels-for-woocommerce | active | available | 1.1.16.4 |
| woocommerce-attribute-images | active | none | 1.2.0 |
| woocommerce-brands | active | none | 1.6.10 |
| woocommerce-composite-products2 | active | none | 7.1.1 |
| woocommerce-currency-converter-widget | active | none | 1.6.23 |
| woocommerce-email-test | active | version higher than expected | 2.1 |
| order-emails-log-for-woocommerce | active | version higher than expected | 2.0 |
| woocommerce-order-status-manager | active | none | 1.9.2 |
| woocommerce-product-bundles | active | none | 6.4.0 |
| woocommerce-sequential-order-numbers | active | none | 1.9.5 |
| woocommerce-gateway-stripe | active | none | 4.5.5 |
| weight-based-shipping-for-woocommerce | active | none | 5.3.7 |
| wordpress-importer | active | none | 0.7 |
| xforwoocommerce | active | none | 1.2.8 |
| yith-woocommerce-pre-order-premium | active | none | 1.5.9 |
+------------------------------------------------+--------+------------------------------+----------+
Also I found I have duplicate product on category page with different price while they have same price in inner pages!

In fact I had two issue. the first issue was duplicate product in product list page, that I figured it out the issue relate the some codes like this:
add_filter('posts_clauses', 'order_by_stock_status');
function order_by_stock_status($posts_clauses) {
global $wpdb;
// only change query on WooCommerce loops
if ( is_woocommerce() && (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy())) {
$posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) ";
$posts_clauses['orderby'] = " istockstatus.meta_value ASC, " . $posts_clauses['orderby'];
$posts_clauses['where'] = " AND istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> '' " . $posts_clauses['where'];
}
return $posts_clauses;
}
I added the !is_admin() to conditions, then It fixed.
Also I had another same issue but this time in categories page. For this case I checked plugins and I figured it out the xforwoocommerce (filter) plugin makes duplicate product with different pricing! :| ( I don't know why! )
I disabled it and it fixed, but I think the root cause is the above code.
Thanks from #benjamin, #grégory-c and #Mtxz!

Related

I have problem with crud in my code and command

when pressing the command php artisan route: list does not appear the addresses to perform the crud in my code.
| | GET|HEAD | / | | App\Http\Controllers\CarController#casa | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | GET|HEAD | crear | cars.create | App\Http\Controllers\CarController#mostrar | web |
| | POST | crear | cars.crear | App\Http\Controllers\CarController#crear | web |
| | GET|HEAD | home | home | App\Http\Controllers\HomeController#index | web,auth |
| | GET|HEAD | login | login | App\Http\Controllers\Auth\LoginController#showLoginForm | web,guest |
| | POST | login | | App\Http\Controllers\Auth\LoginController#login | web,guest |
| | POST | logout | logout | App\Http\Controllers\Auth\LoginController#logout | web |
| | POST | password/email | password.email | App\Http\Controllers\Auth\ForgotPasswordController#sendResetLinkEmail | web,guest |
| | GET|HEAD | password/reset | password.request | App\Http\Controllers\Auth\ForgotPasswordController#showLinkRequestForm | web,guest |
| | POST | password/reset | password.update | App\Http\Controllers\Auth\ResetPasswordController#reset | web,guest |
| | GET|HEAD | password/reset/{token} | password.reset | App\Http\Controllers\Auth\ResetPasswordController#showResetForm | web,guest |
| | GET|HEAD | register | register | App\Http\Controllers\Auth\RegisterController#showRegistrationForm | web,guest |
| | POST | register | | App\Http\Controllers\Auth\RegisterController#register | web,guest |
Routes/web.php
<?php
Route::get('/crear',[ 'uses'=>'CarController#mostrar', 'as'=>'cars.create' ] );
Route::post('/crear',[ 'uses'=>'CarController#crear', 'as'=>'cars.crear' ]);
Route::get('/', 'CarController#casa' );
Auth::routes();
Route::get('/home', 'HomeController#index')->name('home');
Run this command in cmd : php artisan make:controller AddressController --resource
and add this in web.php, Route::resource('address', 'AddressController');
Now, you will get crud list while doing route:list

Why MySQL Group Replication slave nodes have high delay with write node?

MySQL 5.7.17 MGR deploy in single-primary mode, 3 node all one one machine, the same configuration.
And then we test insert on the primary node and observe that the slave nodes have high delay with the write node, even primary node finish the insert test, slave node data is incresing!
Why MySQL Group Replication slave nodes have high delay with write node?
here is the my.cnf:
[mysqld]
datadir=/dba/mysql/data/s1
basedir=/dba/mysql/mysql-5.7/
port=24801
socket=/dba/mysql/data/s1/s1.sock
server_id=1
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:24901"
loose-group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
loose-group_replication_bootstrap_group= off
loose-group_replication_single_primary_mode=true
loose-group_replication_enforce_update_everywhere_checks=false
slave_parallel_type=LOGICAL_CLOCK
slave_preserve_commit_order=1
slave_parallel_workers=4
and the MGR config :
mysql> show variables like '%group_replication%';
+----------------------------------------------------+-------------------------------------------------+
| Variable_name | Value |
+----------------------------------------------------+-------------------------------------------------+
| group_replication_allow_local_disjoint_gtids_join | OFF |
| group_replication_allow_local_lower_version_join | OFF |
| group_replication_auto_increment_increment | 7 |
| group_replication_bootstrap_group | OFF |
| group_replication_components_stop_timeout | 31536000 |
| group_replication_compression_threshold | 1000000 |
| group_replication_enforce_update_everywhere_checks | OFF |
| group_replication_flow_control_applier_threshold | 25000 |
| group_replication_flow_control_certifier_threshold | 25000 |
| group_replication_flow_control_mode | QUOTA |
| group_replication_force_members | |
| group_replication_group_name | aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa |
| group_replication_group_seeds | 127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903 |
| group_replication_gtid_assignment_block_size | 1000000 |
| group_replication_ip_whitelist | AUTOMATIC |
| group_replication_local_address | 127.0.0.1:24901 |
| group_replication_poll_spin_loops | 0 |
| group_replication_recovery_complete_at | TRANSACTIONS_APPLIED |
| group_replication_recovery_reconnect_interval | 60 |
| group_replication_recovery_retry_count | 10 |
| group_replication_recovery_ssl_ca | |
| group_replication_recovery_ssl_capath | |
| group_replication_recovery_ssl_cert | |
| group_replication_recovery_ssl_cipher | |
| group_replication_recovery_ssl_crl | |
| group_replication_recovery_ssl_crlpath | |
| group_replication_recovery_ssl_key | |
| group_replication_recovery_ssl_verify_server_cert | OFF |
| group_replication_recovery_use_ssl | OFF |
| group_replication_single_primary_mode | ON |
| group_replication_ssl_mode | DISABLED |
| group_replication_start_on_boot | OFF |
+----------------------------------------------------+-------------------------------------------------+
32 rows in set (0.01 sec)

Read permission error when adding disk Image to the Images Collection

I'm trying to create and use custom images following this guide and I get an error.
$ gcutil --project=es-cloud addimage elasticsearch-0-90-2 gs://esimage/e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz --preferred_kernel=projects/google/global/kernels/gce-v20130603
It gives:
INFO: Waiting for insert of image elasticsearch-0-90-2. Sleeping for 3s.
+---------------------+-------------------------------------------------+
| property | value |
+---------------------+-------------------------------------------------+
| name | operation-1372347522289-4e0248e924631-f9512254 |
| region | |
| zone | |
| creation-time | |
| status | DONE |
| progress | 100 |
| status-message | |
| target | elasticsearch-0-90-2 |
| target-id | |
| client-operation-id | |
| insert-time | 2013-06-27T08:38:42.289-07:00 |
| user | 338179480470#project.gserviceaccount.com |
| start-time | 2013-06-27T08:38:42.346-07:00 |
| end-time | |
| operation-type | insert |
| error-code | 403 |
| error-message | FORBIDDEN |
| warning | |
| warning-message | |
| | |
| errors | |
| | |
| error | PERMISSIONS_ERROR |
| message | Required 'read' permission for 'rawDisk.source' |
+---------------------+-------------------------------------------------+
I don't understand the error message.
I can read my disk using:
$ gsutil ls gs://esimage
gives
gs://esimage/e4686d7f5bf904a924ae0cfeb58d0827c6d5b966.image.tar.gz
I'm using gcutil 1.8.1.
Did I miss to add a permission somewhere?
Thanks for your help.
Found the issue. I was launching this command from a Google Compute Engine instead of my local machine as stated in documentation.

Nova boot error Devstack

I uploaded an image to glance, an Ubuntu server 12.04 in a vhd format and when i'm trying to boot that image with nova boot i receive this:
+-------------------------------------+--------------------------------------+
| Property | Value |
+-------------------------------------+--------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-SRV-ATTR:host | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | instance-00000004 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| accessIPv4 | |
| accessIPv6 | |
| adminPass | PK2mwUZ7SJEH |
| config_drive | |
| created | 2012-12-19T17:21:48Z |
| flavor | m1.tiny |
| hostId | |
| id | 716c9276-648c-4f90-9e67-43b8f41feb91 |
| image | Ubuntu |
| key_name | key1 |
| metadata | {} |
| name | vm1 |
| progress | 0 |
| security_groups | [{u'name': u'default'}] |
| status | BUILD |
| tenant_id | 73e54a9f1ddc46fa9bd0a99d5e2a1cda |
| updated | 2012-12-19T17:21:54Z |
| user_id | dc9c0376d5604467b3898082fd270b1c |
+-------------------------------------+--------------------------------------+
ubuntu#ubuntu:~/vmware-tools-distrib$ cd /
ubuntu#ubuntu:/$ cd /home/ubuntu/devstack/
ubuntu#ubuntu:~/devstack$ nova list
+--------------------------------------+------+--------+----------+
| ID | Name | Status | Networks |
+--------------------------------------+------+--------+----------+
| 716c9276-648c-4f90-9e67-43b8f41feb91 | vm1 | ERROR | |
| 77aa0d77-2dae-4d18-a827-f08d0fb2f71a | vm1 | ERROR | |
+--------------------------------------+------+--------+----------+
So, what may be the problem??
Thanks!
you can access the database to get the detail reason if there is no obvious information in log file, query nova.instance_faults table will give you more information about why this instance became error status.
look at the nova-network.log if there is an error which is related dhcpbridge file, add that line to nova.conf
dhcpbridge = /usr/bin/nova-dhcpbridge
hint: if there is a builted image(nova list) delete it and then restart all nova-* services

what is the best way to achieve this layout?

I am struggling a bit trying to achieve the following layout.
I have the following divs:
----------------wrapper--------------
| ---------------info-------------- |
| | ----detail-- ---summary-- | |
| | | | | | | |
| | | | | | | |
| | | | ------------ | |
| | | | ----graph--- | |
| | | | | | | |
| | | | | | | |
| | ------------ ------------ | |
| --------------------------------- |
| |
| ---------------info-------------- |
| | ----detail-- ---summary-- | |
| | | | | | | |
| | | | | | | |
| | | | ------------ | |
| | | | ----graph--- | |
| | | | | | | |
| | | | | | | |
| | ------------ ------------ | |
| --------------------------------- |
| |
-------------------------------------
How can I use position and display on my divs to get my page to show correctly?
i have created a sample of what you want.
http://jsfiddle.net/FFU2Y/
Hope it helped.
just try to edit the css of what you like it to be or add div.
Try to use 960.css grid layout !
http://960.gs/
or another way would be using Bootstrap from Twitter, which provides grid solutions, css reset, and many more awesome stylings.
http://twitter.github.com/bootstrap/