woocommerce update/create/delete simple products - php

I have 20,000 products that I need to import form one database to woocommerce database.
I created a table in the database and loaded all products on to that table within 2 min. No problem.
Then I used the Woocommerce 3.0 CRUD method as per https://www.webhat.in/article/woocommerce-tutorial/creating-simple-product-using-woocommerce-crud/
This only updates 1500 products then it times out.
What I'm I doing wrong and how can I update or Create 1000's of products without timeout

Related

How to remove out of stock woocommerce products?

As the title describes i want to delete all the out of stock products from my woocommerce eshop at the end of the day. Every day morning i import 6000 products with their images from another server and 600-700 are out of stock. So every day i upload 700 trash in my server and i have to delete manually at the end of the day cause server data limitations. I found these related questions
How to move out of stock product to trash Woocommerce?
Woocommerce delete products which are "Out of stock"
but the problem is that if i run one of these sql codes in functions.php file the products can be deleted but the thumbnails and images of the products are remain in my server and i have to delete manually.
I would prevent the out or stock products from being imported in the first place?
How are you importing these products in the first place? The import takes place, usually via a CSV which can contain as little or as much information as you require. One column is called 'In stock?' with either a value of 1 for in stock, or 0 for out of stock.
So in your import file you can just remove the products that have a value of 0 for 'In stock?' and then carry on as normal. That way no images etc will be imported.

What is the most efficient way to search WooCommerce database for products by unique ID and check if product exists or not?

Suppose you work with a 20,000 product database and you need to check if a product with each unique ID exists in the database or not. Rather than loading 20,000 products in PHP memory, what is another way to check?
Can you load the 20,000 products in batches of 1000 products and check without having the memory explode?
In other words, how can I get the first 5000 products out of 20,000, then load the next 5,000, and then the next?
Is there a way to batch?

Cannot Export Import Products on Backend Magento

I've tried to export products + category from X magento to Y magento with this https://www.siteground.com/tutorials/magento/import-products.htm
FYI, the exported files are correct, even XML or CSV type.
But, i found error when i importing it. it says i found 84 rows, but it's only Imported 1 records, when i check the Manage Products, none of products is imported. I tried on CSV and XML files, the result are same.
The magento version of both are similar, any possibilities to debug it?
In your import process 84 records means there is 84 lines in your csv file not 84 products!
I guess you're using just one sku for all of your products and that's why you have just one imported product. It's good to know that
magento uses sku as ID to identify products, so you need to assign an unique sku to every single product.
Update:
To insert new products by CSV Import check this columns in your csv file.
Required Product Attributes for New Products (written as they should appear in the CSV file column):
sku
Stock Keeping Unit - a unique value to identify the product. No two items can share the same SKU in Pixafy.
_attribute_set
Unless you have already set up Attribute Sets, set this to "Default"
_type
What type of product is this? Your options are: simple, configurable, virtual, and downloadable. Grouped or bundle products can not be imported at this time and must be created in the Control Panel.
name
The product's name- such as "Magic Wand". This should not be longer than 60 characters
description
The long description with detailed information regarding the product.
short_description
The shorter description that appears to the right of the Product Image on the Product page
price
The amount you are charging your customers for this product before sales or discounts.
status
Is the product Enabled or Disabled? Enabled is 1, Disabled, 2
visibility
How will the customer be able to view this item?
Visible in Catalog and Search = 4
Visible in Catalog =2
Visible in Search = 3
Not visible individually = 1
tax_class_id
Tax Class ID as set up under Set Up > Tax > Product Tax Classes. By default, Taxable Goods are 2
weight
Enter a numerical value for the weight of this product. This will be used by any calculated shipping methods.
_product_websites
At this time, your only option is base
Update 2:
To learn how to add product images to your csv file, read this post:
Update Magento products with multiple images

Magento product delete not working

I am using Magento 1.7.0.2 and have encountered a problem when deleting products. I create 20 products in a clean install of magento using the product import routine. The products where assigned to categories, and had images associated with them. The products displayed perfectly.
I then went in to the back end and deleted the products by selecting them from the product grid and choosing delete. This worked fine on the face of it and the products disappeared from the products grid.
I then attempted to re-import the products using the same format import file with some slightly different descriptions ect (SKU's were the same as previously) and I get an error saying that the SKU must be unique.
I have attempted creating a simple product in the back end with several of the now deleted SKU's and I get the same error - sku must be unique.
I have noticed that if I go into the category within the back end the deleted products are still listed against the category - I cant un-associate them as the products are not visible in the product list.
The products are not visible within the store,and I have tried the following:
refreshing the indexes and deleting the cash multiple times
Using the mage api to try deleting the phantom items - this just errors as stock item not found
Tried using the Mage and Soap API's to re-create the item, but get the same SKU must be unique error
Does any body have any ideas? I assume it should be possible to delete an item from the product list and re-create it?
If I cant fully delete the item is there a way for me to un-delete it? so I can then just update the profile?
I don't know why SKU still exists in your system after delete products. But you can solve your problem by execute SQL statement bellow:
DELETE * FROM catalog_product_entity WHERE sku='XXXX';

Where are magento 1.5 product reviews stored?

In my magento 1.5 webshop I've re-created some products because it seemed the easiest way to convert configurable products to simple products.
anyways, now I want to move the reviews to the new products but i cannot find them within the database.
Does anyone know where they are stored so that i can move them to the correct products?
-thank you
The table you're interested in is review. This table holds the relationship between the review itself and the product. The review table has a column named entity_pk_value that references the primary key of the product being reviewed.
Replace the value in the entity_pk_value column with the new product id and all of the reviews should be moved across.

Categories