Magento - setting url key in csv leads to 404 page - magento

I have a lot of products which need to be uploaded via csv in Magento. I have for example two attributes with values:
url_key
mypage
url_path
mypage.html
I have also tried the values the same, but when I upload them the products exist but always leads to an 404 error when trying to view their product page.
Is there somethig I'm missing out in the csv?
I'm using Magento 1.7
Thanks in advance.

Are you trying to have a different URL that the Product Name?
EG Product ABC, Magento would make the URL key product-abc and URL Path product-abc.html by default.
If that is your goal then you can leave those 2 columns blank on your import and Magento will apply this rule. Also be sure to re-index after you import.

Step 1 : Leave both column (url_key and url_path) empty and upload csv file
Step 2 : After succesful importing csv file, go to System -> Index Management :
Click on Select All and click on Submit.
It is very simple way. I tried and got result.

Related

Magento 1.9 Missing products

I have imported 16990 products to my website via Import All products Profile
Its divided info 9 files
8 files contains 2000 products
and 1 file contains 990 products
All files imported successfully with no error messages
After checking the total number of records from catalog, about 1500 products are Missing
I have double check the CSVs files its correct with no issues
Could you please help me to explorer the issue?
Well, I have prepared a workaround for this problem. First of all, check if your missing products are showing in the database. If yes, try to do the following:
Sign in to Magento Admin Panel
Go to Catalog > Manage Products
Your current URL will look like this:
yourdomain.com/index.php/admin/catalog_product/index/key/[your_key]/
Change your URL to:
yourdomain.com/index.php/admin/catalog_product/edit/id/[product_id]/key/[your_key]/
You can find the product_id in the database. When you enter this URL, you will be able to edit the product. Now, check product attributes and make sure that you check all the values which are empty or not filled properly. In this way, you can clearly see all little mistakes by the Values in the CSV.

Attribute not changing in frontend

I created an attribute and include it in my attribute set. The attribute is Multiselect with 6 different values. Now when i import my csv with the value for the sku everything looks fine on the backend, the product shows the attribute with the value assigned from the csv file but does not show anything on frontend, not even after reindexing and cleaning cache.
It will only show if i open the product and save it. Not changing anything other than what the csv file already changed. Then it will show on frontend.
Now... in my csv file i'm only have sku, attribute_set and Type which is the attribute i need to change.
Any ideas what's going on here?
Try the following after a new import of products.
Check your csv file and confirm that you're importing product options in Magento format:
Open the attribute:
admin/catalog_product_attribute/edit/attribute_id
and ensure its visible on the frontend and set to global.
Ensure that the reindexing for product attributes is ready/done:
/admin/process/list/
Flush cache
/admin/cache/index/
Delete cache folders in
root/var
If that fails to work, do what I did. Export a current product that has the attributes you wish. Change the attributes/sku and reimport the same file back in.
I tested the following file for color: Green and it updated instantly:
sku,_store,_attribute_set,_type,_category,_root_category,_product_websites,color,cost,country_of_manufacture,created_at,custom_design,custom_design_from,custom_design_to,custom_layout_update,description,gallery,gift_message_available,has_options,image,image_label,manufacturer,media_gallery,meta_description,meta_keyword,meta_title,minimal_price,msrp,msrp_display_actual_price_type,msrp_enabled,name,news_from_date,news_to_date,options_container,page_layout,price,required_options,short_description,small_image,small_image_label,special_from_date,special_price,special_to_date,status,tax_class_id,thumbnail,thumbnail_label,updated_at,url_key,url_path,visibility,weight,qty,min_qty,use_config_min_qty,is_qty_decimal,backorders,use_config_backorders,min_sale_qty,use_config_min_sale_qty,max_sale_qty,use_config_max_sale_qty,is_in_stock,notify_stock_qty,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,stock_status_changed_auto,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,_links_related_sku,_links_related_position,_links_crosssell_sku,_links_crosssell_position,_links_upsell_sku,_links_upsell_position,_associated_sku,_associated_default_qty,_associated_position,_tier_price_website,_tier_price_customer_group,_tier_price_qty,_tier_price_price,_group_price_website,_group_price_customer_group,_group_price_price,_media_attribute_id,_media_image,_media_lable,_media_position,_media_is_disabled
3,,Default,simple,,,base,Green,,,"2015-03-12 00:00:23",,,,,1,,,0,no_selection,,,,,,,,,"Use config","Use config",1,,,"Product Info Column",,9.9900,0,1,no_selection,,,,,1,2,no_selection,,"2015-03-15 17:44:00",1,1.html,4,1.0000,555555.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,,1,0,1,0,1,0.0000,1,0,0,,,,,,,,,,,,,,,,,,,,,
4,,Default,simple,,,base,Green,,,"2015-03-12 00:02:16",,,,,2,,,0,no_selection,,,,,,,,,"Use config","Use config",2,,,"Product Info Column",,14.9900,0,2,no_selection,,,,,1,0,no_selection,,"2015-03-12 00:02:16",2,2.html,4,2.0000,423555.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,,1,0,1,0,1,0.0000,1,0,0,,,,,,,,,,,,,,,,,,,,,
Explore if another extension is interfering with your import. If you can, try to test on a vanilla installation.
If attributes are still stale after doing so I strongly recommend you explore Magmi product import to avoid such squirrel-ly vanilla magento import behaviour:
http://sourceforge.net/projects/magmi/

