Harleybill
http://spaparts1.com
+1Qphoria wrote:We will try to add this in future versions.l
OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English
if it does, grab it's id and then redirect to the product
--
same could be done on the search results page, if only 1 result found redirect to it.
I'm updating my search extension soon, so may add this. When I do I'll post the code for it and similar for the category changes too.
edit: catalog/controller/product/category.php
Find:
Code: Select all
foreach ($results as $result) {
if ($result['image']) {
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.uksitebuilder wrote:Sorry for the delay on this guys
edit: catalog/controller/product/category.php
Find:Replace with:Code: Select all
foreach ($results as $result) { if ($result['image']) {
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']) {
Find:
Code: Select all
foreach ($results as $result) {
if ($result['image']) {
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']) {
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
The result:
When I go to the main category, I get a description of the category, with all the products listed below in grid form. I also see the main category on the left side bar and below it is a list of all the products (sub categories) that I can click on.
What is wrong:
When I click on a product the categories go back the way they were (only displays the main category, no sub categories).
What I want:
I want the code that will make the subcategories show up on every product page that is within the main category so that no matter what product you are looking at, you can switch to another product within that same category without going back to the first page.
Does this make sense?
I need the template name and the code to replace. Seems like it shouldn't be too hard I hope.
Thanks in advance!
That was a really nice solution! Thanks a lot!
Márcio Vítor
http://www.comunicair.pt
https://facebook.com/ComunicAir
I tried this approach and it works really well except I am still missing one thing. I have 10 or less products per main category, so I made a main category, then sub categories that are named the same thing as the product name. Then for each product, I linked it to both the main category and the sub category that it is named after. Then I changed the code on the category.php file as per the instructions above.
The result:
When I go to the main category, I get a description of the category, with all the products listed below in grid form. I also see the main category on the left side bar and below it is a list of all the products (sub categories) that I can click on.
What is wrong:
When I click on a product the categories go back the way they were (only displays the main category, no sub categories).
What I want:
I want the code that will make the subcategories show up on every product page that is within the main category so that no matter what product you are looking at, you can switch to another product within that same category without going back to the first page.
Does this make sense?
I need the template name and the code to replace. Seems like it shouldn't be too hard I hope.
Thanks in advance!
Just wondering if anyone found/knows of a solution for sub categories, it sounds like it is only for categories?
Anita
My problem was I did not want to use the category view as I have very few products and cd not configure the category.tpl the way I wanted.harleybill wrote:Is there a way to skip the category page and go straight to the product page on categories that have only one product.
This may be an over-simplistic solution, but what I did was:
1) Build a new Banner though with store admin. This allows to add a link for each product e.g. index.php?route=product/product&product_id=52
2) Go to Extensions > Modules and enable 'Carousel' and select the banner just created
3) Eliminate to Menu Bar from header.tpl
In your <search> tag for this line use the "index" function:
for example the following code replaces the first instance of the line:
Code: Select all
<search position="replace" index="1"><![CDATA[
if ($result['image']) {
]]></search>
This is a useful guide to writing code for vQmods http://code.google.com/p/vqmod/wiki/Scripting
Genuine, Honest Opencart Support @ http://webvetservices.com
Is there a way to add code like this in OC 2.x to get the same function, if only one product i category:
foreach ($results as $result) {
if($product_total == 1){
$this->redirect($this->url->link('product/product', 'product_id='.$result['product_id']));
}
if ($result['image']) {
Please help :-)
Thanks, Jannik
Users browsing this forum: No registered users and 72 guests