News:

Looking for documentation? Take a look on our wiki

Main Menu

Link to all products from manufacturer in product details.

Started by Lockerbie, December 06, 2016, 15:46:14 PM

Previous topic - Next topic

Lockerbie

Hello,
I've been trying to set the link to the 'all products from this manufacturer page', but can't get it right. I'm using a logo instead of the manufacturers name.
This is what I have in default_manufacturer.php:
<?php

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
?>

<div class="manufacturer">
    <?php
    $link 
JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' $this->product->virtuemart_manufacturer_id'');
    
$text $this->product->mf_name;

    
/* Avoid JavaScript on PDF Output */
    
if (strtolower(JRequest::getWord('output')) == "pdf") {
echo JHTML::_('link'$link$text);
    } else {
?>

        <a href="<?php echo $link ?>"><img src="<?php echo $this->baseurl ?>/images/stories/virtuemart/manufacturer/<?php echo $this->product->mf_name ?>.jpg " title="<?php echo $text?>" alt="<?php echo $text?>"></a>
    <?PHP } ?>
</div>


I've tried all sorts of thing in the JRoute-piece, especcially in the end-part, but can't get it working. It only leads to the main shop page. What piece would work here?

Joomla! 3.6.4 / VirtueMart 3.0.18 / PHP 5.6.17

K&K media production

JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=0&virtuemart_manufacturer_id=' . $this->product->virtuemart_manufacturer_id, FALSE);

Lockerbie

Thanks K&K media production, but that's not working either... It redirects to the same main shop page.

Ghost

Forgot index on manufacturer ID.

JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=0&virtuemart_manufacturer_id=' . $this->product->virtuemart_manufacturer_id[0], FALSE);

Studio 42

You can remove FALSE in jroute, it's not needed and, on removing it, display proper link.

Lockerbie

Ghost's suggestion showed me the name of the manufacturer in the link, but didn't redirect to the concerning manufacturers page. That got me thinking if the path was correct. The manufacturers are only set as manufacturers, not as categories or menu-items.
So instead, I've been trying to find the right link:

1.
In the CustomFiltersPro-module (back-end). The only thing I could find that made sense was in this menu-item:
index.php?option=com_customfilters&view=products
So comparing this with what I had, I came to this:
    $link = JRoute::_('index.php?option=com_customfilters&view=category&virtuemart_manufacturer_id=' . $this->product->virtuemart_manufacturer_id[0]);

This leads to the right page, with all the products of the manufacturer (the page is just not styled correctly, but that's a minor thing).

Only thing is: is this a correct url? Can it be cleaned up so it's a nicer url, and can it show the manufacturers name instead of the id?
For instance, when clicking 'Triumph', the link is:
http://websiteurl.com/index.php/component/customfilters/?view=category&virtuemart_manufacturer_id=1

2.
Directly through the customfilters-module in the front-end.
The link to the same manufacturer 'Triumph' for instance is:
http://websiteurl.com/index.php/zoeken-in-webshop/no-category/triumph

What would be the best way and how to retrieve the most clean, right url?

Ghost

QuoteGhost's suggestion showed me the name of the manufacturer in the link, but didn't redirect to the concerning manufacturers page.
Where does it lead to?

Lockerbie

@Ghost:

The url shows:http://websiteurl.com/index.php/component/virtuemart/manufacturer/triumph?Itemid=135
but it leads to the main shop page with all categories (all "types of motors").

And when I remove the "?itemid=135"-part, it leads to a page with the main category ("type of motor").

Studio 42


Lockerbie

Two different threads here:

The first one is using Ghost' suggestion:
JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=0&virtuemart_manufacturer_id=' . $this->product->virtuemart_manufacturer_id[0], FALSE);

Unfortunate this is only showing the mf-name in the link, but not redirecting to the concerning manufacturer. Instead it leads to the main shop page with all (sub)categories:
http://websiteurl.com/index.php/component/virtuemart/manufacturer/triumph?Itemid=135


The second one is using something from the customfilters in the link.
Quote from: Lockerbie on December 08, 2016, 11:39:23 AM
1.
In the CustomFiltersPro-module (back-end). The only thing I could find that made sense was in this menu-item:
index.php?option=com_customfilters&view=products
So comparing this with what I had, I came to this:
    $link = JRoute::_('index.php?option=com_customfilters&view=category&virtuemart_manufacturer_id=' . $this->product->virtuemart_manufacturer_id[0]);

This leads to the right page, with all the products of the manufacturer (the page is just not styled correctly, but that's a minor thing).

Only thing is: is this a correct url? Can it be cleaned up so it's a nicer url, and can it show the manufacturers name instead of the id?
For instance, when clicking 'Triumph', the link is:
http://websiteurl.com/index.php/component/customfilters/?view=category&virtuemart_manufacturer_id=1

2.
Directly through the customfilters-module in the front-end.
The link to the same manufacturer 'Triumph' for instance is:
http://websiteurl.com/index.php/zoeken-in-webshop/no-category/triumph

What would be the best way and how to retrieve the most clean, right url?
That #1 does lead to the right manufacturer and his products, but doesn't show his name in the ugly url. That's the url I would want to clean up, if possible. (Or else use something like in #2, but with the right code.)

Studio 42

Add a Joomla menu link to categoy view and don't set any categories and manufacturer, then the links are right !
In old releases, you had a warning "please add a menu link to shop root" or similar, but now this view is obselete and if the link is not set, then you have this behavior without any warning.
So please try my suggestion and check if it solve your problem.

Lockerbie

#11
Ok, after hours of trying all sorts of combinations, I'm lost, haha!

The Joomla menu link was already set (VM-category-view, without setting any category or manufacturer).

When I use:JRoute::_('index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id=' . $this->product->virtuemart_manufacturer_id[0]);
clicking the mf-logo gets you to this nice clean url.
But there's only the mf-name and logo, and a button 'show all products'. Unfortunate, clicking this button does not show these products, but leads to the page you're visiting already.

And when i use:JRoute::_('index.php?option=com_customfilters&view=manufacturer&virtuemart_manufacturer_id=' . $this->product->virtuemart_manufacturer_id[0]);
clicking the mf-logo gets you to this page with ugly url, where the mf-products are visible, but there's no mf-name and logo (and header at the top of this 'unofficial' page).

Ghost

The URL is correct. If no products are shown, make sure 'Show products of the selected category' is set to Yes in VM category menu item.

Lockerbie

With the 'com_virtuemart'-part, you mean? Nice clean url.
The 'show products' was/is set to 'yes' in VM-category menu item. Cache is cleaned, but no products are showing beneath the mf-name and logo.

And when using the customfilters-search (front-end), the url to the (in this example) Triumph-products would be this other route.