Why does a category have a weird path defined in the Magento database? - magento

My catalog_category_entity table has an entry for a category that does not appear anywhere in the admin area of the site, or in the front end.
It has a weird path: "/30" (30 is its entity_id). Every other category in every other Magento site I have access to starts its path with a number, not a slash.
It has entries through the rest of the EAV system in various places.
My suspicion is that someone ran a bad import, or other manual process, which left this category in the database, when really it should have been simply deleted.
Is this an anomaly, or is there a reason for this category to have a weird path?

Your suspicion is right. Most probably this is due to a bad import. Normally all paths look like this: 1/2/5/17. The path represents the ids of the categories starting from "root of all roots" (1) and continuing with all the parents and last is the category id. The path is used for displaying the categories in frontend and backend. That's why the category does not appear in any list.
If you have data on that category and you need it, just edit the path field and make it 1/2/30. 2 is the id of the root catalog so it may be different for you.
Then just increment the field children_count for the categories with id 1 and 2.
Back-up your db before trying this.

Related

Configure magmi to import or create categories from multiple columns in magento

Hi i have a csv in which the product categories are in 3 columns .
say column1 == parent category
column 2 = subcategory
column 3 subcategory of column 2
Now can you please tell me how can i configure magmi to import categories from multiple columns.
I am also using a csv (actually, it's a ~ delimited file).
You want to use one column for the categories and separate them by something, but let MAGMI know. I'll explain that part in a bit.
Anyway, my csv file looks like this...
categories~cost~sku
Catalog|Computer Components|DRAM DDR3|> 2GB~154~mysku
So, Catalog is the parent category, then Computer Components, then DRAM DDR3, then > 2GB
If you wanted to add another category - let's say Catalog->Computers->Upgrade Components (not that you would ever have a category for that), you'd do the following
categories~cost~sku
Catalog|Computer Components|DRAM DDR3|> 2GB,Catalog|Computers|Upgrade Components~154~mysku
The | separates the categories in their parent-child relationships.
The comma (why I don't use an actual csv) separates the two different categories you want to add.
Now, for the MAGMI configuration.
You're going to be using the "On the fly category creator/importer". I can't recall if it is installed by default. I believe it is. If not, it's easy to install plugins. Look it up.
Anyway, you'll want that checked off and then click on "configure" beside it.
Set "Assing product to" (you read that correctly) to "all categories in tree"... that is, unless you don't want your products to be added to all the categories in the tree. So, it would add the product to Catalog AND Computer Components AND ..and so on.. If you have this set differently it will only add to the last categories (> 2GB AND Upgrade Components).
Set the "Tree level separator" to |
base category tree will depend on how you have configured yours to work. I include Catalog, which is my base level tree, so I have this blank.
I would suggest keeping the url ending in html
I hope that makes sense and it what you're looking for.
I re-read your question. I think I answered it above, but in a little more detail than you need probably. You can't really have multiple categories in multiple columns and try to import them. The way I described (importing them using a different delimiter) and using the on the fly category creater/importer is the only way I have been able to efficiently gain control over category management with MAGMI. So, create your csv file using a one column method for categories and you should be good. I also suggest using ~ delimited files, rather than comma - comma is used in a lot of other places and would be more prone to issues. For example, if you want to include two stores you would do "store1, store2" and MAGMI will know how to include them. If you forgot the quotes the import might would work fine (with warnings or errors), but it would assume the comma is there to separate different columns and likely throw bad data into other columns, rather than the proper values for that column.
I hope that all makes sense.

How do you query the category id or name in Opencart 1.5.5.1 Joomla 3.3.0

So I am modifying a module and I've successfully queried the product ID. So if I am browsing products and go into the product details page, I can see my product ID using
JRequest::getInt('product_id');
but for some reason I cannot get the category ID. I've tried.
JRequest::getInt('category_id');
and it always comes out to zero no matter what category I go to. Anyone else experience this? I could get it from the nonSEF url but there's gotta be another way. My goal is to basically query the category ID when I am browsing that category or if I am in the product details of a product.
I assume, you're using some OpenCart component for Joomla. In this case, you have to look into controller and model files for OpenCart. It's not THAT easy to get certain values sometimes, because these are 2 different engines.
In short, you may have to use VQMod for OpenCart, add category_id to data array and only then JRequest it. Solely depends on task.

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.

Magento creating invoice redirect to wrong url

When I create an invoice from the order in the backend, this on this url:
http://www.site.com/index.php/safe/sales_order_invoice/new/order_id/4372/
But when the Invoice is about to be created it goes to:
http://www.site.com/shop/safe/sales_order/view/order_id/4372/
You see the (Shop), which is mostly correct because the storefront is named that(We had 2 storefronts once) If I remove the (Shop) part from the url, I'm getting back to the correct page and it shows that the invoice was correctly created. This only happens from the Order itself. If I use Mass action to create invoices from the orders list, it's not giving me any problems.
If anyone else has the problem (Using multi stores)
Please check your database, core_config_data and see if web/secure/base_url etc. is redirecting to the right path. And make sure to check that it's doing so for the right store ID that is giving you the trouble.
My problem was that the secure path for one of my stores, was ruining it.
All works fine now!

404 error when switching between stores when in a category on magento

My magento website has 5 store views. When we are in a product in English and select French, it redirects correctly and show the product in French. But when it comes to categories, it doesn't work at all.
I'm on a category with the url http://myweb.com/en/body-care, if I change to the Spanish view, it doesn't redirect to the url "../cuidado-del-cuerpo" it just goes to to http://myweb.com/es/body-care and shows a 404 error (it changes the 'en' for 'es', but doesn't change the last part of the url).
The rewrite is not defined on the URL Rewrite Management section. I have 5 categories and 5 store views, so it's not a good idea to create the rewrites rules manually.
How can I solve this? Why the rewrite rules were not written when we created/modified the url of each category?
1) Can you check if the urlkey is definable on store view level, or if it is set to website level? That way, you can only create 1 url key for EN and ES. You need it to be at store view level, do define 2 separate values.
2) Is there something in your error log? (and is your error log turned on?) Normally url rewrites are created automatically for each store view. If not, you may need to manually reindex.
It's hard to give further advice, since the problem could be anywhere (conflicting module? bad code?)

Resources