Page 1 of 1
SEO URLs only showing products from one category
Posted: Sat Mar 26, 2011 4:36 am
by neosdesign
I've just turned on my SEO URL function. The URLs display properly, however I am experiencing a bug where I can only view products from one category.
All the category pages still view properly with the right information. But when I click to view a product in category 20, I get a product from category 25. This happens regardless of what category I am in. I only load products from category 25.
If I turn SEO URLs off, everything goes back to normal and I can view all products, everything is linked perfectly. My seo keywords are setup as "store/category/product-name" and here is my htacess file:
Code: Select all
# Options +FollowSymlinks
# Prevent Directoy listing
# Options -Indexes
#
# # Prevent Direct Access to files
# <FilesMatch "\.tpl">
# Order deny,allow
# Deny from all
# </FilesMatch>
# SEO URL Settings
RewriteEngine On
RewriteBase /wallpapers/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
I did not change any other files before activating SEO URLs. My store is installed in the /wallpapers directory. I am using 1.4.9.1. Any ideas!? Please help : ) Thank you
Re: SEO URLs only showing products from one category
Posted: Sat Mar 26, 2011 5:13 am
by BrianW
I had a similar issue when I first enabled SEO URLs, but once I converted all of the pages over, it worked fine. There seemed to be a problem where some had SEO URLs, and some didn't (so the category does, but not all the products do, or vice versa).
Re: SEO URLs only showing products from one category
Posted: Sat Mar 26, 2011 5:26 am
by neosdesign
Are you saying somewhere I might be missing a SEO Keyword value?
Re: SEO URLs only showing products from one category
Posted: Sat Mar 26, 2011 5:41 am
by neosdesign
Would it be an issue if two categories of different sublevels have the same seo keyword?
examples
mens shirts (parent category) > red (sub category) ----- store/mens/red
womens shirts (parent category > red (sub category) ----- store/womens/red
Re: SEO URLs only showing products from one category
Posted: Sat Mar 26, 2011 6:17 am
by neosdesign
Yup...that was it. Didn't realize SEO Keywords have to be unique even if they show up in different directories.
Re: SEO URLs only showing products from one category
Posted: Tue Apr 12, 2011 1:27 pm
by neosdesign
Ok, somewhere Im still having issues with SEO URLs. I have two different product .tpls on my site. One in the product/product.tpl directory and one in the bundles/product.tpl directory.
With SEO URLs turned off, my bundle products are displayed with the correct bundles/product.tpl template. When I turn on SEO URLs I get the product/product.tpl template???
Both templates are part of a custom theme I made, so the app isn't reverting to a default template at all. Just a little out of ideas as to why this if happening. Thank you so much for looking, please help if possible.
Re: SEO URLs only showing products from one category
Posted: Tue Apr 12, 2011 11:29 pm
by neosdesign
I found catalog/controller/common/seo_url.php this line:
Code: Select all
if (isset($this->request->get['product_id'])) {
$this->request->get['route'] = 'product/product';
How would I write If category is category_39, category 39_44 or category 39_43, get 'bundles/product' else get 'product/product' ?
Sorry my php skills are quite limited. Please help!
Re: SEO URLs only showing products from one category
Posted: Wed Apr 13, 2011 9:07 am
by neosdesign
I really don't want to be a 'bump'er but maybe someone could at least let me know if what I am seeking is possible? Maybe someone else that has SEO URLs and multiple product-page templates. I am willing to pay someone to help me out if needed! I appreciate everyone taking the time to look at my thread. Thanks!
Re: SEO URLs only showing products from one category
Posted: Wed Apr 13, 2011 12:12 pm
by neosdesign
Im continuing to try to hack this up to make it work. I've added:
Code: Select all
$this->load->model('catalog/category');
if (isset($this->request->get['path'])) {
$path = '';
$parts = explode('_', $this->request->get['path']);
foreach ($parts as $path_id) {
$category_info = $this->model_catalog_category->getCategory($path_id);
if ($category_info) {
if (!$path) {
$path = $path_id;
} else {
$path .= '_' . $path_id;
}
}
}
$category_id = array_pop($parts);
} else {
$category_id = 0;
}
if ($path == '39') {
if (isset($this->request->get['product_id'])) {
$this->request->get['route'] = 'bundles/product';
} elseif (isset($this->request->get['path'])) {
$this->request->get['route'] = 'product/category';
} elseif (isset($this->request->get['manufacturer_id'])) {
$this->request->get['route'] = 'product/manufacturer';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
}
if (isset($this->request->get['route'])) {
return $this->forward($this->request->get['route']);
}
}
elseif ($path == '43') {
if (isset($this->request->get['product_id'])) {
$this->request->get['route'] = 'bundles/product';
} elseif (isset($this->request->get['path'])) {
$this->request->get['route'] = 'product/category';
} elseif (isset($this->request->get['manufacturer_id'])) {
$this->request->get['route'] = 'product/manufacturer';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
}
if (isset($this->request->get['route'])) {
return $this->forward($this->request->get['route']);
}
}
elseif ($path == '44') {
if (isset($this->request->get['product_id'])) {
$this->request->get['route'] = 'bundles/product';
} elseif (isset($this->request->get['path'])) {
$this->request->get['route'] = 'product/category';
} elseif (isset($this->request->get['manufacturer_id'])) {
$this->request->get['route'] = 'product/manufacturer';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
}
if (isset($this->request->get['route'])) {
return $this->forward($this->request->get['route']);
}
}
else {
if (isset($this->request->get['product_id'])) {
$this->request->get['route'] = 'product/product';
} elseif (isset($this->request->get['path'])) {
$this->request->get['route'] = 'product/category';
} elseif (isset($this->request->get['manufacturer_id'])) {
$this->request->get['route'] = 'product/manufacturer';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
}
if (isset($this->request->get['route'])) {
return $this->forward($this->request->get['route']);
}
}
to seo_url.php controller to get different product templates to load for different categories. I am fully aware that there is likely a MUCH shorter way of writing this, but as mentioned above, I don't really know php so Im just copying and pasting from other controllers.
The above code will load the different product.tpls correctly, but now when I click on a related product I get undefined variable notices for $path at each of the $path==39, $path==43, $path==44 lines in seo_url.php. Still hoping someone with some php chops will right my many wrongs : )