but when i click LOGIN from home page, it displayed Home > Register Account > Login
so, where will be a method can display the whole path, when i open a link of a product.
and
http://demo.opencart.com/index.php?rout ... uct_id=100
http://demo.opencart.com/index.php?rout ... uct_id=100
http://demo.opencart.com/route=product/ ... uct_id=100
http://demo.opencart.com/product/product&product_id=100
http://demo.opencart.com/product&product_id=100
http://demo.opencart.com/p&product_id=100
these links all display a same page!!!!!!
so, where will be a method can display the whole path, when i open a link of a product.
and
http://demo.opencart.com/index.php?rout ... uct_id=100
http://demo.opencart.com/index.php?rout ... uct_id=100
http://demo.opencart.com/route=product/ ... uct_id=100
http://demo.opencart.com/product/product&product_id=100
http://demo.opencart.com/product&product_id=100
http://demo.opencart.com/p&product_id=100
these links all display a same page!!!!!!
jkungfu's issue makes perfect sense. I'm having this problem as well and would like to see solved because it's just pathetic...
Thing is, if you look for a product by browsing through CATEGORIES, you'll eventually see the full path, which is useful to the user to go check other similar products on categories, if he so wish for.
But if you click on a product on either LATEST PRODUCTS, BESTSELLERS, or FEATURED, you'll get a very annoying "Home > [product name]", which leads to confusion to "oh, nice, and of which category is this item, of same category but not necessarily related?".
ver 1.4.9.2, so this is a core issue, clean install, no modules involved. Please advise... it IS stupid and annoying.
Thing is, if you look for a product by browsing through CATEGORIES, you'll eventually see the full path, which is useful to the user to go check other similar products on categories, if he so wish for.
But if you click on a product on either LATEST PRODUCTS, BESTSELLERS, or FEATURED, you'll get a very annoying "Home > [product name]", which leads to confusion to "oh, nice, and of which category is this item, of same category but not necessarily related?".
ver 1.4.9.2, so this is a core issue, clean install, no modules involved. Please advise... it IS stupid and annoying.
While I can understand your frustration regarding this, the simple fact of the matter is this is not a design flaw, its due to the fact that a product can have multiple categories. How would you distinguish which category is shown when a product has multiple categories?
This is possible to fix to a degree, but your categories would be assigned randomly for products in multiple categories
This is possible to fix to a degree, but your categories would be assigned randomly for products in multiple categories
As of now I'm quite frustrated with a lot of things regarding Opencart, lol...JAY6390 wrote:While I can understand your frustration regarding this

I see your point. In this case, this would probably require additional template hacking to provide more information aside from Price, Availability, Model, Manufacturer, Average Rating, on the product details on the right side of as product's picture.JAY6390 wrote:its due to the fact that a product can have multiple categories. How would you distinguish which category is shown when a product has multiple categories?
This is possible to fix to a degree, but your categories would be assigned randomly for products in multiple categories
I think, from a salesman's point of view, if you can help a customer keep track of the category one's interested in, he or she might want to check out what other similar items could be interested in. Related Products is not good enough, and even if it was, you can't have "infinite" related products, don't you agree?
I can understand what you mean about this - I made a module called also bought (commercial) that basically upsells products most frequently bought in an order with the current product you are viewing, or the products in the basket on the checkout so that you get maximum upsell from your customers, plus you don't need to add the products, it runs off the orders 

