I was wondering if anybody has ever tried to mass import custom attributes into a Magento Database before? My client has a Magento store that specialises in selling musical instruments, and wishes to add a Google Shopping Feed (using the extension of that name by Rocket Web) to sell the products on Google Shopping. The problem is that i need both an MPN (Manufacturer Product Number) and a Brand (so for instance Gibson) for the shopping feed to work, both of which are not automatically uploaded by the stores POS system.
The way that the POS system currently works is when a product is added, the title / SKU number / description / price etc are all uploaded to the Magento store, which means the client does not need to add the product twice. The problem is that as MPN and Brand aren't necessarily out of the box attributes, the POS system does not upload either of these to Magento, and therefore I now have 1,000 products without them and they are apparently crucial to the Google Shopping Feed extension.
I'm currently working on getting a table of each of the products SKU, MPN and Brands from the local database of the POS system (of which each of the products has all 3), but once i have it my question is this: is there a simple way for me to reference the products currently in the Magento database (most likely by SKU, as both databases contain the same SKU for each of the items) and apply two custom fields to each of the products: MPN and Brand? I've created custom 'MPN' and 'cat-brand' attributes (which i can use the Google Shopping Feed to map to the custom attributes) and looked inside the Magento database but i cant find them anywhere, but i found a table called 'catalog_product_flat_1', which i imagine is a flat DB used for indexing or something, but it looks perfect for achieving what i want, in that i could easily search for SKU and apply two custom attributes as columns for each product. Something tells me it isn't going to be that easy though.
Any thoughts would be a great help, thanks for your time.
Magento uses an EAV data model, which means your attributes are broken up into multiple tables. Take a look at any tables with 'entity', 'eav', 'attribute', or 'value' in their name if you want an idea of how it all works.
What you're probably looking for is catalog_product_entity_varchar or catalog_product_entity_text. In those tables, entity_id is your product ID number (different from SKU, but you can link a product_id to a SKU) and attribute_id corresponds to the eav_attribute table.
In short, what you want to do is look at your eav_attribute table, pull the entity_type_id, attribute_id fields for your MPN and cat-brand attributes you made, and then you can insert your data into catalog_product_entity_varchar. (or _text if your attributes use that instead)
Related
Does anyone have any previous experience or ideas on how to proceed in the product filtering section by category on the e-commerce site?
Because the filter field in the left menu will vary according to the product category. The memory filter should appear in the phone category, but the body (S,M,L) filter should appear in the t-shirt category. The project was built in Laravel. Options and option values models are available. Should the option_id be added to the category table and set accordingly or manually?
Thanks in advance.
You can use pivot table for this purpose. If each category has its own filters and you have a filter table (you name it option here), you must create a pivot table like category_option to store categoty_id and option_id. This will help you when building filter menu in category page. Next use another table to store product_id, option_id and value for that option to store values for each individual product.
i have a huge product table, this is its simplified structure:
ID|SHOP|...|MPN|PRICE|CLICKS
i can have the same product coming from different shops, every shop have its own product ID, but (if the shop support it) the MPN for same products is the same.
when i query the database for products, order them by clicks, and if there is the same product from multiple source it is showed twice.
Since im ordered by clicks, the two "equal products" can be far from each other, so its quiete intensive to elaborate it at runtime (consider also the result are paginated and the two equals could be in differente pages).
i was thinking about a query that (if there are multiple result of the same mpn) duplicate some columns as needed (but them how my software can know about the dynamically created columns), i was thinking about SELF JOIN but i don't know how many shop can carry the same product (maybe i can assume all the shop i use...)
My main problem is in search (or category) result where i have a list of products with the "BUY AT SHOP FOR PRICE" button that redirect to the shop... my goal is to have more button to BUY if the product (equal by MPN) have duplicate.
I can keep clicks aligned for both product when a user click on the buy button and maybe it would help
Product detail page is not a big deal, since i have a single product i can get all other instances of it by MPN and it is quiete easy
Any suggestion?
to clarify a bit more i just added this:
https://www.db-fiddle.com/f/61MMDBX4aRqtUFcwVk7Ujw/5#&togetherjs=oO3r8FlaAJ
it shows a simplified versione of my database structure (at the moment products with same MPN can have different click number, but i can keep them in sync)
this is a sample of frontend
https://www.puredesign.it/catalog/male-Scarpe/
my goal is to have multiple "ACQUISTA SU" button if the product can be found in more shop (i.e. same MPN on different product)
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
In a normalized database schema, the manufacturers would have their own attributes like, for example, name, description, address, phone number.
The manufacturer description is something that is useful for the product pages. Many ecommerce sites show a manufacturer description on every product page.
As far as I know, in Magento you would have to create a product attribute, "Manufacturer description" or something like that. If, for example, ABC Corporation has 1,000 products, you would have to update all 1,000 every time you changed your description for ABC Corporation.
Is that the only reasonably easy way to do it?
Or is there a more database normal way of doing it, where a single, atomic update would result in all the manufacturer's items showing an updated value on the front end?
Create a module with the following contents:
setup script that creates a manufacturer table like desired
model and resource model classes for manufacturer
grid to manage the manufacturers (this is quite complicated, you should follow a tutorial like this or copy the basics from another module)
manufacturer block and template to render HTML for manufacturer info. You will use it as frontend model for the manufacturer_id attribute (see below)
setup script that adds a product attribute manufacturer_id
source model for the manufacturer id, so you can select the manufacturer from a dropdown instead of typing in the id
To display manufacturer description on product page without using product attribute you need to create new table "manufacturer_info" and this table contains information of manufacturer id as well as description.
Table is something like this
manufacturer_id | description
To add description, you need to create new module which will display all the shop brand s and description in grid. When you edit manufacture one form will appear and in that form add description and save it to database.
After saving description, You can display it on product page based on manufacture_id.
To get current manufacture use following code
$_product = $this->getProduct();
$manufacturerName = $_product->getAttributeText('manufacturer');
$manufacturerId = $_product->getManufacturer();
Use manufacturer_id for getting description from newly created table
I hope this helps.
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.