Some products disappeared from magento backend and frontend - magento

Some of the products in Magento have suddenly disappeared from backend and frontend. When I try to re-create these products I get this error:
The value of attribute "SKU" must be unique
So the products must still exist somewhere in the DB.
I already tried the following without luck:
Truncate all catalog_product_flat tables
ReIndex all indexes
Refresh all Caches
Checked the "status" attribute of the product in Mysql (it was set to 1)
Any ideas how I can get these products back in the frontend/backend?

Try checking the following tables:
catalog_product_entity
catalog_product_entity_datetime
catalog_product_entity_decimal
catalog_product_entity_gallery
catalog_product_entity_group_price
catalog_product_entity_int
catalog_product_entity_media_gallery
catalog_product_entity_media_gallery_value
catalog_product_entity_text
catalog_product_entity_tier_price
catalog_product_entity_varchar
You can find the sku in the catalog_product_entity table.

Related

Laravel - Please advise on table name

I am in trouble with the name of the pivot table.
products ... Product master table
shop ... Shop master table.
shop_sales ... A table that links products and dates. It leads to another table. The column is date and shop_id.
I want to add a table to shop_sales to manage products and the number sold.
shop_sale_products vs product_shop_sale
Does laravel recommend product_shop_sale?
thanks.

magento 404 on cms page in adminhtml in module cms->page

I have trouble when I click on Admin -> CMS -> Page and I get 404error. Maybe any body had this error early? How to debug router in magento? and i think this is community or local extensions.
I explain the error she code
in app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid.php
$collection->setFirstStoreFlag(true);
when, application get first store for get all pages on the first.
after if first storage in table cms_page_store not exist in table core_store then I get error and 404 error not found.
How to fix I run two queries on my mysql server first delete all not exist store in table core_page_store by this query
delete from `cms_page_store` where `store_id` not in(
select `core_store`.`store_id` as `id` from `core_store`
);
and delete all page in not exist store from cms_page by this query:
delete from `cms_page` where `page_id` not in(
select `cms_page_store`.`page_id` as `id` from `cms_page_store`
);
and finish it's work, please if you read the answer you need create dump table cms_page_store and cms_page for repair the table if you make error.

value of custom product attribute is not storing in database table

I am new in Magento and I am using 1.7.2. I added one product attribute called product type name. It is a drop down field and values are populated from a different custom table called product_type_name. I have done successfully so far. Now I want to store the value of product type name into DB Table while adding a product. For that I have added a column product_attrb_type_name(attribute code) in catalog_product_flat_1 table.
Now while trying to add the product, it is showing the following error
SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''
Also while trying to edit a product, the values are not set in the product entry form.
How to fix this issue? Could you please help me?
Thanks in advance.
Magento uses EAV table structure, so once you add a attribute they are stored in eav_attribute table with specific entity type (4 for product).
Now when you load a product object, say
$product = Mage::getModel('catalog/product')->load({{entity_id}}) , where entity_id is your product id,
you can use get and set function on this object to set the values of the particular product instance, i.e.
$product->setProductTypeName('someValue'); in your case a a dropdown ,so
$product->setProductTypeName(attributeId);
$product->save();
and get by
$product->getProductTypeName();
You do not have to insert in catalog_product_flat tables, that is Magento way to normalize data into flat tables.
Hope it helps!

Tables involved in storing order information for a certain product in magento

What are the Tables involved in storing the information of an order.
For example: Customer - product purchased - etc.
I found the product purchases status etc.(invoice and sales tables) but having hard time in linking it to the customer. Could not find who bought what ? Any suggestions
Thanks
The table sales_flat_order has a field customer_id referring to a row in the customer_entity table. But remember that some orders are guest orders, and they are not associated to a customer account. In those cases customer_id is null.
The products (line items) for an order are stored in sales_flat_order_item. There's an order_id linking it to the order and a product_id linking it to the product.

Magento Products Ordered Report

I'm struggling with the Magento report for "Products Ordered".
Is the Ordered Quantity affected by the date filter? Why do some of the products show as 0? Where does Magento keep the ordered_qty data? I am using Magento 1.4.0.1.
Magento keeps record of all items sold in sales_order_entity, which you can retrieve like this:
select * from sales_order_entity where
entity_type_id = (select entity_type_id from eav_entity_type where
entity_type_code = 'sales/order_item'
);
By grouping by entity_id and counting the result, you can get an accurate total of the quantity_sold for a date range. You can see how Magento does this in Mage_Reports_Model_Mysql4_Order_Collection. From the code, it appears that Magento does in fact respect the date parameter.
Just to be clear, this means that there is no single place where you can retrieve an "ordered_qty" number without more complex queries. The most obvious reason some products show as 0 is that they haven't sold anything.
In v1.4 and up, you should be able to query the sales_flat_order_item table and then group and sum on qty_ordered. e.g.
select product_id, sku, sum(`qty_ordered`) from sales_flat_order_item group by product_id
Cheers,
JD

Resources