You're not understanding. In opencart there is a product to categories table which allows products to be assigned to multiple categories. For instance just say you have an iphone product you put it in the mobile phone category and in the mp3 category. Now when you click on that product from the homepage what category do you want it to display? I have no idea neither does the customer or the program and there's no way to determine that.
Plus over half the urls you listed above are simply where you messed around with the url manually and are not links that would ever be generated by the system or crawled by a search engine.
Plus over half the urls you listed above are simply where you messed around with the url manually and are not links that would ever be generated by the system or crawled by a search engine.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Was this ever fixed? I know this is an old post but it seems crazy that 'featured products' and indeed 'latest products' can't have breadcrumbs. I'd be very interested to know if anyone has managed to hack this?
it doesnt seem crazy, it seems quite reasonable, as Xsecrets keeps pointing out to you all.
It is you guys who do not understand.
Sure, if you have a product and it is listed in only one category ever, and never changes, never runs out of stock, and is always there to buy, ok, maybe you can mod the breadcrumbs, but from a "out of the box" point of view, it is not possible while you have the ability to place products in multiple categories, you cant have 1 and also the other.
It is you guys who do not understand.
Sure, if you have a product and it is listed in only one category ever, and never changes, never runs out of stock, and is always there to buy, ok, maybe you can mod the breadcrumbs, but from a "out of the box" point of view, it is not possible while you have the ability to place products in multiple categories, you cant have 1 and also the other.
Sorry to bump an old thread but this is the problem I was having too. Now I've read this I fully understand why OC does this but I need to find a solution.
My 'Resort Wear' category and its products have a different stylesheet to make the background white/font black, whereas 'Evening Wear' utilises the default css to display a black bg/white font. This works fine until you click on a related product in 'Resort Wear' - the url misses out the parent category and so the stylesheet reverts to the default. How do I get the related product links and links from the cart to keep their parent category in the url?
I would reeeeeeeeeeeeeeeeeeeeeeeeeeeally appreciate any links or ideas that may help me solve this.
My 'Resort Wear' category and its products have a different stylesheet to make the background white/font black, whereas 'Evening Wear' utilises the default css to display a black bg/white font. This works fine until you click on a related product in 'Resort Wear' - the url misses out the parent category and so the stylesheet reverts to the default. How do I get the related product links and links from the cart to keep their parent category in the url?
I would reeeeeeeeeeeeeeeeeeeeeeeeeeeally appreciate any links or ideas that may help me solve this.
I know this is a very old thread, but it's the only mention of the subject I've been able to find. I had also been looking for a "fix" for this issue, as I only ever assign a single category to each product. Unable to find a solution, I created one myself.
Go to catalog/controller/module/featured.php and find the look around line 28.
Copy and paste the code below inside the foreach loop, right at the beginning:
Next, scroll down until you find (still inside the loop). Find the member and change it's value to , so you have .
Once you've done this, links produced by the Featured Products module will include the full category path so that breadcrumbs display properly on the Product page. This should work with 1.5.x, and possibly earlier versions as well.
Email me if you have any questions: jam4online@hotmail.co.uk.
Go to catalog/controller/module/featured.php and find the
Code: Select all
foreach
Copy and paste the code below inside the foreach loop, right at the beginning:
Code: Select all
//Creates path so breadcrumbs display
$cat = $this->model_catalog_product->getCategories($product_id);
if(!empty($cat))
{
$cat_trace = array($cat[0]['category_id']);
$i = 0; $stop = false;
while(!$stop)
{
$arr = $this->model_catalog_category->getCategory($cat_trace[$i++]);
if($arr['parent_id'] != 0)
$cat_trace[] = $arr['parent_id'];
else
$stop = true;
}
$cat_trace = implode('_', array_reverse($cat_trace));
$link = $this->url->link('product/product', 'path=' . $cat_trace . '&product_id=' . $product_info['product_id']);
}
else $link = $this->url->link('product/product', 'product_id=' . $product_info['product_id']);
Code: Select all
$this->data['products'][] = array(
Code: Select all
foreach
Code: Select all
href
Code: Select all
$link
Code: Select all
'href' => $link
Once you've done this, links produced by the Featured Products module will include the full category path so that breadcrumbs display properly on the Product page. This should work with 1.5.x, and possibly earlier versions as well.
Email me if you have any questions: jam4online@hotmail.co.uk.
I know are some months since the resolution was found and shared here but really need to thank you, VettelS. I addapted your solution for bestseller.php, latest.php and special.php. Everithing works great for Opencart v1.5.5.1. Nice job man, really apreciated !
Could you share your addaptation code for Opencart 1.5.5.1? Especially part in the loop where checking parent_id took partQ000 wrote:I know are some months since the resolution was found and shared here but really need to thank you, VettelS. I addapted your solution for bestseller.php, latest.php and special.php. Everithing works great for Opencart v1.5.5.1. Nice job man, really apreciated !
Code: Select all
if($arr['parent_id'] != 0)
Hello to everyone, this is my first post
i was searching a solution about breadcrumb i think that i found it.. I wanted the full breadcrumb like
home->category->subcategory->product even a person was clicking from the latest - featured module of homepage
So below is the code that you need...
catalog->controller/product/product.php around 75-80 line
and go now to catalog->model->catalog->category.php
in the last line before last '}' add this function

i was searching a solution about breadcrumb i think that i found it.. I wanted the full breadcrumb like
home->category->subcategory->product even a person was clicking from the latest - featured module of homepage
So below is the code that you need...
catalog->controller/product/product.php around 75-80 line
Code: Select all
$this->load->model('catalog/product');
if (isset($this->request->get['product_id'])) {
$product_id = (int)$this->request->get['product_id'];
} else {
$product_id = 0;
}
$catids = $this->model_catalog_product->getCategories($product_id);
$cat_ids = '';
if(isset($catids)){
foreach ($catids as $catid) {
$cat_ids .= $catid['category_id'].'_';
}
}
if(isset($cat_ids)) {
$path = '';
$parts = explode('_', (string)$cat_ids);
$category_id = (int)array_pop($parts);
if(isset($parts[0]))
$par_category = $this->model_catalog_category->getParent($parts[0]);
if(!isset($this->request->get['path'])){
if (isset($par_category)) {
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
if (isset($this->request->get['limit'])) {
$url .= '&limit=' . $this->request->get['limit'];
}
$this->data['breadcrumbs'][] = array(
'text' => $par_category['name'],
'href' => $this->url->link('product/category', 'path=' . $par_category['category_id']),//$this->request->get['path']),
'separator' => $this->language->get('text_separator')
);
}
if(isset($parts[0]))
$category_info = $this->model_catalog_category->getCategory($parts[0]);
if(isset($category_info)){
if ($category_info) {
$this->data['breadcrumbs'][] = array(
'text' => $category_info['name'],
'href' => $this->url->link('product/category', 'path=' . $par_category['category_id'].'_'.$parts[0]),
'separator' => $this->language->get('text_separator')
);
}
}
}
}
in the last line before last '}' add this function
Code: Select all
public function getParent($subcat) {
$parid = $this->db->query("SELECT * FROM " . DB_PREFIX . "category WHERE category_id = " . (int)$subcat);
$query = $this->db->query($q = "SELECT DISTINCT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id) LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id) WHERE c.category_id = '" . (int)$parid ->row['parent_id'] . "' AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND c.status = '1'");
return $query->row;
}
Just adding that VettelS' code also works for OpenCart 2.0.2.0 and 2.0.3.1.
The only thing you need to be careful with is placing the code NOT immediately after the foreach loop opens, but after the second line of code inside it:
This is necessary because the code uses the $product_info['product_id'] array element which isn't declared if the line above comes after the addition, which will trigger an error.
This is how your foreach loop should look:
Thank you, VettelS!
The only thing you need to be careful with is placing the code NOT immediately after the foreach loop opens, but after the second line of code inside it:
Code: Select all
$product_info = $this->model_catalog_product->getProduct($product_id);
This is how your foreach loop should look:
Code: Select all
foreach ($products as $product_id) {
$product_info = $this->model_catalog_product->getProduct($product_id);
// Hack to create full path in the breadcrumbs for featured products
$cat = $this->model_catalog_product->getCategories($product_id);
if(!empty($cat)) {
$cat_trace = array($cat[0]['category_id']);
$i = 0; $stop = false;
while(!$stop) {
$arr = $this->model_catalog_category->getCategory($cat_trace[$i++]);
if($arr['parent_id'] != 0)
$cat_trace[] = $arr['parent_id'];
else
$stop = true;
}
$cat_trace = implode('_', array_reverse($cat_trace));
$link = $this->url->link('product/product', 'path=' . $cat_trace . '&product_id=' . $product_info['product_id']);
}
else {
$link = $this->url->link('product/product', 'product_id=' . $product_info['product_id']);
}
// end hack
if ($product_info) {
.......
Who is online
Users browsing this forum: Bing [Bot] and 16 guests