How does Magento store deleted products in database - magento

I'm running a script that exports magento products in an xml. I do the query using SQL connections and selecting all attributes. It there a way or how can I find information of deleted products in a magento database?

only way to find out is to have a list of all existing products or products that have existed and compare them against current dataset. Other way would be never delete a product but mark them as out of stock or inactive

Related

Magento: Deleting archived products - Will the products inside orders be affected?

I have a lot of archived products that I would like to delete.
But I am using a function in the frontend where users can see their old orders and what products were bought:
$orders = Mage::getResourceModel('sales/order_grid_collection')
->addFieldToFilter('store_id', $storeId)
->load();
Some of the products in the orders are already archived.
When I delete all archived products, can the products inside the orders still be accessed? Or will I lose those products?
As answered by Marius:
"Normally, the orders don't have only references to the order products, but they also keep product values (that might seam redundant) because you want to see a snapshot of the product you ordered at the time you ordered it.
This way you avoid seeing new prices or descriptions.
The order history section that magento offers by default works even if you delete ordered products.
but if you have a custom code that loads a product collection or a product to get additional info, it will be affected if you delete the products.
If the only code you use is the one you shown in the question you should be save.
I suggest trying to delete the products first on a staging server then do it on live.
and backup before doing anything."
(If you want to upvote, please consider upvoting his answer too)

Magento configurable product - update associated products?

So here's my scenario:
I have a configurable product with ~50.000 associated products.
This needs to be synced on a periodic basis with ERP. (So the ERP sends info about which simple products should be associated to configurable product)
The number of associated products that need to be synced is too large to use the usual Magento function for this:
$product->setConfigurableProductsData($data);
Where $data is the array of products that should be associated to configurable $product.
Anybody aware of a way/function to (programmatically) insert new associations (as opposed to above functions which resets all existing ones) and delete existing associations where needed?

How to change in the Magento DB the prices of the product

I've troubles to figure out how to change the prices of a product in the magento DB.
I tryed to change the prices in the catalog_product_index_price table but the price doesn't change.
There is a website here that explains it in more detail, but the short answer is that you need to change the price in the catalog_product_entity_decimal table and then reindex Product Prices in the backend (and potentially Product Flat Data as well)
Magento uses variety of indexing and caching methods that make simply changing the value directly in the database not a good idea.
If you look, you can see the prices are also defined in the Price Index tables:
catalog_product_index_price_idx
And also the flat tables (if you use them):
catalog_product_flat_1 (number 1 depends on store)
If you're trying to mass update prices, I recommend either using a tool such as Magmi or the built in Magento import methods to update prices. Directly modifying the database is generally not a good idea with Magento, given it's complex database structure.

Is there a way to see which items are not categorized in magento?

Is there a way to see which items are not categorized in magneto on the backend? I know I can pull a report but I was wondering if there was anything easier?
You can use the free Enhanced Admin Grids extension, as the github version allows to add a categories column on the products grid, for which it is optionally possible to filter on products that are not assigned to any category.
Not natively in the Magento backend.
You could run a simple SQL query against your database to grab a list of skus that aren't assigned to a category.
Something like this:
SELECT sku FROM catalog_product_entity
WHERE entity_id
NOT IN (SELECT product_id FROM catalog_category_product)
Which will return a list of all skus not assigned to a category. From there you can save the results to a CSV using your SQL program.

Magento: Revert price data from index. False price data saved, but not indexed

i hope i am able to describe the problem correctly here, as it is quite complex. I guess you guys are my last chance.
We have ca. 120 config products based on 600 simple products. Some days ago, we accidently overwrote all the prices of the simple products with false prices. We did not notice as in the frontend every price is still ok, they are not indexed.
So we now have the correct prices in the frontend, but the wrong prices for the simple products in the backend.
Is there any method the get the prices from the indexed frontend and write them back in the backend?
Until i reindex all proces should be ok in the frontend.
Does anyone have any idea what i could do to get the prices right again?
If you browse the database, there should be a catalog_product_flat_1 table - this is basically your product index. You should have columns for all the product attributes (including SKU and Price) so you could export this table, then do a product export from Magento, then update all the prices/SKUs accordingly and re-import. Or duplicate the flat_1 table, then write a PHP script to loop through it, updating all the prices, then re-index your data (after checking it's worked of course!)

Resources