Magento with Magmi - Remove unwanted numbers on product update

After updating our 6k+ products in Magento 1.7 using CSV import with Magmi the url_keys for all product get 4-digit numbers as suffix.
e.g. before it was www.domain.com/productname.html
after update it's www.dmain.com/productname-5363.html
This happens although the url_key in CSV is set as "productname"
Only way to fix it is to clear all urls from database and reindex - but after next import it's happening again.
Has anyone an idea how to prevent this on import?
The number suffix will be added when one or more url's get the same url. Since that is not possible Magento adds the suffix. Do you know if this occurs?
You try to make product names unique before processing. For example adding a color or a model or something else from your datasource
Or you could automate the step of emptying and reindexing the core_resource table (also take a look at the Magmi plugin On the fly indexer)

Products are not displaying in Frontend after import in Magento

I have imported products using System - Import/Export - Import option.
I can see my products in Admin panel, but not in Frontend.
I tried Re-indexing, cache clear, cache refresh, physical cache remove.
also checked product stock status, availability etc. Everything is ok.
But they are not displaying in frontend. I marked onething, If I open product that I imported using csv, just saved without any change, it starts displaying. But I have 100s of products. So I can't use this solution.
So please help me where I am going wrong in csv. below is my csv screenshot.
You need to ensure that the products are attached to a website.
This can be done via a bulk update:
Access the product listm select all
Alter attribute
Products information -> websites
It can also be done in the csv by using a "_product_websites" field and setting it to the website name or 'base'.
I forgot which CSV columns are mandatory but I do remember that if some are missing the importer does not tell you that but instead you get the behaviour that you are describing.
The simplest way to find out what is mandatory is to:
Fix bugs in Magento ImportExport module
Create a new product in admin
Check that the new product is visible on front-end
Export the new product with Magento ImportExport exporter
Delete created product
Import the previously exported product csv
Clear cache and reindex data
Check that product is visible on front-end (it should be)
Compare your CSV with the exported one and try to figure out what is missing from it
Try to import your CSV with added/fixed columns and add data untill the product is imported so that it is visible on front-end
This requires allot of trial and error...
The missing columns in my case had always the same value so if this will be the case with your problem as well you can simply extend CSV importer and hard code those values in there instead of fixing your CSV manually.
Since your product gets saved correctly if you open it in admin and save it you can also:
Import a product
Export that product
Open that product in admin and save it
Export newly saved product
Compare exported CSV-s where they differ
Fixing Magento ImportExport bugs:
First bug is that if you import multiple products the quantity informatino from the first product is used for all the products. To fix this you have to add $row = array(); right before $row['product_id'] = $this->_newSku[$rowData[self::COL_SKU]]['entity_id']; in Mage_ImportExport_Model_Import_Entity_Product::_saveStockItem() function.
The second bug causes Magento ImportExport module to return a foreign key constraint error when importing multiple products. Error happens because magento splits products data into multiple segments and if one product is located in two segments importer will delete data that was imported for the product in first segment before importing the second segment thereby causing database corruption (see this link for detailed explanation - this is where I got the solution below).
Note that removing foreign key constraint will not fix the problem but will instead make it worse since the database will contain corrupt data.
To fix it you have to change the code in Mage_ImportExport_Model_Import_Entity_Abstract::_saveValidatedBunches() function:
After if ($startNewBunch || !$source->valid()) { add
if ($startNewBunch && count($bunchRows) > 1) {
$arrKeys = array_keys($bunchRows);
$arrNew = array();
while(($tRow = array_pop($bunchRows))) {
$tKey = array_pop($arrKeys);
$arrNew[$tKey] = $tRow;
if ($tRow['sku']) {
break;
}
}
$nextRowBackup = array_reverse($arrNew, TRUE) + $nextRowBackup;
}
Hope this helps.
I had the same problem recently and I spent some time tring to figure it out...
Looks like magento needs a status flag for every product otherwise magento will not show it in the dashboard.
Solution : add a "status" column to your CSV file and set all the statuses to "Enabled"
(yes it's not a boolean. Just use the string inside the quotes as it is :)
I was stuck with the same problem, i then visited my var/export/export_all_products file, downloaded it again and uploaded the same back through import, logged out of my account and logged-in back, all products were back. This worked as a backup for me and i could see all the products back at the back-end.
Import as you have. If they are enabled, but not showing...
then you can fix this by clicking "select all" products in the "manage products" table and then "change status" and then select "enabled." This process might take a minute.
Visit your store and you should see your frontend with products.
Some kind of bug with the status/enabled setting.
You must have next fields in CSV
sku
_attribute_set
_type
_category
description
image
name
price
short_description
status
tax_class_id
thumbnail
visibility
weight
qty
_product_websites
is_in_stock
Please note that field is_in_stock is mandatory even if qty more then 1
In magento 2 we need to reindex in index management to display the products in frontend.
We can reindex through cmd.like the given example we need to enter magento file directory after that cmd php -f bin/magento indexer:reindex to reindex .
When I first started importing products via csv although I set the product to enabled, I figured out that even though it shows in the magento back end as enabled, it actually isnt - think its to do with setting the field contents as "1" or "0" rather than "enabled" or "disabled/null".
To get around this, after a import I simply selected all the products in the back end and change status to enabled - it fixes issue.
But, I do think if I simply changed the data in the csv import it would save me this minor in-convenience.

why magento using other product's url key for url rewrite

I am using magento 1.7. i am faceing strange problem. magento making duplicate product url with random number with wrong url key please my attached screenshot
I also empty table rewrite_urls and reindex urls but still i am getting wrong urls. please help me to solve this problem. if you are unable to view images in question then please click on links duplicate product urls and Product in admin panel
,
Let me make understand u with example
Like i have one product named "example" and url key is "example" Url will be
www.example.com/example
and now i have created new product "xyz and url key is "xyz" and url should be
www.example.com/xyz
but magento generating url
www.example.com/example-123
This seems to be a bug in 1.7.
If you have multiple simple products with the same url key as the configurable product (e.g. all names are the same), than magento always creates a new url rewrite on every index process.
Example:
First index:
myproducturl (config product)
myproducturl-id (simple product with its id appended, so far so good)
Second index:
myproducturl (config product)
myproducturl-randomnumber (simple product with random number, BAD)
myproducturl-id --> myproducturl-randomnumber (rewrite to the new url)
And on every new index process the last step will be repeated, so always a new random url key is generated.
If magento would check, that a url key with the id for that product already exists, this should be no problem.
After a few months, you will have a really big url_rewrite table, because nothing will be deleted and on every run, at least 1 record for every product with the same url key will be created.
I was able to eliminate the extra numbers at the end of the URLs by truncating the table "core_url_rewrites" (I made sure to make copy first) then reindexed it.

Resources