Post by sirchunk » Tue Feb 21, 2012 6:14 am

Hi everyone.

Been messing around with opencart Version 1.5.1.3 and was wondering, how do I make it so that if I have just one product under a main parent category, the link for that parent category goes straight to that single product instead of a page that makes the user have to click on the product to get to it?

I really hope that makes sense :)


Chunk

Newbie

Posts

Joined
Tue Feb 21, 2012 6:01 am

Post by sirchunk » Sat Feb 25, 2012 10:15 pm

I presume that it didn't then

Ah well, would of thought the opencart community would have been a bit more forthwith that this :(

Newbie

Posts

Joined
Tue Feb 21, 2012 6:01 am

Post by harleybill » Mon Feb 27, 2012 3:16 pm

Hi sirchunk,
Your post makes sense.
We discussed this before http://forum.opencart.com/viewtopic.php?f=19&t=29768

Simon at uksitebuilder was going to look into this but I think he has been busy with other maters.

Maybe he or someone can help with this.

As Qphoria says other carts have this feature.

Harleybill
http://spaparts1.com


User avatar
New member

Posts

Joined
Tue May 04, 2010 7:01 pm


Post by sirchunk » Thu Mar 01, 2012 8:09 pm

Thank you for the point in the right direction Harleybill :)
I thought I was going crazy as I couldn't have been the only person who wanted to do this

Newbie

Posts

Joined
Tue Feb 21, 2012 6:01 am

Post by uksitebuilder » Fri Mar 02, 2012 12:21 am

Sorry for the delay on this guys

edit: catalog/controller/product/category.php

Find:

Code: Select all

			foreach ($results as $result) {
				if ($result['image']) {
Replace with:

Code: Select all

			foreach ($results as $result) {
				if($product_total == 1){
					$this->redirect($this->url->link('product/product', 'product_id='.$result['product_id']));
				}
				
				if ($result['image']) {

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by harleybill » Fri Mar 02, 2012 1:04 am

Hi Simon,
There are a few people on the forum you can always count on, and your one of them.

This is something that should be in the core. It works great.

I just sent you a donation.
It's less than what it is worth but I hope everyone that uses this will send you some thing.

Thanks,
Harleybill

P.S. Sorry for your recent loss.

Harleybill
http://spaparts1.com


User avatar
New member

Posts

Joined
Tue May 04, 2010 7:01 pm


Post by uksitebuilder » Fri Mar 02, 2012 1:07 am

Thanks Harle - Appreciate it.

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by sirchunk » Sat Mar 03, 2012 3:24 am

YAY, thanks for this simon/uksitebuilder

Newbie

Posts

Joined
Tue Feb 21, 2012 6:01 am

Post by nudylady » Sun Mar 25, 2012 8:42 pm

I got an error.

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /home/uimisp/public_html/vqmod/vqcache/vq2-catalog_controller_product_category.php on line 223

New member

Posts

Joined
Sun Feb 19, 2012 12:14 am

Post by ocdictor » Mon Mar 26, 2012 2:51 pm

We tried. No errors.

What's the difference between the OpenCart Templates and Prestashop Themes?


Newbie

Posts

Joined
Tue Mar 13, 2012 4:01 pm

Post by nudylady » Tue Mar 27, 2012 2:05 pm

I tried again. no more error. Thanks for the mod

New member

Posts

Joined
Sun Feb 19, 2012 12:14 am

Post by spitos » Wed Nov 07, 2012 7:23 pm

uksitebuilder wrote:Sorry for the delay on this guys

edit: catalog/controller/product/category.php

Find:

Code: Select all

			foreach ($results as $result) {
				if ($result['image']) {
Replace with:

Code: Select all

			foreach ($results as $result) {
				if($product_total == 1){
					$this->redirect($this->url->link('product/product', 'product_id='.$result['product_id']));
				}
				
				if ($result['image']) {
When I applied this and the redirect was used, the breadcrumb trail was lost so I made a change to the redirect line to keep the breadcrumb trail on the product page.

Find:

Code: Select all

			foreach ($results as $result) {
				if ($result['image']) {
Replace with:

Code: Select all

			foreach ($results as $result) {
				if($product_total == 1){
					$this->redirect($this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']));
				}
				
				if ($result['image']) {

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK
Who is online

Users browsing this forum: No registered users and 72 guests